This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new d02723aab95 MINOR: Add shutdown broker and bootstrap controller for
ConfigCommand (#22134)
d02723aab95 is described below
commit d02723aab95036fdc399bf3bb4c3073671086be0
Author: Ken Huang <[email protected]>
AuthorDate: Wed Apr 29 00:49:48 2026 +0800
MINOR: Add shutdown broker and bootstrap controller for ConfigCommand
(#22134)
FYI: https://github.com/apache/kafka/pull/22104#discussion_r3131634557
Reviewers: Chia-Ping Tsai <[email protected]>
---
.../kafka/tools/ConfigCommandIntegrationTest.java | 43 ++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git
a/tools/src/test/java/org/apache/kafka/tools/ConfigCommandIntegrationTest.java
b/tools/src/test/java/org/apache/kafka/tools/ConfigCommandIntegrationTest.java
index bd8a1e1b2b1..d2c49088f8d 100644
---
a/tools/src/test/java/org/apache/kafka/tools/ConfigCommandIntegrationTest.java
+++
b/tools/src/test/java/org/apache/kafka/tools/ConfigCommandIntegrationTest.java
@@ -644,6 +644,49 @@ public class ConfigCommandIntegrationTest {
}
}
+ @ClusterTest
+ public void
testDeleteNonExistentConfigIsIdempotentWithBootstrapController() throws
Exception {
+ String topicName = "test-delete-nonexistent-topic";
+ try (Admin bootstrapControllerClient = cluster.admin(Map.of(), true);
+ Admin bootstrapServerClient = cluster.admin(Map.of())) {
+ bootstrapServerClient.createTopics(List.of(new NewTopic(topicName,
1, (short) 1))).all().get();
+ ConfigCommand.alterConfig(bootstrapControllerClient, new
ConfigCommand.ConfigCommandOptions(toArray(
+ List.of("--bootstrap-controller",
cluster.bootstrapControllers(),
+ "--entity-type", "topics", "--entity-name", topicName,
+ "--alter", "--delete-config", "non.existent.config"))));
+
+ ConfigCommand.alterConfig(bootstrapControllerClient, new
ConfigCommand.ConfigCommandOptions(toArray(
+ List.of("--bootstrap-controller",
cluster.bootstrapControllers(),
+ "--entity-type", "brokers", "--entity-name",
defaultBrokerId,
+ "--alter", "--delete-config", "non.existent.config"))));
+
+ ConfigCommand.alterConfig(bootstrapControllerClient, new
ConfigCommand.ConfigCommandOptions(toArray(
+ List.of("--bootstrap-controller",
cluster.bootstrapControllers(),
+ "--entity-type", "brokers", "--entity-default",
+ "--alter", "--delete-config", "non.existent.config"))));
+ }
+ }
+
+ @ClusterTest(brokers = 2)
+ public void testAlterBrokerConfigWithOfflineBroker() throws Exception {
+ int offlineBrokerId = cluster.brokerIds().stream()
+ .filter(id -> !cluster.controllerIds().contains(id))
+ .findFirst()
+ .orElseThrow();
+ cluster.shutdownBroker(offlineBrokerId);
+ TestUtils.waitForCondition(
+ () -> !cluster.aliveBrokers().containsKey(offlineBrokerId),
+ "Broker " + offlineBrokerId + " did not shut down in time"
+ );
+
+ try (Admin client = cluster.admin(Map.of(), true)) {
+ ConfigCommand.alterConfig(client, new
ConfigCommand.ConfigCommandOptions(toArray(
+ List.of("--bootstrap-controller",
cluster.bootstrapControllers(),
+ "--entity-type", "brokers", "--entity-name",
String.valueOf(offlineBrokerId),
+ "--alter", "--delete-config", "log.retention.ms"))));
+ }
+ }
+
// Test case from KAFKA-13788
@ClusterTest(serverProperties = {
// Must be at greater than 1MB per cleaner thread, set to 2M+2 so that
we can set 2 cleaner threads.