From: Joao Eduardo Luis Date: Wed, 4 Dec 2013 17:49:10 +0000 (+0000) Subject: mon: MDSMonitor: implement 'get_trim_to()' to let the mon trim mdsmaps X-Git-Tag: v0.73~2^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cf099415ad5ad7560a33efd0016293becc70858a;p=ceph.git mon: MDSMonitor: implement 'get_trim_to()' to let the mon trim mdsmaps This commit also adds two options to the MDSMonitor: - mon_max_mdsmap_epochs: the maximum amount of maps we'll keep (def: 500) - mon_mds_force_trim: the version we want to trim to This results in 'get_trim_to()' returning the possible values: - if we have set mon_mds_force_trim, and this value is greater than the last committed version, trim to mon_mds_force_trim - if we hold more than the max number of maps, trim to last - max - if we have set mon_mds_force_trim and if we hold more than the max number of maps, and mon_mds_force_trim is lower than last - max, then trim to last - max Backport: dumpling Backport: emperor Signed-off-by: Joao Eduardo Luis --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 0d0380977775..b8085f86372e 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -170,6 +170,7 @@ OPTION(mon_force_standby_active, OPT_BOOL, true) // should mons force standby-re OPTION(mon_min_osdmap_epochs, OPT_INT, 500) OPTION(mon_max_pgmap_epochs, OPT_INT, 500) OPTION(mon_max_log_epochs, OPT_INT, 500) +OPTION(mon_max_mdsmap_epochs, OPT_INT, 500) OPTION(mon_max_osd, OPT_INT, 10000) OPTION(mon_probe_timeout, OPT_DOUBLE, 2.0) OPTION(mon_slurp_timeout, OPT_DOUBLE, 10.0) @@ -191,6 +192,7 @@ OPTION(mon_inject_sync_get_chunk_delay, OPT_DOUBLE, 0) // inject N second delay OPTION(mon_osd_min_down_reporters, OPT_INT, 1) // number of OSDs who need to report a down OSD for it to count OPTION(mon_osd_min_down_reports, OPT_INT, 3) // number of times a down OSD must be reported for it to count OPTION(mon_osd_force_trim_to, OPT_INT, 0) // force mon to trim maps to this point, regardless of min_last_epoch_clean (dangerous, use with care) +OPTION(mon_mds_force_trim_to, OPT_INT, 0) // force mon to trim mdsmaps to this point (dangerous, use with care) // dump transactions OPTION(mon_debug_dump_transactions, OPT_BOOL, false) diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 600a41059cec..df9e23e36264 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -137,6 +137,24 @@ void MDSMonitor::encode_pending(MonitorDBStore::Transaction *t) put_last_committed(t, pending_mdsmap.epoch); } +version_t MDSMonitor::get_trim_to() +{ + version_t floor = 0; + if (g_conf->mon_mds_force_trim_to > 0 && + g_conf->mon_mds_force_trim_to < (int)get_last_committed()) { + floor = g_conf->mon_mds_force_trim_to; + dout(10) << __func__ << " explicit mon_mds_force_trim_to = " + << floor << dendl; + } + + unsigned max = g_conf->mon_max_mdsmap_epochs; + version_t last = get_last_committed(); + + if (last - get_first_committed() > max && floor < last - max) + return last - max; + return floor; +} + void MDSMonitor::update_logger() { dout(10) << "update_logger" << dendl; diff --git a/src/mon/MDSMonitor.h b/src/mon/MDSMonitor.h index 10d8d7b4213c..901e93e379b7 100644 --- a/src/mon/MDSMonitor.h +++ b/src/mon/MDSMonitor.h @@ -65,6 +65,7 @@ class MDSMonitor : public PaxosService { void create_new_fs(MDSMap &m, int metadata_pool, int data_pool); + version_t get_trim_to(); // service methods void create_initial();