[5/8] hadoop git commit: Revert "Revert "HDFS-10390. Implement asynchronous setAcl/getAclStatus for DistributedFileSystem. Contributed by Xiaobing Zhou""

2016-06-06 Thread szetszwo
Revert "Revert "HDFS-10390. Implement asynchronous setAcl/getAclStatus for 
DistributedFileSystem.  Contributed by Xiaobing Zhou""

This reverts commit 1de712f22abbe313692cca6bece7f265da96aee5.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/79beac49
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/79beac49
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/79beac49

Branch: refs/heads/branch-2.8
Commit: 79beac49ec08fbe0ed72a35fc7d8b5de1b8639e8
Parents: c949001
Author: Tsz-Wo Nicholas Sze 
Authored: Mon Jun 6 16:53:46 2016 +0800
Committer: Tsz-Wo Nicholas Sze 
Committed: Mon Jun 6 16:53:46 2016 +0800

--
 .../hadoop/hdfs/AsyncDistributedFileSystem.java |  59 
 .../hadoop/hdfs/DistributedFileSystem.java  |   3 +
 .../ClientNamenodeProtocolTranslatorPB.java |  30 +-
 .../org/apache/hadoop/hdfs/TestAsyncDFS.java| 310 +++
 .../apache/hadoop/hdfs/TestAsyncDFSRename.java  |  15 +-
 .../hdfs/server/namenode/FSAclBaseTest.java |  12 +-
 6 files changed, 411 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/79beac49/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
--
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
index 1f60df2..b507fa5 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
@@ -19,12 +19,16 @@
 package org.apache.hadoop.hdfs;
 
 import java.io.IOException;
+import java.util.List;
 import java.util.concurrent.Future;
 
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.fs.Options;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.AclEntry;
+import org.apache.hadoop.fs.permission.AclStatus;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.hdfs.DFSOpsCountStatistics.OpType;
 import org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB;
 import org.apache.hadoop.util.concurrent.AsyncGet;
 import org.apache.hadoop.util.concurrent.AsyncGetFuture;
@@ -85,6 +89,7 @@ public class AsyncDistributedFileSystem {
   public Future rename(Path src, Path dst,
   final Options.Rename... options) throws IOException {
 dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.RENAME);
 
 final Path absSrc = dfs.fixRelativePart(src);
 final Path absDst = dfs.fixRelativePart(dst);
@@ -113,6 +118,7 @@ public class AsyncDistributedFileSystem {
   public Future setPermission(Path p, final FsPermission permission)
   throws IOException {
 dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.SET_PERMISSION);
 final Path absPath = dfs.fixRelativePart(p);
 final boolean isAsync = Client.isAsynchronousMode();
 Client.setAsynchronousMode(true);
@@ -144,6 +150,7 @@ public class AsyncDistributedFileSystem {
 }
 
 dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.SET_OWNER);
 final Path absPath = dfs.fixRelativePart(p);
 final boolean isAsync = Client.isAsynchronousMode();
 Client.setAsynchronousMode(true);
@@ -154,4 +161,56 @@ public class AsyncDistributedFileSystem {
   Client.setAsynchronousMode(isAsync);
 }
   }
