From: Sage Weil Date: Mon, 29 Apr 2013 18:06:36 +0000 (-0700) Subject: mon: remap creating pgs on startup X-Git-Tag: v0.61~52^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a2fe0137946541e7b3b537698e1865fbce974ca6;p=ceph.git mon: remap creating pgs on startup 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 --- diff --git a/src/mon/AuthMonitor.h b/src/mon/AuthMonitor.h index 256da24b1599..5d1422bbc4d7 100644 --- a/src/mon/AuthMonitor.h +++ b/src/mon/AuthMonitor.h @@ -154,8 +154,6 @@ private: void pre_auth(MAuth *m); void tick(); // check state, take actions - - void init(); }; diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 739f9b9d182a..405ab30597bf 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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() diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 772b2a435a47..ed4833bce7a9 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -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()) diff --git a/src/mon/PGMonitor.h b/src/mon/PGMonitor.h index 3b82f131d870..0871a46b97b1 100644 --- a/src/mon/PGMonitor.h +++ b/src/mon/PGMonitor.h @@ -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 diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index b213342947c1..0e4c9e23b025 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -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. *