HBASE-11708 RegionSplitter incorrectly calculates splitcount

when split table using the util(UniformSplit or HexStringSplit),
with "-r" option, the caculation of splitCount in funciton rollingSplit
may be wrong.

Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
shuai.lou 2014-08-14 17:51:08 -07:00 committed by Andrew Purtell
parent a783281b72
commit dad56cee19
1 changed files with 10 additions and 3 deletions

View File

@ -532,16 +532,20 @@ public class RegionSplitter {
admin.split(table.getTableName(), split); admin.split(table.getTableName(), split);
LinkedList<Pair<byte[], byte[]>> finished = Lists.newLinkedList(); LinkedList<Pair<byte[], byte[]>> finished = Lists.newLinkedList();
LinkedList<Pair<byte[], byte[]>> local_finished = Lists.newLinkedList();
if (conf.getBoolean("split.verify", true)) { if (conf.getBoolean("split.verify", true)) {
// we need to verify and rate-limit our splits // we need to verify and rate-limit our splits
outstanding.addLast(dr); outstanding.addLast(dr);
// with too many outstanding splits, wait for some to finish // with too many outstanding splits, wait for some to finish
while (outstanding.size() >= MAX_OUTSTANDING) { while (outstanding.size() >= MAX_OUTSTANDING) {
finished = splitScan(outstanding, table, splitAlgo); LOG.debug("Wait for outstanding splits " + outstanding.size());
if (finished.isEmpty()) { local_finished = splitScan(outstanding, table, splitAlgo);
if (local_finished.isEmpty()) {
Thread.sleep(30 * 1000); Thread.sleep(30 * 1000);
} else { } else {
outstanding.removeAll(finished); finished.addAll(local_finished);
outstanding.removeAll(local_finished);
LOG.debug(local_finished.size() + " outstanding splits finished");
} }
} }
} else { } else {
@ -565,6 +569,7 @@ public class RegionSplitter {
} }
if (conf.getBoolean("split.verify", true)) { if (conf.getBoolean("split.verify", true)) {
while (!outstanding.isEmpty()) { while (!outstanding.isEmpty()) {
LOG.debug("Finally Wait for outstanding splits " + outstanding.size());
LinkedList<Pair<byte[], byte[]>> finished = splitScan(outstanding, LinkedList<Pair<byte[], byte[]>> finished = splitScan(outstanding,
table, splitAlgo); table, splitAlgo);
if (finished.isEmpty()) { if (finished.isEmpty()) {
@ -574,7 +579,9 @@ public class RegionSplitter {
for (Pair<byte[], byte[]> region : finished) { for (Pair<byte[], byte[]> region : finished) {
splitOut.writeChars("- " + splitAlgo.rowToStr(region.getFirst()) splitOut.writeChars("- " + splitAlgo.rowToStr(region.getFirst())
+ " " + splitAlgo.rowToStr(region.getSecond()) + "\n"); + " " + splitAlgo.rowToStr(region.getSecond()) + "\n");
splitCount++;
} }
LOG.debug("Finally " + finished.size() + " outstanding splits finished");
} }
} }
} }