HDFS-13175. Add more information for checking argument in DiskBalancerVolume.
Contributed by Lei (Eddy) Xu.
(cherry picked from commit 121e1e1280
)
This commit is contained in:
parent
7601489995
commit
c0d8103ba2
|
@ -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