-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-9507 AdminClient should check for missing committed offsets #8057
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 1 commit
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 |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ public class ListConsumerGroupOffsetsResult { | |
|
|
||
| /** | ||
| * Return a future which yields a map of topic partitions to OffsetAndMetadata objects. | ||
| * If the partition does not have a committed offset, the corresponding value will be null | ||
|
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. I'd suggest rephrasing this:
|
||
| */ | ||
| public KafkaFuture<Map<TopicPartition, OffsetAndMetadata>> partitionsToOffsetAndMetadata() { | ||
| return future; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1494,6 +1494,7 @@ public void testDescribeConsumerGroupOffsets() throws Exception { | |
| TopicPartition myTopicPartition0 = new TopicPartition("my_topic", 0); | ||
| TopicPartition myTopicPartition1 = new TopicPartition("my_topic", 1); | ||
| TopicPartition myTopicPartition2 = new TopicPartition("my_topic", 2); | ||
| TopicPartition myTopicPartition3 = new TopicPartition("my_topic", 3); | ||
|
|
||
| final Map<TopicPartition, OffsetFetchResponse.PartitionData> responseData = new HashMap<>(); | ||
| responseData.put(myTopicPartition0, new OffsetFetchResponse.PartitionData(10, | ||
|
|
@@ -1502,15 +1503,18 @@ public void testDescribeConsumerGroupOffsets() throws Exception { | |
| Optional.empty(), "", Errors.NONE)); | ||
| responseData.put(myTopicPartition2, new OffsetFetchResponse.PartitionData(20, | ||
| Optional.empty(), "", Errors.NONE)); | ||
| responseData.put(myTopicPartition3, new OffsetFetchResponse.PartitionData(-1, | ||
|
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. Let's use |
||
| Optional.empty(), "", Errors.NONE)); | ||
| env.kafkaClient().prepareResponse(new OffsetFetchResponse(Errors.NONE, responseData)); | ||
|
|
||
| final ListConsumerGroupOffsetsResult result = env.adminClient().listConsumerGroupOffsets("group-0"); | ||
| final Map<TopicPartition, OffsetAndMetadata> partitionToOffsetAndMetadata = result.partitionsToOffsetAndMetadata().get(); | ||
|
|
||
| assertEquals(3, partitionToOffsetAndMetadata.size()); | ||
| assertEquals(4, partitionToOffsetAndMetadata.size()); | ||
| assertEquals(10, partitionToOffsetAndMetadata.get(myTopicPartition0).offset()); | ||
| assertEquals(0, partitionToOffsetAndMetadata.get(myTopicPartition1).offset()); | ||
| assertEquals(20, partitionToOffsetAndMetadata.get(myTopicPartition2).offset()); | ||
| assertNull(partitionToOffsetAndMetadata.get(myTopicPartition3)); | ||
|
hachikuji marked this conversation as resolved.
|
||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.