Skip to content

Commit

Permalink
HBASE-26944 Possible resource leak while creating new region scanner (#…
Browse files Browse the repository at this point in the history
…4339)

* HBASE-26944 Possible resource leak while creating new region scanner

Signed-off-by: Duo Zhang <[email protected]>
  • Loading branch information
pankaj72981 authored Apr 15, 2022
1 parent f990f56 commit 62e3efc
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3203,8 +3203,16 @@ private Pair<String, RegionScannerHolder> newRegionScanner(ScanRequest request,
RegionScannerImpl coreScanner = region.getScanner(scan);
Shipper shipper = coreScanner;
RegionScanner scanner = coreScanner;
if (region.getCoprocessorHost() != null) {
scanner = region.getCoprocessorHost().postScannerOpen(scan, scanner);
try {
if (region.getCoprocessorHost() != null) {
scanner = region.getCoprocessorHost().postScannerOpen(scan, scanner);
}
} catch (Exception e) {
// Although region coprocessor is for advanced users and they should take care of the
// implementation to not damage the HBase system, closing the scanner on exception here does
// not have any bad side effect, so let's do it
scanner.close();
throw e;
}
long scannerId = scannerIdGenerator.generateNewScannerId();
builder.setScannerId(scannerId);
Expand Down

0 comments on commit 62e3efc

Please sign in to comment.