HDFS-10580. DiskBalancer: Make use of unused methods in GreedyPlanner to print debug info. Contributed by Yiqun Lin
This commit is contained in:
parent
24249115bf
commit
bed69d18e6
@ -158,6 +158,7 @@ private void applyStep(Step nextStep, DiskBalancerVolumeSet currentSet,
|
|||||||
|
|
||||||
// since the volume data changed , we need to recompute the DataDensity.
|
// since the volume data changed , we need to recompute the DataDensity.
|
||||||
currentSet.computeVolumeDataDensity();
|
currentSet.computeVolumeDataDensity();
|
||||||
|
printQueue(currentSet.getSortedQueue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,7 +185,7 @@ private Step computeMove(DiskBalancerVolumeSet currentSet,
|
|||||||
if (maxLowVolumeCanReceive <= 0) {
|
if (maxLowVolumeCanReceive <= 0) {
|
||||||
LOG.debug("{} Skipping disk from computation. Maximum data size " +
|
LOG.debug("{} Skipping disk from computation. Maximum data size " +
|
||||||
"achieved.", lowVolume.getPath());
|
"achieved.", lowVolume.getPath());
|
||||||
lowVolume.setSkip(true);
|
skipVolume(currentSet, lowVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
long maxHighVolumeCanGive = highVolume.getUsed() -
|
long maxHighVolumeCanGive = highVolume.getUsed() -
|
||||||
@ -195,7 +196,7 @@ private Step computeMove(DiskBalancerVolumeSet currentSet,
|
|||||||
if (maxHighVolumeCanGive <= 0) {
|
if (maxHighVolumeCanGive <= 0) {
|
||||||
LOG.debug(" {} Skipping disk from computation. Minimum data size " +
|
LOG.debug(" {} Skipping disk from computation. Minimum data size " +
|
||||||
"achieved.", highVolume.getPath());
|
"achieved.", highVolume.getPath());
|
||||||
highVolume.setSkip(true);
|
skipVolume(currentSet, highVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -219,17 +220,20 @@ private Step computeMove(DiskBalancerVolumeSet currentSet,
|
|||||||
*/
|
*/
|
||||||
private void skipVolume(DiskBalancerVolumeSet currentSet,
|
private void skipVolume(DiskBalancerVolumeSet currentSet,
|
||||||
DiskBalancerVolume volume) {
|
DiskBalancerVolume volume) {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
String message = String.format(
|
String message =
|
||||||
|
String.format(
|
||||||
"Skipping volume. Volume : %s " +
|
"Skipping volume. Volume : %s " +
|
||||||
"Type : %s Target " +
|
"Type : %s Target " +
|
||||||
"Number of bytes : %f lowVolume dfsUsed : %d. Skipping this " +
|
"Number of bytes : %f lowVolume dfsUsed : %d. Skipping this " +
|
||||||
"volume from all future balancing calls.", volume.getPath(),
|
"volume from all future balancing calls.", volume.getPath(),
|
||||||
volume.getStorageType(),
|
volume.getStorageType(),
|
||||||
currentSet.getIdealUsed() * volume.getCapacity(), volume.getUsed());
|
currentSet.getIdealUsed() * volume.getCapacity(),
|
||||||
volume.setSkip(true);
|
volume.getUsed());
|
||||||
LOG.debug(message);
|
LOG.debug(message);
|
||||||
}
|
}
|
||||||
|
volume.setSkip(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Removes all volumes which are part of the volumeSet but skip flag is set.
|
// Removes all volumes which are part of the volumeSet but skip flag is set.
|
||||||
private void removeSkipVolumes(DiskBalancerVolumeSet currentSet) {
|
private void removeSkipVolumes(DiskBalancerVolumeSet currentSet) {
|
||||||
@ -242,6 +246,7 @@ private void removeSkipVolumes(DiskBalancerVolumeSet currentSet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentSet.computeVolumeDataDensity();
|
currentSet.computeVolumeDataDensity();
|
||||||
|
printQueue(currentSet.getSortedQueue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -251,14 +256,14 @@ private void removeSkipVolumes(DiskBalancerVolumeSet currentSet) {
|
|||||||
* @param queue - Queue
|
* @param queue - Queue
|
||||||
*/
|
*/
|
||||||
private void printQueue(TreeSet<DiskBalancerVolume> queue) {
|
private void printQueue(TreeSet<DiskBalancerVolume> queue) {
|
||||||
String format = String.format("First Volume : %s, DataDensity : %f",
|
if (LOG.isDebugEnabled()) {
|
||||||
queue.first().getPath(),
|
String format =
|
||||||
queue.first().getVolumeDataDensity());
|
String.format(
|
||||||
LOG.info(format);
|
"First Volume : %s, DataDensity : %f, " +
|
||||||
|
"Last Volume : %s, DataDensity : %f",
|
||||||
format = String
|
queue.first().getPath(), queue.first().getVolumeDataDensity(),
|
||||||
.format("Last Volume : %s, DataDensity : %f%n", queue.last().getPath(),
|
queue.last().getPath(), queue.last().getVolumeDataDensity());
|
||||||
queue.last().getVolumeDataDensity());
|
LOG.debug(format);
|
||||||
LOG.info(format);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user