sadanand48 commented on code in PR #11190:
URL: https://github.com/apache/ozone/pull/11190#discussion_r4123343853


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java:
##########
@@ -485,12 +488,27 @@ public CompletableFuture<Message> 
applyTransaction(TransactionContext trx) {
       // lastAppliedIndex in OzoneManager StateMachine, even if other
       // executor has completed the transactions with id more.
 
-      //if there are too many pending requests, wait for doubleBuffer flushing
-      ozoneManagerDoubleBuffer.acquireUnFlushedTransactions(1);
+      enterApplyTransaction();
+      try {
+        //if there are too many pending requests, wait for doubleBuffer 
flushing
+        ozoneManagerDoubleBuffer.acquireUnFlushedTransactions(1);
+      } catch (Exception ex) {
+        exitApplyTransaction();
+        throw ex;
+      }
 
-      return CompletableFuture.supplyAsync(() -> runCommand(request, 
termIndex), executorService)
+      return CompletableFuture.supplyAsync(() -> {
+            try {
+              return runCommand(request, termIndex);
+            } finally {
+              exitApplyTransaction();

Review Comment:
   Added ozoneManagerDoubleBuffer.releaseUnFlushedTransactions(1); in the catch 
(RuntimeException ex) path before exitApplyTransaction() and rethrow.



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