chia7712 commented on code in PR #20205:
URL: https://github.com/apache/kafka/pull/20205#discussion_r2223634384


##########
storage/src/main/java/org/apache/kafka/server/log/remote/storage/RemoteLogManager.java:
##########
@@ -1639,20 +1639,20 @@ static boolean 
isRemoteSegmentWithinLeaderEpochs(RemoteLogSegmentMetadata segmen
      */
     // Visible for testing
     static NavigableMap<Integer, Long> 
buildFilteredLeaderEpochMap(NavigableMap<Integer, Long> leaderEpochs) {
-        List<Integer> epochsWithNoMessages = new ArrayList<>();
+        if (leaderEpochs.size() <= 1) return leaderEpochs;

Review Comment:
   Is this early return necessary?



##########
storage/src/test/java/org/apache/kafka/server/log/remote/storage/RemoteLogManagerTest.java:
##########
@@ -1847,6 +1847,18 @@ public void testBuildFilteredLeaderEpochMap() {
 
         NavigableMap<Integer, Long> refinedLeaderEpochMap = 
RemoteLogManager.buildFilteredLeaderEpochMap(leaderEpochToStartOffset);
         assertEquals(expectedLeaderEpochs, refinedLeaderEpochMap);
+
+
+        TreeMap<Integer, Long> leaderEpochToStartOffset2 = new TreeMap<>();

Review Comment:
   It would be useful to have a unit test to loop over 1000 times, using random 
input to ensure before/after methods have same output.



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