HDFS-13246. FileInputStream redundant closes in readReplicasFromCache. Contributed by liaoyuxiangqin.
This commit is contained in:
parent
3a0f4bc0d5
commit
5ff22d4c3a
@ -812,7 +812,6 @@ private boolean readReplicasFromCache(ReplicaMap volumeMap,
|
||||
break;
|
||||
}
|
||||
}
|
||||
inputStream.close();
|
||||
// Now it is safe to add the replica into volumeMap
|
||||
// In case of any exception during parsing this cache file, fall back
|
||||
// to scan all the files on disk.
|
||||
@ -835,12 +834,13 @@ private boolean readReplicasFromCache(ReplicaMap volumeMap,
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
// close the inputStream
|
||||
IOUtils.closeStream(inputStream);
|
||||
|
||||
if (!fileIoProvider.delete(volume, replicaFile)) {
|
||||
LOG.info("Failed to delete replica cache file: " +
|
||||
replicaFile.getPath());
|
||||
}
|
||||
// close the inputStream
|
||||
IOUtils.closeStream(inputStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user