chia7712 commented on code in PR #15853:
URL: https://github.com/apache/kafka/pull/15853#discussion_r1589362449
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java:
##########
@@ -906,6 +906,7 @@ public long position(TopicPartition partition, Duration
timeout) {
return position.offset;
updateFetchPositions(timer);
Review Comment:
We need to make sure `updateFetchPositions` also honour the `wakeup`. For
example, the following test get failed with this PR.
```java
@ParameterizedTest(name =
TestInfoUtils.TestWithParameterizedQuorumAndGroupProtocolNames)
@MethodSource(Array("getTestQuorumAndGroupProtocolParametersAll"))
@Timeout(5)
def testPositionRespectsWakeup(quorum: String, groupProtocol: String):
Unit = {
val topicPartition = new TopicPartition(topic, 15)
val properties = new Properties();
properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
"localhost:12345");
val consumer = createConsumer(configOverrides = properties)
consumer.assign(List(topicPartition).asJava)
CompletableFuture.runAsync { () =>
TimeUnit.SECONDS.sleep(1)
consumer.wakeup()
}
assertThrows(classOf[WakeupException], () =>
consumer.position(topicPartition, Duration.ofSeconds(100)))
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]