siddhantsangwan commented on code in PR #3751:
URL: https://github.com/apache/ozone/pull/3751#discussion_r977465464


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java:
##########
@@ -568,6 +561,39 @@ private void checkIterationMoveResults() {
         metrics.getNumContainerMovesCompletedInLatestIteration());
   }
 
+  private long performTimeMoveCancelAndCount() {
+    return moveSelectionToFutureMap.entrySet().stream()
+        .filter(entry -> !entry.getValue().isDone())
+        .peek(entry -> {
+          LOG.warn("Container move canceled for container {} from source {}" +
+                  " to target {} due to timeout.",
+              entry.getKey().getContainerID(),
+              containerToSourceMap.get(entry.getKey().getContainerID())
+                  .getUuidString(),
+              entry.getKey().getTargetNode().getUuidString());
+          entry.getValue().cancel(true);
+        }).count();
+  }
+
+  private long performMoveCancelAndFailCount() {
+    long cnt = moveSelectionToFutureMap.entrySet().stream()
+        .filter(entry -> entry.getValue().isDone() && entry.getValue()
+            .isCompletedExceptionally()).count();
+    moveSelectionToFutureMap.entrySet().stream()
+        .filter(entry -> !entry.getValue().isDone())
+        .peek(entry -> {
+          LOG.warn("Container move canceled for container {} from source {}" +
+                  " to target {} due to timeout.",

Review Comment:
   Should be "failure" instead of "timeout".



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java:
##########
@@ -568,6 +561,39 @@ private void checkIterationMoveResults() {
         metrics.getNumContainerMovesCompletedInLatestIteration());
   }
 
+  private long performTimeMoveCancelAndCount() {
+    return moveSelectionToFutureMap.entrySet().stream()
+        .filter(entry -> !entry.getValue().isDone())
+        .peek(entry -> {
+          LOG.warn("Container move canceled for container {} from source {}" +
+                  " to target {} due to timeout.",
+              entry.getKey().getContainerID(),
+              containerToSourceMap.get(entry.getKey().getContainerID())
+                  .getUuidString(),
+              entry.getKey().getTargetNode().getUuidString());
+          entry.getValue().cancel(true);
+        }).count();
+  }
+
+  private long performMoveCancelAndFailCount() {

Review Comment:
   How does `cancelAndCountFailedMoves` sound?



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java:
##########
@@ -568,6 +561,39 @@ private void checkIterationMoveResults() {
         metrics.getNumContainerMovesCompletedInLatestIteration());
   }
 
+  private long performTimeMoveCancelAndCount() {

Review Comment:
   Let's rename this method to something like `cancelAndCountTimedOutMoves`?



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