Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tests/kafkatest/services/verifiable_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
* `--enable-autocommit`
* `--max-messages <n>`
* `--assignment-strategy <s>`
* `--consumer.config <config-file>` - consumer config properties (typically empty)
* `--consumer.config <config-file>` - (DEPRECATED) consumer config properties (typically empty). This option will be removed in a future version. Use --command-config instead.
* `--command.config <config-file>` - consumer config properties
Comment thread
JimmyWang6 marked this conversation as resolved.
Outdated

Environment variables:
* `LOG_DIR` - log output directory. Typically not needed if logs are written to stderr.
Expand All @@ -97,7 +98,8 @@
* `--broker-list <brokers>`
* `--max-messages <n>`
* `--throughput <msgs/s>`
* `--producer.config <config-file>` - producer config properties (typically empty)
* `--producer.config <config-file>` - producer config properties (typically empty). This option will be removed in a future version. Use --command-config instead.
* `--command.config <config-file>` - producer config properties
Comment thread
JimmyWang6 marked this conversation as resolved.
Outdated

Environment variables:
* `LOG_DIR` - log output directory. Typically not needed if logs are written to stderr.
Expand Down
2 changes: 1 addition & 1 deletion tests/kafkatest/services/verifiable_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def start_cmd(self, node):
if self.max_messages > 0:
cmd += " --max-messages %s" % str(self.max_messages)

cmd += " --consumer.config %s" % VerifiableConsumer.CONFIG_FILE
cmd += " --command.config %s" % VerifiableConsumer.CONFIG_FILE
Comment thread
JimmyWang6 marked this conversation as resolved.
Outdated
cmd += " 2>> %s | tee -a %s &" % (VerifiableConsumer.STDOUT_CAPTURE, VerifiableConsumer.STDOUT_CAPTURE)
return cmd

Expand Down
2 changes: 1 addition & 1 deletion tests/kafkatest/services/verifiable_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def start_cmd(self, node, idx):
if self.repeating_keys is not None:
cmd += " --repeating-keys %s " % str(self.repeating_keys)

cmd += " --producer.config %s" % VerifiableProducer.CONFIG_FILE
cmd += " --command.config %s" % VerifiableProducer.CONFIG_FILE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--command-config


