in hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java [605:803]
public boolean doCommandLine(final String[] args) {
if (args.length < 2) {
printUsage(null);
return false;
}
try {
for (int i = 0; i < args.length; i++) {
String cmd = args[i];
if (cmd.equals("-h") || cmd.startsWith("--h")) {
printUsage(null);
return false;
}
final String startTimeArgKey = "--starttime=";
if (cmd.startsWith(startTimeArgKey)) {
startTime = Long.parseLong(cmd.substring(startTimeArgKey.length()));
continue;
}
final String endTimeArgKey = "--endtime=";
if (cmd.startsWith(endTimeArgKey)) {
endTime = Long.parseLong(cmd.substring(endTimeArgKey.length()));
continue;
}
final String includeDeletedCellsArgKey = "--raw";
if (cmd.equals(includeDeletedCellsArgKey)) {
includeDeletedCells = true;
continue;
}
final String versionsArgKey = "--versions=";
if (cmd.startsWith(versionsArgKey)) {
versions = Integer.parseInt(cmd.substring(versionsArgKey.length()));
continue;
}
final String batchArgKey = "--batch=";
if (cmd.startsWith(batchArgKey)) {
batch = Integer.parseInt(cmd.substring(batchArgKey.length()));
continue;
}
final String familiesArgKey = "--families=";
if (cmd.startsWith(familiesArgKey)) {
families = cmd.substring(familiesArgKey.length());
continue;
}
final String rowPrefixesKey = "--row-prefixes=";
if (cmd.startsWith(rowPrefixesKey)) {
rowPrefixes = cmd.substring(rowPrefixesKey.length());
continue;
}
final String delimiterArgKey = "--delimiter=";
if (cmd.startsWith(delimiterArgKey)) {
delimiter = cmd.substring(delimiterArgKey.length());
continue;
}
final String deprecatedSleepToReCompareKey = "--recomparesleep=";
final String sleepToReCompareKey = "--recompareSleep=";
if (cmd.startsWith(deprecatedSleepToReCompareKey)) {
LOG.warn("--recomparesleep is deprecated and will be removed in 4.0.0."
+ " Use --recompareSleep instead.");
sleepMsBeforeReCompare =
Integer.parseInt(cmd.substring(deprecatedSleepToReCompareKey.length()));
continue;
}
if (cmd.startsWith(sleepToReCompareKey)) {
sleepMsBeforeReCompare = Integer.parseInt(cmd.substring(sleepToReCompareKey.length()));
continue;
}
final String verboseKey = "--verbose";
if (cmd.startsWith(verboseKey)) {
verbose = true;
continue;
}
final String sourceSnapshotNameArgKey = "--sourceSnapshotName=";
if (cmd.startsWith(sourceSnapshotNameArgKey)) {
sourceSnapshotName = cmd.substring(sourceSnapshotNameArgKey.length());
continue;
}
final String sourceSnapshotTmpDirArgKey = "--sourceSnapshotTmpDir=";
if (cmd.startsWith(sourceSnapshotTmpDirArgKey)) {
sourceSnapshotTmpDir = cmd.substring(sourceSnapshotTmpDirArgKey.length());
continue;
}
final String peerSnapshotNameArgKey = "--peerSnapshotName=";
if (cmd.startsWith(peerSnapshotNameArgKey)) {
peerSnapshotName = cmd.substring(peerSnapshotNameArgKey.length());
continue;
}
final String peerSnapshotTmpDirArgKey = "--peerSnapshotTmpDir=";
if (cmd.startsWith(peerSnapshotTmpDirArgKey)) {
peerSnapshotTmpDir = cmd.substring(peerSnapshotTmpDirArgKey.length());
continue;
}
final String peerFSAddressArgKey = "--peerFSAddress=";
if (cmd.startsWith(peerFSAddressArgKey)) {
peerFSAddress = cmd.substring(peerFSAddressArgKey.length());
continue;
}
final String peerHBaseRootAddressArgKey = "--peerHBaseRootAddress=";
if (cmd.startsWith(peerHBaseRootAddressArgKey)) {
peerHBaseRootAddress = cmd.substring(peerHBaseRootAddressArgKey.length());
continue;
}
final String peerTableNameArgKey = "--peerTableName=";
if (cmd.startsWith(peerTableNameArgKey)) {
peerTableName = cmd.substring(peerTableNameArgKey.length());
continue;
}
final String reCompareThreadArgs = "--recompareThreads=";
if (cmd.startsWith(reCompareThreadArgs)) {
reCompareThreads = Integer.parseInt(cmd.substring(reCompareThreadArgs.length()));
continue;
}
final String reCompareTriesKey = "--recompareTries=";
if (cmd.startsWith(reCompareTriesKey)) {
reCompareTries = Integer.parseInt(cmd.substring(reCompareTriesKey.length()));
continue;
}
final String reCompareBackoffExponentKey = "--recompareBackoffExponent=";
if (cmd.startsWith(reCompareBackoffExponentKey)) {
reCompareBackoffExponent =
Integer.parseInt(cmd.substring(reCompareBackoffExponentKey.length()));
continue;
}
if (cmd.startsWith("--")) {
printUsage("Invalid argument '" + cmd + "'");
return false;
}
if (i == args.length - 2) {
if (isPeerQuorumAddress(cmd)) {
peerQuorumAddress = cmd;
} else {
peerId = cmd;
}
}
if (i == args.length - 1) {
tableName = cmd;
}
}
if (
(sourceSnapshotName != null && sourceSnapshotTmpDir == null)
|| (sourceSnapshotName == null && sourceSnapshotTmpDir != null)
) {
printUsage("Source snapshot name and snapshot temp location should be provided"
+ " to use snapshots in source cluster");
return false;
}
if (
peerSnapshotName != null || peerSnapshotTmpDir != null || peerFSAddress != null
|| peerHBaseRootAddress != null
) {
if (
peerSnapshotName == null || peerSnapshotTmpDir == null || peerFSAddress == null
|| peerHBaseRootAddress == null
) {
printUsage(
"Peer snapshot name, peer snapshot temp location, Peer HBase root address and "
+ "peer FSAddress should be provided to use snapshots in peer cluster");
return false;
}
}
// This is to avoid making recompare calls to source/peer tables when snapshots are used
if ((sourceSnapshotName != null || peerSnapshotName != null) && sleepMsBeforeReCompare > 0) {
printUsage(
"Using sleepMsBeforeReCompare along with snapshots is not allowed as snapshots are"
+ " immutable");
return false;
}
} catch (Exception e) {
LOG.error("Failed to parse commandLine arguments", e);
printUsage("Can't start because " + e.getMessage());
return false;
}
return true;
}