-
Notifications
You must be signed in to change notification settings - Fork 14.6k
MINOR: Change LogCompactionTester topics parameter to Set<String> #20372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
test log
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Some comments left
tools/src/main/java/org/apache/kafka/tools/LogCompactionTester.java
Outdated
Show resolved
Hide resolved
tools/src/main/java/org/apache/kafka/tools/LogCompactionTester.java
Outdated
Show resolved
Hide resolved
Set<String> topics = IntStream.range(0, topicCount) | ||
.mapToObj(i -> "log-cleaner-test-" + testId + "-" + i) | ||
.toArray(String[]::new); | ||
.collect(toCollection(LinkedHashSet::new)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don’t we use a List
? I think a List
is more convenient than a Set
when we need to retrieve elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m1a2st thanks for the review! I totally agree with List
would be more convenient for indexed access, but Set
is preferred here because
- semantic clarity:
topics
represents a collection of unique topic names - duplicate prevention:
Set
protects against duplicate topics by accident
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, e2e test result seems good.
[INFO:2025-08-18 18:18:23,475]: starting test run with session id 2025-08-18--002...
[INFO:2025-08-18 18:18:23,475]: running 1 tests...
[INFO:2025-08-18 18:18:23,475]: Triggering test 1 of 1...
[INFO:2025-08-18 18:18:23,480]: RunnerClient: Loading test {'directory': '/opt/kafka-dev/tests/kafkatest/tests/tools', 'file_name': 'log_compaction_test.py', 'cls_name': 'LogCompactionTest', 'method_name': 'test_log_compaction', 'injected_args': {'metadata_quorum': 'ISOLATED_KRAFT'}}
[INFO:2025-08-18 18:18:23,481]: RunnerClient: kafkatest.tests.tools.log_compaction_test.LogCompactionTest.test_log_compaction.metadata_quorum=ISOLATED_KRAFT: on run 1/1
[INFO:2025-08-18 18:18:23,482]: RunnerClient: kafkatest.tests.tools.log_compaction_test.LogCompactionTest.test_log_compaction.metadata_quorum=ISOLATED_KRAFT: Setting up...
[INFO:2025-08-18 18:18:23,482]: RunnerClient: kafkatest.tests.tools.log_compaction_test.LogCompactionTest.test_log_compaction.metadata_quorum=ISOLATED_KRAFT: Running...
[INFO:2025-08-18 18:19:13,711]: RunnerClient: kafkatest.tests.tools.log_compaction_test.LogCompactionTest.test_log_compaction.metadata_quorum=ISOLATED_KRAFT: Tearing down...
[INFO:2025-08-18 18:19:18,607]: RunnerClient: kafkatest.tests.tools.log_compaction_test.LogCompactionTest.test_log_compaction.metadata_quorum=ISOLATED_KRAFT: PASS
[WARNING - 2025-08-18 18:19:18,607 - runner_client - log - lineno:459]: RunnerClient: kafkatest.tests.tools.log_compaction_test.LogCompactionTest.test_log_compaction.metadata_quorum=ISOLATED_KRAFT: Test requested 4 nodes, used only 3
[WARNING:2025-08-18 18:19:18,607]: RunnerClient: kafkatest.tests.tools.log_compaction_test.LogCompactionTest.test_log_compaction.metadata_quorum=ISOLATED_KRAFT: Test requested 4 nodes, used only 3
[INFO:2025-08-18 18:19:18,608]: RunnerClient: kafkatest.tests.tools.log_compaction_test.LogCompactionTest.test_log_compaction.metadata_quorum=ISOLATED_KRAFT: Data: None
================================================================================
SESSION REPORT (ALL TESTS)
ducktape version: 0.12.0
session_id: 2025-08-18--002
run time: 55.240 seconds
tests run: 1
passed: 1
flaky: 0
failed: 0
ignored: 0
================================================================================
test_id: kafkatest.tests.tools.log_compaction_test.LogCompactionTest.test_log_compaction.metadata_quorum=ISOLATED_KRAFT
status: PASS
run time: 55.126 seconds
--------------------------------------------------------------------------------
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch, LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM
issue: #19905 (comment)
What: Change
String[] topics
toSet<String> topics
throughoutLogCompactionTester
. Why:Set<String>
is more modern and reduces theneed for array-to-collection conversions.
Reviewers: Ken Huang s7133700@gmail.com, TengYao Chi
kitingiao@gmail.com, Jhen-Yung Hsu jhenyunghsu@gmail.com, Lan Ding
isDing_L@163.com, Kuan-Po Tseng brandboat@gmail.com, Chia-Ping
Tsai chia7712@gmail.com