+
+  /**
+   * Fully replaces ACL of files and directories, discarding all existing
+   * entries.
+   *
+   * @param p
+   *  Path to modify
+   * @param aclSpec
+   *  List describing modifications, must include entries for
+   *  user, group, and others for compatibility with permission bits.
+   * @throws IOException
+   *   if an ACL could not be modified
+   * @return an instance of Future, #get of which is invoked to wait for
+   * asynchronous call being finished.
+   */
+  public Future setAcl(Path p, final List aclSpec)
+  throws IOException {
+dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.SET_ACL);
+final Path absPath = dfs.fixRelativePart(p);
+final boolean isAsync = Client.isAsynchronousMode();
+Client.setAsynchronousMode(true);
+try {
+  dfs.getClient().setAcl(dfs.getPathName(absPath), aclSpec);
+  return 

[5/8] hadoop git commit: Revert "Revert "HDFS-10390. Implement asynchronous setAcl/getAclStatus for DistributedFileSystem. Contributed by Xiaobing Zhou""

2016-06-06 Thread szetszwo
Revert "Revert "HDFS-10390. Implement asynchronous setAcl/getAclStatus for 
DistributedFileSystem.  Contributed by Xiaobing Zhou""

This reverts commit 87ea0784eb5f2f39f89f951c119c0fe7c5d6786a.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/136d3b64
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/136d3b64
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/136d3b64

Branch: refs/heads/branch-2
Commit: 136d3b6414ddbebc6a920aabf79da6df996b5639
Parents: 09a543f
Author: Tsz-Wo Nicholas Sze 
Authored: Mon Jun 6 16:52:09 2016 +0800
Committer: Tsz-Wo Nicholas Sze 
Committed: Mon Jun 6 16:52:09 2016 +0800

--
 .../hadoop/hdfs/AsyncDistributedFileSystem.java |  59 
 .../hadoop/hdfs/DistributedFileSystem.java  |   3 +
 .../ClientNamenodeProtocolTranslatorPB.java |  30 +-
 .../org/apache/hadoop/hdfs/TestAsyncDFS.java| 310 +++
 .../apache/hadoop/hdfs/TestAsyncDFSRename.java  |  15 +-
 .../hdfs/server/namenode/FSAclBaseTest.java |  12 +-
 6 files changed, 411 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/136d3b64/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
--
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
index 1f60df2..b507fa5 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
@@ -19,12 +19,16 @@
 package org.apache.hadoop.hdfs;
 
 import java.io.IOException;
+import java.util.List;
 import java.util.concurrent.Future;
 
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.fs.Options;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.AclEntry;
+import org.apache.hadoop.fs.permission.AclStatus;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.hdfs.DFSOpsCountStatistics.OpType;
 import org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB;
 import org.apache.hadoop.util.concurrent.AsyncGet;
 import org.apache.hadoop.util.concurrent.AsyncGetFuture;
@@ -85,6 +89,7 @@ public class AsyncDistributedFileSystem {
   public Future rename(Path src, Path dst,
   final Options.Rename... options) throws IOException {
 dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.RENAME);
 
 final Path absSrc = dfs.fixRelativePart(src);
 final Path absDst = dfs.fixRelativePart(dst);
@@ -113,6 +118,7 @@ public class AsyncDistributedFileSystem {
   public Future setPermission(Path p, final FsPermission permission)
   throws IOException {
 dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.SET_PERMISSION);
 final Path absPath = dfs.fixRelativePart(p);
 final boolean isAsync = Client.isAsynchronousMode();
 Client.setAsynchronousMode(true);
@@ -144,6 +150,7 @@ public class AsyncDistributedFileSystem {
 }
 
 dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.SET_OWNER);
 final Path absPath = dfs.fixRelativePart(p);
 final boolean isAsync = Client.isAsynchronousMode();
 Client.setAsynchronousMode(true);
@@ -154,4 +161,56 @@ public class AsyncDistributedFileSystem {
   Client.setAsynchronousMode(isAsync);
 }
   }
+
+  /**
+   * Fully replaces ACL of files and directories, discarding all existing
+   * entries.
+   *
+   * @param p
+   *  Path to modify
+   * @param aclSpec
+   *  List describing modifications, must include entries for
+   *  user, group, and others for compatibility with permission bits.
+   * @throws IOException
+   *   if an ACL could not be modified
+   * @return an instance of Future, #get of which is invoked to wait for
+   * asynchronous call being finished.
+   */
+  public Future setAcl(Path p, final List aclSpec)
+  throws IOException {
+dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.SET_ACL);
+final Path absPath = dfs.fixRelativePart(p);
+final boolean isAsync = Client.isAsynchronousMode();
+Client.setAsynchronousMode(true);
+try {
+  dfs.getClient().setAcl(dfs.getPathName(absPath), aclSpec);
+  return 

[5/8] hadoop git commit: Revert "Revert "HDFS-10390. Implement asynchronous setAcl/getAclStatus for DistributedFileSystem. Contributed by Xiaobing Zhou""

2016-06-06 Thread szetszwo
Revert "Revert "HDFS-10390. Implement asynchronous setAcl/getAclStatus for 
DistributedFileSystem.  Contributed by Xiaobing Zhou""

This reverts commit b82c74b9102ba95eae776501ed4484be9edd8c96.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b3d81f38
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b3d81f38
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b3d81f38

Branch: refs/heads/trunk
Commit: b3d81f38da5d3d913e7b7ed498198c899c1e68b7
Parents: 574dcd3
Author: Tsz-Wo Nicholas Sze 
Authored: Mon Jun 6 16:31:30 2016 +0800
Committer: Tsz-Wo Nicholas Sze 
Committed: Mon Jun 6 16:31:30 2016 +0800

--
 .../hadoop/hdfs/AsyncDistributedFileSystem.java |  59 
 .../hadoop/hdfs/DistributedFileSystem.java  |   3 +
 .../ClientNamenodeProtocolTranslatorPB.java |  30 +-
 .../org/apache/hadoop/hdfs/TestAsyncDFS.java| 310 +++
 .../apache/hadoop/hdfs/TestAsyncDFSRename.java  |  15 +-
 .../hdfs/server/namenode/FSAclBaseTest.java |  12 +-
 6 files changed, 411 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b3d81f38/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
--
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
index 6bfd71d..29bac2a 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/AsyncDistributedFileSystem.java
@@ -19,12 +19,16 @@
 package org.apache.hadoop.hdfs;
 
 import java.io.IOException;
+import java.util.List;
 import java.util.concurrent.Future;
 
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.fs.Options;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.AclEntry;
+import org.apache.hadoop.fs.permission.AclStatus;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.hdfs.DFSOpsCountStatistics.OpType;
 import org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB;
 import org.apache.hadoop.util.concurrent.AsyncGetFuture;
 import org.apache.hadoop.ipc.Client;
@@ -83,6 +87,7 @@ public class AsyncDistributedFileSystem {
   public Future rename(Path src, Path dst,
   final Options.Rename... options) throws IOException {
 dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.RENAME);
 
 final Path absSrc = dfs.fixRelativePart(src);
 final Path absDst = dfs.fixRelativePart(dst);
@@ -111,6 +116,7 @@ public class AsyncDistributedFileSystem {
   public Future setPermission(Path p, final FsPermission permission)
   throws IOException {
 dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.SET_PERMISSION);
 final Path absPath = dfs.fixRelativePart(p);
 final boolean isAsync = Client.isAsynchronousMode();
 Client.setAsynchronousMode(true);
@@ -142,6 +148,7 @@ public class AsyncDistributedFileSystem {
 }
 
 dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.SET_OWNER);
 final Path absPath = dfs.fixRelativePart(p);
 final boolean isAsync = Client.isAsynchronousMode();
 Client.setAsynchronousMode(true);
@@ -152,4 +159,56 @@ public class AsyncDistributedFileSystem {
   Client.setAsynchronousMode(isAsync);
 }
   }
+
+  /**
+   * Fully replaces ACL of files and directories, discarding all existing
+   * entries.
+   *
+   * @param p
+   *  Path to modify
+   * @param aclSpec
+   *  List describing modifications, must include entries for
+   *  user, group, and others for compatibility with permission bits.
+   * @throws IOException
+   *   if an ACL could not be modified
+   * @return an instance of Future, #get of which is invoked to wait for
+   * asynchronous call being finished.
+   */
+  public Future setAcl(Path p, final List aclSpec)
+  throws IOException {
+dfs.getFsStatistics().incrementWriteOps(1);
+dfs.getDFSOpsCountStatistics().incrementOpCounter(OpType.SET_ACL);
+final Path absPath = dfs.fixRelativePart(p);
+final boolean isAsync = Client.isAsynchronousMode();
+Client.setAsynchronousMode(true);
+try {
+  dfs.getClient().setAcl(dfs.getPathName(absPath), aclSpec);
+  return getReturnValue();
+}