GlenGeng commented on a change in pull request #1914:
URL: https://github.com/apache/ozone/pull/1914#discussion_r584425193



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImplV2.java
##########
@@ -79,6 +79,8 @@
   private final Lock lock;
   // Maps txId to set of DNs which are successful in committing the transaction
   private Map<Long, Set<UUID>> transactionToDNsCommitMap;
+  // Maps txId to its retry counts;
+  private Map<Long, Integer> transactionRetryCountMap;

Review comment:
       `transactionRetryCountMap` to `transactionToRetryCountMap `

##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImplV2.java
##########
@@ -145,8 +148,25 @@ public DeletedBlockLogImplV2(ConfigurationSource conf,
   public void incrementCount(List<Long> txIDs) throws IOException {
     lock.lock();
     try {
-      deletedBlockLogStateManager
-          .increaseRetryCountOfTransactionInDB(new ArrayList<>(txIDs));
+      ArrayList<Long> toUpdateTxIDs = new ArrayList<>();
+      for (Long txID : txIDs) {
+        int currentCount =
+            transactionRetryCountMap.getOrDefault(txID, 0);
+        if (currentCount > maxRetry) {
+          continue;
+        } else {
+          currentCount += 1;
+          if (currentCount > maxRetry) {
+            toUpdateTxIDs.add(txID);
+          }
+          transactionRetryCountMap.put(txID, currentCount);
+        }
+      }
+
+      if (!toUpdateTxIDs.isEmpty()) {

Review comment:
       `toUpdateTxIDs` -> `txIDsToUpdate`




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

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