Skip to content

Commit 34eb71b

Browse files
committed
Move assertion
1 parent b7a5328 commit 34eb71b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/src/main/java/org/elasticsearch/cluster/coordination/Coordinator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,10 @@ public void invariant() {
446446
= currentPublication.map(Publication::publishedState).orElse(coordinationState.get().getLastAcceptedState());
447447
lastPublishedState.nodes().forEach(lastPublishedNodes::add);
448448
assert lastPublishedNodes.remove(getLocalNode());
449+
assert lastPublishedNodes.equals(knownFollowers) : lastPublishedNodes + " != " + knownFollowers
450+
+ " [becomingMaster=" + becomingMaster + ", publicationInProgress=" + publicationInProgress() + "]";
451+
// TODO instead assert that knownFollowers is updated appropriately at the end of each publication
449452
}
450-
assert lastPublishedNodes.equals(knownFollowers) : lastPublishedNodes + " != " + knownFollowers
451-
+ " [becomingMaster=" + becomingMaster + ", publicationInProgress=" + publicationInProgress() + "]";
452453
} else if (mode == Mode.FOLLOWER) {
453454
assert coordinationState.get().electionWon() == false : getLocalNode() + " is FOLLOWER so electionWon() should be false";
454455
assert lastKnownLeader.isPresent() && (lastKnownLeader.get().equals(getLocalNode()) == false);

0 commit comments

Comments
 (0)