cadonna commented on code in PR #15491:
URL: https://github.com/apache/kafka/pull/15491#discussion_r1519991935


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchCollector.java:
##########
@@ -278,32 +278,48 @@ private CompletedFetch handleInitializeSuccess(final 
CompletedFetch completedFet
             }
         }
 
-        if (partition.highWatermark() >= 0) {
-            log.trace("Updating high watermark for partition {} to {}", tp, 
partition.highWatermark());
-            subscriptions.updateHighWatermark(tp, partition.highWatermark());
+        if (!updatePartitionState(partition, tp)) {
+            return null;
+        }
+
+        completedFetch.setInitialized();
+        return completedFetch;
+    }
+
+    private boolean updatePartitionState(final FetchResponseData.PartitionData 
partitionData,
+                                         final TopicPartition tp) {
+        if (partitionData.highWatermark() >= 0) {
+            log.trace("Updating high watermark for partition {} to {}", tp, 
partitionData.highWatermark());
+            if (!subscriptions.tryUpdatingHighWatermark(tp, 
partitionData.highWatermark())) {

Review Comment:
   Yep!



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to