-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-5588: Remove deprecated new-consumer option for tools #5097
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
Changes from 4 commits
e536013
179e80e
ec77573
9f8d327
56b2204
136f2eb
cf68494
80e035a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -222,4 +222,11 @@ class DeleteConsumerGroupTest extends ConsumerGroupCommandTest { | |
| result.size == 1 && | ||
| result.keySet.contains(group) && result.get(group).contains(Errors.COORDINATOR_NOT_AVAILABLE)) | ||
| } | ||
|
|
||
| @Test(expected = classOf[joptsimple.OptionException]) | ||
| def testDeleteWithUnrecognizedNewConsumerOption() { | ||
| val cgcArgs = Array("--new-consumer", "--bootstrap-server", brokerList, "--delete", "--group", group) | ||
| getConsumerGroupService(cgcArgs) | ||
| fail("Expected an error due to presence of unrecognized --new-consumer option") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not needed given the expected exception annotation. Same for other similar cases.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need tests for checking unrecognized option "--new-consumer" ? |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,8 +149,7 @@ class ConsoleConsumerTest { | |
| val args: Array[String] = Array( | ||
| "--bootstrap-server", "localhost:9092", | ||
| "--topic", "test", | ||
| "--from-beginning", | ||
| "--new-consumer") //new | ||
| "--from-beginning") | ||
|
|
||
| //When | ||
| val config = new ConsoleConsumer.ConsumerConfig(args) | ||
|
|
@@ -169,8 +168,7 @@ class ConsoleConsumerTest { | |
| "--bootstrap-server", "localhost:9092", | ||
| "--topic", "test", | ||
| "--partition", "0", | ||
| "--offset", "3", | ||
| "--new-consumer") //new | ||
| "--offset", "3") | ||
|
|
||
| //When | ||
| val config = new ConsoleConsumer.ConsumerConfig(args) | ||
|
|
@@ -185,6 +183,30 @@ class ConsoleConsumerTest { | |
|
|
||
| } | ||
|
|
||
| @Test(expected = classOf[IllegalArgumentException]) | ||
| def shouldExitOnUnrecognizedNewConsumerOption(): Unit = { | ||
|
|
||
| // Override exit procedure to throw an exception instead of exiting, so we can catch the exit | ||
| // properly for this test case | ||
| Exit.setExitProcedure((_, message) => throw new IllegalArgumentException(message.orNull)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment seems redundant given the code.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I am going to remove it from all the other places in the same test scala class |
||
|
|
||
| //Given | ||
| val args: Array[String] = Array( | ||
| "--new-consumer", | ||
| "--bootstrap-server", "localhost:9092", | ||
| "--topic", "test", | ||
| "--from-beginning") | ||
|
|
||
| //When | ||
| try { | ||
| new ConsoleConsumer.ConsumerConfig(args) | ||
| } finally { | ||
| Exit.resetExitProcedure() | ||
| } | ||
|
|
||
| fail("Expected consumer config construction to fail due to unrecognized --new-consumer option") | ||
| } | ||
|
|
||
| @Test | ||
| def testDefaultConsumer() { | ||
| //Given | ||
|
|
@@ -200,6 +222,21 @@ class ConsoleConsumerTest { | |
| assertFalse(config.useOldConsumer) | ||
| } | ||
|
|
||
| @Test | ||
| def testNewConsumerRemovedOption() { | ||
| //Given | ||
| val args: Array[String] = Array( | ||
| "--bootstrap-server", "localhost:9092", | ||
| "--topic", "test", | ||
| "--from-beginning") | ||
|
|
||
| //When | ||
| val config = new ConsoleConsumer.ConsumerConfig(args) | ||
|
|
||
| //Then | ||
| assertFalse(config.useOldConsumer) | ||
| } | ||
|
|
||
| @Test | ||
| def shouldParseValidNewSimpleConsumerValidConfigWithStringOffset() { | ||
| //Given | ||
|
|
@@ -208,7 +245,6 @@ class ConsoleConsumerTest { | |
| "--topic", "test", | ||
| "--partition", "0", | ||
| "--offset", "LatEst", | ||
| "--new-consumer", //new | ||
| "--property", "print.value=false") | ||
|
|
||
| //When | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,6 +97,11 @@ <h5><a id="upgrade_200_notable" href="#upgrade_200_notable">Notable changes in 2 | |
| will be removed in a future version.</li> | ||
| <li>The internal method <code>kafka.admin.AdminClient.deleteRecordsBefore</code> has been removed. Users are encouraged to migrate to <code>org.apache.kafka.clients.admin.AdminClient.deleteRecords</code>.</li> | ||
| <li>The tool kafka.tools.ReplayLogProducer has been removed.</li> | ||
| <li><a href="https://cwiki.apache.org/confluence/display/KAFKA/KIP-176%3A+Remove+deprecated+new-consumer+option+for+tools">KIP-176</a> removes | ||
| the <code>--new-consumer</code> option for all consumer based tools as <code>kafka-console-consumer</code>, <code>kafka-consumer-perf-test</code> | ||
| and <code>kafka-consumer-groups</code>. The new consumer is automatically used if the bootstrap servers list is provided on the command line | ||
| otherwise, providing the zookeeper connection instead, the old one is used. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should make it clear that we haven't changed the behaviour, |
||
| </li> | ||
| </ul> | ||
|
|
||
| <h5><a id="upgrade_200_new_protocols" href="#upgrade_200_new_protocols">New Protocol Versions</a></h5> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: why are we not importing
OptionException?