If we contract to 1 monitor, we win_standalone_election() without bumping
the election epoch. Racing paxos updates can then reach us without being
ignored and trigger an assert:
mon/Paxos.cc: In function 'void Paxos::handle_accept(MMonPaxos*)' thread
7f85eae05700 time 2012-08-20 16:01:00.843937
mon/Paxos.cc: 468: FAILED assert(state == STATE_UPDATING)
Fixes: #3003
Reported-by: John Wilkins <john.wilkins@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
*
* @param e Epoch to which we will update our epoch
*/
- void bump_epoch(epoch_t e=0);
+ void bump_epoch(epoch_t e);
/**
* @defgroup Elector_h_callbacks Callbacks
*/
epoch_t get_epoch() { return epoch; }
+ /**
+ * advance_epoch
+ *
+ * increase election epoch by 1
+ */
+ void advance_epoch() {
+ bump_epoch(epoch + 1);
+ }
+
/**
* Handle received messages.
*
void Monitor::win_standalone_election()
{
dout(1) << "win_standalone_election" << dendl;
+
+ // bump election epoch, in case the previous epoch included other
+ // monitors; we need to be able to make the distinction.
+ elector.advance_epoch();
+
rank = monmap->get_rank(name);
assert(rank == 0);
set<int> q;