]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: remap creating pgs on startup
authorSage Weil <sage@inktank.com>
Mon, 29 Apr 2013 18:06:36 +0000 (11:06 -0700)
committerSage Weil <sage@inktank.com>
Mon, 29 Apr 2013 18:11:27 +0000 (11:11 -0700)
After Monitor::init_paxos() has loaded all of the PaxosService state,
we should then map creating pgs to osds.  This ensures we do so after the
osdmap has been loaded and the pgs actually map somewhere meaningful.

Fixes: #4675
Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/AuthMonitor.h
src/mon/Monitor.cc
src/mon/PGMonitor.cc
src/mon/PGMonitor.h
src/mon/PaxosService.h

index 256da24b1599cf9e980878866fe7580f0d5a799d..5d1422bbc4d7cfffa88b5316ed4e36b770b40fb8 100644 (file)
@@ -154,8 +154,6 @@ private:
   void pre_auth(MAuth *m);
   
   void tick();  // check state, take actions
-
-  void init();
 };
 
 
index 739f9b9d182af17c15c64cfc257859ca3a9dbfdd..405ab30597bf1ca0fb11ed5eb0cccd8951b5a86a 100644 (file)
@@ -510,12 +510,20 @@ void Monitor::init_paxos()
 {
   dout(10) << __func__ << dendl;
   paxos->init();
-  // init paxos
+
+  // update paxos
   for (int i = 0; i < PAXOS_NUM; ++i) {
     if (paxos->is_consistent()) {
       paxos_service[i]->update_from_paxos();
     }
   }
+
+  // init services
+  for (int i = 0; i < PAXOS_NUM; ++i) {
+    if (paxos->is_consistent()) {
+      paxos_service[i]->init();
+    }
+  }
 }
 
 void Monitor::register_cluster_logger()
index 772b2a435a47984e108741ee1a022aa79a400bc8..ed4833bce7a99e988115a5319363fde9fdf41357 100644 (file)
@@ -220,6 +220,13 @@ void PGMonitor::update_from_paxos()
   update_logger();
 }
 
+void PGMonitor::init()
+{
+  if (mon->osdmon()->osdmap.get_epoch()) {
+    map_pg_creates();
+  }
+}
+
 void PGMonitor::handle_osd_timeouts()
 {
   if (!mon->is_leader())
index 3b82f131d87009b6f7039b61d77afe7409a9f371..0871a46b97b1348c2dd11202c4c7e55ded1c48fe 100644 (file)
@@ -52,6 +52,7 @@ private:
 
   void create_initial();
   void update_from_paxos();
+  void init();
   void handle_osd_timeouts();
   void create_pending();  // prepare a new pending
   // propose pending update to peers
index b213342947c1c8f55df30b836b1f5843ab1ec1c9..0e4c9e23b025b3af5e3b9afc52c7067298a743b3 100644 (file)
@@ -337,6 +337,14 @@ public:
    */
   virtual void update_from_paxos() = 0;
 
+  /**
+   * Init on startup
+   *
+   * This is called on mon startup, after all of the PaxosService instances'
+   * update_from_paxos() methods have been called
+   */
+  virtual void init() {}
+
   /**
    * Create the pending state.
    *