apoorvmittal10 commented on code in PR #17583:
URL: https://github.com/apache/kafka/pull/17583#discussion_r1817030012
##########
core/src/main/java/kafka/server/share/DelayedShareFetch.java:
##########
@@ -182,22 +194,28 @@ Map<TopicIdPartition, FetchRequest.PartitionData>
acquirablePartitions() {
// Add the share partition to the list of partitions to be fetched
only if we can
// acquire the fetch lock on it.
if (sharePartition.maybeAcquireFetchLock()) {
- // If the share partition is already at capacity, we should
not attempt to fetch.
- if (sharePartition.canAcquireRecords()) {
- topicPartitionData.put(
+ try {
+ // If the share partition is already at capacity, we
should not attempt to fetch.
+ if (sharePartition.canAcquireRecords()) {
+ topicPartitionData.put(
topicIdPartition,
new FetchRequest.PartitionData(
- topicIdPartition.topicId(),
- sharePartition.nextFetchOffset(),
- 0,
- partitionMaxBytes,
- Optional.empty()
+ topicIdPartition.topicId(),
+ sharePartition.nextFetchOffset(),
+ 0,
+ partitionMaxBytes,
+ Optional.empty()
)
- );
- } else {
- sharePartition.releaseFetchLock();
- log.trace("Record lock partition limit exceeded for
SharePartition {}, " +
+ );
+ } else {
+ sharePartition.releaseFetchLock();
+ log.trace("Record lock partition limit exceeded for
SharePartition {}, " +
"cannot acquire more records", sharePartition);
+ }
+ } catch (Exception e) {
Review Comment:
I have added the exception block so if there is any unrealized exception
then atleast lock should be released.
--
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]