Skip to content

KAFKA-12597: remove deprecated zookeeper option in ReassignPartitionsCommand#10471

Merged
ijuma merged 8 commits into
apache:trunkfrom
showuon:KAFKA-12597
Jun 4, 2021
Merged

KAFKA-12597: remove deprecated zookeeper option in ReassignPartitionsCommand#10471
ijuma merged 8 commits into
apache:trunkfrom
showuon:KAFKA-12597

Conversation

@showuon

@showuon showuon commented Apr 4, 2021

Copy link
Copy Markdown
Member

remove deprecated --zookeeper option in ReassignPartitionsCommand. And also the zookeeper dependent methods, and the tests.

Committer Checklist (excluded from commit message)

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

.withRequiredArg
.describedAs("Server(s) to use for bootstrapping")
.ofType(classOf[String])
.required()

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 bootstrapServerOpt as required

@showuon

showuon commented Apr 4, 2021

Copy link
Copy Markdown
Member Author

@ijuma , could you help review this PR? Thanks.

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

Thanks for the PR. A few comments below.

var failed = true

val props = if (opts.options.has(opts.commandConfigOpt))
Utils.loadProps(opts.options.valueOf(opts.commandConfigOpt))

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.

Why was this moved outside the try?

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.

Good question. The lines I moved out of try block are props setup (which is safe), and Admin.create. I was trying to do try-with-resource in scala, but it can't. I moved the Admin.create back to try block. Thank you.

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.

Why is props setup safe? It could fail to load the fail, etc.

