]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pgmon: call check_osd_map via a new on_active implementation
authorGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 8 Aug 2011 20:48:29 +0000 (13:48 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 8 Aug 2011 20:48:29 +0000 (13:48 -0700)
Previously it was possible to lose PG creations if a monitor election
happened at the right time. The issue would get rectified on the
next OSDMap update, but that could take...a while. (My observed time
when I discovered the bug had it go without creation for 43 minutes,
at which point I killed it.)

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/mon/PGMonitor.cc
src/mon/PGMonitor.h

index c48e671097986eb4cb1c51dd6e8d6cb083e6e87b..265817c001324c37fd601fa9b5628d80840c67d0 100644 (file)
@@ -90,6 +90,13 @@ void PGMonitor::on_election_start()
   last_osd_report.clear();
 }
 
+void PGMonitor::on_active()
+{
+  if (mon->is_leader()) {
+    check_osd_map(mon->osdmon()->osdmap.epoch);
+  }
+}
+
 void PGMonitor::tick() 
 {
   if (!paxos->is_active()) return;
@@ -654,7 +661,7 @@ bool PGMonitor::register_new_pgs()
                    new_pool);
       }
     }
-  } 
+  }
 
   int max = MIN(osdmap->get_max_osd(), osdmap->crush.get_max_devices());
   int removed = 0;
index eb9facae0c1f970ebfb6c05ecb92f016ba5b381e..a8280bab81d98e4b6971a98faaff89f022102bc6 100644 (file)
@@ -102,6 +102,11 @@ public:
 
   virtual void on_election_start();
 
+  /* Courtesy function provided by PaxosService, called when an election
+   * finishes and the cluster goes active. We use it here to make sure we
+   * haven't lost any PGs from new pools. */
+  virtual void on_active();
+
   void tick();  // check state, take actions
 
   void check_osd_map(epoch_t epoch);