HDFS-7356. Use DirectoryListing.hasMore() directly in nfs. Contributed by Li Lu.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/27f106e2 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/27f106e2 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/27f106e2 Branch: refs/heads/HDFS-EC Commit: 27f106e2261d0dfdb04e3d08dfd84ca4fdfad244 Parents: ad21d28 Author: Jing Zhao <ji...@apache.org> Authored: Tue Nov 4 15:04:26 2014 -0800 Committer: Jing Zhao <ji...@apache.org> Committed: Tue Nov 4 15:04:26 2014 -0800 ---------------------------------------------------------------------- .../java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java | 6 ++---- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/27f106e2/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java b/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java index 91d066e..d96babf 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java +++ b/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) { http://git-wip-us.apache.org/repos/asf/hadoop/blob/27f106e2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 8790951..b4e0fa1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/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