apoorvmittal10 commented on code in PR #19045:
URL: https://github.com/apache/kafka/pull/19045#discussion_r1974552557


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -1291,13 +1303,30 @@ public boolean maybeAcquireFetchLock() {
         if (stateNotActive()) {
             return false;
         }
-        return fetchLock.compareAndSet(false, true);
+        boolean acquired = fetchLock.compareAndSet(false, true);
+        if (acquired) {
+            long currentTime = time.hiResClockMs();
+            fetchLockAcquiredTimeMs = currentTime;
+            timeSinceLastLockAcquisitionMs = timeSinceLastLockAcquisitionMs != 
0 ? currentTime - timeSinceLastLockAcquisitionMs : 0;

Review Comment:
   Though this should not happen in practice, but I have added a safe check 
with comment.



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