KAFKA-12596: remove --zookeeper option from topic command#10457
Conversation
|
@ijuma @tombentley , could you help review this PR? Thanks. |
ijuma
left a comment
There was a problem hiding this comment.
Thanks for the PR. Maybe we can remove the TopicService trait and rename AdminClientTopicService to TopicService? Do we use the trait for anything now that the ZK code was removed?
| "if set when describing topics, only show partitions whose isr count is less than the configured minimum.") | ||
| private val reportAtMinIsrPartitionsOpt = parser.accepts("at-min-isr-partitions", | ||
| "if set when describing topics, only show partitions whose isr count is equal to the configured minimum. Not supported with the --zookeeper option.") | ||
| "if set when describing topics, only show partitions whose isr count is equal to the configured minimum.") |
There was a problem hiding this comment.
We have this line:
// This is not currently used, but we keep it for compatibility
parser.accepts("force", "Suppress console prompts")
Was this deprecated also? Can we remove it?
There was a problem hiding this comment.
I confirmed this issue is fixed in KIP-74 (KAFKA-2063). Yes I'll remove it!. Thank you.
|
|
||
| if (!has(bootstrapServerOpt)) | ||
| CommandLineUtils.checkRequiredArgs(parser, options, zkConnectOpt) | ||
| throw new IllegalArgumentException("--bootstrap-server must be specified") |
There was a problem hiding this comment.
I think you can mark the argument as required to get this behavior automatically.
| if (has(createOpt) && !has(replicaAssignmentOpt) && has(zkConnectOpt)) | ||
| if (has(createOpt) && !has(replicaAssignmentOpt)) | ||
| CommandLineUtils.checkRequiredArgs(parser, options, partitionsOpt, replicationFactorOpt) | ||
| if (has(bootstrapServerOpt) && has(alterOpt)) { |
There was a problem hiding this comment.
We don't need the has(bootstrapServerOpt) check.
| } | ||
|
|
||
| case class AdminClientTopicService private (adminClient: Admin) extends TopicService { | ||
| case class TopicService private (adminClient: Admin) extends AutoCloseable { |
There was a problem hiding this comment.
Rename AdminClientTopicService into TopicService
| } | ||
| } | ||
|
|
||
| trait TopicService extends AutoCloseable { |
There was a problem hiding this comment.
remove TopicService trait since we only have one service now.
| .withRequiredArg | ||
| .describedAs("server to connect to") | ||
| .ofType(classOf[String]) | ||
| .required() |
There was a problem hiding this comment.
Set as required argument.
| def testCreate(): Unit = { | ||
| createAndWaitTopic(new TopicCommandOptions( | ||
| Array("--partitions", "2", "--replication-factor", "1", "--topic", testTopicName))) | ||
| brokerOptions ++ Array("--partitions", "2", "--replication-factor", "1", "--topic", testTopicName))) |
There was a problem hiding this comment.
We didn't checkArgs before, so it's ok to not pass the --bootstrap-server option. Since we make it as required argument now, we need to pass the option explicitly.
|
@ijuma , thanks for the good suggestion. Yes, we don't need the |
| @@ -65,9 +65,10 @@ class TopicCommandWithAdminClientTest extends KafkaServerTestHarness with Loggin | |||
| private val numPartitions = 1 | |||
There was a problem hiding this comment.
We can rename this test to be TopicCommandTest.
There was a problem hiding this comment.
@ijuma , we already have a TopicCommandTest to do Unit test. This TopicCommandWithAdminClientTest is much like an integration test. How about rename to TopicCommandIntegrationTest just like DeleteOffsetsConsumerGroupCommandIntegrationTest in the same folder?
There was a problem hiding this comment.
So, I rename the test to TopicCommandIntegrationTest, and move this test to integration test folder: core/src/test/scala/integration/kafka/admin. Thanks.
There was a problem hiding this comment.
The name sounds good, but I think you don't have to move the test. We rely on tags instead of directory structure for distinguishing test types.
There was a problem hiding this comment.
I see. Moved back now. Thanks.
|
@ijuma , I've updated the PR to check |
|
@ijuma , could you please check this PR? Thank you. |
|
@ijuma , please help review this PR again. Thanks. |
|
failed tests are unrelated and flaky. Thanks. |
| if (!has(listOpt) && !has(describeOpt)) | ||
| CommandLineUtils.checkRequiredArgs(parser, options, topicOpt) | ||
| if (has(createOpt) && !has(replicaAssignmentOpt) && has(zkConnectOpt)) | ||
| if (has(createOpt) && !has(replicaAssignmentOpt)) |
There was a problem hiding this comment.
Was it a bug that we only verified this when zkConnectOpt was set? If so, we should add a unit test for this case.
There was a problem hiding this comment.
Good catch! Added 2 tests: testCreateWithAssignmentAndPartitionCount and testCreateWithAssignmentAndReplicationFactor in TopicCommandTest. Thank you.
ijuma
left a comment
There was a problem hiding this comment.
Thanks for the updates. Just a few comments, I think we're close.
|
@ijuma , Thanks for the comments. I've updated. Please take a look again. Thank you very much. |
|
Failed tests are unrelated and flaky. Thanks. |
|
@ijuma , could you help check this PR again? Thanks. |
|
Unrelated failures:
|
|
After merging, I noticed we are missing a note in upgrade.html. We can fix that as part of #10471. |
|
One more thing, did we check that there are no system tests using the flag we just removed? |
|
Will address the above 2 comments in #10471. Thank you. |
[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>
[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>
[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>
[KIP-464](https://cwiki.apache.org/confluence/display/KAFKA/KIP-464%3A+Defaults+for+AdminClient%23createTopic) (PR: apache/kafka#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/kafka#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>
…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>
…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>
Remove
ZookeeperTopicServiceand the test using zookeeperTopicCommandWithZKClientTestCommitter Checklist (excluded from commit message)