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