diff options
author | Sage Weil <sage@inktank.com> | 2013-05-31 15:32:06 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-24 16:16:41 -0700 |
commit | cf75478d027dfd377424988745230d096dae79ac (patch) | |
tree | 9007c496b84346fddcab23b0917d74e8d91855f2 | |
parent | 6ac58cd9c1f9c80c5f3cbe97e19cfcd8427db46d (diff) | |
download | ceph-cf75478d027dfd377424988745230d096dae79ac.tar.gz |
mon: safely signal bootstrap from MonmapMonitor::update_from_paxos()
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit dc83430124a5fd37573202a4cc0986c3c03739ef)
-rw-r--r-- | src/mon/AuthMonitor.cc | 2 | ||||
-rw-r--r-- | src/mon/AuthMonitor.h | 2 | ||||
-rw-r--r-- | src/mon/LogMonitor.cc | 2 | ||||
-rw-r--r-- | src/mon/LogMonitor.h | 2 | ||||
-rw-r--r-- | src/mon/MDSMonitor.cc | 2 | ||||
-rw-r--r-- | src/mon/MDSMonitor.h | 2 | ||||
-rw-r--r-- | src/mon/Monitor.cc | 6 | ||||
-rw-r--r-- | src/mon/Monitor.h | 2 | ||||
-rw-r--r-- | src/mon/MonmapMonitor.cc | 11 | ||||
-rw-r--r-- | src/mon/MonmapMonitor.h | 2 | ||||
-rw-r--r-- | src/mon/OSDMonitor.cc | 2 | ||||
-rw-r--r-- | src/mon/OSDMonitor.h | 2 | ||||
-rw-r--r-- | src/mon/PGMonitor.cc | 2 | ||||
-rw-r--r-- | src/mon/PGMonitor.h | 2 | ||||
-rw-r--r-- | src/mon/Paxos.cc | 11 | ||||
-rw-r--r-- | src/mon/PaxosService.cc | 4 | ||||
-rw-r--r-- | src/mon/PaxosService.h | 4 |
17 files changed, 33 insertions, 27 deletions
diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index 0fe94871f37..391dc3c988b 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -111,7 +111,7 @@ void AuthMonitor::create_initial() check_rotate(); } -void AuthMonitor::update_from_paxos() +void AuthMonitor::update_from_paxos(bool *need_bootstrap) { dout(10) << __func__ << dendl; version_t version = get_version(); diff --git a/src/mon/AuthMonitor.h b/src/mon/AuthMonitor.h index 896384dbc95..ddd68cf3317 100644 --- a/src/mon/AuthMonitor.h +++ b/src/mon/AuthMonitor.h @@ -127,7 +127,7 @@ private: void election_finished(); bool should_propose(double& delay); void create_initial(); - void update_from_paxos(); + void update_from_paxos(bool *need_bootstrap); void create_pending(); // prepare a new pending bool prepare_global_id(MMonGlobalID *m); void increase_max_global_id(); diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index 5588ea06784..690b47e8f00 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -90,7 +90,7 @@ void LogMonitor::create_initial() pending_log.insert(pair<utime_t,LogEntry>(e.stamp, e)); } -void LogMonitor::update_from_paxos() +void LogMonitor::update_from_paxos(bool *need_bootstrap) { dout(10) << __func__ << dendl; version_t version = get_version(); diff --git a/src/mon/LogMonitor.h b/src/mon/LogMonitor.h index 9eee758d47f..e20c81e227b 100644 --- a/src/mon/LogMonitor.h +++ b/src/mon/LogMonitor.h @@ -34,7 +34,7 @@ private: LogSummary pending_summary, summary; void create_initial(); - void update_from_paxos(); + void update_from_paxos(bool *need_bootstrap); void create_pending(); // prepare a new pending // propose pending update to peers void encode_pending(MonitorDBStore::Transaction *t); diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index f9e24482a95..0d45420d7a7 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -80,7 +80,7 @@ void MDSMonitor::create_initial() } -void MDSMonitor::update_from_paxos() +void MDSMonitor::update_from_paxos(bool *need_bootstrap) { version_t version = get_version(); if (version == mdsmap.epoch) diff --git a/src/mon/MDSMonitor.h b/src/mon/MDSMonitor.h index 674003728aa..29470f880e3 100644 --- a/src/mon/MDSMonitor.h +++ b/src/mon/MDSMonitor.h @@ -69,7 +69,7 @@ class MDSMonitor : public PaxosService { // service methods void create_initial(); - void update_from_paxos(); + void update_from_paxos(bool *need_bootstrap); void create_pending(); void encode_pending(MonitorDBStore::Transaction *t); // we don't require full versions; don't encode any. diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 522434997d1..484ccf962aa 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -516,7 +516,7 @@ void Monitor::init_paxos() // update paxos if (paxos->is_consistent()) - refresh_from_paxos(); + refresh_from_paxos(NULL); // init services for (int i = 0; i < PAXOS_NUM; ++i) { @@ -526,11 +526,11 @@ void Monitor::init_paxos() } } -void Monitor::refresh_from_paxos() +void Monitor::refresh_from_paxos(bool *need_bootstrap) { dout(10) << __func__ << dendl; for (int i = 0; i < PAXOS_NUM; ++i) { - paxos_service[i]->refresh(); + paxos_service[i]->refresh(need_bootstrap); } } diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index cea2a23d978..2508aa7f3d3 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -1412,7 +1412,7 @@ public: int preinit(); int init(); void init_paxos(); - void refresh_from_paxos(); + void refresh_from_paxos(bool *need_bootstrap); void shutdown(); void tick(); diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc index 06927113d82..a76c0d0a3bc 100644 --- a/src/mon/MonmapMonitor.cc +++ b/src/mon/MonmapMonitor.cc @@ -45,7 +45,7 @@ void MonmapMonitor::create_initial() pending_map.epoch = 1; } -void MonmapMonitor::update_from_paxos() +void MonmapMonitor::update_from_paxos(bool *need_bootstrap) { version_t version = get_version(); if (version <= mon->monmap->get_epoch()) @@ -93,7 +93,10 @@ void MonmapMonitor::update_from_paxos() mon->monmap->decode(latest_bl); } */ - bool need_restart = version != mon->monmap->get_epoch(); + if (need_bootstrap && version != mon->monmap->get_epoch()) { + dout(10) << " signaling that we need a bootstrap" << dendl; + *need_bootstrap = true; + } // read and decode monmap_bl.clear(); @@ -109,10 +112,6 @@ void MonmapMonitor::update_from_paxos() erase_mkfs(&t); mon->store->apply_transaction(t); } - - if (need_restart) { - mon->bootstrap(); - } } void MonmapMonitor::create_pending() diff --git a/src/mon/MonmapMonitor.h b/src/mon/MonmapMonitor.h index 0690fb7409f..198489d7017 100644 --- a/src/mon/MonmapMonitor.h +++ b/src/mon/MonmapMonitor.h @@ -46,7 +46,7 @@ class MonmapMonitor : public PaxosService { void create_initial(); - void update_from_paxos(); + void update_from_paxos(bool *need_bootstrap); void create_pending(); diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 573e3470dcd..6ad0206c677 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -106,7 +106,7 @@ void OSDMonitor::create_initial() newmap.encode(pending_inc.fullmap); } -void OSDMonitor::update_from_paxos() +void OSDMonitor::update_from_paxos(bool *need_bootstrap) { version_t version = get_version(); if (version == osdmap.epoch) diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 30fd09fa499..494a66cafe0 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -145,7 +145,7 @@ private: public: void create_initial(); private: - void update_from_paxos(); + void update_from_paxos(bool *need_bootstrap); void create_pending(); // prepare a new pending void encode_pending(MonitorDBStore::Transaction *t); virtual void encode_full(MonitorDBStore::Transaction *t); diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 4a8c89801ac..da648c77dfa 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -135,7 +135,7 @@ void PGMonitor::create_initial() dout(10) << "create_initial -- creating initial map" << dendl; } -void PGMonitor::update_from_paxos() +void PGMonitor::update_from_paxos(bool *need_bootstrap) { version_t version = get_version(); if (version == pg_map.version) diff --git a/src/mon/PGMonitor.h b/src/mon/PGMonitor.h index 0871a46b97b..7f04fec1256 100644 --- a/src/mon/PGMonitor.h +++ b/src/mon/PGMonitor.h @@ -51,7 +51,7 @@ private: PGMap::Incremental pending_inc; void create_initial(); - void update_from_paxos(); + void update_from_paxos(bool *need_bootstrap); void init(); void handle_osd_timeouts(); void create_pending(); // prepare a new pending diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 0b90722de80..0c3c603002c 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -715,7 +715,7 @@ void Paxos::handle_commit(MMonPaxos *commit) commit->put(); - mon->refresh_from_paxos(); + mon->refresh_from_paxos(NULL); finish_contexts(g_ceph_context, waiting_for_commit); } @@ -786,7 +786,8 @@ void Paxos::finish_proposal() assert(mon->is_leader()); // make sure we have the latest state loaded up - mon->refresh_from_paxos(); + bool need_bootstrap = false; + mon->refresh_from_paxos(&need_bootstrap); // finish off the last proposal if (!proposals.empty()) { @@ -821,6 +822,12 @@ void Paxos::finish_proposal() first_committed = get_store()->get(get_name(), "first_committed"); last_committed = get_store()->get(get_name(), "last_committed"); + if (need_bootstrap) { + dout(10) << " doing requested bootstrap" << dendl; + mon->bootstrap(); + return; + } + if (should_trim()) { trim(); } diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index cf08ec46811..e897aa79e15 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -104,7 +104,7 @@ bool PaxosService::dispatch(PaxosServiceMessage *m) return true; } -void PaxosService::refresh() +void PaxosService::refresh(bool *need_bootstrap) { // update cached versions cached_first_committed = mon->store->get(get_service_name(), first_committed_name); @@ -112,7 +112,7 @@ void PaxosService::refresh() dout(10) << __func__ << dendl; - update_from_paxos(); + update_from_paxos(need_bootstrap); } diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 9ca926292b7..6e57831095e 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -314,7 +314,7 @@ public: */ bool dispatch(PaxosServiceMessage *m); - void refresh(); + void refresh(bool *need_bootstrap); /** * @defgroup PaxosService_h_override_funcs Functions that should be @@ -338,7 +338,7 @@ public: * * @returns 'true' on success; 'false' otherwise. */ - virtual void update_from_paxos() = 0; + virtual void update_from_paxos(bool *need_bootstrap) = 0; /** * Init on startup |