]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: tolerate stray victory message (restart the election)
authorSage Weil <sage@newdream.net>
Thu, 5 Mar 2009 19:27:41 +0000 (11:27 -0800)
committerSage Weil <sage@newdream.net>
Fri, 6 Mar 2009 00:29:02 +0000 (16:29 -0800)
No need to core dump.

src/mon/Elector.cc

index 75d1c2c4c9d5076b72ac04cf0f51ae38bb02c139..319d94645392e960626475aa528c67ff8b786c17 100644 (file)
@@ -252,7 +252,16 @@ void Elector::handle_victory(MMonElection *m)
 
   assert(from < whoami);
   assert(m->epoch % 2 == 0);  
-  assert(m->epoch == epoch + 1);  // i should have seen this election if i'm getting the victory.
+
+  // i should have seen this election if i'm getting the victory.
+  if (m->epoch != epoch + 1) { 
+    dout(5) << "woah, that's a funny epoch, i must have rebooted.  bumping and re-starting!" << dendl;
+    bump_epoch(m->epoch);
+    mon->call_election();//start();
+    delete m;
+    return;
+  }
+
   bump_epoch(m->epoch);
   
   // they win
@@ -260,6 +269,7 @@ void Elector::handle_victory(MMonElection *m)
   
   // cancel my timer
   cancel_timer();      
+  delete m;
 }