Apache9 commented on code in PR #6768:
URL: https://github.com/apache/hbase/pull/6768#discussion_r1987041619
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java:
##########
@@ -3191,13 +3192,28 @@ private RegionScannerImpl getScanner(Scan scan,
List<KeyValueScanner> additional
checkFamily(family);
}
}
- return instantiateRegionScanner(scan, additionalScanners, nonceGroup,
nonce);
+
+ regionScanner = instantiateRegionScanner(scan, additionalScanners,
nonceGroup, nonce);
+ return regionScanner;
} finally {
- closeRegionOperation(Operation.SCAN);
+ // close region operation can throw an exception, in that case the
scanner never gets
+ // closed.
+ try {
+ closeRegionOperation(Operation.SCAN);
+ } catch (Throwable t) {
+ throw handleException(t, regionScanner);
+ }
}
}, () -> createRegionSpan("Region.getScanner"));
}
+ private static IOException handleException(Throwable t, RegionScannerImpl
regionScanner) {
+ if (null != regionScanner) {
+ regionScanner.close();
+ }
+ return t instanceof IOException ? (IOException) t : new IOException(t);
Review Comment:
I think here we could just use the safe rethrow feature? Just inline this
method and type "throw t;". It could pass compilation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]