Skip to content

Commit c0f4601

Browse files
committed
HBASE-25709 Close region may stuck when region is compacting and skipped most cells read
1 parent 446f22f commit c0f4601

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,12 @@ public boolean next(List<Cell> outResult, ScannerContext scannerContext) throws
751751
default:
752752
throw new RuntimeException("UNEXPECTED");
753753
}
754+
// when reaching the heartbeat check, try to return from the loop,
755+
// to avoid the cycle of skipped cells. See HBASE-25709
756+
if (kvsScanned % cellsPerHeartbeatCheck == 0) {
757+
return scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues();
758+
}
759+
754760
} while ((cell = this.heap.peek()) != null);
755761

756762
if (count > 0) {

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,9 @@ protected boolean performCompaction(FileDetails fd, InternalScanner scanner, Cel
401401
String compactionName = ThroughputControlUtil.getNameForThrottling(store, "compaction");
402402
long now = 0;
403403
boolean hasMore;
404-
ScannerContext scannerContext =
405-
ScannerContext.newBuilder().setBatchLimit(compactionKVMax).build();
404+
ScannerContext scannerContext = ScannerContext.newBuilder()
405+
.setBatchLimit(compactionKVMax)
406+
.build();
406407

407408
throughputController.start(compactionName);
408409
KeyValueScanner kvs = (scanner instanceof KeyValueScanner) ? (KeyValueScanner) scanner : null;

0 commit comments

Comments
 (0)