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 84fee3399ed KAFKA-17087 Deprecate `delete-config` of TopicCommand
(#17222)
84fee3399ed is described below
commit 84fee3399edee0e2940d20315f7e45acda747f48
Author: TengYao Chi <[email protected]>
AuthorDate: Thu Sep 26 03:37:10 2024 +0800
KAFKA-17087 Deprecate `delete-config` of TopicCommand (#17222)
Reviewers: Apoorv Mittal <[email protected]>, Chia-Ping Tsai
<[email protected]>
---
docs/upgrade.html | 3 +++
tools/src/main/java/org/apache/kafka/tools/TopicCommand.java | 12 +++++++++---
.../test/java/org/apache/kafka/tools/TopicCommandTest.java | 3 ---
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/docs/upgrade.html b/docs/upgrade.html
index 5c0f8b8ec16..f005e419a69 100644
--- a/docs/upgrade.html
+++ b/docs/upgrade.html
@@ -55,6 +55,9 @@
The <code>--whitelist</code> and <code>--blacklist</code>
options were removed from the
<code>org.apache.kafka.connect.transforms.ReplaceField</code>.
Please use <code>--include</code> and <code>--exclude</code>
instead.
</li>
+ <li>
+ The <code>--delete-config</code> option in the
<code>kafka-topics</code> command line tool has been deprecated.
+ </li>
<li>
The <code>metrics.jmx.blacklist</code> was removed from the
<code>org.apache.kafka.common.metrics.JmxReporter</code>
Please use <code>metrics.jmx.exclude</code> instead.
diff --git a/tools/src/main/java/org/apache/kafka/tools/TopicCommand.java
b/tools/src/main/java/org/apache/kafka/tools/TopicCommand.java
index b538a33888d..ca6a295febe 100644
--- a/tools/src/main/java/org/apache/kafka/tools/TopicCommand.java
+++ b/tools/src/main/java/org/apache/kafka/tools/TopicCommand.java
@@ -713,6 +713,10 @@ public abstract class TopicCommand {
private final ArgumentAcceptingOptionSpec<String> configOpt;
+ /**
+ * @deprecated since 4.0 and should not be used any longer.
+ */
+ @Deprecated
private final ArgumentAcceptingOptionSpec<String> deleteConfigOpt;
private final ArgumentAcceptingOptionSpec<Integer> partitionsOpt;
@@ -782,7 +786,7 @@ public abstract class TopicCommand {
.describedAs("name=value")
.ofType(String.class);
- deleteConfigOpt = parser.accepts("delete-config", "This option is
no longer supported.")
+ deleteConfigOpt = parser.accepts("delete-config", "This option is
no longer supported and has been deprecated since 4.0")
.withRequiredArg()
.describedAs("name")
.ofType(String.class);
@@ -962,6 +966,10 @@ public abstract class TopicCommand {
if (actions != 1)
CommandLineUtils.printUsageAndExit(parser, "Command must
include exactly one action: --list, --describe, --create, --alter or --delete");
+ if (has(deleteConfigOpt)) {
+ System.err.println("delete-config option is no longer
supported and deprecated since version 4.0. The config will be fully removed in
future releases.");
+ }
+
checkRequiredArgs();
checkInvalidArgs();
}
@@ -989,8 +997,6 @@ public abstract class TopicCommand {
private void checkInvalidArgs() {
// check invalid args
CommandLineUtils.checkInvalidArgs(parser, options, configOpt,
invalidOptions(Arrays.asList(alterOpt, createOpt)));
- CommandLineUtils.checkInvalidArgs(parser, options, deleteConfigOpt,
- invalidOptions(new
HashSet<>(Arrays.asList(bootstrapServerOpt)), Arrays.asList(alterOpt)));
CommandLineUtils.checkInvalidArgs(parser, options, partitionsOpt,
invalidOptions(Arrays.asList(alterOpt, createOpt)));
CommandLineUtils.checkInvalidArgs(parser, options,
replicationFactorOpt, invalidOptions(Arrays.asList(createOpt)));
CommandLineUtils.checkInvalidArgs(parser, options,
replicaAssignmentOpt, invalidOptions(Arrays.asList(alterOpt, createOpt)));
diff --git a/tools/src/test/java/org/apache/kafka/tools/TopicCommandTest.java
b/tools/src/test/java/org/apache/kafka/tools/TopicCommandTest.java
index 6a668a73f41..4a2b93d2dbc 100644
--- a/tools/src/test/java/org/apache/kafka/tools/TopicCommandTest.java
+++ b/tools/src/test/java/org/apache/kafka/tools/TopicCommandTest.java
@@ -137,9 +137,6 @@ public class TopicCommandTest {
assertInitializeInvalidOptionsExitCode(1,
new String[] {"--bootstrap-server", bootstrapServer, "--alter",
"--topic", topicName,
"--partitions", "3", "--config", "cleanup.policy=compact"});
- assertInitializeInvalidOptionsExitCode(1,
- new String[] {"--bootstrap-server", bootstrapServer, "--alter",
"--topic", topicName,
- "--partitions", "3", "--delete-config", "cleanup.policy"});
TopicCommand.TopicCommandOptions opts =
new TopicCommand.TopicCommandOptions(
new String[] {"--bootstrap-server", bootstrapServer,
"--create", "--topic", topicName, "--partitions", "3",