logic.receive_ack(from, m->epoch);
}
+bool ElectionLogic::receive_victory_claim(int from, epoch_t from_epoch)
+{
+ ceph_assert(from < elector_my_rank());
+ ceph_assert(from_epoch % 2 == 0);
+
+ leader_acked = -1;
+
+ // i should have seen this election if i'm getting the victory.
+ if (from_epoch != epoch + 1) {
+ dout(5) << "woah, that's a funny epoch, i must have rebooted. bumping and re-starting!" << dendl;
+ bump_epoch(from_epoch);
+ start();
+ return false;
+ }
+
+ bump_epoch(from_epoch);
+
+ // they win
+ return true;
+}
void Elector::handle_victory(MonOpRequestRef op)
{
<< dendl;
int from = m->get_source().num();
- ceph_assert(from < mon->rank);
- ceph_assert(m->epoch % 2 == 0);
-
- logic.leader_acked = -1;
+ bool accept_victory = logic.receive_victory_claim(from, m->epoch);
- // i should have seen this election if i'm getting the victory.
- if (m->epoch != logic.epoch + 1) {
- dout(5) << "woah, that's a funny epoch, i must have rebooted. bumping and re-starting!" << dendl;
- logic.bump_epoch(m->epoch);
- logic.start();
+ if (!accept_victory) {
return;
}
- logic.bump_epoch(m->epoch);
-
- // they win
mon->lose_election(logic.epoch, m->quorum, from,
m->quorum_features, m->mon_features, m->mon_release);
void end_election_period();
void handle_propose_logic(epoch_t mepoch, int from);
void receive_ack(int from, epoch_t from_epoch);
+ bool receive_victory_claim(int from, epoch_t from_epoch);
void declare_victory();