yunchipang commented on code in PR #20372:
URL: https://github.com/apache/kafka/pull/20372#discussion_r2292251480


##########
tools/src/main/java/org/apache/kafka/tools/LogCompactionTester.java:
##########
@@ -430,14 +433,14 @@ record = new ProducerRecord<>(topic,
         }
     }
 
-    private static Path consumeMessages(String brokerUrl, String[] topics) 
throws IOException {
+    private static Path consumeMessages(String brokerUrl, Set<String> topics) 
throws IOException {
 
         Path consumedFilePath = 
Files.createTempFile("kafka-log-cleaner-consumed-", ".txt");
         System.out.println("Logging consumed messages to " + consumedFilePath);
 
         try (Consumer<String, String> consumer = createConsumer(brokerUrl);
              BufferedWriter consumedWriter = 
Files.newBufferedWriter(consumedFilePath, StandardCharsets.UTF_8)) {
-            consumer.subscribe(Arrays.asList(topics));
+            consumer.subscribe(new ArrayList<>(topics));

Review Comment:
   fixed!



##########
tools/src/main/java/org/apache/kafka/tools/LogCompactionTester.java:
##########
@@ -408,8 +410,9 @@ producerProps, new ByteArraySerializer(), new 
ByteArraySerializer())) {
 
             try (BufferedWriter producedWriter = Files.newBufferedWriter(
                     producedFilePath, StandardCharsets.UTF_8)) {
-                for (long i = 0; i < messages * topics.length; i++) {
-                    String topic = topics[(int) (i % topics.length)];
+                String[] topicsArray = topics.toArray(new String[0]);

Review Comment:
   fixed!



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