HDFS-17526. getMetadataInputStream should use getShareDeleteFileInputStream for windows (#6826). Contributed by Danny Becker

This commit is contained in:
dannytbecker 2024-09-22 23:46:25 -07:00 committed by GitHub
parent d8ca2dbe34
commit 50fcfd8b29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -291,6 +291,12 @@ public URI getMetadataURI() {
public LengthInputStream getMetadataInputStream(long offset) public LengthInputStream getMetadataInputStream(long offset)
throws IOException { throws IOException {
final File meta = getMetaFile(); final File meta = getMetaFile();
if (NativeIO.isAvailable()) {
return new LengthInputStream(
getFileIoProvider().getShareDeleteFileInputStream(
getVolume(), meta, offset),
meta.length());
}
return new LengthInputStream( return new LengthInputStream(
getFileIoProvider().openAndSeek(getVolume(), meta, offset), getFileIoProvider().openAndSeek(getVolume(), meta, offset),
meta.length()); meta.length());