diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java index bd998770e7e4..f75e7e125350 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java @@ -751,6 +751,12 @@ public boolean next(List 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) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java index 6b5e7f52fbdc..d9e98615ce9b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java @@ -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;