junrao commented on code in PR #17283:
URL: https://github.com/apache/kafka/pull/17283#discussion_r1794384573
##########
core/src/main/java/kafka/server/share/DelayedShareFetch.java:
##########
@@ -120,28 +122,22 @@ public void onComplete() {
});
log.trace("Data successfully retrieved by replica manager: {}",
responseData);
- ShareFetchUtils.processFetchResponse(shareFetchData, responseData,
sharePartitionManager, replicaManager)
- .whenComplete((result, throwable) -> {
- if (throwable != null) {
- log.error("Error processing fetch response for share
partitions", throwable);
-
shareFetchData.future().completeExceptionally(throwable);
- } else {
- shareFetchData.future().complete(result);
- }
- // Releasing the lock to move ahead with the next request
in queue.
- releasePartitionLocks(shareFetchData.groupId(),
topicPartitionData.keySet());
- // If we have a fetch request completed for a
topic-partition, we release the locks for that partition,
- // then we should check if there is a pending share fetch
request for the topic-partition and complete it.
- // We add the action to delayed actions queue to avoid an
infinite call stack, which could happen if
- // we directly call
delayedShareFetchPurgatory.checkAndComplete
-
sharePartitionManager.addPurgatoryCheckAndCompleteDelayedActionToActionQueue(result.keySet(),
shareFetchData.groupId());
- });
-
+ Map<TopicIdPartition, ShareFetchResponseData.PartitionData> result
=
+ ShareFetchUtils.processFetchResponse(shareFetchData,
responseData, sharePartitionManager, replicaManager);
+ shareFetchData.future().complete(result);
} catch (Exception e) {
// Release the locks acquired for the partitions in the share
fetch request in case there is an exception
log.error("Error processing delayed share fetch request", e);
shareFetchData.future().completeExceptionally(e);
+ } finally {
+ // Releasing the lock to move ahead with the next request in queue.
Review Comment:
The comment above in line 129 is out of place.
--
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]