hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wan...@apache.org
Subject [02/50] [abbrv] hadoop git commit: HDFS-10580. DiskBalancer: Make use of unused methods in GreedyPlanner to print debug info. Contributed by Yiqun Lin
Date Wed, 17 Aug 2016 17:58:32 GMT
HDFS-10580. DiskBalancer: Make use of unused methods in GreedyPlanner to print debug info.
Contributed by Yiqun Lin


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

Branch: refs/heads/YARN-3368
Commit: bed69d18e6c84583cbe5fd765f068d9faa807617
Parents: 2424911
Author: Anu Engineer <aengineer@apache.org>
Authored: Mon Aug 15 12:40:29 2016 -0700
Committer: Anu Engineer <aengineer@apache.org>
Committed: Mon Aug 15 12:40:29 2016 -0700

----------------------------------------------------------------------
 .../diskbalancer/planner/GreedyPlanner.java     | 45 +++++++++++---------
 1 file changed, 25 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/bed69d18/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 0df9843..fb83eeb 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
@@ -158,6 +158,7 @@ public class GreedyPlanner implements Planner {
 
     // since the volume data changed , we need to recompute the DataDensity.
     currentSet.computeVolumeDataDensity();
+    printQueue(currentSet.getSortedQueue());
   }
 
   /**
@@ -184,7 +185,7 @@ public class GreedyPlanner implements Planner {
     if (maxLowVolumeCanReceive <= 0) {
       LOG.debug("{} Skipping disk from computation. Maximum data size " +
           "achieved.", lowVolume.getPath());
-      lowVolume.setSkip(true);
+      skipVolume(currentSet, lowVolume);
     }
 
     long maxHighVolumeCanGive = highVolume.getUsed() -
@@ -195,7 +196,7 @@ public class GreedyPlanner implements Planner {
     if (maxHighVolumeCanGive <= 0) {
       LOG.debug(" {} Skipping disk from computation. Minimum data size " +
           "achieved.", highVolume.getPath());
-      highVolume.setSkip(true);
+      skipVolume(currentSet, highVolume);
     }
 
 
@@ -219,16 +220,19 @@ public class GreedyPlanner implements Planner {
    */
   private void skipVolume(DiskBalancerVolumeSet currentSet,
                           DiskBalancerVolume volume) {
-
-    String message = String.format(
-        "Skipping volume. Volume : %s " +
-            "Type : %s Target " +
-            "Number of bytes : %f lowVolume dfsUsed : %d. Skipping this " +
-            "volume from all future balancing calls.", volume.getPath(),
-        volume.getStorageType(),
-        currentSet.getIdealUsed() * volume.getCapacity(), volume.getUsed());
+    if (LOG.isDebugEnabled()) {
+      String message =
+          String.format(
+              "Skipping volume. Volume : %s " +
+              "Type : %s Target " +
+              "Number of bytes : %f lowVolume dfsUsed : %d. Skipping this " +
+              "volume from all future balancing calls.", volume.getPath(),
+              volume.getStorageType(),
+              currentSet.getIdealUsed() * volume.getCapacity(),
+              volume.getUsed());
+      LOG.debug(message);
+    }
     volume.setSkip(true);
-    LOG.debug(message);
   }
 
   // Removes all volumes which are part of the volumeSet but skip flag is set.
@@ -242,6 +246,7 @@ public class GreedyPlanner implements Planner {
       }
     }
     currentSet.computeVolumeDataDensity();
+    printQueue(currentSet.getSortedQueue());
   }
 
   /**
@@ -251,14 +256,14 @@ public class GreedyPlanner implements Planner {
    * @param queue - Queue
    */
   private void printQueue(TreeSet<DiskBalancerVolume> queue) {
-    String format = String.format("First Volume : %s, DataDensity : %f",
-        queue.first().getPath(),
-        queue.first().getVolumeDataDensity());
-    LOG.info(format);
-
-    format = String
-        .format("Last Volume : %s, DataDensity : %f%n", queue.last().getPath(),
-            queue.last().getVolumeDataDensity());
-    LOG.info(format);
+    if (LOG.isDebugEnabled()) {
+      String format =
+          String.format(
+              "First Volume : %s, DataDensity : %f, " +
+              "Last Volume : %s, DataDensity : %f",
+              queue.first().getPath(), queue.first().getVolumeDataDensity(),
+              queue.last().getPath(), queue.last().getVolumeDataDensity());
+      LOG.debug(format);
+    }
   }
 }


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


Mime
View raw message