summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoao Eduardo Luis <joao.luis@inktank.com>2013-06-19 02:50:45 +0100
committerSage Weil <sage@inktank.com>2013-06-18 22:01:03 -0700
commit6427985b746b7c29f5337d87b60aab9008a8bc6e (patch)
tree37c95c55abf007392487c04dc97cc68e91fefda9
parentf8f83e78218ee5b8602cfe6758caf2ecd3e06602 (diff)
downloadceph-6427985b746b7c29f5337d87b60aab9008a8bc6e.tar.gz
mon: Monitor: make sure we backup a monmap during sync start
First of all, we must find a monmap to backup. The newest version. Secondly, we must make sure we back it up before clearing the store. Finally, we must make sure that we don't remove said backup while clearing the store; otherwise, we would be out of a backup monmap if the sync happened to fail (and if the monitor happened to be killed before a new sync had finished). This patch makes sure these conditions are met. Fixes: #5256 (partially) Backport: cuttlefish Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com> (cherry picked from commit 5e6dc4ea21b452e34599678792cd36ce1ba3edb3)
-rw-r--r--src/mon/Monitor.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index 9543885deaa..5b6f8786642 100644
--- a/src/mon/Monitor.cc
+++ b/src/mon/Monitor.cc
@@ -1453,15 +1453,17 @@ void Monitor::sync_start(entity_inst_t &other)
sync_role = SYNC_ROLE_REQUESTER;
sync_state = SYNC_STATE_START;
+ // First init the store (grab the monmap and all that) and only then
+ // clear the store (except for the mon_sync prefix). This avoids that
+ // we end up losing the monmaps from the store.
+ sync_store_init();
+
// clear the underlying store, since we are starting a whole
// sync process from the bare beginning.
set<string> targets = get_sync_targets_names();
- targets.insert("mon_sync");
store->clear(targets);
- sync_store_init();
-
// assume 'other' as the leader. We will update the leader once we receive
// a reply to the sync start.
entity_inst_t leader = other;