adoroszlai commented on code in PR #3615:
URL: https://github.com/apache/ozone/pull/3615#discussion_r928730469


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java:
##########
@@ -181,6 +181,31 @@ public void incrementCount(List<Long> txIDs)
     }
   }
 
+  /**
+   * {@inheritDoc}
+   *
+   * @throws IOException
+   */
+  @Override
+  public int resetCount(List<Long> txIDs) throws IOException {
+    List<Long> failedTransactions = getFailedTransactions().stream()
+        .map(DeletedBlocksTransaction::getTxID).collect(Collectors.toList());
+    if (txIDs != null && !txIDs.isEmpty()) {
+      failedTransactions = failedTransactions.stream().filter(txIDs::contains)
+          .collect(Collectors.toList());
+    }
+    lock.lock();
+    try {
+      return deletedBlockLogStateManager.resetRetryCountOfTransactionInDB(
+            new ArrayList<>(failedTransactions));
+    } catch (TimeoutException | IOException ex) {
+      LOG.error("Cannot reset block deletion transactions {}",
+          failedTransactions, ex);
+      return 0;

Review Comment:
   Grouping `IOException` and `TimeoutException` in the same `catch` is not a 
problem.  Sorry if my original comment was not clear.
   
   This method is declared as:
   
   ```java
   int resetCount(List<Long> txIDs) throws IOException;
   ```
   
   but it never throws `IOException`, since the method catches it and returns 0 
instead.  So we can simplify the definition as:
   
   ```java
   int resetCount(List<Long> txIDs);
   ```
   
   Or we can keep `throws`, but drop `IOException` from the `catch`.



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