KAFKA-14577: Move the scala ConsoleProducer from core to tools module#13214
KAFKA-14577: Move the scala ConsoleProducer from core to tools module#13214Hangleton wants to merge 8 commits intoapache:trunkfrom
Conversation
There was a problem hiding this comment.
I believe the same change needs to be done in bin/windows/kafka-console-producer.bat
33eb0a7 to
635cb58
Compare
There was a problem hiding this comment.
Note that this class is only used by the ConsoleProducer and has one implementation. If no further used is intended, it can be removed.
There was a problem hiding this comment.
This would be a breaking change, because there is an option that allows to provide your own message reader implementation.
There was a problem hiding this comment.
Apologies, that is right. Thanks for correcting. On that note, this interface moved from kafka.common.MessageReader to org.apache.kafka.tools.MessageReader. Any foreign implementation will have to be updated accordingly. What is the convention to follow is in this case - preserve the same package to avoid breaking dependencies or change the package to match the new structure?
There was a problem hiding this comment.
This is tricky. It's not a class from the public API, but it's exposed via the command line and definitely used (search for AvroMessageReader for example). I also found the still open KIP-641 which deals with this interface.
We should have a deprecation period, but at the same time we don't want to depend on core. Given that checkstyle can only handle a single root package, the only solution I see is to create a :tools:deprecated sub-module containing kafka.common.MessageReader, to be removed in Kafka 4.0.
There was a problem hiding this comment.
Agreed on taking an intermediate step to preserve FQN compatibility for the SPI.
There was a problem hiding this comment.
@Hangleton Do you already have a strategy to deal with this? How are you planning to provide a deprecation period? Can we generalize this approach?
There was a problem hiding this comment.
- For
MessageReader: maybe we could provide a depreciation period until Apache Kafka 4.0 by exposing the class defined in KIP-641 and keep the interfacekafka.common.MessageReaderinheriting fromorg.apache.kafka.common.MessageReaderto avoid breaking the implementations above? The classorg.apache.kafka.common.MessageReadercould be put in theclientsmodule (KIP-641 suggests to haveMessageReaderin this module since it is a public interface). - For the JMX Tool: maybe we could keep the existing class with a deprecation warning as you did in PR-13195 and create a shell and bat scripts as the public contract for the new class?
kafka.tools.StateChangeLogMergercould be removed if it isn't used as mentioned in PR-13171.- There is a missing BAT script for
FeatureCommandalthough the shell script is defined. This could be added. - I skimmed through the other command/tool classes and all of them seem to be exposed via a script so that there shouldn't be any compatibility problem there? What other changes do we want to address?
There was a problem hiding this comment.
Thanks. This is more or less what I had in mind. I'm going to go through all tools to see if there is any further issue and then we can discuss the policy with the community and possibly have a vote.
There was a problem hiding this comment.
https://cwiki.apache.org/confluence/display/KAFKA/KIP-906%3A+Tools+migration+guidelines
We also revived KIP-641. Any feedback is welcomed.
There was a problem hiding this comment.
Thanks @fvaleri and apologies for the delay, I will look at the KIP. Thanks!
fvaleri
left a comment
There was a problem hiding this comment.
Hi @Hangleton, thanks for working on this and it looks great.
I just leaved few comments and ideas for improvements. Let me know what you think.
There was a problem hiding this comment.
I think we can get rid of the final extra space.
There was a problem hiding this comment.
Why not using Header and RecordHeader?
There was a problem hiding this comment.
| public static void validatePortOrDie(OptionParser parser, String hostPort) { | |
| public static void validatePortOrExit(OptionParser parser, String hostPort) { |
There was a problem hiding this comment.
| ToolsUtils.validatePortOrDie(parser, brokerHostsAndPorts()); | |
| ToolsUtils.validatePortOrExit(parser, brokerHostsAndPorts()); |
There was a problem hiding this comment.
Given that there is no hard dependency with the parent class and there is a dedicated test, I would suggest to put LineMessageReader in a separate file. Also note that the NPath complexity lives here, so this would be the class to suppress in checkstyle.
|
@showuon if you have some time, this looks almost ready. |
|
Thank you for your review Frederico (@fvaleri). I pushed the changes to address all your comments. |
7727b3c to
fb32c09
Compare
|
Please ignore the request for review Frederico - was learning about the refresh icon on Github... |
…y/finally; 3) Remove unnecessary getters; 4) Add Javadoc.
…tion; b) Fix typos; c) Move LineMessageReader in its own top-level class.
fb32c09 to
277fb06
Compare
fvaleri
left a comment
There was a problem hiding this comment.
@Hangleton should we move to RecordReader interface now and then call another round of review? Also note this comment.
Thanks Frederico for the follow-up and call-out. I will rebase and update the PR. |
|
Hi @Hangleton, what's the state of this PR? Let me know if you need some help/review. |
|
This PR is being marked as stale since it has not had any activity in 90 days. If you would like to keep this PR alive, please ask a committer for review. If the PR has merge conflicts, please update it with the latest from trunk (or appropriate release branch) If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed. |
|
Hello @Hangleton . Do you need help with review of this PR? |
|
Done in #17157, closing |
Code move for the
consoleProduceras part of KAFKA-14525 - Move CLI tools fromcoretotoolsmodule. The copy is as identical as possible as the original class and provides iso-functionality. Unit tests are moved as well forConsoleProducerandLineMessageReader. One minor additional unit test for the console producer.Tests:
ConsoleProducerTestandLineMessageReaderTest.Committer Checklist (excluded from commit message)