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 b715c0902d08..412780f12fd0 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 @@ -2669,9 +2669,11 @@ private Result get(Get get, HRegion region, RegionScannersCloseCallBack closeCal scan.setLoadColumnFamiliesOnDemand(region.isLoadingCfsOnDemandDefault()); } - ScannerContext scannerContext = ScannerContext.newBuilder() + ScannerContext scannerContext = get.getMaxResultSize() > 0 + ? ScannerContext.newBuilder() .setSizeLimit(LimitScope.BETWEEN_CELLS, get.getMaxResultSize(), get.getMaxResultSize()) - .build(); + .build() + : null; RegionScannerImpl scanner = null; try { @@ -2702,7 +2704,7 @@ private Result get(Get get, HRegion region, RegionScannersCloseCallBack closeCal region.metricsUpdateForGet(results, before); return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale, - scannerContext.mayHaveMoreCellsInRow()); + scannerContext != null && scannerContext.mayHaveMoreCellsInRow()); } private void checkBatchSizeAndLogLargeSize(MultiRequest request) throws ServiceException { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScannerImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScannerImpl.java index 612bb5c9e371..333999fade78 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScannerImpl.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScannerImpl.java @@ -240,6 +240,9 @@ public synchronized boolean next(List outResults, ScannerContext scannerCo } region.startRegionOperation(Operation.SCAN); try { + if (scannerContext == null) { + scannerContext = defaultScannerContext; + } return nextRaw(outResults, scannerContext); } finally { region.closeRegionOperation(Operation.SCAN);