println(Utils.stackTrace(e))
} finally {
// Close the AdminClient or ZooKeeper client, as appropriate.
// Close the AdminClient, as appropriate.

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 comment is redundant IMO

@@ -1695,14 +1367,12 @@ object ReassignPartitionsCommand extends Logging {
opts.bootstrapServerOpt,

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.

Do we need to pass bootstrapServerOpt here and the lines below?

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.

Yes, if bootstrapServerOpt is not in the permitted arg list, the check will fail since bootstrapServerOpt is not permitted option for this action.

def shouldPrintHelpTextIfHelpArg(): Unit = {
val args: Array[String]= Array(
"--help",
"--bootstrap-server", "localhost:1234")

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.

Hmm, we should not require this line to see the help text.

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.

Well, I agree. Making the --bootstrap-server as required argument caused this side effect. I think we should keep the --bootstrap-server as non-required, and do the argument check by ourselves. I'll update it, and also the other PR: #10457 on the ConfigCommand tomorrow. Thank you.

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.

Makes sense.

@showuon showuon force-pushed the KAFKA-12597 branch 3 times, most recently from c3666e7 to b95c713 Compare April 7, 2021 09:34
@showuon

showuon commented Apr 7, 2021

Copy link
Copy Markdown
Member Author

@ijuma , thanks for the comments. I've updated with:

  1. move Admin.create into try block
  2. check --bootstrap-server option manually, so that help text can be displayed when no option provided.

Thanks.

@showuon

showuon commented Apr 16, 2021

Copy link
Copy Markdown
Member Author

@ijuma , could you please help review the PR? Thank you.
The failed tests are all un-related.


    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationSSLTest.testOneWayReplicationWithAutoOffsetSync()
    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationTest.testReplicationWithEmptyPartition()
    Build / JDK 11 and Scala 2.13 / kafka.controller.ControllerIntegrationTest.testPartitionReassignmentToBrokerWithOfflineLogDir()
    Build / JDK 11 and Scala 2.13 / kafka.server.RaftClusterTest.testCreateClusterAndCreateAndManyTopics()
    Build / JDK 11 and Scala 2.13 / kafka.server.RaftClusterTest.testCreateClusterAndCreateAndManyTopics()
    Build / JDK 15 and Scala 2.13 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationSSLTest.testOneWayReplicationWithAutoOffsetSync()
    Build / JDK 15 and Scala 2.13 / kafka.log.LogCleanerIntegrationTest.testMarksPartitionsAsOfflineAndPopulatesUncleanableMetrics()
    Build / JDK 15 and Scala 2.13 / kafka.network.SocketServerTest.testUnmuteChannelWithBufferedReceives()
    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationSSLTest.testReplication()
    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationSSLTest.testReplication()
    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationTest.testOneWayReplicationWithAutoOffsetSync()
    Build / JDK 11 and Scala 2.13 / org.apache.kafka.connect.mirror.integration.MirrorConnectorsIntegrationTest.testOneWayReplicationWithAutoOffsetSync

@showuon

showuon commented May 18, 2021

Copy link
Copy Markdown
Member Author

@ijuma , could you take a look again for this PR? Thanks.

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

Thanks for the updates, a couple of comments.

var failed = true

val props = if (opts.options.has(opts.commandConfigOpt))
Utils.loadProps(opts.options.valueOf(opts.commandConfigOpt))

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.

Why is props setup safe? It could fail to load the fail, etc.

shouldFailWith("You must specify --bootstrap-server when using \"[command-config]\"", args)
def shouldPrintHelpTextIfHelpArg(): Unit = {
val args: Array[String]= Array("--help")
shouldFailWith(ReassignPartitionsCommand.helpText, args)

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.

Should this actually fail? It seems that it should succeed, right?

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.

Yes, it should not fail actually. But we share the same printUsageAndDie method with other wrong argument cases, so it indeed fail in the logic. I think it's OK since user won't feel it's a failed run anyway. I'll add a comment here. Thanks.

ref: https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/utils/CommandLineUtils.scala#L57

@showuon

showuon commented May 20, 2021

Copy link
Copy Markdown
Member Author

@ijuma , thanks for the comments. I've updated. Please take a look again. Thank you.

@showuon

showuon commented Jun 1, 2021

Copy link
Copy Markdown
Member Author

@ijuma , could you help check this PR again? Thanks.

@showuon

showuon commented Jun 1, 2021

Copy link
Copy Markdown
Member Author

Failed tests are flaky RaftClusterTest tests. Thanks.

    Build / JDK 15 and Scala 2.13 / kafka.server.RaftClusterTest.testCreateClusterAndCreateAndManyTopics()
    Build / JDK 15 and Scala 2.13 / kafka.server.RaftClusterTest.testCreateClusterAndCreateListDeleteTopic()

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

Thanks for the PR. I left a couple of comments below. In addition, we should add a note to upgrade.html for this removal as well as the topic command one.

PartitionReassignmentState(Seq(3, 2, 0), Seq(3, 2, 0), true)
)

// When using --zookeeper, we aren't able to see the new-style assignment

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 we are removing this comment, should we be using new style assignment?

@showuon showuon Jun 3, 2021

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.

This comment is kind of weird here, but as here mentioned:

Warning: because you are using the deprecated --zookeeper option, the results may be incomplete. Use --bootstrap-server instead for more accurate results.

So, I added one more verification here due to we change to adminClient now. The most important finalAssignment is already verified.
Thank you.

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.

Yeah, I don't know what it means by new-style assignment either.

@showuon

showuon commented Jun 3, 2021

Copy link
Copy Markdown
Member Author

@ijuma , thanks for your comments. I've addressed them and add a note in upgrade.html in this commit: 9215777. For the system tests, I've created another jira ticket to track it: KAFKA-12884. Thank you.

@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, just one nit below.

Comment thread docs/upgrade.html Outdated
<li>The <code>Admin.electedPreferredLeaders()</code> methods were removed. Please use <code>Admin.electLeaders</code> instead.</li>
<li>The <code>kafka-preferred-replica-election</code> command line tool was removed. Please use <code>kafka-leader-election</code> instead.</li>
<li>The <code>--zookeeper</code> option was removed from the <code>bin/kafka-topics.sh</code> command line tool. Please use <code>--bootstrap-server</code> instead.</li>
<li>The <code>--zookeeper</code> option was removed from the <code>bin/kafka-topics.sh</code> and <code>bin/kafka-reassign-partitions.sh</code> command line tool.

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 line tool" -> "command line tools"

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.

Updated. Thanks.

PartitionReassignmentState(Seq(3, 2, 0), Seq(3, 2, 0), true)
)

// When using --zookeeper, we aren't able to see the new-style assignment

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.

Yeah, I don't know what it means by new-style assignment either.

@ijuma

ijuma commented Jun 4, 2021

Copy link
Copy Markdown
Member

Unrelated test failures:

Build / JDK 11 and Scala 2.13 / kafka.server.RaftClusterTest.testCreateClusterAndCreateListDeleteTopic()
Build / JDK 11 and Scala 2.13 / kafka.server.RaftClusterTest.testCreateClusterAndCreateListDeleteTopic()
Build / JDK 8 and Scala 2.12 / kafka.server.RaftClusterTest.testCreateClusterAndCreateAndManyTopicsWithManyPartitions()

@ijuma ijuma merged commit ccde334 into apache:trunk Jun 4, 2021
@showuon

showuon commented Jun 4, 2021

Copy link
Copy Markdown
Member Author

Thanks @ijuma , I should have listed all failed tests and verify they are all un-related failure to reduce your review task. Thank you. :)

ijuma pushed a commit that referenced this pull request Aug 23, 2021
…nmentWithAlterIsrDisabled (#11244)

Removes assertion added in #10471. It's unsafe to assert that
there are partition movements ongoing for some of the tests in
the suite because partitions in some of the tests have 0 data,
which may complete reassignment before `verify` can run.

Tests pass locally.

Reviewers: Luke Chen <showuon@gmail.com>, Ismael Juma <ismael@juma.me.uk>
ijuma pushed a commit that referenced this pull request Aug 23, 2021
…nmentWithAlterIsrDisabled (#11244)

Removes assertion added in #10471. It's unsafe to assert that
there are partition movements ongoing for some of the tests in
the suite because partitions in some of the tests have 0 data,
which may complete reassignment before `verify` can run.

Tests pass locally.

Reviewers: Luke Chen <showuon@gmail.com>, Ismael Juma <ismael@juma.me.uk>
xdgrulez pushed a commit to xdgrulez/kafka that referenced this pull request Dec 22, 2021
…nmentWithAlterIsrDisabled (apache#11244)

Removes assertion added in apache#10471. It's unsafe to assert that
there are partition movements ongoing for some of the tests in
the suite because partitions in some of the tests have 0 data,
which may complete reassignment before `verify` can run.

Tests pass locally.

Reviewers: Luke Chen <showuon@gmail.com>, 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.

2 participants