FrankYang0529 commented on code in PR #16564:
URL: https://github.com/apache/kafka/pull/16564#discussion_r1676763757
##########
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java:
##########
@@ -850,24 +850,26 @@ public void
verifyNoCoordinatorLookupForManualAssignmentWithOffsetCommit(GroupPr
assertEquals(55, consumer.committed(Collections.singleton(tp0),
Duration.ZERO).get(tp0).offset());
}
- // TODO: this test triggers a bug with the CONSUMER group protocol
implementation.
- // The bug will be investigated and fixed so this test can use both
group protocols.
@ParameterizedTest
- @EnumSource(value = GroupProtocol.class, names = "CLASSIC")
+ @EnumSource(value = GroupProtocol.class)
public void testFetchProgressWithMissingPartitionPosition(GroupProtocol
groupProtocol) {
// Verifies that we can make progress on one partition while we are
awaiting
// a reset on another partition.
ConsumerMetadata metadata = createMetadata(subscription);
MockClient client = new MockClient(time, metadata);
initMetadata(client, Collections.singletonMap(topic, 2));
- Node node = metadata.fetch().nodes().get(0);
consumer = newConsumerNoAutoCommit(groupProtocol, time, client,
subscription, metadata);
consumer.assign(Arrays.asList(tp0, tp1));
consumer.seekToEnd(singleton(tp0));
consumer.seekToBeginning(singleton(tp1));
+ if (groupProtocol == GroupProtocol.CONSUMER) {
+ Node node = metadata.fetch().nodes().get(0);
+
client.prepareResponseFrom(FindCoordinatorResponse.prepareResponse(Errors.NONE,
groupId, node), node);
+ }
Review Comment:
May you move this block before `newConsumerNoAutoCommit`? Please check
https://issues.apache.org/jira/browse/KAFKA-17129 for the reason.
tl;dr
[MockClient#send](https://github.com/apache/kafka/blob/7495e70365ebeba4806fc4da23c2ca75fa191649/clients/src/test/java/org/apache/kafka/clients/MockClient.java#L215-L278)
only match request when there is a `FutureResponse`. If we don't add it to
`MockClient` first, `FindCoordinatorRequest` may not get a response and it will
hang for long time.
--
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]