From: Sage Weil Date: Tue, 28 Jan 2014 20:18:15 +0000 (-0800) Subject: leveldb: add leveldb_* options X-Git-Tag: v0.78~254^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2a737d841e17dff8b831fc600c1b902cb467f4b9;p=ceph.git leveldb: add leveldb_* options The osd_leveldb_* and mon_leveldb_* are now deprecated. If they are still used, they override these values. Signed-off-by: Sage Weil --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 98aa2262c56..2c60872ecfd 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -210,7 +210,7 @@ OPTION(mon_leveldb_bloom_size, OPT_INT, 0) // monitor's leveldb bloom bits per e OPTION(mon_leveldb_max_open_files, OPT_INT, 0) // monitor's leveldb max open files OPTION(mon_leveldb_compression, OPT_BOOL, false) // monitor's leveldb uses compression OPTION(mon_leveldb_paranoid, OPT_BOOL, false) // monitor's leveldb paranoid flag -OPTION(mon_leveldb_log, OPT_STR, "/dev/null") +OPTION(mon_leveldb_log, OPT_STR, "") OPTION(mon_leveldb_size_warn, OPT_U64, 40*1024*1024*1024) // issue a warning when the monitor's leveldb goes over 40GB (in bytes) OPTION(paxos_stash_full_interval, OPT_INT, 25) // how often (in commits) to stash a full copy of the PaxosService state OPTION(paxos_max_join_drift, OPT_INT, 10) // max paxos iterations before we must first sync the monitor stores @@ -512,11 +512,21 @@ OPTION(osd_leveldb_bloom_size, OPT_INT, 0) // OSD's leveldb bloom bits per entry OPTION(osd_leveldb_max_open_files, OPT_INT, 0) // OSD's leveldb max open files OPTION(osd_leveldb_compression, OPT_BOOL, true) // OSD's leveldb uses compression OPTION(osd_leveldb_paranoid, OPT_BOOL, false) // OSD's leveldb paranoid flag -OPTION(osd_leveldb_log, OPT_STR, "/dev/null") // enable OSD leveldb log file +OPTION(osd_leveldb_log, OPT_STR, "") // enable OSD leveldb log file // determines whether PGLog::check() compares written out log to stored log OPTION(osd_debug_pg_log_writeout, OPT_BOOL, false) +OPTION(leveldb_write_buffer_size, OPT_U64, 0) // leveldb write buffer size +OPTION(leveldb_cache_size, OPT_U64, 0) // leveldb cache size +OPTION(leveldb_block_size, OPT_U64, 0) // leveldb block size +OPTION(leveldb_bloom_size, OPT_INT, 0) // leveldb bloom bits per entry +OPTION(leveldb_max_open_files, OPT_INT, 0) // leveldb max open files +OPTION(leveldb_compression, OPT_BOOL, true) // leveldb uses compression +OPTION(leveldb_paranoid, OPT_BOOL, false) // leveldb paranoid flag +OPTION(leveldb_log, OPT_STR, "/dev/null") // enable leveldb log file +OPTION(leveldb_compact_on_mount, OPT_BOOL, false) + /** * osd_client_op_priority and osd_recovery_op_priority adjust the relative * priority of client io vs recovery io. diff --git a/src/mon/MonitorDBStore.h b/src/mon/MonitorDBStore.h index 35f5cbce4df..88c4f9366ef 100644 --- a/src/mon/MonitorDBStore.h +++ b/src/mon/MonitorDBStore.h @@ -502,7 +502,7 @@ class MonitorDBStore db->options.max_open_files = g_conf->mon_leveldb_max_open_files; if (g_conf->mon_leveldb_paranoid) db->options.paranoid_checks = g_conf->mon_leveldb_paranoid; - if (g_conf->mon_leveldb_log) + if (g_conf->mon_leveldb_log.length()) db->options.log_file = g_conf->mon_leveldb_log; } diff --git a/src/os/LevelDBStore.cc b/src/os/LevelDBStore.cc index 0ace7fa73ef..326862f896a 100644 --- a/src/os/LevelDBStore.cc +++ b/src/os/LevelDBStore.cc @@ -12,6 +12,16 @@ using std::string; int LevelDBStore::init() { + // init defaults. caller can override these if they want + // prior to calling open. + options.write_buffer_size = g_conf->leveldb_write_buffer_size; + options.cache_size = g_conf->leveldb_cache_size; + options.block_size = g_conf->leveldb_block_size; + options.bloom_size = g_conf->leveldb_bloom_size; + options.compression_enabled = g_conf->leveldb_compression; + options.paranoid_checks = g_conf->leveldb_paranoid; + options.max_open_files = g_conf->leveldb_max_open_files; + options.log_file = g_conf->leveldb_log; return 0; } @@ -64,6 +74,12 @@ int LevelDBStore::do_open(ostream &out, bool create_if_missing) return -EINVAL; } + if (g_conf->leveldb_compact_on_mount) { + derr << "Compacting leveldb store..." << dendl; + compact(); + derr << "Finished compacting leveldb store" << dendl; + } + PerfCountersBuilder plb(g_ceph_context, "leveldb", l_leveldb_first, l_leveldb_last); plb.add_u64_counter(l_leveldb_gets, "leveldb_get"); plb.add_u64_counter(l_leveldb_txns, "leveldb_transaction");