]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: tell MonmapMonitor first about winning an election
authorSage Weil <sage@inktank.com>
Fri, 14 Feb 2014 19:25:52 +0000 (11:25 -0800)
committerJoao Eduardo Luis <jecluis@gmail.com>
Mon, 17 Mar 2014 15:43:52 +0000 (15:43 +0000)
It is important in the bootstrap case that the very first paxos round
also codify the contents of the monmap itself in order to avoid any manner
of confusing scenarios where subsequent elections are called and people
try to recover and modify paxos without agreeing on who the quorum
participants are.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit ad7f5dd481a7f45dfe6b50d27ad45abc40950510)
(cherry picked from commit e073a062d56099b5fb4311be2a418f7570e1ffd9)

src/mon/Monitor.cc

index 2f94837e23f74ed884419b4c674cc775a917fa04..25e063fee8638e05cdcfd036ca5ccc7a63294d79 100644 (file)
@@ -1500,8 +1500,17 @@ void Monitor::win_election(epoch_t epoch, set<int>& active, uint64_t features)
                << " won leader election with quorum " << quorum << "\n";
 
   paxos->leader_init();
-  for (vector<PaxosService*>::iterator p = paxos_service.begin(); p != paxos_service.end(); ++p)
-    (*p)->election_finished();
+  // NOTE: tell monmap monitor first.  This is important for the
+  // bootstrap case to ensure that the very first paxos proposal
+  // codifies the monmap.  Otherwise any manner of chaos can ensue
+  // when monitors are call elections or participating in a paxos
+  // round without agreeing on who the participants are.
+  monmon()->election_finished();
+  for (vector<PaxosService*>::iterator p = paxos_service.begin();
+       p != paxos_service.end(); ++p) {
+    if (*p != monmon())
+      (*p)->election_finished();
+  }
   health_monitor->start(epoch);
 
   finish_election();