ChenSammi commented on code in PR #6547:
URL: https://github.com/apache/ozone/pull/6547#discussion_r1570701318


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/DeleteBlocksCommandHandler.java:
##########
@@ -626,20 +630,27 @@ private void updateMetaData(KeyValueContainerData 
containerData,
     }
   }
 
-  private void logDeleteTransaction(long containerId,
-      KeyValueContainerData containerData, DeletedBlocksTransaction delTX) {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Processing Container : {}, DB path : {}, transaction {}",
-          containerId, containerData.getMetadataPath(), delTX.getTxID());
-    }
+  public static boolean isDuplicateTransaction(long containerId, 
KeyValueContainerData containerData,
+      DeletedBlocksTransaction delTX, BlockDeletingServiceMetrics metrics) {
+    boolean duplicate = false;
 
-    if (delTX.getTxID() <= containerData.getDeleteTransactionId()) {
-      blockDeleteMetrics.incOutOfOrderDeleteBlockTransactionCount();
+    if (delTX.getTxID() < containerData.getDeleteTransactionId()) {
+      metrics.incOutOfOrderDeleteBlockTransactionCount();
       LOG.info(String.format("Delete blocks for containerId: %d"
-              + " is either received out of order or retried,"
-              + " %d <= %d", containerId, delTX.getTxID(),
+              + " is received out of order, %d < %d", containerId, 
delTX.getTxID(),
           containerData.getDeleteTransactionId()));
+    } else if (delTX.getTxID() == containerData.getDeleteTransactionId()) {
+      duplicate = true;
+      LOG.info(String.format("Delete blocks with txID {} for containerId: %d"
+              + " is retried.", delTX.getTxID(), containerId,
+          containerData.getDeleteTransactionId()));

Review Comment:
   Ops, good catch! Here is the message of new commit,
   
   ```
   2024-04-18 21:34:39,920 [DeleteBlocksCommandHandlerThread-1] INFO  
commandhandler.DeleteBlocksCommandHandler 
(DeleteBlocksCommandHandler.java:isDuplicateTransaction(644)) - Delete blocks 
with txID 1 for containerId: 0 is retried.
   ```



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