|
@@ -17,7 +17,6 @@
|
|
|
*/
|
|
|
package org.apache.hadoop.hdfs.server.balancer;
|
|
|
|
|
|
-import static org.apache.hadoop.thirdparty.com.google.common.base.Preconditions.checkArgument;
|
|
|
import static org.apache.hadoop.hdfs.protocol.BlockType.CONTIGUOUS;
|
|
|
|
|
|
import java.io.IOException;
|
|
@@ -75,7 +74,7 @@ import org.apache.hadoop.util.Time;
|
|
|
import org.apache.hadoop.util.Tool;
|
|
|
import org.apache.hadoop.util.ToolRunner;
|
|
|
|
|
|
-import org.apache.hadoop.thirdparty.com.google.common.base.Preconditions;
|
|
|
+import org.apache.hadoop.util.Preconditions;
|
|
|
|
|
|
/** <p>The balancer is a tool that balances disk space usage on an HDFS cluster
|
|
|
* when some datanodes become full or when new empty nodes join the cluster.
|
|
@@ -998,7 +997,7 @@ public class Balancer {
|
|
|
try {
|
|
|
for(int i = 0; i < args.length; i++) {
|
|
|
if ("-threshold".equalsIgnoreCase(args[i])) {
|
|
|
- checkArgument(++i < args.length,
|
|
|
+ Preconditions.checkArgument(++i < args.length,
|
|
|
"Threshold value is missing: args = " + Arrays.toString(args));
|
|
|
try {
|
|
|
double threshold = Double.parseDouble(args[i]);
|
|
@@ -1015,7 +1014,7 @@ public class Balancer {
|
|
|
throw e;
|
|
|
}
|
|
|
} else if ("-policy".equalsIgnoreCase(args[i])) {
|
|
|
- checkArgument(++i < args.length,
|
|
|
+ Preconditions.checkArgument(++i < args.length,
|
|
|
"Policy value is missing: args = " + Arrays.toString(args));
|
|
|
try {
|
|
|
b.setBalancingPolicy(BalancingPolicy.parse(args[i]));
|
|
@@ -1036,7 +1035,7 @@ public class Balancer {
|
|
|
i = processHostList(args, i, "source", sourceNodes);
|
|
|
b.setSourceNodes(sourceNodes);
|
|
|
} else if ("-blockpools".equalsIgnoreCase(args[i])) {
|
|
|
- checkArgument(
|
|
|
+ Preconditions.checkArgument(
|
|
|
++i < args.length,
|
|
|
"blockpools value is missing: args = "
|
|
|
+ Arrays.toString(args));
|
|
@@ -1045,7 +1044,7 @@ public class Balancer {
|
|
|
+ blockpools.toString());
|
|
|
b.setBlockpools(blockpools);
|
|
|
} else if ("-idleiterations".equalsIgnoreCase(args[i])) {
|
|
|
- checkArgument(++i < args.length,
|
|
|
+ Preconditions.checkArgument(++i < args.length,
|
|
|
"idleiterations value is missing: args = " + Arrays
|
|
|
.toString(args));
|
|
|
int maxIdleIteration = Integer.parseInt(args[i]);
|
|
@@ -1061,7 +1060,7 @@ public class Balancer {
|
|
|
b.setRunAsService(true);
|
|
|
LOG.info("Balancer will run as a long running service");
|
|
|
} else if ("-hotBlockTimeInterval".equalsIgnoreCase(args[i])) {
|
|
|
- checkArgument(++i < args.length,
|
|
|
+ Preconditions.checkArgument(++i < args.length,
|
|
|
"hotBlockTimeInterval value is missing: args = "
|
|
|
+ Arrays.toString(args));
|
|
|
long hotBlockTimeInterval = Long.parseLong(args[i]);
|
|
@@ -1077,7 +1076,7 @@ public class Balancer {
|
|
|
+ Arrays.toString(args));
|
|
|
}
|
|
|
}
|
|
|
- checkArgument(excludedNodes == null || includedNodes == null,
|
|
|
+ Preconditions.checkArgument(excludedNodes == null || includedNodes == null,
|
|
|
"-exclude and -include options cannot be specified together.");
|
|
|
} catch(RuntimeException e) {
|
|
|
printUsage(System.err);
|