SaketaChalamchala commented on code in PR #9869:
URL: https://github.com/apache/ozone/pull/9869#discussion_r2914866443


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotCache.java:
##########
@@ -323,8 +324,13 @@ private UncheckedAutoCloseableSupplier<OMLockDetails> 
lock(Supplier<OMLockDetail
 
     AtomicReference<OMLockDetails> lockDetails = new 
AtomicReference<>(emptyLockFunction.get());
     if (lockDetails.get().isLockAcquired()) {
-      if (!cleanupFunction.get()) {
+      try {
+        if (!cleanupFunction.get()) {
+          lockDetails.set(emptyUnlockFunction.get());
+        }
+      } catch (Throwable t) {
         lockDetails.set(emptyUnlockFunction.get());
+        throw t;
       }

Review Comment:
   Updated the patch to throw an exception when cleanup returns false so that 
callers do not proceed without the lock.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to