Skip to content

KAFKA-13396: allow create topic without partition/replicaFactor#11429

Merged
ijuma merged 1 commit into
apache:trunkfrom
showuon:KAFKA-13396
Nov 4, 2021
Merged

KAFKA-13396: allow create topic without partition/replicaFactor#11429
ijuma merged 1 commit into
apache:trunkfrom
showuon:KAFKA-13396

Conversation

@showuon

@showuon showuon commented Oct 24, 2021

Copy link
Copy Markdown
Member

In https://github.com/apache/kafka/pull/10457/files#r635196307, the reviewer asked if there's a bug that we only check for zookeeper case, I didn't do a well check and directly confirm it. Now, after checking the change history, I found the change is because the KIP-464 (PR: #6728) added default values for partition count and replica factor for createTopic in AdminClient. So it didn't apply for zookeeper option case.

Fix this bug and add tests for the command lines in quick start (i.e. create topic and describe topic), to make sure it won't be broken in the future.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

if (!has(listOpt) && !has(describeOpt))
CommandLineUtils.checkRequiredArgs(parser, options, topicOpt)
if (has(createOpt) && !has(replicaAssignmentOpt))
CommandLineUtils.checkRequiredArgs(parser, options, partitionsOpt, replicationFactorOpt)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

remove them since it is only checked for zookeeper option case before.

Comment on lines +126 to +142
@Test
def testCreateWithoutPartitionCountAndReplicationFactorShouldSucceed(): Unit = {
val opts = new TopicCommandOptions(
Array("--bootstrap-server", brokerList,
"--create",
"--topic", topicName))
opts.checkArgs()
}

@Test
def testDescribeShouldSucceed(): Unit = {
val opts = new TopicCommandOptions(
Array("--bootstrap-server", brokerList,
"--describe",
"--topic", topicName))
opts.checkArgs()
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Make sure the 2 command lines from quick start will pass successfully.

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.

I love this case-by-case approach + it also works like a charm. 😃
20211024-214641

@showuon

showuon commented Oct 24, 2021

Copy link
Copy Markdown
Member Author

@ijuma , please help check this PR when available. Thank you.

@showuon

showuon commented Nov 4, 2021

Copy link
Copy Markdown
Member Author

@ijuma , please help check it when available. This is a regression issue, so I think we should put it v3.1.0. Thank you.

@ijuma

ijuma commented Nov 4, 2021

Copy link
Copy Markdown
Member

@showuon we should have this in 3.0.1 too, right?

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

LGTM, thanks!

@showuon

showuon commented Nov 4, 2021

Copy link
Copy Markdown
Member Author

Yes, cherry-pick back to v3.0.1, too, please. Thank you!

@ijuma ijuma merged commit 43bcc56 into apache:trunk Nov 4, 2021
ijuma pushed a commit that referenced this pull request Nov 4, 2021
[KIP-464](https://cwiki.apache.org/confluence/display/KAFKA/KIP-464%3A+Defaults+for+AdminClient%23createTopic) (PR: #6728)
made it possible to create topics without passing partition count and/or replica factor when using
the admin client. We incorrectly disallowed this via #10457 while
trying to ensure validation was consistent between ZK and the admin client (in this case the
inconsistency was intentional).

Fix this regression and add tests for the command lines in quick start (i.e. create topic and describe
topic) to make sure it won't be broken in the future.

Reviewers: Lee Dongjin <dongjin@apache.org>, Ismael Juma <ismael@juma.me.uk>
@dajac

dajac commented Nov 4, 2021

Copy link
Copy Markdown
Member

@ijuma Should we pick this one to the 3.1 branch as well?

@ijuma

ijuma commented Nov 4, 2021

Copy link
Copy Markdown
Member

@dajac Makes sense, pushed to trunk, 3.1 and 3.0.

ijuma pushed a commit that referenced this pull request Nov 4, 2021
[KIP-464](https://cwiki.apache.org/confluence/display/KAFKA/KIP-464%3A+Defaults+for+AdminClient%23createTopic) (PR: #6728)
made it possible to create topics without passing partition count and/or replica factor when using
the admin client. We incorrectly disallowed this via #10457 while
trying to ensure validation was consistent between ZK and the admin client (in this case the
inconsistency was intentional).

Fix this regression and add tests for the command lines in quick start (i.e. create topic and describe
topic) to make sure it won't be broken in the future.

Reviewers: Lee Dongjin <dongjin@apache.org>, Ismael Juma <ismael@juma.me.uk>
stanislavkozlovski added a commit to stanislavkozlovski/kafka that referenced this pull request Nov 11, 2021
…ntegration-11-nov

* ak/trunk: (15 commits)
  KAFKA-13429: ignore bin on new modules (apache#11415)
  KAFKA-12648: introduce TopologyConfig and TaskConfig for topology-level overrides (apache#11272)
  KAFKA-12487: Add support for cooperative consumer protocol with sink connectors (apache#10563)
  MINOR: Log client disconnect events at INFO level (apache#11449)
  MINOR: Remove topic null check from `TopicIdPartition` and adjust constructor order (apache#11403)
  KAFKA-13417; Ensure dynamic reconfigurations set old config properly (apache#11448)
  MINOR: Adding a constant to denote UNKNOWN leader in LeaderAndEpoch (apache#11477)
  KAFKA-10543: Convert KTable joins to new PAPI (apache#11412)
  KAFKA-12226: Commit source task offsets without blocking on batch delivery (apache#11323)
  KAFKA-13396: Allow create topic without partition/replicaFactor (apache#11429)
  ...
xdgrulez pushed a commit to xdgrulez/kafka that referenced this pull request Dec 22, 2021
…he#11429)

[KIP-464](https://cwiki.apache.org/confluence/display/KAFKA/KIP-464%3A+Defaults+for+AdminClient%23createTopic) (PR: apache#6728)
made it possible to create topics without passing partition count and/or replica factor when using
the admin client. We incorrectly disallowed this via apache#10457 while
trying to ensure validation was consistent between ZK and the admin client (in this case the
inconsistency was intentional).

Fix this regression and add tests for the command lines in quick start (i.e. create topic and describe
topic) to make sure it won't be broken in the future.

Reviewers: Lee Dongjin <dongjin@apache.org>, Ismael Juma <ismael@juma.me.uk>
lmr3796 pushed a commit to lmr3796/kafka that referenced this pull request Jun 2, 2022
…he#11429)

[KIP-464](https://cwiki.apache.org/confluence/display/KAFKA/KIP-464%3A+Defaults+for+AdminClient%23createTopic) (PR: apache#6728)
made it possible to create topics without passing partition count and/or replica factor when using
the admin client. We incorrectly disallowed this via apache#10457 while
trying to ensure validation was consistent between ZK and the admin client (in this case the
inconsistency was intentional).

Fix this regression and add tests for the command lines in quick start (i.e. create topic and describe
topic) to make sure it won't be broken in the future.

Reviewers: Lee Dongjin <dongjin@apache.org>, Ismael Juma <ismael@juma.me.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants