Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-4307 Inconsistent parameters between console producer and consumer #2161

Closed
wants to merge 9 commits into from

Conversation

baluchicken
Copy link
Contributor

@gwenshap please review

@ijuma
Copy link
Contributor

ijuma commented Nov 24, 2016

Thanks for the PR. A few comments:

  1. We need to maintain compatibility, so the older parameter should be supported but deprecated.
  2. It would be great to do the same change for any other class that uses --broker-list (VerifiableConsumer, VerifiableProducer, etc.)
  3. It would be good to update the documentation and system tests to use bootstrap-server.

@baluchicken
Copy link
Contributor Author

Thanks for the review, I will start to work on the suggested modifications. I will update this pull request soon.

@baluchicken
Copy link
Contributor Author

@ijuma I updated the pull request, with the suggested modifications. I forgot to update the documentation but I will do that maybe this weekend or in the beginning of the next one. Also there are couple of files where I don't know how to proceed.
These files are: GetOffsetshell, ReplicaVerificationTool, SimpleConsumerShell, Consumer Performance, VerifiableLog4jAppender. One of those are refactored to use broker-list instead of zookeeper, others are still using the old implementation as far as I can tell because the metadata.broker.list property is in use.

@baluchicken
Copy link
Contributor Author

Updated the pull request with the documentation, and I also fixed the stylecheck errors.

Copy link
Contributor

@ijuma ijuma 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. Left a couple of comments. Also, it would be good to rebase the branch.

.withRequiredArg
.describedAs("broker-list")
.ofType(classOf[String])
val bootstrapServerListOpt = parser.accepts("bootstrap-server", "REQUIRED (unless old producer is used): The bootstrap server list string in the form HOST1:PORT1,HOST2:PORT2.")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this. bootstrap-server and broker-list should be equivalent. The user should provide exactly one of the two. And it can be used with both old and new producers. bootstrap-server is recommended going forward for consistency with the console consumer. I think you did it right for the VerifiableConsumer, for example.

Also, we can call the val simply bootstrapServerOpt.

.action(store())
.type(String.class)
.metavar("HOST1:PORT1[,HOST2:PORT2[...]]")
.dest("bootstrapServerList")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd call this just bootstrapServer. Similarly elsewhere.

@baluchicken
Copy link
Contributor Author

@ijuma Updated the PR with the suggested changes.

@asfbot
Copy link

asfbot commented Jan 5, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/531/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Jan 5, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/529/
Test PASSed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Jan 5, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/530/
Test PASSed (JDK 8 and Scala 2.12).


val useOldProducer = options.has(useOldProducerOpt)
val topic = options.valueOf(topicOpt)
val bootstrapServer = options.valueOf(bootstrapServerOpt)
Copy link
Contributor

@ijuma ijuma Jan 6, 2017

Choose a reason for hiding this comment

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

The general pattern over all files should be that bootstrapServer has the value of bootstrapServerOpt or brokerListOpt. Since we validate that only one of them can be set, this is OK. If we do it that way, we don't have to check two fields everywhere (or worse forget to check one of them like it seems to be happening here in getNewProducerProps).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh sorry, yeah you are right. I have one question, why can the user use the old-producer with the bootstrap-server? The broker-list and the bootstrap-server uses different properties "metadata.broker.list" vs "bootstrap.servers".

Copy link
Contributor

Choose a reason for hiding this comment

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

It's to make it easier for users. They don't have to switch the CLI param to switch between new/old producer. After all broker-list is not the same as metadata.broker.list either.

@baluchicken
Copy link
Contributor Author

@ijuma thanks for the review. Updated the pull request as you suggested.

@asfbot
Copy link

asfbot commented Jan 11, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/739/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Jan 11, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/737/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link

asfbot commented Jan 11, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/737/
Test FAILed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Jan 12, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/784/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Jan 12, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/782/
Test FAILed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Jan 12, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/782/
Test FAILed (JDK 8 and Scala 2.12).

Copy link
Contributor

@ijuma ijuma 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 update, left one comment.


val useOldProducer = options.has(useOldProducerOpt)
val bootstrapServer = List(bootstrapServerOpt, brokerListOpt).flatMap(x => Option(options.valueOf(x))).head
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be done after we validate arguments. Otherwise, we can get a NoSuchElementException if neither bootstrap-server or broker-list is passed by the user. Same for other classes. Worth adding a test for this.

@baluchicken
Copy link
Contributor Author

@ijuma thanks for the review, updated the files.

@asfbot
Copy link

asfbot commented Jan 23, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/1117/
Test FAILed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Jan 23, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/1115/
Test FAILed (JDK 8 and Scala 2.12).

@asfbot
Copy link

asfbot commented Jan 23, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/1115/
Test PASSed (JDK 7 and Scala 2.10).

@ijuma
Copy link
Contributor

ijuma commented Jan 27, 2017

@ewencp, do you think it's OK to include this in 0.10.2? It technically adds a command-line parameters to some tools, but that parameter already exists in a number of tools, it's just making them consistent.

@ewencp
Copy link
Contributor

ewencp commented Jan 27, 2017

@ijuma I think it's fine as long as we're confident we didn't break compatibility anywhere.

@baluchicken
Copy link
Contributor Author

Resolved the conflicts, made some modifications on testBrokerListAndBootstrapServerOptionMissing

@asfbot
Copy link

asfbot commented Apr 12, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.11/2909/
Test PASSed (JDK 8 and Scala 2.11).

@asfbot
Copy link

asfbot commented Apr 12, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.10/2904/
Test PASSed (JDK 7 and Scala 2.10).

@asfbot
Copy link

asfbot commented Apr 12, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/2905/
Test PASSed (JDK 8 and Scala 2.12).

@baluchicken
Copy link
Contributor Author

@gwenshap if you have time can you please take a look? Thanks.

@asfbot
Copy link

asfbot commented Jun 2, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/4781/
Test PASSed (JDK 8 and Scala 2.12).

@asfbot
Copy link

asfbot commented Jun 2, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/4797/
Test PASSed (JDK 7 and Scala 2.11).

@ijuma
Copy link
Contributor

ijuma commented Aug 4, 2017

Sorry for the delay. Can you please resolve the conflicts so that I can hopefully take a final look and we can finally merge this.

@baluchicken
Copy link
Contributor Author

No worries:). I resolved the conflicts and extended the stream docs.

@asfgit
Copy link

asfgit commented Aug 4, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/6575/
Test PASSed (JDK 7 and Scala 2.11).

@baluchicken
Copy link
Contributor Author

Resolved the conflicts. @ijuma if you have time can you please review?

@asfgit
Copy link

asfgit commented Aug 8, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/6635/
Test PASSed (JDK 7 and Scala 2.11).

@asfgit
Copy link

asfgit commented Aug 8, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/6620/
Test PASSed (JDK 8 and Scala 2.12).

@ijuma
Copy link
Contributor

ijuma commented Aug 8, 2017

Yes, I started looking into this. I think there may be scope for some sharing of code. I'll share a sketch tomorrow.

@asfgit
Copy link

asfgit commented Aug 15, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk7-scala2.11/6776/
Test PASSed (JDK 7 and Scala 2.11).

@asfgit
Copy link

asfgit commented Aug 15, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/6761/
Test PASSed (JDK 8 and Scala 2.12).

@mimaison
Copy link
Member

I believe this has been addressed by KIP-499, so closing this PR.

@mimaison mimaison closed this Feb 10, 2022
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.

8 participants