sodonnel commented on code in PR #4391:
URL: https://github.com/apache/ozone/pull/4391#discussion_r1135420226


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancerTask.java:
##########
@@ -757,48 +785,66 @@ private boolean moveContainer(DatanodeDetails source,
     CompletableFuture<MoveManager.MoveResult> future;
     try {
       ContainerInfo containerInfo = containerManager.getContainer(containerID);
-      future = replicationManager
-          .move(containerID, source, moveSelection.getTargetNode())
-          .whenComplete((result, ex) -> {
-
-            metrics.incrementCurrentIterationContainerMoveMetric(result, 1);
-            if (ex != null) {
-              LOG.info("Container move for container {} from source {} to " +
-                      "target {} failed with exceptions {}",
-                  containerID.toString(),
+
+      ReplicationManager.ReplicationManagerConfiguration rmConf =
+          ozoneConfiguration.getObject(
+              ReplicationManager.ReplicationManagerConfiguration.class);
+      /*
+      If LegacyReplicationManager is enabled, ReplicationManager will
+      redirect to it. Otherwise, use MoveManager.
+       */
+      if (rmConf.isLegacyEnabled()) {
+        future = replicationManager
+            .move(containerID, source, moveSelection.getTargetNode());
+      } else {
+        future = moveManager.move(containerID, source,
+            moveSelection.getTargetNode());
+      }
+
+      future = future.whenComplete((result, ex) -> {
+        metrics.incrementCurrentIterationContainerMoveMetric(result, 1);
+        if (ex != null) {
+          LOG.info("Container move for container {} from source {} to " +
+                  "target {} failed with exceptions.",
+              containerID.toString(),
+              source.getUuidString(),
+              moveSelection.getTargetNode().getUuidString(), ex);
+          metrics.incrementNumContainerMovesFailedInLatestIteration(1);
+        } else {
+          if (result == MoveManager.MoveResult.COMPLETED) {
+            sizeActuallyMovedInLatestIteration +=
+                containerInfo.getUsedBytes();
+            if (LOG.isDebugEnabled()) {

Review Comment:
   NIT: We usually don't need to wrap debug calls in `if (LOG.isDebugEnabled`) 
if the parameters to the log are simple getters, which I think they are here.



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