Skip to content

Commit

Permalink
HBASE-25709 Close region may stuck when region is compacting and skip…
Browse files Browse the repository at this point in the history
…ped most cells read
  • Loading branch information
sunhelly committed Apr 9, 2021
1 parent 446f22f commit c0f4601
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,12 @@ public boolean next(List<Cell> outResult, ScannerContext scannerContext) throws
default:
throw new RuntimeException("UNEXPECTED");
}
// when reaching the heartbeat check, try to return from the loop,
// to avoid the cycle of skipped cells. See HBASE-25709
if (kvsScanned % cellsPerHeartbeatCheck == 0) {
return scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues();
}

} while ((cell = this.heap.peek()) != null);

if (count > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,9 @@ protected boolean performCompaction(FileDetails fd, InternalScanner scanner, Cel
String compactionName = ThroughputControlUtil.getNameForThrottling(store, "compaction");
long now = 0;
boolean hasMore;
ScannerContext scannerContext =
ScannerContext.newBuilder().setBatchLimit(compactionKVMax).build();
ScannerContext scannerContext = ScannerContext.newBuilder()
.setBatchLimit(compactionKVMax)
.build();

throughputController.start(compactionName);
KeyValueScanner kvs = (scanner instanceof KeyValueScanner) ? (KeyValueScanner) scanner : null;
Expand Down

0 comments on commit c0f4601

Please sign in to comment.