OPTION(rocksdb_compact_on_mount, OPT_BOOL, false)
OPTION(rocksdb_write_buffer_size, OPT_U64, 0) // rocksdb write buffer size
+OPTION(rocksdb_target_file_size_base, OPT_U64, 0) // target file size for compaction
OPTION(rocksdb_cache_size, OPT_U64, 0) // rocksdb cache size
OPTION(rocksdb_block_size, OPT_U64, 0) // rocksdb block size
OPTION(rocksdb_bloom_size, OPT_INT, 0) // rocksdb bloom bits per entry
+OPTION(rocksdb_write_buffer_num, OPT_INT, 0) // rocksdb bloom bits per entry
+OPTION(rocksdb_background_compactions, OPT_INT, 0) // number for background compaction jobs
+OPTION(rocksdb_background_flushes, OPT_INT, 0) // number for background flush jobs
OPTION(rocksdb_max_open_files, OPT_INT, 0) // rocksdb max open files
OPTION(rocksdb_compression, OPT_STR, "") // rocksdb uses compression : none, snappy, zlib, bzip2
OPTION(rocksdb_paranoid, OPT_BOOL, false) // rocksdb paranoid flag
-OPTION(rocksdb_log, OPT_STR, "") // enable rocksdb log file
+OPTION(rocksdb_log, OPT_STR, "/dev/null") // enable rocksdb log file
+OPTION(rocksdb_level0_file_num_compaction_trigger, OPT_U64, 0)
+OPTION(rocksdb_level0_slowdown_writes_trigger, OPT_U64, 0)
+OPTION(rocksdb_level0_stop_writes_trigger, OPT_U64, 0)
+OPTION(rocksdb_disableDataSync, OPT_BOOL, true)
+OPTION(rocksdb_disableWAL, OPT_BOOL, false)
+OPTION(rocksdb_num_levels, OPT_INT, 0)
+OPTION(rocksdb_wal_dir, OPT_STR, "") // rocksdb write ahead log file
/**
* osd_client_op_priority and osd_recovery_op_priority adjust the relative
options.paranoid_checks = g_conf->rocksdb_paranoid;
options.max_open_files = g_conf->rocksdb_max_open_files;
options.log_file = g_conf->rocksdb_log;
+ options.write_buffer_num = g_conf->rocksdb_write_buffer_num;
+ options.max_background_compactions = g_conf->rocksdb_background_compactions;
+ options.max_background_flushes = g_conf->rocksdb_background_flushes;
+ options.target_file_size_base = g_conf->rocksdb_target_file_size_base;
+ options.level0_file_num_compaction_trigger = g_conf->rocksdb_level0_file_num_compaction_trigger;
+ options.level0_slowdown_writes_trigger = g_conf->rocksdb_level0_slowdown_writes_trigger;
+ options.level0_stop_writes_trigger = g_conf->rocksdb_level0_stop_writes_trigger;
+ options.disableDataSync = g_conf->rocksdb_disableDataSync;
+ options.num_levels = g_conf->rocksdb_num_levels;
+ options.disableWAL = g_conf->rocksdb_disableWAL;
+ options.wal_dir = g_conf->rocksdb_wal_dir;
return 0;
}
if (options.write_buffer_size)
ldoptions.write_buffer_size = options.write_buffer_size;
+ if (options.write_buffer_num)
+ ldoptions.max_write_buffer_number = options.write_buffer_num;
+ if (options.max_background_compactions)
+ ldoptions.max_background_compactions = options.max_background_compactions;
+ if (options.max_background_flushes)
+ ldoptions.max_background_flushes = options.max_background_flushes;
+ if (options.target_file_size_base)
+ ldoptions.target_file_size_base = options.target_file_size_base;
if (options.max_open_files)
ldoptions.max_open_files = options.max_open_files;
if (options.cache_size) {
rocksdb::Env *env = rocksdb::Env::Default();
env->NewLogger(options.log_file, &ldoptions.info_log);
}
+ if(options.disableDataSync)
+ ldoptions.disableDataSync = options.disableDataSync;
+ if(options.num_levels)
+ ldoptions.num_levels = options.num_levels;
+ if(options.level0_file_num_compaction_trigger)
+ ldoptions.level0_file_num_compaction_trigger = options.level0_file_num_compaction_trigger;
+ if(options.level0_slowdown_writes_trigger)
+ ldoptions.level0_slowdown_writes_trigger = options.level0_slowdown_writes_trigger;
+ if(options.level0_stop_writes_trigger)
+ ldoptions.level0_stop_writes_trigger = options.level0_stop_writes_trigger;
+ if(options.wal_dir.length())
+ ldoptions.wal_dir = options.wal_dir;
+
//rocksdb::DB *_db;
rocksdb::Status status = rocksdb::DB::Open(ldoptions, path, &db);
{
RocksDBTransactionImpl * _t =
static_cast<RocksDBTransactionImpl *>(t.get());
- rocksdb::Status s = db->Write(rocksdb::WriteOptions(), _t->bat);
+ rocksdb::WriteOptions woptions;
+ woptions.disableWAL = options.disableWAL;
+ rocksdb::Status s = db->Write(woptions, _t->bat);
logger->inc(l_rocksdb_txns);
return s.ok() ? 0 : -1;
}
{
RocksDBTransactionImpl * _t =
static_cast<RocksDBTransactionImpl *>(t.get());
- rocksdb::WriteOptions options;
- options.sync = true;
- rocksdb::Status s = db->Write(options, _t->bat);
+ rocksdb::WriteOptions woptions;
+ woptions.sync = true;
+ woptions.disableWAL = options.disableWAL;
+ rocksdb::Status s = db->Write(woptions, _t->bat);
logger->inc(l_rocksdb_txns);
return s.ok() ? 0 : -1;
}
*/
struct options_t {
uint64_t write_buffer_size; /// in-memory write buffer size
+ uint64_t write_buffer_num; /// in-memory write buffer number
+ uint64_t target_file_size_base; /// Target file size for compaction
+ int max_background_compactions; /// Maximum number of concurrent background compaction jobs
+ int max_background_flushes; /// Maximum number of concurrent background memtable flushea jobs
int max_open_files; /// maximum number of files RocksDB can open at once
uint64_t cache_size; /// size of extra decompressed cache to use
uint64_t block_size; /// user data per block
int block_restart_interval;
bool error_if_exists;
bool paranoid_checks;
+ uint64_t level0_file_num_compaction_trigger;
+ uint64_t level0_slowdown_writes_trigger;
+ uint64_t level0_stop_writes_trigger;
+ bool disableDataSync;
+ bool disableWAL;
+ int num_levels;
string log_file;
+ string wal_dir;
options_t() :
write_buffer_size(0), //< 0 means default
compression_type("none"), //< set to false for no compression
block_restart_interval(0), //< 0 means default
error_if_exists(false), //< set to true if you want to check nonexistence
- paranoid_checks(false) //< set to true if you want paranoid checks
+ paranoid_checks(false), //< set to true if you want paranoid checks
+ level0_file_num_compaction_trigger(0),
+ level0_slowdown_writes_trigger(0),
+ level0_stop_writes_trigger(0),
+ disableDataSync(false),
+ disableWAL(false),
+ num_levels(0)
{}
} options;