summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-04-29 11:27:22 -0700
committerSage Weil <sage@inktank.com>2013-04-29 11:27:22 -0700
commit6a5be251df0e14ec66fb868ff6a6ef6e08d539c6 (patch)
tree52d355d7fdd8ee2b848628a5db43f4d7cec35e84
parentf8f762a2814dc778da7027998126b60bd260d099 (diff)
parenta2fe0137946541e7b3b537698e1865fbce974ca6 (diff)
downloadceph-6a5be251df0e14ec66fb868ff6a6ef6e08d539c6.tar.gz
Merge branch 'wip-mon-pg' into next
Reviewed-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/mon/AuthMonitor.h2
-rw-r--r--src/mon/Monitor.cc10
-rw-r--r--src/mon/PGMonitor.cc41
-rw-r--r--src/mon/PGMonitor.h2
-rw-r--r--src/mon/PaxosService.h8
5 files changed, 53 insertions, 10 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 fe50b34da8c..ed4833bce7a 100644
--- a/src/mon/PGMonitor.cc
+++ b/src/mon/PGMonitor.cc
@@ -212,11 +212,21 @@ void PGMonitor::update_from_paxos()
update_trim();
- send_pg_creates();
+ if (mon->osdmon()->osdmap.get_epoch()) {
+ map_pg_creates();
+ send_pg_creates();
+ }
update_logger();
}
+void PGMonitor::init()
+{
+ if (mon->osdmon()->osdmap.get_epoch()) {
+ map_pg_creates();
+ }
+}
+
void PGMonitor::handle_osd_timeouts()
{
if (!mon->is_leader())
@@ -664,7 +674,10 @@ void PGMonitor::check_osd_map(epoch_t epoch)
if (propose)
propose_pending();
- send_pg_creates();
+ if (mon->osdmon()->osdmap.get_epoch()) {
+ map_pg_creates();
+ send_pg_creates();
+ }
}
void PGMonitor::register_pg(pg_pool_t& pool, pg_t pgid, epoch_t epoch, bool new_pool)
@@ -785,12 +798,10 @@ bool PGMonitor::register_new_pgs()
return false;
}
-void PGMonitor::send_pg_creates()
+void PGMonitor::map_pg_creates()
{
- dout(10) << "send_pg_creates to " << pg_map.creating_pgs.size() << " pgs" << dendl;
+ dout(10) << "map_pg_creates to " << pg_map.creating_pgs.size() << " pgs" << dendl;
- utime_t now = ceph_clock_now(g_ceph_context);
-
for (set<pg_t>::iterator p = pg_map.creating_pgs.begin();
p != pg_map.creating_pgs.end();
++p) {
@@ -820,12 +831,23 @@ void PGMonitor::send_pg_creates()
if (nrep) {
pg_map.creating_pgs_by_osd[acting[0]].insert(pgid);
} else {
- dout(20) << "send_pg_creates " << pgid << " -> no osds in epoch "
+ dout(20) << "map_pg_creates " << pgid << " -> no osds in epoch "
<< mon->osdmon()->osdmap.get_epoch() << ", skipping" << dendl;
continue; // blarney!
}
}
+ for (map<int, set<pg_t> >::iterator p = pg_map.creating_pgs_by_osd.begin();
+ p != pg_map.creating_pgs_by_osd.end();
+ ++p) {
+ dout(10) << "map_pg_creates osd." << p->first << " has " << p->second.size() << " pgs" << dendl;
+ }
+}
+void PGMonitor::send_pg_creates()
+{
+ dout(10) << "send_pg_creates to " << pg_map.creating_pgs.size() << " pgs" << dendl;
+
+ utime_t now = ceph_clock_now(g_ceph_context);
for (map<int, set<pg_t> >::iterator p = pg_map.creating_pgs_by_osd.begin();
p != pg_map.creating_pgs_by_osd.end();
++p) {
@@ -1084,6 +1106,11 @@ bool PGMonitor::preprocess_command(MMonCommand *m)
ss << "got pgmap version " << pg_map.version;
r = 0;
}
+ else if (m->cmd[1] == "map_pg_creates") {
+ map_pg_creates();
+ ss << "mapped pg creates ";
+ r = 0;
+ }
else if (m->cmd[1] == "send_pg_creates") {
send_pg_creates();
ss << "sent pg creates ";
diff --git a/src/mon/PGMonitor.h b/src/mon/PGMonitor.h
index de78e984ae9..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
@@ -109,6 +110,7 @@ private:
*/
bool register_new_pgs();
+ void map_pg_creates();
void send_pg_creates();
void send_pg_creates(int osd, Connection *con);
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.