]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
leveldb: add leveldb_* options
authorSage Weil <sage@inktank.com>
Tue, 28 Jan 2014 20:18:15 +0000 (12:18 -0800)
committerSage Weil <sage@inktank.com>
Tue, 28 Jan 2014 20:18:15 +0000 (12:18 -0800)
The osd_leveldb_* and mon_leveldb_* are now deprecated.  If they are
still used, they override these values.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/mon/MonitorDBStore.h
src/os/LevelDBStore.cc

index 98aa2262c56ee462b6dd54f03af87051cbb984cd..2c60872ecfdedace5215217ef6786155ab3e788b 100644 (file)
@@ -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.
index 35f5cbce4df7780e242e363c58837fffcde26450..88c4f9366ef3c797ed4b8adadfba02c669e28ce8 100644 (file)
@@ -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;
   }
 
index 0ace7fa73ef75a5e93e1c6db354bbc71dcc27c0d..326862f896a15ad4ef3dc2da9bfd2d0d33510da5 100644 (file)
@@ -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");