m1a2st commented on code in PR #19284:
URL: https://github.com/apache/kafka/pull/19284#discussion_r2024009549


##########
raft/src/test/java/org/apache/kafka/snapshot/SnapshotWriterReaderTest.java:
##########
@@ -49,7 +48,7 @@
 
 public final class SnapshotWriterReaderTest {
     private final int localId = 0;
-    private final Set<Integer> voters = Collections.singleton(localId);
+    private final Set<Integer> voters = Set.of(localId);
 
     @Test
     public void testSnapshotDelimiters() throws Exception {

Review Comment:
   Could you also check the assertion where the expected position is incorrect 
in L224 and L244?



##########
raft/src/main/java/org/apache/kafka/raft/internals/VoterSetHistory.java:
##########
@@ -142,7 +142,7 @@ public void truncateOldEntries(long startOffset) {
     }
 
     /**

Review Comment:
   Maybe We could also update the `lastVoterSetOffset()` method to 
   ```java
   public OptionalLong lastVoterSetOffset() {
       return votersHistory.lastEntry()
           .map(voterSetEntry -> OptionalLong.of(voterSetEntry.offset()))
           .orElseGet(OptionalLong::empty);
   }
   ```



-- 
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

Reply via email to