]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/MgrMonitor: limit mgrmap history
authorSage Weil <sage@redhat.com>
Mon, 27 Nov 2017 22:45:25 +0000 (16:45 -0600)
committerSage Weil <sage@redhat.com>
Mon, 27 Nov 2017 23:04:09 +0000 (17:04 -0600)
Keep 500 by default (like we do osdmaps and mdsmaps).

Fixes: http://tracker.ceph.com/issues/22257
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/options.cc
src/mon/MgrMonitor.cc
src/mon/MgrMonitor.h

index 0064af6652312f65d52f74251d0f6854940729e2..6925c1219f44c3019bb6a40863e87be0bf5b4ec5 100644 (file)
@@ -1169,6 +1169,10 @@ std::vector<Option> get_global_options() {
     .set_default(500)
     .set_description(""),
 
+    Option("mon_max_mgrmap_epochs", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    .set_default(500)
+    .set_description(""),
+
     Option("mon_max_osd", Option::TYPE_INT, Option::LEVEL_ADVANCED)
     .set_default(10000)
     .set_description(""),
index 751ed45e81173a99f43de67636b14a7eaa8a7f57..fedd1c1cf6fb4fe8e0687b548a64f2be6822bd41 100644 (file)
@@ -40,6 +40,15 @@ static ostream& _prefix(std::ostream *_dout, Monitor *mon,
 const static std::string command_descs_prefix = "mgr_command_descs";
 
 
+version_t MgrMonitor::get_trim_to() const
+{
+  int64_t max = g_conf->get_val<int64_t>("mon_max_mgrmap_epochs");
+  if (map.epoch > max) {
+    return map.epoch - max;
+  }
+  return 0;
+}
+
 void MgrMonitor::create_initial()
 {
   // Take a local copy of initial_modules for tokenizer to iterate over.
index 5507615af43526008b48aeaf963a4c40eadfe0a1..40d40c0a7a10999d9683ec7186475bab6d8777ff 100644 (file)
@@ -78,6 +78,8 @@ public:
 
   bool in_use() const { return map.epoch > 0; }
 
+  version_t get_trim_to() const override;
+
   void create_initial() override;
   void get_store_prefixes(std::set<string>& s) const override;
   void update_from_paxos(bool *need_bootstrap) override;