* @param args
* @return A struct containing validated options.
* @throws IOException
*/
private static ConsistencyFixCLI.Options parseArgs(String[] args) {
OptionParser parser = new OptionParser();
parser.accepts("help", "print help information");
parser.accepts("url", "The bootstrap url.")
.withRequiredArg()
.describedAs("bootstrapUrl")
.ofType(String.class);
parser.accepts("store", "The store name.")
.withRequiredArg()
.describedAs("storeName")
.ofType(String.class);
parser.accepts("bad-key-file-in",
"Name of bad-key-file-in. " + "Each key must be in hexadecimal format. "
+ "Each key must be on a separate line in the file. ")
.withRequiredArg()
.describedAs("badKeyFileIn")
.ofType(String.class);
parser.accepts("orphan-format",
"Indicates format of bad-key-file-in is of 'orphan' key-values.");
parser.accepts("dry-run",
"Indicates to go through all of the read actions until the point of issuing repair puts. Then, do a 'no-op'.");
parser.accepts("parse-only",
"Indicates to only parse the input file. Does not perform any key queries or repair puts. "
+ "Does bootstrap though so bootstrapUrl and storeName must be specified.");
parser.accepts("bad-key-file-out",
"Name of bad-key-file-out. "
+ "Keys that are not mae consistent are output to this file.")
.withRequiredArg()
.describedAs("badKeyFileOut")
.ofType(String.class);
parser.accepts("parallelism",
"Number of consistency fix messages outstanding in parallel. ")
.withRequiredArg()
.describedAs("parallelism [Default value: " + Options.defaultParallelism + "]")
.ofType(Integer.class);
parser.accepts("progress-period-ops",
"Number of operations between 'info' progress messages. ")
.withRequiredArg()
.describedAs("period (in operations) between outputting progress [Default value: "
+ Options.defaultProgressPeriodOps + "]")
.ofType(Long.class);
parser.accepts("per-server-qps-limit",
"Number of operations that the consistency fixer will issue to any individual server in one second. ")
.withRequiredArg()
.describedAs("perServerQPSLimit [Default value: " + Options.defaultPerServerQPSLimit
+ "]")
.ofType(Long.class);
OptionSet optionSet = parser.parse(args);
if(optionSet.hasArgument("help")) {
try {
parser.printHelpOn(System.out);
} catch(IOException e) {
e.printStackTrace();
}
printUsage();
System.exit(0);