KAFKA-4457. Add BrokerVersionCommand#2184
Conversation
There was a problem hiding this comment.
This seems non-standard wrt the format of config options. This should probably be - separated words.
There was a problem hiding this comment.
With these tools, should we consider better ways of providing JSON output? In particular, could we possibly provide output that uses Jackson to dump output and only depends on it for tools (i.e. without requiring it for everything in core)?
There was a problem hiding this comment.
That would be nice. Probably means that we'd want the tool to be in Java in the tools subproject. We would then not be able to use AdminClient.scala. Maybe we can do that as a subsequent JIRA as it will be easier once there is a Java AdminClient.
There was a problem hiding this comment.
Working locally with this patch, I'm still getting an error trying to test these new commands. Seems the API versions don't work -- any idea what's going wrong?
java.lang.IllegalStateException: Attempt to send API Versions request to node 0 which is not ready.
at org.apache.kafka.clients.NetworkClient.doSend(NetworkClient.java:309)
at org.apache.kafka.clients.NetworkClient.send(NetworkClient.java:296)
at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.trySend(ConsumerNetworkClient.java:398)
at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:255)
at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:181)
at kafka.admin.AdminClient.kafka$admin$AdminClient$$send(AdminClient.scala:49)
at kafka.admin.AdminClient.getApiVersions(AdminClient.scala:83)
at kafka.admin.AdminClient$$anonfun$listAllBrokerVersionInfo$1.liftedTree2$1(AdminClient.scala:166)
at kafka.admin.AdminClient$$anonfun$listAllBrokerVersionInfo$1.apply(AdminClient.scala:165)
at kafka.admin.AdminClient$$anonfun$listAllBrokerVersionInfo$1.apply(AdminClient.scala:162)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at kafka.admin.AdminClient.listAllBrokerVersionInfo(AdminClient.scala:162)
at kafka.admin.BrokerVersionCommand$.main(BrokerVersionCommand.scala:37)
at kafka.admin.BrokerVersionCommand.main(BrokerVersionCommand.scala)
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
apurvam
left a comment
There was a problem hiding this comment.
Mostly looks fine. But I think the format of the output needs to be improved for it to be useful.
There was a problem hiding this comment.
This output seems a bit illegible. Everything is on a single line:
localhost:9092 (id: 0 rack: null) -> {Produce(0): 0 to 2 [usable: 2], Fetch(1): 0 to 3 [usable: 3], Offsets(2): 0 to 1 [usable: 1], Metadata(3): 0 to 2 [usable: 2], LeaderAndIsr(4): 0 [usable: 0], StopReplica(5): 0 [usable: 0], UpdateMetadata(6): 0 to 2 [usable: 2], ControlledShutdown(7): 1 [usable: 1], OffsetCommit(8): 0 to 2 [usable: 2], OffsetFetch(9): 0 to 1 [usable: 1], GroupCoordinator(10): 0 [usable: 0], JoinGroup(11): 0 to 1 [usable: 1], Heartbeat(12): 0 [usable: 0], LeaveGroup(13): 0 [usable: 0], SyncGroup(14): 0 [usable: 0], DescribeGroups(15): 0 [usable: 0], ListGroups(16): 0 [usable: 0], SaslHandshake(17): 0 [usable: 0], ApiVersions(18): 0 [usable: 0], CreateTopics(19): 0 [usable: 0], DeleteTopics(20): 0 [usable: 0]}
That isn't json, and is not very human readable either. Shall we at least have one line per command?
There was a problem hiding this comment.
OK, we can put each API key on its own line and use some indentation.
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
There was a problem hiding this comment.
so, if the server is down, or if the request times out, we will still get an output with all APIS showing 'Unsupported'. IF we didn't get a response, it might be better to just print the error (timeout, connection refused, etc.), and return.
There was a problem hiding this comment.
Fair enough. Let's use a scala.Try to represent the fact that we might get an exception here.
apurvam
left a comment
There was a problem hiding this comment.
Overall, this looks good to me. I ran the command and the output serves the purpose. The comment I left is a nit, since the actual error messages will be displayed anyway.
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
ijuma
left a comment
There was a problem hiding this comment.
Thanks for the PR. I left a few comments.
There was a problem hiding this comment.
Nit: would it not be better to use \t instead of hardcoded spaces?
There was a problem hiding this comment.
This one is still not using a tab.
There was a problem hiding this comment.
I think we should return a Scala collection like other methods (e.g. listGroups).
There was a problem hiding this comment.
We don't use the RPC terminology in Kafka, so it may confuse people to see this. It would be good to use terminology consistent with how the protocol is described in:
https://kafka.apache.org/protocol
There was a problem hiding this comment.
Hmm. That document makes a lot of references to "API versions," so it seems like we can just say "API versions" here and drop the RPC.
There was a problem hiding this comment.
There is no "Consumer" being used here right?
There was a problem hiding this comment.
Interpolation calls toString by default, so the no-args versions are not needed.
Should we be prefixing v with a blurb stating that there was an error retrieving the data for that broker?
There was a problem hiding this comment.
Ah... yeah, we can drop the .toString from the broker line.
I'll add an ERROR prefix to the Failure line.
There was a problem hiding this comment.
Nit: should be in the previous line.
There was a problem hiding this comment.
Nit: should be in the previous line and case is not needed here (if you're feeling generous, you could fix listAllGroups as well.
There was a problem hiding this comment.
You could replace the try/catch with Try(new NodeApiVersions(getApiVersions(broker))).
There was a problem hiding this comment.
Would it be better to name the shell script kafka-broker-api-versions and the command BrokerApiVersionsCommand? We could then drop the required list-api-versions option. I'm guessing you may have ideas of how to extend the command in the future, maybe you can elaborate on that a little?
There was a problem hiding this comment.
I was thinking that eventually we might want to have a way to request API versions from only specific brokers. We may also want to have a way to pull the version string out of the requests they return. I agree that it's probably safe to drop the requested list-api-versions option. I would rather not add "api" to the name, since there may eventually be more to versioning, such as reading the version string sent over the wire, etc. Thoughts?
There was a problem hiding this comment.
As discussed offline, we don't have a broker string at the moment. It's a bit hard to predict the future, but maybe this command should be a simple one focused on api versions. If we add a more general command later, we can change the shell script to invoke it with the right parameters.
There was a problem hiding this comment.
fair enough. I will change it to kafka-broker-api-versions.sh
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
ijuma
left a comment
There was a problem hiding this comment.
Just a few minor comments and I think we can merge this.
There was a problem hiding this comment.
As discussed offline, we don't have a broker string at the moment. It's a bit hard to predict the future, but maybe this command should be a simple one focused on api versions. If we add a more general command later, we can change the shell script to invoke it with the right parameters.
There was a problem hiding this comment.
This one is still not using a tab.
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
Author: Colin P. Mccabe <cmccabe@confluent.io> Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>, Apurva Mehta <apurva.1618@gmail.com>, Ismael Juma <ismael@juma.me.uk> Closes #2184 from cmccabe/KAFKA-4457 (cherry picked from commit 4a6f2c6) Signed-off-by: Ismael Juma <ismael@juma.me.uk>
|
Refer to this link for build results (access rights to CI server needed): |
Author: Colin P. Mccabe <cmccabe@confluent.io> Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>, Apurva Mehta <apurva.1618@gmail.com>, Ismael Juma <ismael@juma.me.uk> Closes apache#2184 from cmccabe/KAFKA-4457
No description provided.