ShivsundarR commented on code in PR #16727:
URL: https://github.com/apache/kafka/pull/16727#discussion_r1705254209


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumeRequestManager.java:
##########
@@ -291,18 +325,27 @@ public CompletableFuture<Map<TopicIdPartition, 
Acknowledgements>> commitSync(
                         resultCount.incrementAndGet();
                     }
                 }
-                acknowledgeRequestStates.add(new 
AcknowledgeRequestState(logContext,
-                        ShareConsumeRequestManager.class.getSimpleName() + 
":1",
-                        deadlineMs,
-                        retryBackoffMs,
-                        retryBackoffMaxMs,
-                        sessionHandler,
-                        nodeId,
-                        acknowledgementsMapForNode,
-                        this::handleShareAcknowledgeSuccess,
-                        this::handleShareAcknowledgeFailure,
-                        resultHandler
-                ));
+                acknowledgeRequestStates.putIfAbsent(nodeId, new Pair<>(null, 
null));
+
+                // Ensure there is no commitSync()/close() request already 
present as they are blocking calls
+                // and only one request can be active at a time.
+                if (acknowledgeRequestStates.get(nodeId).getSyncRequest() != 
null) {
+                    log.error("Attempt to call commitSync() when there is an 
existing sync request for node {}", node.id());

Review Comment:
   Right yes, have updated now.



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