Prechádzať zdrojové kódy

HDFS-7356. Use DirectoryListing.hasMore() directly in nfs. Contributed by Li Lu.

Jing Zhao 10 rokov pred
rodič
commit
27f106e226

+ 2 - 4
hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java

@@ -1584,8 +1584,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
      */
     HdfsFileStatus[] fstatus = dlisting.getPartialListing();    
     int n = (int) Math.min(fstatus.length, count-2);
-    boolean eof = (n < fstatus.length) ? false : (dlisting
-        .getRemainingEntries() == 0);
+    boolean eof = (n >= fstatus.length) && !dlisting.hasMore();
 
     Entry3[] entries;
     if (cookie == 0) {
@@ -1733,8 +1732,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
     // Set up the dirents in the response
     HdfsFileStatus[] fstatus = dlisting.getPartialListing();
     int n = (int) Math.min(fstatus.length, dirCount-2);
-    boolean eof = (n < fstatus.length) ? false : (dlisting
-        .getRemainingEntries() == 0);
+    boolean eof = (n >= fstatus.length) && !dlisting.hasMore();
 
     READDIRPLUS3Response.EntryPlus3[] entries;
     if (cookie == 0) {

+ 2 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -331,6 +331,8 @@ Release 2.7.0 - UNRELEASED
     HDFS-6917. Add an hdfs debug command to validate blocks, call recoverlease,
     etc. (cmccabe)
 
+    HDFS-7356. Use DirectoryListing.hasMore() directly in nfs. (Li Lu via jing9)
+
   OPTIMIZATIONS
 
   BUG FIXES