From: Joao Eduardo Luis Date: Mon, 23 Jun 2014 20:59:13 +0000 (+0100) Subject: ceph-mon: override 'leveldb_*' config options for the monitor X-Git-Tag: v0.83~51^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=52b147c8b3b3a6f95d948c1c82d9e09c95fa60cf;p=ceph.git ceph-mon: override 'leveldb_*' config options for the monitor '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 --- diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 9b1e5764cb8..c81d428c404 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -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 = "" diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index a0277363e13..c0b1c2c4341 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -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 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 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;