Parcourir la source

HDFS-2751. Backport: Datanode may incorrectly drop OS cache behind reads even for short reads. Contributed by Brandon Li

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1365883 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze il y a 13 ans
Parent
commit
c53a1edda5

+ 3 - 0
CHANGES.txt

@@ -120,6 +120,9 @@ Release 1.2.0 - unreleased
     HADOOP-8606. FileSystem.get may return the wrong filesystem (Daryn Sharp 
     via bobby)
 
+    HDFS-2751. Backport: Datanode may incorrectly drop OS cache behind reads
+    even for short reads.  (Brandon Li via szetszwo)
+
 Release 1.1.0 - unreleased
 
   INCOMPATIBLE CHANGES

+ 1 - 1
src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockSender.java

@@ -207,7 +207,7 @@ class BlockSender implements java.io.Closeable, FSConstants {
    * close opened files.
    */
   public void close() throws IOException {
-    if (blockInFd != null && shouldDropCacheBehindRead) {
+    if (blockInFd != null && shouldDropCacheBehindRead && isLongRead()) {
       // drop the last few MB of the file from cache
       try {
         NativeIO.posixFadviseIfPossible(blockInFd, lastCacheDropOffset, offset