ahuang98 commented on code in PR #18987: URL: https://github.com/apache/kafka/pull/18987#discussion_r1975951752
########## raft/src/test/java/org/apache/kafka/raft/RaftEventSimulationTest.java: ########## @@ -1127,14 +1381,83 @@ private MajorityReachedHighWatermark(Cluster cluster) { @Override public void verify() { - cluster.leaderHighWatermark().ifPresent(highWatermark -> { - long numReachedHighWatermark = cluster.nodes.entrySet().stream() - .filter(entry -> cluster.voters.containsKey(entry.getKey())) - .filter(entry -> entry.getValue().log.endOffset().offset() >= highWatermark) - .count(); - assertTrue( - numReachedHighWatermark >= cluster.majoritySize(), - "Insufficient nodes have reached current high watermark"); + if (cluster.withKip853) { + /* + * For clusters running in KIP-853 mode, we check that a majority of at least one of the following + * voter sets has reached the high watermark: + * 1. the leader's voter set at the HWM (i.e. the last committed voter set) + * 2. the leader's lastVoterSet() (which may or may not be committed) + * Note that 1 and 2 can be the same set, but when they are not, lastVoterSet() is uncommitted, + * which follows from the AtMostOneUncommittedVoterSet invariant. Review Comment: I think the below paragraph could simply be replaced with ``` We need to consider both options because it is possible verify is called after the leader's partitionState is updated but not committed yet. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org