0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-29 08:13:46 +02:00

ircd::db: Add feature define for direct-io multiget; various cleanup.

This commit is contained in:
Jason Volk 2020-06-15 22:34:08 -07:00
parent 597052e5c0
commit e2654ddaed
4 changed files with 18 additions and 11 deletions

View file

@ -47,10 +47,10 @@ struct ircd::db::cell
std::unique_ptr<rocksdb::Iterator> it;
public:
operator const rocksdb::Iterator &() const { return *it; }
operator const rocksdb::Iterator &() const { assert(it); return *it; }
operator const database::snapshot &() const { return ss; }
explicit operator const column &() const { return c; }
operator rocksdb::Iterator &() { return *it; }
operator rocksdb::Iterator &() { assert(it); return *it; }
operator database::snapshot &() { return ss; }
explicit operator column &() { return c; }

View file

@ -8014,7 +8014,7 @@ ircd::db::_read(column &column,
closure(value);
// triggered when the result was not zero-copy
//assert(buf.empty());
assert(!opts.fill_cache || buf.empty());
return ret;
}
@ -8086,7 +8086,7 @@ ircd::db::_read(const vector_view<_read_op> &op,
const bool parallelize
{
#ifdef IRCD_DB_HAS_MULTIGET_BATCHED
#ifdef IRCD_DB_HAS_MULTIGET_DIRECT
true && num > 1
#else
false
@ -8111,13 +8111,15 @@ ircd::db::_read(const vector_view<_read_op> &op,
return false;
}
//#ifdef IRCD_DB_HAS_MULTIGET_DIRECT
// triggered when the result was not zero-copy
//assert(!std::count_if(buf, buf + num, [](auto &&s) { return !s.empty(); }));
static const auto not_empty{[](auto &&s) { return !s.empty(); }};
assert(!ropts.fill_cache || !std::count_if(buf, buf + num, not_empty));
//#endif
return true;
}
#ifdef IRCD_DB_HAS_MULTIGET_BATCHED
void
ircd::db::_seek(const vector_view<_read_op> &op,
const vector_view<rocksdb::Status> &ret,
@ -8157,7 +8159,9 @@ ircd::db::_seek(const vector_view<_read_op> &op,
const ircd::timer timer;
#endif
#ifdef IRCD_DB_HAS_MULTIGET_BATCHED
d.d->MultiGet(ropts, num, cf, key, val.data(), ret.data());
#endif
#ifdef RB_DEBUG_DB_SEEK
log::debug
@ -8174,9 +8178,6 @@ ircd::db::_seek(const vector_view<_read_op> &op,
};
#endif
}
#else
#warning "RocksDB version does not support batched MultiGet; some queries will be linearized"
#endif IRCD_DB_HAS_MULTIGET_BATCHED
//
// iterator seek suite

View file

@ -59,8 +59,8 @@ namespace ircd::db
struct throw_on_error;
struct error_to_status;
constexpr const auto BLOCKING { rocksdb::ReadTier::kReadAllTier };
constexpr const auto NON_BLOCKING { rocksdb::ReadTier::kBlockCacheTier };
constexpr auto BLOCKING { rocksdb::ReadTier::kReadAllTier };
constexpr auto NON_BLOCKING { rocksdb::ReadTier::kBlockCacheTier };
// state
extern log::log rog;

View file

@ -66,3 +66,9 @@
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 7 && ROCKSDB_PATCH >= 3)
#define IRCD_DB_HAS_ENV_FILESYSTEM
#endif
#if ROCKSDB_MAJOR > 6 \
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR > 10) \
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 10 && ROCKSDB_PATCH >= 0)
#define IRCD_DB_HAS_MULTIGET_DIRECT
#endif