提交 8d99ba17 编写于 作者: G groot

refine


Former-commit-id: e0bb1ee1ff6c7bdac13ebe2d06ec45acb9db3d20
上级 5d862e1c
......@@ -95,7 +95,7 @@ private:
MetaPtr pMeta_;
MemManagerPtr pMemMgr_;
}; // DBImpl
......
......@@ -15,6 +15,10 @@ namespace engine {
class Env;
static constexpr uint64_t ONE_KB = 1024;
static constexpr uint64_t ONE_MB = ONE_KB*ONE_KB;
static constexpr uint64_t ONE_GB = ONE_KB*ONE_MB;
struct ArchiveConf {
using CriteriaT = std::map<std::string, int>;
......@@ -42,7 +46,7 @@ struct Options {
Options();
uint16_t memory_sync_interval = 1; //unit: second
uint16_t merge_trigger_number = 2;
size_t index_trigger_size = 1024*1024*1024; //unit: byte
size_t index_trigger_size = ONE_GB; //unit: byte
Env* env;
DBMetaOptions meta;
}; // Options
......
......@@ -37,8 +37,8 @@ namespace {
opt.memory_sync_interval = (uint16_t)config.GetInt32Value(CONFIG_DB_FLUSH_INTERVAL, 10);
opt.meta.path = db_path + "/db";
int64_t index_size = config.GetInt64Value(CONFIG_DB_INDEX_TRIGGER_SIZE);
if(index_size > 0) {//ensure larger than zero
opt.index_trigger_size = (size_t)index_size;
if(index_size > 0) {//ensure larger than zero, unit is MB
opt.index_trigger_size = (size_t)index_size * engine::ONE_MB;
}
CommonUtil::CreateDirectory(opt.meta.path);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册