HBASE-26136 Backport HBASE-25723 "Temporarily remove the trace support for RegionScanner.next" to branch-2 (#3623)

13/17 commits of HBASE-22120, original commit 7f90c2201f6a17d2e2d031505c35ae7c2b1ed7ea

Co-authored-by: Duo Zhang <zhangduo@apache.org>

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Tak Lon (Stephen) Wu 2021-08-24 17:45:04 -07:00
parent 8f160109cd
commit c639d6f353
2 changed files with 28 additions and 31 deletions

View File

@ -255,39 +255,37 @@ class RegionScannerImpl implements RegionScanner, Shipper, RpcCallback {
@Override @Override
public boolean nextRaw(List<Cell> outResults, ScannerContext scannerContext) throws IOException { public boolean nextRaw(List<Cell> outResults, ScannerContext scannerContext) throws IOException {
return TraceUtil.trace(() -> { if (storeHeap == null) {
if (storeHeap == null) { // scanner is closed
// scanner is closed throw new UnknownScannerException("Scanner was closed");
throw new UnknownScannerException("Scanner was closed"); }
} boolean moreValues = false;
boolean moreValues = false; if (outResults.isEmpty()) {
if (outResults.isEmpty()) { // Usually outResults is empty. This is true when next is called
// Usually outResults is empty. This is true when next is called // to handle scan or get operation.
// to handle scan or get operation. moreValues = nextInternal(outResults, scannerContext);
moreValues = nextInternal(outResults, scannerContext); } else {
} else { List<Cell> tmpList = new ArrayList<>();
List<Cell> tmpList = new ArrayList<>(); moreValues = nextInternal(tmpList, scannerContext);
moreValues = nextInternal(tmpList, scannerContext); outResults.addAll(tmpList);
outResults.addAll(tmpList); }
}
region.addReadRequestsCount(1); region.addReadRequestsCount(1);
if (region.getMetrics() != null) { if (region.getMetrics() != null) {
region.getMetrics().updateReadRequestCount(); region.getMetrics().updateReadRequestCount();
} }
// If the size limit was reached it means a partial Result is being returned. Returning a // If the size limit was reached it means a partial Result is being returned. Returning a
// partial Result means that we should not reset the filters; filters should only be reset in // partial Result means that we should not reset the filters; filters should only be reset in
// between rows // between rows
if (!scannerContext.mayHaveMoreCellsInRow()) { if (!scannerContext.mayHaveMoreCellsInRow()) {
resetFilters(); resetFilters();
} }
if (isFilterDoneInternal()) { if (isFilterDoneInternal()) {
moreValues = false; moreValues = false;
} }
return moreValues; return moreValues;
}, () -> region.createRegionSpan("RegionScanner.next"));
} }
/** /**

View File

@ -178,7 +178,6 @@ public class TestHRegionTracing {
} }
assertSpan("Region.getScanner"); assertSpan("Region.getScanner");
assertSpan("RegionScanner.reseek"); assertSpan("RegionScanner.reseek");
assertSpan("RegionScanner.next");
assertSpan("RegionScanner.close"); assertSpan("RegionScanner.close");
} }
} }