HBASE-13601 Connection leak during log splitting. (Abhishek Singh Chouhan)
This commit is contained in:
parent
aabf6ea2f6
commit
235dc9734f
|
@ -278,6 +278,7 @@ public class WALFactory {
|
|||
long startWaiting = EnvironmentEdgeManager.currentTime();
|
||||
long openTimeout = timeoutMillis + startWaiting;
|
||||
int nbAttempt = 0;
|
||||
FSDataInputStream stream = null;
|
||||
while (true) {
|
||||
try {
|
||||
if (lrClass != ProtobufLogReader.class) {
|
||||
|
@ -286,7 +287,7 @@ public class WALFactory {
|
|||
reader.init(fs, path, conf, null);
|
||||
return reader;
|
||||
} else {
|
||||
FSDataInputStream stream = fs.open(path);
|
||||
stream = fs.open(path);
|
||||
// Note that zero-length file will fail to read PB magic, and attempt to create
|
||||
// a non-PB reader and fail the same way existing code expects it to. If we get
|
||||
// rid of the old reader entirely, we need to handle 0-size files differently from
|
||||
|
@ -300,6 +301,14 @@ public class WALFactory {
|
|||
return reader;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
}
|
||||
} catch (IOException exception) {
|
||||
LOG.warn("Could not close FSDataInputStream" + exception.getMessage());
|
||||
LOG.debug("exception details", exception);
|
||||
}
|
||||
String msg = e.getMessage();
|
||||
if (msg != null && (msg.contains("Cannot obtain block length")
|
||||
|| msg.contains("Could not obtain the last block")
|
||||
|
|
Loading…
Reference in New Issue