cmd += " 2>> %s | tee -a %s &" % (VerifiableProducer.STDOUT_CAPTURE, VerifiableProducer.STDOUT_CAPTURE)
return cmd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,16 @@ private static ArgumentParser argParser() {
.required(false)
.type(String.class)
.metavar("CONFIG_FILE")
.help("Consumer config properties file (config options shared with command line parameters will be overridden).");
.help("(DEPRECATED) Consumer config properties file (config options shared with command line parameters will be overridden)." +
"This option will be removed in a future version. Use --command-config instead.");

parser.addArgument("--command-config")
.action(store())
.required(false)
.type(String.class)
.metavar("CONFIG-FILE")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The names of the metavars use a mixture of - and _ as separators. Please could you choose one or the other (I have a slight preference for -), and then apply to the delinquent arguments.

.dest("commandConfigFile")
.help("Consumer config properties file.");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we are trying in this KIP to get away from specific names for producer/config config, maybe this could be "Config properties file..


return parser;
}
Expand All @@ -622,16 +631,27 @@ public static VerifiableConsumer createFromArgs(ArgumentParser parser, String[]

boolean useAutoCommit = res.getBoolean("useAutoCommit");
String configFile = res.getString("consumer.config");
String commandConfigFile = res.getString("command-config");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you used the destination of commandConfigFile on line 623, I would expect you to refer to the string by that name here, unless I'm missing something.

String brokerHostAndPort = res.getString("bootstrapServer");

Properties consumerProps = new Properties();
if (configFile != null && commandConfigFile != null) {
throw new ArgumentParserException("Options --consumer.config and --command-config are mutually exclusive.", parser);
}
if (configFile != null) {
try {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a deprecation message here like System.out.println("Option --consumer.config has been deprecated and will be removed in a future version. Use --command-config instead.");.

@JimmyWang6 JimmyWang6 Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really sorry—I just woke up, so I made a lot of silly typo errors. :( I’ve already addressed all the comments. Thanks for your review.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, not quite. The deprecation message should be printed if the user specified the old --consumer.config and we'd like to encourage them to use --command-config. So, I think the System.out.println you added ought to be added just after if (configFile != null) on line 642.

consumerProps.putAll(Utils.loadProps(configFile));
} catch (IOException e) {
throw new ArgumentParserException(e.getMessage(), parser);
}
}
if (res.getString(commandConfigFile) != null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you just use if (commandConfigFile != null) here? And also simplify the loadProps line accordingly?

try {
consumerProps.putAll(Utils.loadProps(res.getString(commandConfigFile)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be
consumerProps.putAll(Utils.loadProps(commandConfigFile)); ?

} catch (IOException e) {
throw new ArgumentParserException(e.getMessage(), parser);
}
}

GroupProtocol groupProtocol = GroupProtocol.of(res.getString("groupProtocol"));
consumerProps.put(ConsumerConfig.GROUP_PROTOCOL_CONFIG, groupProtocol.name());
Expand Down
25 changes: 23 additions & 2 deletions tools/src/main/java/org/apache/kafka/tools/VerifiableProducer.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ private static ArgumentParser argParser() {
.required(false)
.type(String.class)
.metavar("CONFIG_FILE")
.help("Producer config properties file.");
.help("(DEPRECATED) Producer config properties file. " +
"This option will be removed in a future version. Use --command-config instead.");

parser.addArgument("--message-create-time")
.action(store())
Expand All @@ -189,6 +190,14 @@ private static ArgumentParser argParser() {
.dest("repeatingKeys")
.help("If specified, each produced record will have a key starting at 0 increment by 1 up to the number specified (exclusive), then the key is set to 0 again");

parser.addArgument("--command-config")
.action(store())
.required(false)
.type(String.class)
.metavar("CONFIG-FILE")
Comment thread
JimmyWang6 marked this conversation as resolved.
.dest("commandConfigFile")
.help("Producer config properties file.");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we are trying in this KIP to get away from specific names for producer/config config, maybe this could be "Config properties file..


return parser;
}

Expand Down Expand Up @@ -217,6 +226,7 @@ public static VerifiableProducer createFromArgs(ArgumentParser parser, String[]
String topic = res.getString("topic");
int throughput = res.getInt("throughput");
String configFile = res.getString("producer.config");
String commandConfigFile = res.getString("commandConfigFile");
Integer valuePrefix = res.getInt("valuePrefix");
Long createTime = res.getLong("createTime");
Integer repeatingKeys = res.getInt("repeatingKeys");
Expand All @@ -240,14 +250,25 @@ public static VerifiableProducer createFromArgs(ArgumentParser parser, String[]
producerProps.put(ProducerConfig.ACKS_CONFIG, Integer.toString(res.getInt("acks")));
// No producer retries
producerProps.put(ProducerConfig.RETRIES_CONFIG, "0");
if (configFile != null && commandConfigFile != null) {
throw new ArgumentParserException("Options --producer.config and --command-config are mutually exclusive.", parser);
}

if (configFile != null) {
System.out.println("Option --producer-config has been deprecated and will be removed in a future version. Use --command-config instead.");
Comment thread
JimmyWang6 marked this conversation as resolved.
Outdated
try {
producerProps.putAll(loadProps(configFile));
} catch (IOException e) {
throw new ArgumentParserException(e.getMessage(), parser);
}
}

if (commandConfigFile != null) {
try {
producerProps.putAll(loadProps(commandConfigFile));
} catch (IOException e) {
throw new ArgumentParserException(e.getMessage(), parser);
}
}
StringSerializer serializer = new StringSerializer();
KafkaProducer<String, String> producer = new KafkaProducer<>(producerProps, serializer, serializer);

Expand Down
Loading