sunhelly commented on a change in pull request #2882:
URL: https://github.com/apache/hbase/pull/2882#discussion_r558877057
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
##########
@@ -345,7 +345,17 @@ private InternalScanner
postCompactScannerOpen(CompactionRequestImpl request, Sc
+ store.getRegionInfo().getRegionNameAsString() + " because it was
interrupted.");
}
} finally {
- Closeables.close(scanner, true);
+ // createScanner may fail when seeking hfiles encounter Exception, e.g.
even only one hfile
+ // reader encounters java.io.IOException: Invalid HFile block magic:
\x00\x00\x00\x00\x00\x00\x00\x00
+ // and then scanner will be null, but scanners for all the hfiles should
be closed,
+ // or else we will find leak of ESTABLISHED sockets.
+ if (scanner == null) {
+ for (StoreFileScanner sfs : scanners) {
+ sfs.close();
+ }
+ } else {
+ Closeables.close(scanner, true);
Review comment:
Thanks, @saintstack . I check the codes of KVHeap and RegionScanner,
they seem OK. Thanks your suggests, I also think createFileScanners should be
inside the try/finally. If we only close the scanners when InnerScanner is
null, may be we can avoid to close the scanners twice. What do you think?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]