HDFS-11229. HDFS-11056 failed to close meta file. Contributed by Wei-Chiu Chuang.
This commit is contained in:
parent
6c93c1870c
commit
292bd78b44
|
@ -1188,9 +1188,10 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
|
|||
int offsetInChecksum = BlockMetadataHeader.getHeaderSize() +
|
||||
(int)(onDiskLen / bytesPerChecksum * checksumSize);
|
||||
byte[] lastChecksum = new byte[checksumSize];
|
||||
RandomAccessFile raf = new RandomAccessFile(metaFile, "r");
|
||||
raf.seek(offsetInChecksum);
|
||||
raf.read(lastChecksum, 0, checksumSize);
|
||||
try (RandomAccessFile raf = new RandomAccessFile(metaFile, "r")) {
|
||||
raf.seek(offsetInChecksum);
|
||||
raf.read(lastChecksum, 0, checksumSize);
|
||||
}
|
||||
return lastChecksum;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue