HDFS-13175. Add more information for checking argument in DiskBalancerVolume.
Contributed by Lei (Eddy) Xu.
This commit is contained in:
parent
b0d3c877e3
commit
121e1e1280
|
@ -124,6 +124,14 @@ public class PlanCommand extends Command {
|
|||
throw new IllegalArgumentException("Unable to find the specified node. " +
|
||||
cmd.getOptionValue(DiskBalancerCLI.PLAN));
|
||||
}
|
||||
|
||||
try (FSDataOutputStream beforeStream = create(String.format(
|
||||
DiskBalancerCLI.BEFORE_TEMPLATE,
|
||||
cmd.getOptionValue(DiskBalancerCLI.PLAN)))) {
|
||||
beforeStream.write(getCluster().toJson()
|
||||
.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
this.thresholdPercentage = getThresholdPercentage(cmd);
|
||||
|
||||
LOG.debug("threshold Percentage is {}", this.thresholdPercentage);
|
||||
|
@ -138,14 +146,6 @@ public class PlanCommand extends Command {
|
|||
plan = plans.get(0);
|
||||
}
|
||||
|
||||
|
||||
try (FSDataOutputStream beforeStream = create(String.format(
|
||||
DiskBalancerCLI.BEFORE_TEMPLATE,
|
||||
cmd.getOptionValue(DiskBalancerCLI.PLAN)))) {
|
||||
beforeStream.write(getCluster().toJson()
|
||||
.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
try {
|
||||
if (plan != null && plan.getVolumeSetPlans().size() > 0) {
|
||||
outputLine = String.format("Writing plan to:");
|
||||
|
|
|
@ -144,8 +144,6 @@ class DBNameNodeConnector implements ClusterConnector {
|
|||
// Does it make sense ? Balancer does do that. Right now
|
||||
// we only deal with volumes and not blockPools
|
||||
|
||||
volume.setUsed(report.getDfsUsed());
|
||||
|
||||
volume.setUuid(storage.getStorageID());
|
||||
|
||||
// we will skip this volume for disk balancer if
|
||||
|
|
|
@ -269,7 +269,9 @@ public class DiskBalancerVolume {
|
|||
* @param dfsUsedSpace - dfsUsedSpace for this volume.
|
||||
*/
|
||||
public void setUsed(long dfsUsedSpace) {
|
||||
Preconditions.checkArgument(dfsUsedSpace < this.getCapacity());
|
||||
Preconditions.checkArgument(dfsUsedSpace < this.getCapacity(),
|
||||
"DiskBalancerVolume.setUsed: dfsUsedSpace(%s) < capacity(%s)",
|
||||
dfsUsedSpace, getCapacity());
|
||||
this.used = dfsUsedSpace;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue