fix: as long as some leader was sending heartbeats we would keep the currentNominee as leader, even if that currentNominee was not the one sending the heartbeats
This commit is contained in:
parent
a71a54647a
commit
4f9dd10644
|
@ -272,7 +272,17 @@ ACTOR Future<Void> leaderRegister(LeaderElectionRegInterface interf, Key key) {
|
|||
nextNominee = Optional<LeaderInfo>();
|
||||
}
|
||||
|
||||
if ( currentNominee.present() != nextNominee.present() || (currentNominee.present() && currentNominee.get().leaderChangeRequired(nextNominee.get())) || !availableLeaders.size() ) {
|
||||
bool foundCurrentNominee = false;
|
||||
if(currentNominee.present()) {
|
||||
for(auto& it : availableLeaders) {
|
||||
if(currentNominee.get().equalInternalId(it)) {
|
||||
foundCurrentNominee = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( currentNominee.present() != nextNominee.present() || (nextNominee.present() && !foundCurrentNominee) || (currentNominee.present() && currentNominee.get().leaderChangeRequired(nextNominee.get())) ) {
|
||||
TraceEvent("NominatingLeader").detail("Nominee", nextNominee.present() ? nextNominee.get().changeID : UID())
|
||||
.detail("Changed", nextNominee != currentNominee).detail("Key", printable(key));
|
||||
for(int i=0; i<notify.size(); i++)
|
||||
|
|
Loading…
Reference in New Issue