Skip to content

Conversation

AndrewJSchofield
Copy link
Member

@AndrewJSchofield AndrewJSchofield commented Aug 29, 2025

This trivial PR improves the so-called metavariable names in the usage
messages of the verifiable producer/consumer command-line tools. These
are the names of the replacement variables that appear solely in the
usage messages.

Verifiable producer (before):

usage: verifiable-producer [-h] --topic TOPIC
    [--max-messages MAX-MESSAGES] [--throughput THROUGHPUT]
    [--acks ACKS] [--producer.config CONFIG_FILE]
    [--message-create-time CREATETIME] [--value-prefix VALUE-PREFIX]
    [--repeating-keys REPEATING-KEYS] [--command-config CONFIG_FILE]
    --bootstrap-server HOST1:PORT1[,HOST2:PORT2[...]]

(after)

usage: verifiable-producer [-h] --topic TOPIC
    [--max-messages MAX-MESSAGES] [--throughput THROUGHPUT]
    [--acks ACKS] [--producer.config CONFIG-FILE]
    [--message-create-time CREATE-TIME] [--value-prefix VALUE-PREFIX]
    [--repeating-keys REPEATING-KEYS] [--command-config CONFIG-FILE]
    --bootstrap-server HOST1:PORT1[,HOST2:PORT2[...]]

Verifiable consumer (before):

usage: verifiable-consumer [-h] --topic TOPIC
    [--group-protocol GROUP_PROTOCOL]
    [--group-remote-assignor GROUP_REMOTE_ASSIGNOR]
    --group-id GROUP_ID
    [--group-instance-id GROUP_INSTANCE_ID]
    [--max-messages MAX-MESSAGES]
    [--session-timeout TIMEOUT_MS] [--verbose]
    [--enable-autocommit] [--reset-policy RESETPOLICY]
    [--assignment-strategy ASSIGNMENTSTRATEGY]
    [--consumer.config CONFIG_FILE] [--command-config CONFIG_FILE]
    --bootstrap-server HOST1:PORT1[,HOST2:PORT2[...]]

(after)

usage: verifiable-consumer [-h] --topic TOPIC
    [--group-protocol GROUP-PROTOCOL]
    [--group-remote-assignor GROUP-REMOTE-ASSIGNOR]
    --group-id GROUP-ID
    [--group-instance-id GROUP-INSTANCE-ID]
    [--max-messages MAX-MESSAGES]
    [--session-timeout TIMEOUT-MS] [--verbose]
    [--enable-autocommit] [--reset-policy RESET-POLICY]
    [--assignment-strategy ASSIGNMENT-STRATEGY]
    [--consumer.config CONFIG-FILE] [--command-config CONFIG-FILE]
    --bootstrap-server HOST1:PORT1[,HOST2:PORT2[...]]

Verifiable share consumer (before):

usage: verifiable-share-consumer
       [-h] --topic TOPIC --group-id GROUP_ID
       [--max-messages MAX-MESSAGES] [--verbose]
       [--acknowledgement-mode ACKNOWLEDGEMENTMODE]
       [--offset-reset-strategy OFFSETRESETSTRATEGY]
       [--command-config CONFIG_FILE]
       --bootstrap-server HOST1:PORT1[,HOST2:PORT2[...]]

(after):

usage: verifiable-share-consumer
       [-h] --topic TOPIC --group-id GROUP-ID
       [--max-messages MAX-MESSAGES] [--verbose]
       [--acknowledgement-mode ACKNOWLEDGEMENT-MODE]
       [--offset-reset-strategy OFFSET-RESET-STRATEGY]
       [--command-config CONFIG-FILE]
       --bootstrap-server HOST1:PORT1[,HOST2:PORT2[...]]

Reviewers: Kirk True [email protected], Ken Huang
[email protected], Lianet Magrans [email protected]

@Yunyung
Copy link
Collaborator

Yunyung commented Aug 29, 2025

LGTM. I see the same situation in Agent.java, Coordinator.java, MessageGenerator.java, etc., but it's outside the scope of this KIP. We can improve it in another PR.

Copy link
Collaborator

@m1a2st m1a2st left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM

Copy link
Contributor

@kirktrue kirktrue left a 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 @AndrewJSchofield! I like the switch to dash vs. underscore for readability, though it's subjective.

Are we sticking with the term "messages" over "records?" I'm sure I'm getting mixed up, but I thought there was an effort to switch the tools over to using records.

Thanks!

@AndrewJSchofield
Copy link
Member Author

Thanks for the PR @AndrewJSchofield! I like the switch to dash vs. underscore for readability, though it's subjective.

Are we sticking with the term "messages" over "records?" I'm sure I'm getting mixed up, but I thought there was an effort to switch the tools over to using records.

Thanks!

Thanks @kirktrue. wrt to "messages" vs "records", we prefer "records" in general and are moving in that direction. The verifiable producer/consumer still use "messages" and KIP-1147 didn't include changing those to "records".

Copy link
Member

@lianetm lianetm left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

@AndrewJSchofield AndrewJSchofield merged commit 4b9075b into apache:trunk Sep 3, 2025
28 checks passed
@AndrewJSchofield AndrewJSchofield deleted the KAFKA-19653 branch September 3, 2025 14:38

parser.addArgument("--command-config")
.action(store())
.required(false)
.type(String.class)
.dest("commandConfig")
.metavar("CONFIG_FILE")
.metavar("CONFIG-FILE")
Copy link
Member

Choose a reason for hiding this comment

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

Kafka currently uses two parser libraryies: joptsimple and argparse4j. As a result, not all tools support metavariables. I'm not sure why Kafka relies on both parsers, but it would be beneficial to unify them to ensure a consistent codebase and output message.

@AndrewJSchofield @lianetm @kirktrue @m1a2st WDYT?

Copy link
Collaborator

@Yunyung Yunyung Sep 3, 2025

Choose a reason for hiding this comment

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

Yes, this is a bit annoying. If we have to choose between the two, we should probably use joptsimple everywhere, since most scripts already rely on CommandDefaultOptions, which works well with CommandLineUtils.

Copy link
Member Author

Choose a reason for hiding this comment

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

While I agree in principle, the syntax supported by kafka-producer-perf-test is a bit different. We might accidentally cause existing commands to fail. So, care needed here for sure.

Copy link
Member

Choose a reason for hiding this comment

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

I have opened https://issues.apache.org/jira/browse/KAFKA-19670

Since argparse4j provides more powerful features, we could consider using it for the codebase

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.

6 participants