]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: fix mon removal check
authorSage Weil <sage@inktank.com>
Wed, 16 May 2012 22:37:34 +0000 (15:37 -0700)
committerSage Weil <sage@inktank.com>
Wed, 16 May 2012 22:37:34 +0000 (15:37 -0700)
Only take our absence from the monmap to mean that we were removed if we
were ever a member in the first places.

This fixes the bootstrap case:

 - create temp_monmap with existing member(s) plus new guy
 - ceph-mon --mkfs --monmap temp_monmap --fsid ...
 - start ceph-mon

Basically, this is just using the seed monmap as a way to tell the new
daemon which ip:port to use.  Specifying mon addr, public network, or
public addr would also work.

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

index 91f65dab3968a83749ebad98f7666dd9b63aed36..4e2deaf774908a84e6d0cd5ca587f1d36335645f 100644 (file)
@@ -400,8 +400,11 @@ void Monitor::bootstrap()
   // note my rank
   int newrank = monmap->get_rank(messenger->get_myaddr());
   if (newrank < 0 && rank >= 0) {
-    dout(0) << " removed from monmap, suicide." << dendl;
-    exit(0);
+    // was i ever part of the quorum?
+    if (store->exists_bl_ss("joined")) {
+      dout(0) << " removed from monmap, suicide." << dendl;
+      exit(0);
+    }
   }
   if (newrank != rank) {
     dout(0) << " my rank is now " << newrank << " (was " << rank << ")" << dendl;
@@ -851,6 +854,9 @@ void Monitor::finish_election()
   resend_routed_requests();
   update_logger();
   register_cluster_logger();
+
+  // make note of the fact that i was, once, part of the quorum.
+  store->put_int(1, "joined");
 }