summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-04-29 11:06:36 -0700
committerSage Weil <sage@inktank.com>2013-04-29 11:11:27 -0700
commita2fe0137946541e7b3b537698e1865fbce974ca6 (patch)
tree52d355d7fdd8ee2b848628a5db43f4d7cec35e84
parent278186d750cf223193159b9d0a03c491b8be746e (diff)
downloadceph-a2fe0137946541e7b3b537698e1865fbce974ca6.tar.gz
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 <sage@inktank.com>
-rw-r--r--src/mon/AuthMonitor.h2
-rw-r--r--src/mon/Monitor.cc10
-rw-r--r--src/mon/PGMonitor.cc7
-rw-r--r--src/mon/PGMonitor.h1
-rw-r--r--src/mon/PaxosService.h8
5 files changed, 25 insertions, 3 deletions
diff --git a/src/mon/AuthMonitor.h b/src/mon/AuthMonitor.h
index 256da24b159..5d1422bbc4d 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 739f9b9d182..405ab30597b 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 772b2a435a4..ed4833bce7a 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 3b82f131d87..0871a46b97b 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 b213342947c..0e4c9e23b02 100644
--- a/src/mon/PaxosService.h
+++ b/src/mon/PaxosService.h
@@ -338,6 +338,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.
*
* @invariant This function is only called on a Leader.