NihalJain commented on code in PR #135: URL: https://github.com/apache/hbase-operator-tools/pull/135#discussion_r1303265833
########## hbase-hbck2/README.md: ########## @@ -173,6 +179,10 @@ Command: If -i or --inputFiles is specified, pass one or more input file names. Each file contains PID's, one per line. For example: $ HBCK2 bypass -i fileName1 fileName2 + If -b or --batchSize is specified, the command processes those many + procedures at a time in a batch-ed manner; Consider using this option, + if the list of procedures is huge, to avoid CallTimeoutException. + $ HBCK2 bypass -i fileName1 fileName2 -b 500 Review Comment: Done! ########## hbase-hbck2/src/main/java/org/apache/hbase/HBCK2.java: ########## @@ -450,42 +461,82 @@ List<Future<List<String>>> addMissingRegionsInMetaForTables(String... nameSpaceO } List<Long> assigns(Hbck hbck, String[] args) throws IOException { + // Init Options options = new Options(); Option override = Option.builder("o").longOpt("override").build(); Option inputFile = Option.builder("i").longOpt("inputFiles").build(); + Option batchOpt = Option.builder("b").longOpt("batchSize").hasArg().type(Integer.class).build(); options.addOption(override); options.addOption(inputFile); - // Parse command-line. + options.addOption(batchOpt); + + // Parse command-line CommandLine commandLine = getCommandLine(args, options); if (commandLine == null) { return null; } + + int batchSize = getBatchSize(batchOpt, commandLine); boolean overrideFlag = commandLine.hasOption(override.getOpt()); boolean inputFileFlag = commandLine.hasOption(inputFile.getOpt()); + List<String> argList = commandLine.getArgList(); - return hbck.assigns(getFromArgsOrFiles(argList, inputFileFlag), overrideFlag); + List<String> regionList = getFromArgsOrFiles(argList, inputFileFlag); + + // Process here + if (batchSize == NO_BATCH_SIZE) { + return hbck.assigns(regionList, overrideFlag); + } else { + List<Long> pidList = new ArrayList<>(argList.size()); + final List<List<String>> batch = Lists.partition(regionList, batchSize); Review Comment: Verified. ``` $ export HBCK_JAR=hbase-hbck2-1.3.0-SNAPSHOT.jar $ hbase --config conf hbck -j $HBCK_JAR bypass -b 10 1 2 3 4 . . 16:06:43.278 [main] INFO org.apache.hbase.HBCK2 - Batch size set to: 10 16:06:43.826 [main] INFO org.apache.hbase.HBCK2 - Processing batch #0 false, false, false, false $ hbase --config conf hbck -j $HBCK_JAR assigns -b 10 1 2 3 4 . . 16:08:02.168 [main] INFO org.apache.hbase.HBCK2 - Batch size set to: 10 16:08:02.170 [main] INFO org.apache.hbase.HBCK2 - Processing batch #0 [-1, -1, -1, -1] $ hbase --config conf hbck -j $HBCK_JAR unassigns -b 10 1 2 3 4 . . 16:08:12.736 [main] INFO org.apache.hbase.HBCK2 - Batch size set to: 10 16:08:12.738 [main] INFO org.apache.hbase.HBCK2 - Processing batch #0 -1, -1, -1, -1 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org