HDFS-14119. Improve GreedyPlanner Parameter Logging. Contributed by Beluga Behr.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/69489ff2
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/69489ff2
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/69489ff2

Branch: refs/heads/HDFS-12943
Commit: 69489ff2d18a26be9c56d632672079e134f1cd99
Parents: c9a3aa6
Author: Giovanni Matteo Fumarola <gif...@apache.org>
Authored: Mon Dec 3 12:55:52 2018 -0800
Committer: Giovanni Matteo Fumarola <gif...@apache.org>
Committed: Mon Dec 3 12:55:52 2018 -0800

----------------------------------------------------------------------
 .../diskbalancer/planner/GreedyPlanner.java     | 24 ++++++++------------
 1 file changed, 10 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/69489ff2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/planner/GreedyPlanner.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/planner/GreedyPlanner.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/planner/GreedyPlanner.java
index 568c1e6..3f97345 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/planner/GreedyPlanner.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/planner/GreedyPlanner.java
@@ -64,7 +64,7 @@ public class GreedyPlanner implements Planner {
    */
   @Override
   public NodePlan plan(DiskBalancerDataNode node) throws Exception {
-    long startTime = Time.monotonicNow();
+    final long startTime = Time.monotonicNow();
     NodePlan plan = new NodePlan(node.getDataNodeName(),
         node.getDataNodePort());
     LOG.info("Starting plan for Node : {}:{}",
@@ -75,12 +75,10 @@ public class GreedyPlanner implements Planner {
       }
     }
 
-    long endTime = Time.monotonicNow();
-    String message = String
-        .format("Compute Plan for Node : %s:%d took %d ms ",
-            node.getDataNodeName(), node.getDataNodePort(),
-            endTime - startTime);
-    LOG.info(message);
+    final long endTime = Time.monotonicNow();
+    LOG.info("Compute Plan for Node : {}:{} took {} ms",
+        node.getDataNodeName(), node.getDataNodePort(), endTime - startTime);
+
     return plan;
   }
 
@@ -117,21 +115,19 @@ public class GreedyPlanner implements Planner {
 
       applyStep(nextStep, currentSet, lowVolume, highVolume);
       if (nextStep != null) {
-        LOG.debug("Step : {} ",  nextStep.toString());
+        LOG.debug("Step : {} ", nextStep);
         plan.addStep(nextStep);
       }
     }
 
-    String message = String
-        .format("Disk Volume set %s Type : %s plan completed.",
-            currentSet.getSetID(),
-            currentSet.getVolumes().get(0).getStorageType());
+    LOG.info("Disk Volume set {} - Type : {} plan completed.",
+        currentSet.getSetID(),
+        currentSet.getVolumes().get(0).getStorageType());
 
     plan.setNodeName(node.getDataNodeName());
     plan.setNodeUUID(node.getDataNodeUUID());
     plan.setTimeStamp(Time.now());
     plan.setPort(node.getDataNodePort());
-    LOG.info(message);
   }
 
   /**
@@ -207,7 +203,7 @@ public class GreedyPlanner implements Planner {
       // Create a new step
       nextStep = new MoveStep(highVolume, currentSet.getIdealUsed(), lowVolume,
           bytesToMove, currentSet.getSetID());
-      LOG.debug(nextStep.toString());
+      LOG.debug("Next Step: {}", nextStep);
     }
     return nextStep;
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to