diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java index d3c877284e3..266b4f3c74b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java @@ -2855,9 +2855,9 @@ public class RSRpcServices implements HBaseRPCErrorHandler, // Heartbeat messages occur when the time limit has been reached. builder.setHeartbeatMessage(timeLimitReached); if (timeLimitReached && rsh.needCursor) { - Cell readingCell = scannerContext.getPeekedCellInHeartbeat(); - if (readingCell != null) { - builder.setCursor(ProtobufUtil.toCursor(readingCell)); + Cell cursorCell = scannerContext.getLastPeekedCell(); + if (cursorCell != null) { + builder.setCursor(ProtobufUtil.toCursor(cursorCell)); } } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScannerContext.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScannerContext.java index ee53a9513f0..6831c919770 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScannerContext.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScannerContext.java @@ -19,8 +19,6 @@ package org.apache.hadoop.hbase.regionserver; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.HBaseInterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceAudience; @@ -97,7 +95,7 @@ public class ScannerContext { boolean keepProgress; private static boolean DEFAULT_KEEP_PROGRESS = false; - private Cell peekedCellInHeartbeat = null; + private Cell lastPeekedCell = null; /** * Tracks the relevant server side metrics during scans. null when metrics should not be tracked @@ -324,12 +322,12 @@ public class ScannerContext { || checkTimeLimit(checkerScope); } - public Cell getPeekedCellInHeartbeat() { - return peekedCellInHeartbeat; + public Cell getLastPeekedCell() { + return lastPeekedCell; } - public void setPeekedCellInHeartbeat(Cell peekedCellInHeartbeat) { - this.peekedCellInHeartbeat = peekedCellInHeartbeat; + public void setLastPeekedCell(Cell lastPeekedCell) { + this.lastPeekedCell = lastPeekedCell; } @Override 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 7c34b870300..fbdf7b2f1b2 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 @@ -46,11 +46,11 @@ import org.apache.hadoop.hbase.filter.Filter; import org.apache.hadoop.hbase.regionserver.ScannerContext.LimitScope; import org.apache.hadoop.hbase.regionserver.ScannerContext.NextState; import org.apache.hadoop.hbase.regionserver.handler.ParallelSeekHandler; -import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.regionserver.querymatcher.CompactionScanQueryMatcher; import org.apache.hadoop.hbase.regionserver.querymatcher.LegacyScanQueryMatcher; import org.apache.hadoop.hbase.regionserver.querymatcher.ScanQueryMatcher; import org.apache.hadoop.hbase.regionserver.querymatcher.UserScanQueryMatcher; +import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.CollectionUtils; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; @@ -540,7 +540,6 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner if ((kvsScanned % cellsPerHeartbeatCheck == 0)) { scannerContext.updateTimeProgress(); if (scannerContext.checkTimeLimit(LimitScope.BETWEEN_CELLS)) { - scannerContext.setPeekedCellInHeartbeat(prevCell); return scannerContext.setScannerState(NextState.TIME_LIMIT_REACHED).hasMoreValues(); } } @@ -548,6 +547,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner if (prevCell != cell) ++kvsScanned; // Do object compare - we set prevKV from the same heap. checkScanOrder(prevCell, cell, comparator); prevCell = cell; + scannerContext.setLastPeekedCell(cell); topChanged = false; ScanQueryMatcher.MatchCode qcode = matcher.match(cell); switch (qcode) {