jsancio commented on a change in pull request #10085: URL: https://github.com/apache/kafka/pull/10085#discussion_r610942230
########## File path: raft/src/main/java/org/apache/kafka/raft/ReplicatedCounter.java ########## @@ -68,20 +70,65 @@ public synchronized void increment() { @Override public synchronized void handleCommit(BatchReader<Integer> reader) { try { - int initialValue = this.committed; + int initialValue = committed; while (reader.hasNext()) { BatchReader.Batch<Integer> batch = reader.next(); log.debug("Handle commit of batch with records {} at base offset {}", batch.records(), batch.baseOffset()); for (Integer value : batch.records()) { - if (value != this.committed + 1) { - throw new AssertionError("Expected next committed value to be " + - (this.committed + 1) + ", but instead found " + value + " on node " + nodeId); + if (value != committed + 1) { + throw new AssertionError( + String.format( + "Expected next committed value to be %s, but instead found %s on node %s", + committed + 1, + value, + nodeId + ) + ); } - this.committed = value; + committed = value; } + + nextReadOffset = batch.lastOffset() + 1; Review comment: Yep. Not sure what I was thinking when I added those fields. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org