]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-mon: override 'leveldb_*' config options for the monitor
authorJoao Eduardo Luis <joao.luis@inktank.com>
Mon, 23 Jun 2014 20:59:13 +0000 (21:59 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Mon, 23 Jun 2014 20:59:13 +0000 (21:59 +0100)
'leveldb_*' options are currently used both by the monitor and the osd.
However, the monitor has quite different requirements from those of the
osds.

We need to specify some default values that must squash the defaults we
have for 'leveldb_*' options, while allowing users to overriding them too.
We take this not-exactly-ideal-but-still-good-enough approach of
defining the monitor-specific defaults in the 'default arguments' to
global_init(), thus allowing the user's options to take precedence over
whatever we define.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
PendingReleaseNotes
src/ceph_mon.cc

index 9b1e5764cb8b52af60019e51bdb4f790802b6da2..c81d428c4047bcbf38c646ba2fd4ceaa3c9090e3 100644 (file)
@@ -5,3 +5,10 @@ v0.82
 - mon-specific leveldb options have been removed.  From this point onward,
   users should use 'leveldb_' generic options and add the options in the
   appropriate sections of their configuration files.
+  The monitors will still maintain the following monitor-specific defaults:
+
+    leveldb_write_buffer_size = 32*1024*1024  = 33554432  // 32MB
+    leveldb_cache_size        = 512*1024*1204 = 536870912 // 512MB
+    leveldb_block_size        = 64*1024       = 65536     // 64KB
+    leveldb_compression       = false
+    leveldb_log               = ""
index a0277363e137035f0d9d0c8c3d6ca59c2ec4c3f9..c0b1c2c43413ed4bef5a291aeb5074cc50de30ea 100644 (file)
@@ -198,6 +198,28 @@ int main(int argc, const char **argv)
   argv_to_vec(argc, argv, args);
   env_to_vec(args);
 
+  // We need to specify some default values that may be overridden by the
+  // user, that are specific to the monitor.  The options we are overriding
+  // are also used on the OSD (or in any other component that uses leveldb),
+  // so changing them directly in common/config_opts.h is not an option.
+  // This is not the prettiest way of doing this, especially since it has us
+  // having a different place than common/config_opts.h defining default
+  // values, but it's not horribly wrong enough to prevent us from doing it :)
+  //
+  // NOTE: user-defined options will take precedence over ours.
+  //
+  //  leveldb_write_buffer_size = 32*1024*1024  = 33554432  // 32MB
+  //  leveldb_cache_size        = 512*1024*1204 = 536870912 // 512MB
+  //  leveldb_block_size        = 64*1024       = 65536     // 64KB
+  //  leveldb_compression       = false
+  //  leveldb_log               = ""
+  vector<const char*> def_args;
+  def_args.push_back("--leveldb-write-buffer-size=33554432");
+  def_args.push_back("--leveldb-cache-size=536870912");
+  def_args.push_back("--leveldb-block-size=65536");
+  def_args.push_back("--leveldb-compression=false");
+  def_args.push_back("--leveldb-log=");
+
   int flags = 0;
   {
     vector<const char*> args_copy = args;
@@ -218,7 +240,8 @@ int main(int argc, const char **argv)
     }
   }
 
-  global_init(NULL, args, CEPH_ENTITY_TYPE_MON, CODE_ENVIRONMENT_DAEMON, flags);
+  global_init(&def_args, args,
+              CEPH_ENTITY_TYPE_MON, CODE_ENVIRONMENT_DAEMON, flags);
 
   uuid_d fsid;
   std::string val;