]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: only include monmap mon's in outside_quorum, new quorum
authorSage Weil <sage@inktank.com>
Thu, 17 May 2012 19:39:11 +0000 (12:39 -0700)
committerSage Weil <sage@inktank.com>
Fri, 18 May 2012 23:23:56 +0000 (16:23 -0700)
Only include mons that are in the monmap in the outside_quorum set, which
we use to determine if we can form a new quorum.

In particular, if we ourselves are not in the monmap, we can't call an
election (that wouldn't include us anyway).

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/Monitor.cc

index 4057172abfbca43e15d09b738c3d32e7d4327f04..995807cbcaea49528632d15a4b4ef301333942f8 100644 (file)
@@ -453,7 +453,8 @@ void Monitor::bootstrap()
   reset_probe_timeout();
 
   // i'm outside the quorum
-  outside_quorum.insert(name);
+  if (monmap->contains(name))
+    outside_quorum.insert(name);
 
   // probe monitors
   dout(10) << "probing other monitors" << dendl;
@@ -655,14 +656,21 @@ void Monitor::handle_probe_reply(MMonProbe *m)
     }
   } else {
     // not part of a quorum
-    outside_quorum.insert(m->name);
+    if (monmap->contains(m->name))
+      outside_quorum.insert(m->name);
+    else
+      dout(10) << " mostly ignoring mon." << m->name << ", not part of monmap" << dendl;
 
     unsigned need = monmap->size() / 2 + 1;
     dout(10) << " outside_quorum now " << outside_quorum << ", need " << need << dendl;
 
     if (outside_quorum.size() >= need) {
-      dout(10) << " that's enough to form a new quorum, calling election" << dendl;
-      start_election();
+      if (outside_quorum.count(name)) {
+       dout(10) << " that's enough to form a new quorum, calling election" << dendl;
+       start_election();
+      } else {
+       dout(10) << " that's enough to form a new quorum, but it does not include me; waiting" << dendl;
+      }
     } else {
       dout(10) << " that's not yet enough for a new quorum, waiting" << dendl;
     }