HBASE-16012 Major compaction can't work due to obsolete scanner read point in RegionServer (Guanghao Zhang)
This commit is contained in:
parent
6ba67ab8d6
commit
ba631b4d92
@ -5714,12 +5714,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||
}
|
||||
}
|
||||
initializeKVHeap(scanners, joinedScanners, region);
|
||||
} catch (IOException e) {
|
||||
// close all already instantiated scanners before throwing the exception
|
||||
for (KeyValueScanner scanner : instantiatedScanners) {
|
||||
scanner.close();
|
||||
}
|
||||
throw e;
|
||||
} catch (Throwable t) {
|
||||
throw handleException(instantiatedScanners, t);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5732,6 +5728,26 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||
}
|
||||
}
|
||||
|
||||
private IOException handleException(List<KeyValueScanner> instantiatedScanners,
|
||||
Throwable t) {
|
||||
// remove scaner read point before throw the exception
|
||||
scannerReadPoints.remove(this);
|
||||
if (storeHeap != null) {
|
||||
storeHeap.close();
|
||||
storeHeap = null;
|
||||
if (joinedHeap != null) {
|
||||
joinedHeap.close();
|
||||
joinedHeap = null;
|
||||
}
|
||||
} else {
|
||||
// close all already instantiated scanners before throwing the exception
|
||||
for (KeyValueScanner scanner : instantiatedScanners) {
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
return t instanceof IOException ? (IOException) t : new IOException(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxResultSize() {
|
||||
return maxResultSize;
|
||||
|
@ -305,19 +305,23 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||
RegionScanner s = rsh.s;
|
||||
LOG.info("Scanner " + this.scannerName + " lease expired on region "
|
||||
+ s.getRegionInfo().getRegionNameAsString());
|
||||
Region region = null;
|
||||
try {
|
||||
Region region = regionServer.getRegion(s.getRegionInfo().getRegionName());
|
||||
region = regionServer.getRegion(s.getRegionInfo().getRegionName());
|
||||
if (region != null && region.getCoprocessorHost() != null) {
|
||||
region.getCoprocessorHost().preScannerClose(s);
|
||||
}
|
||||
|
||||
s.close();
|
||||
if (region != null && region.getCoprocessorHost() != null) {
|
||||
region.getCoprocessorHost().postScannerClose(s);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("Closing scanner for "
|
||||
+ s.getRegionInfo().getRegionNameAsString(), e);
|
||||
LOG.error("Closing scanner for " + s.getRegionInfo().getRegionNameAsString(), e);
|
||||
} finally {
|
||||
try {
|
||||
s.close();
|
||||
if (region != null && region.getCoprocessorHost() != null) {
|
||||
region.getCoprocessorHost().postScannerClose(s);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("Closing scanner for " + s.getRegionInfo().getRegionNameAsString(), e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG.warn("Scanner " + this.scannerName + " lease expired, but no related" +
|
||||
|
Loading…
x
Reference in New Issue
Block a user