diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplica.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplica.java index 7102fcd28f..26651a033e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplica.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplica.java @@ -291,6 +291,12 @@ public URI getMetadataURI() { public LengthInputStream getMetadataInputStream(long offset) throws IOException { final File meta = getMetaFile(); + if (NativeIO.isAvailable()) { + return new LengthInputStream( + getFileIoProvider().getShareDeleteFileInputStream( + getVolume(), meta, offset), + meta.length()); + } return new LengthInputStream( getFileIoProvider().openAndSeek(getVolume(), meta, offset), meta.length());