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

This commit is contained in:
Giovanni Matteo Fumarola 2018-12-03 12:55:52 -08:00
parent c9a3aa64dc
commit 69489ff2d1
1 changed files with 10 additions and 14 deletions

View File

@ -64,7 +64,7 @@ public class GreedyPlanner implements Planner {
*/ */
@Override @Override
public NodePlan plan(DiskBalancerDataNode node) throws Exception { public NodePlan plan(DiskBalancerDataNode node) throws Exception {
long startTime = Time.monotonicNow(); final long startTime = Time.monotonicNow();
NodePlan plan = new NodePlan(node.getDataNodeName(), NodePlan plan = new NodePlan(node.getDataNodeName(),
node.getDataNodePort()); node.getDataNodePort());
LOG.info("Starting plan for Node : {}:{}", LOG.info("Starting plan for Node : {}:{}",
@ -75,12 +75,10 @@ public class GreedyPlanner implements Planner {
} }
} }
long endTime = Time.monotonicNow(); final long endTime = Time.monotonicNow();
String message = String LOG.info("Compute Plan for Node : {}:{} took {} ms",
.format("Compute Plan for Node : %s:%d took %d ms ", node.getDataNodeName(), node.getDataNodePort(), endTime - startTime);
node.getDataNodeName(), node.getDataNodePort(),
endTime - startTime);
LOG.info(message);
return plan; return plan;
} }
@ -117,13 +115,12 @@ public class GreedyPlanner implements Planner {
applyStep(nextStep, currentSet, lowVolume, highVolume); applyStep(nextStep, currentSet, lowVolume, highVolume);
if (nextStep != null) { if (nextStep != null) {
LOG.debug("Step : {} ", nextStep.toString()); LOG.debug("Step : {} ", nextStep);
plan.addStep(nextStep); plan.addStep(nextStep);
} }
} }
String message = String LOG.info("Disk Volume set {} - Type : {} plan completed.",
.format("Disk Volume set %s Type : %s plan completed.",
currentSet.getSetID(), currentSet.getSetID(),
currentSet.getVolumes().get(0).getStorageType()); currentSet.getVolumes().get(0).getStorageType());
@ -131,7 +128,6 @@ public class GreedyPlanner implements Planner {
plan.setNodeUUID(node.getDataNodeUUID()); plan.setNodeUUID(node.getDataNodeUUID());
plan.setTimeStamp(Time.now()); plan.setTimeStamp(Time.now());
plan.setPort(node.getDataNodePort()); plan.setPort(node.getDataNodePort());
LOG.info(message);
} }
/** /**
@ -207,7 +203,7 @@ public class GreedyPlanner implements Planner {
// Create a new step // Create a new step
nextStep = new MoveStep(highVolume, currentSet.getIdealUsed(), lowVolume, nextStep = new MoveStep(highVolume, currentSet.getIdealUsed(), lowVolume,
bytesToMove, currentSet.getSetID()); bytesToMove, currentSet.getSetID());
LOG.debug(nextStep.toString()); LOG.debug("Next Step: {}", nextStep);
} }
return nextStep; return nextStep;
} }