]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: OSDMonitor: smaller transactions when rebuilding full versions
authorJoao Eduardo Luis <joao.luis@inktank.com>
Sun, 15 Sep 2013 20:00:55 +0000 (21:00 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Sun, 15 Sep 2013 23:32:59 +0000 (00:32 +0100)
Otherwise, for considerably sized rebuilds, the monitor will not only
consume vast amounts of memory, but it will also have troubles committing
the transaction.  Anyway, it's also a good idea to adjust transactions to
the granularity we want, and to be fair we care that each rebuilt full map
gets to disk, even if subsequent full maps don't (those can be rebuilt
later).

Fixes: #6323
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/OSDMonitor.cc

index 85dcf576271bc9bec92e8b9c515e36cd4e6d5098..3f45a18111a20217ce815a5c61bf9147b097d45a 100644 (file)
@@ -179,13 +179,13 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
   }
 
   // walk through incrementals
-  MonitorDBStore::Transaction t;
   while (version > osdmap.epoch) {
+    MonitorDBStore::Transaction t;
     bufferlist inc_bl;
     int err = get_version(osdmap.epoch+1, inc_bl);
     assert(err == 0);
     assert(inc_bl.length());
-    
+
     dout(7) << "update_from_paxos  applying incremental " << osdmap.epoch+1 << dendl;
     OSDMap::Incremental inc(inc_bl);
     err = osdmap.apply_incremental(inc);
@@ -202,9 +202,9 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
     if (osdmap.epoch == 1) {
       t.erase("mkfs", "osdmap");
     }
+    if (!t.empty())
+      mon->store->apply_transaction(t);
   }
-  if (!t.empty())
-    mon->store->apply_transaction(t);
 
   for (int o = 0; o < osdmap.get_max_osd(); o++) {
     if (osdmap.is_down(o)) {