Skip to content

KAFKA-19625: Consistency of command-line arguments for verifiable producer/consumer#20390

Merged
AndrewJSchofield merged 8 commits into
apache:trunkfrom
JimmyWang6:KAFKA-19625
Aug 27, 2025
Merged

KAFKA-19625: Consistency of command-line arguments for verifiable producer/consumer#20390
AndrewJSchofield merged 8 commits into
apache:trunkfrom
JimmyWang6:KAFKA-19625

Conversation

@JimmyWang6

@JimmyWang6 JimmyWang6 commented Aug 21, 2025

Copy link
Copy Markdown
Contributor

As described in
jira, this PR
implements replace consumer.config and producer.config with
command-config for kafka-verifiable-producer.sh and
kafka-verifiable-consumer.sh.

Reviewers: Andrew Schofield aschofield@confluent.io

@github-actions github-actions Bot added triage PRs from the community tools small Small PRs labels Aug 21, 2025
@AndrewJSchofield
AndrewJSchofield self-requested a review August 25, 2025 10:42
@AndrewJSchofield AndrewJSchofield removed the triage PRs from the community label Aug 25, 2025

@AndrewJSchofield AndrewJSchofield left a comment

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.

Thanks for the PR.

Comment thread tests/kafkatest/services/verifiable_client.py Outdated
Comment thread tests/kafkatest/services/verifiable_client.py Outdated
Comment thread tests/kafkatest/services/verifiable_consumer.py Outdated
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


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.

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

.type(String.class)
.metavar("CONFIG-FILE")
.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..

.type(String.class)
.metavar("CONFIG-FILE")
.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..

Comment thread tools/src/main/java/org/apache/kafka/tools/VerifiableProducer.java Outdated
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.

@AndrewJSchofield AndrewJSchofield left a comment

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.

Thanks for the changes.

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.

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.

@JimmyWang6

Copy link
Copy Markdown
Contributor Author

@AndrewJSchofield Thanks for your comments, I have already fixed them, please take a look.

@AndrewJSchofield AndrewJSchofield left a comment

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.

Thanks for the updates. Just a couple of remaining comments.

.type(String.class)
.metavar("CONFIG-FILE")
.dest("commandConfigFile")
.help("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.

I suggest adding (config options shared with command line parameters will be overridden) to the help string. That's still true.

.type(String.class)
.metavar("CONFIG-FILE")
.dest("commandConfigFile")
.help("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.

And here (config options shared with command line parameters will be overridden).

@AndrewJSchofield
AndrewJSchofield merged commit a931f85 into apache:trunk Aug 27, 2025
21 checks passed

@chia7712 chia7712 left a comment

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.

@JimmyWang6 Could you please file minor patch to fix the broken e2e? we could generate the command line according to the kafka version.

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.

this change could break the compatibility_test_new_broker_test.py, since the VerifiableProducer is running under old kafka.

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.

upgrade_test.py will also fail with these changes.

cc @JimmyWang6

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.

@chia7712 @omkreddy Thanks for this. These tests are an area of the code which I am unfamiliar with. Next time I will be aware.

cmd += " --max-messages %s" % str(self.max_messages)

cmd += " --consumer.config %s" % VerifiableConsumer.CONFIG_FILE
cmd += " --command-config %s" % VerifiableConsumer.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.

this breaks consumer_protocol_migration_test.py

}
if (commandConfigFile != null) {
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)); ?

omkreddy pushed a commit that referenced this pull request Sep 4, 2025
…test.py (#20471)

#20390 Replace the -`-producer.config` for the verifiable producer and
`--consumer.config` option by `--command-config` for the verifiable
consumer. However, for e2e tests targeting older broker versions, the
original configuration should still be used.

Fix the following tests:
`consumer_protocol_migration_test.py`、`compatibility_test_new_broker_test.py`
and `upgrade_test.py`.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Manikumar Reddy <manikumar.reddy@gmail.com>
eduwercamacaro pushed a commit to littlehorse-enterprises/kafka that referenced this pull request Nov 12, 2025
…ducer/consumer (apache#20390)

As described in
[jira](https://issues.apache.org/jira/browse/KAFKA-19625), this PR
implements replace `consumer.config` and `producer.config` with
`command-config` for kafka-verifiable-producer.sh and
kafka-verifiable-consumer.sh.

Reviewers: Andrew Schofield <aschofield@confluent.io>
eduwercamacaro pushed a commit to littlehorse-enterprises/kafka that referenced this pull request Nov 12, 2025
…test.py (apache#20471)

apache#20390 Replace the -`-producer.config` for the verifiable producer and
`--consumer.config` option by `--command-config` for the verifiable
consumer. However, for e2e tests targeting older broker versions, the
original configuration should still be used.

Fix the following tests:
`consumer_protocol_migration_test.py`、`compatibility_test_new_broker_test.py`
and `upgrade_test.py`.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Manikumar Reddy <manikumar.reddy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants