[
https://issues.apache.org/jira/browse/KAFKA-19351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17954965#comment-17954965
]
Chia-Ping Tsai commented on KAFKA-19351:
----------------------------------------
the unit test is shown below
{code:java}
@Test
public void testCommitAsyncShouldCopyOffsets() {
consumer = newConsumer();
var tp = new TopicPartition("t0", 2);
var offsets = new HashMap<TopicPartition, OffsetAndMetadata>();
offsets.put(tp, new OffsetAndMetadata(10L));
markOffsetsReadyForCommitEvent();
consumer.commitAsync(offsets, null);
var commitEventCaptor = ArgumentCaptor.forClass(AsyncCommitEvent.class);
verify(applicationEventHandler).add(commitEventCaptor.capture());
var commitEvent = commitEventCaptor.getValue();
assertTrue(commitEvent.offsets().get().containsKey(tp));
offsets.remove(tp);
assertTrue(commitEvent.offsets().get().containsKey(tp));
}
{code}
> AsyncConsumer#commitAsync should copy the input offsets
> -------------------------------------------------------
>
> Key: KAFKA-19351
> URL: https://issues.apache.org/jira/browse/KAFKA-19351
> Project: Kafka
> Issue Type: Bug
> Reporter: Chia-Ping Tsai
> Assignee: Chia-Ping Tsai
> Priority: Major
> Labels: async-client
>
> see the docs:
> https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L1146
> {code:java}
> * @param offsets A map of offsets by partition with associate metadata.
> This map will be copied internally, so it
> * is safe to mutate the map after returning.
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)