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


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/SCMDeletedBlockTransactionStatusManager.java:
##########
@@ -415,6 +450,76 @@ private boolean alreadyExecuted(DatanodeID dnId, long 
txId) {
         .contains(dnId);
   }
 
+  @VisibleForTesting
+  public void addTransactions(ArrayList<DeletedBlocksTransaction> txList) 
throws IOException {
+    if (txList.isEmpty()) {
+      return;
+    }
+    if 
(VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.STORAGE_SPACE_DISTRIBUTION)
 &&
+        !disableDataDistributionForTest) {
+      for (DeletedBlocksTransaction tx: txList) {
+        if (tx.hasTotalBlockSize()) {
+          if (!isFirstTxIdForDataDistributionSet) {
+            // set the first transaction ID for data distribution
+            isFirstTxIdForDataDistributionSet = true;
+            firstTxIdForDataDistribution = tx.getTxID();
+          }
+          incrDeletedBlocksSummary(tx);
+        }
+      }
+      deletedBlockLogStateManager.addTransactionsToDB(txList, getSummary());
+      return;
+    }
+    deletedBlockLogStateManager.addTransactionsToDB(txList);
+  }
+
+  private void incrDeletedBlocksSummary(DeletedBlocksTransaction tx) {
+    totalTxCount.addAndGet(1);
+    totalBlockCount.addAndGet(tx.getLocalIDCount());
+    totalBlocksSize.addAndGet(tx.getTotalBlockSize());
+    totalReplicatedBlocksSize.addAndGet(tx.getTotalBlockReplicatedSize());
+  }
+
+  @VisibleForTesting
+  public void removeTransactions(ArrayList<Long> txIDs) throws IOException {

Review Comment:
   All the txs and summary are calculated by leader SCM, and synced to other 
SCMs. 
   
   > For transactions not present at the current SCM and notified by DN, I 
think we can ignore this.
   
   We should not ignore this. It will cause minor inaccuracy to summary each 
time. The accumulated minor inaccuracy will become big inaccuracy with time 
past. 
   
   



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