Pārlūkot izejas kodu

HDFS-15080. Fix the issue in reading persistent memory cached data with an offset. Contributed by Feilong He.

(cherry picked from commit 7030722e5d9f376245a9ab0a6a883538b6c55f82)
Rakesh Radhakrishnan 5 gadi atpakaļ
vecāks
revīzija
b1eb47865c

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java

@@ -821,7 +821,7 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
       if (addr != -1) {
         LOG.debug("Get InputStream by cache address.");
         return FsDatasetUtil.getDirectInputStream(
-            addr, info.getBlockDataLength());
+            addr + seekOffset, info.getBlockDataLength() - seekOffset);
       }
       LOG.debug("Get InputStream by cache file path.");
       return FsDatasetUtil.getInputStreamAndSeek(