@@ -729,11 +729,14 @@ class MockPersistedState implements CoordinationState.PersistedState {
729729
730730 final long persistedCurrentTerm ;
731731
732- if ((oldState .getLastAcceptedState ().nodes ().getLocalNode ().isMasterNode () && newLocalNode .isMasterNode ()) == false
732+ if ( // node is master-ineligible either before or after the restart ...
733+ (oldState .getLastAcceptedState ().nodes ().getLocalNode ().isMasterNode () && newLocalNode .isMasterNode ()) == false
734+ // ... and it's accepted some non-initial state so we can roll back ...
733735 && (oldState .getLastAcceptedState ().term () > 0L || oldState .getLastAcceptedState ().version () > 0L )
736+ // ... and we're feeling lucky ...
734737 && randomBoolean ()) {
735738
736- // master-ineligible nodes do not reliably persist the cluster state, so emulate a rollback
739+ // ... then we might not have reliably persisted the cluster state, so emulate a rollback
737740
738741 persistedCurrentTerm = randomLongBetween (0L , oldState .getCurrentTerm ());
739742 final long lastAcceptedTerm = oldState .getLastAcceptedState ().term ();
@@ -750,7 +753,8 @@ && randomBoolean()) {
750753 newLastAcceptedVersion = randomLongBetween (0L ,
751754 newLastAcceptedTerm == lastAcceptedTerm ? lastAcceptedVersion - 1 : Long .MAX_VALUE );
752755 }
753- final VotingConfiguration newVotingConfiguration = new VotingConfiguration (singleton (randomAlphaOfLength (10 )));
756+ final VotingConfiguration newVotingConfiguration
757+ = new VotingConfiguration (randomBoolean () ? emptySet () : singleton (randomAlphaOfLength (10 )));
754758 final long newValue = randomLong ();
755759
756760 logger .trace ("rolling back persisted cluster state on master-ineligible node [{}]: " +
0 commit comments