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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/DeleteBlocksCommandHandler.java:
##########
@@ -630,17 +630,28 @@ private void updateMetaData(KeyValueContainerData 
containerData,
                 containerData.getLatestDeleteTxnKey(), delTX.getTxID());
       }
 
-      long pendingDeleteBlocks =
-          containerData.getNumPendingDeletionBlocks() + newDeletionBlocks;
-      metadataTable
-          .putWithBatch(batchOperation,
-              containerData.getPendingDeleteBlockCountKey(),
-              pendingDeleteBlocks);
-
-      // update pending deletion blocks count and delete transaction ID in
-      // in-memory container status
-      containerData.updateDeleteTransactionId(delTX.getTxID());
-      containerData.incrPendingDeletionBlocks(newDeletionBlocks);
+      if (!isDuplicateTransaction(containerData.getContainerID(), 
containerData, delTX, blockDeleteMetrics)) {
+        long pendingDeleteBlocks =
+            containerData.getNumPendingDeletionBlocks() + newDeletionBlocks;
+        metadataTable
+            .putWithBatch(batchOperation,
+                containerData.getPendingDeleteBlockCountKey(),
+                pendingDeleteBlocks);
+
+        // update pending deletion blocks count and delete transaction ID in
+        // in-memory container status
+        long pendingBytes = delTX.getTotalBlockSize();
+        containerData.incrPendingDeletionBlocks(newDeletionBlocks, 
pendingBytes);

Review Comment:
   Let's move the memory change after the data is persisted into DB. Disk 
change prior to memory change, a safe rule of storage system. 



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