chirag-wadhwa5 commented on code in PR #17573:
URL: https://github.com/apache/kafka/pull/17573#discussion_r1814717792


##########
core/src/test/java/kafka/test/api/ShareConsumerTest.java:
##########
@@ -209,11 +224,12 @@ public void testSubscribeSubscribeEmptyPollFails() {
 
     @Test
     public void testSubscriptionAndPoll() {
+        KafkaShareConsumer<byte[], byte[]> shareConsumer = 
createShareConsumer(new ByteArrayDeserializer(), new ByteArrayDeserializer(), 
"group1");
+        shareConsumer.subscribe(Collections.singleton(tp.topic()));
+        alterShareAutoOffsetReset("group1", "earliest");

Review Comment:
   Thanks for the review. The issue here is that the default value of 
share.auto.offset.reset config is "latest". Also the share partition is 
initialized during the first share fetch request to that topic partition for a 
groupId, which means during share partition initialization, if the default 
value is returned by persister, then by default the value of start offset will 
be set to the latest offset for that topic partition, thereby discarding all 
the previously produced messages to that topic partition. And, in almost every 
test, the share fetch requests (issues by shareConsumer.poll) are issued after 
some messages have been produced to that that topic. So, in order to not 
discard those previous messages and thus test the specific functionality being 
tested in the tests, I have changed the value of the config to "earliest", 
which would simply start fetching from the first record and doesn't care for 
the order in which messages are produced and consumed.



-- 
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]

Reply via email to