HDFS-14210. RBF: ACL commands should work over all the destinations. Contributed by Ayush Saxena.
This commit is contained in:
parent
32841178ba
commit
62fa53a01d
|
@ -1313,7 +1313,11 @@ public class RouterClientProtocol implements ClientProtocol {
|
||||||
RemoteMethod method = new RemoteMethod("modifyAclEntries",
|
RemoteMethod method = new RemoteMethod("modifyAclEntries",
|
||||||
new Class<?>[] {String.class, List.class},
|
new Class<?>[] {String.class, List.class},
|
||||||
new RemoteParam(), aclSpec);
|
new RemoteParam(), aclSpec);
|
||||||
rpcClient.invokeSequential(locations, method, null, null);
|
if (rpcServer.isInvokeConcurrent(src)) {
|
||||||
|
rpcClient.invokeConcurrent(locations, method);
|
||||||
|
} else {
|
||||||
|
rpcClient.invokeSequential(locations, method);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1327,7 +1331,11 @@ public class RouterClientProtocol implements ClientProtocol {
|
||||||
RemoteMethod method = new RemoteMethod("removeAclEntries",
|
RemoteMethod method = new RemoteMethod("removeAclEntries",
|
||||||
new Class<?>[] {String.class, List.class},
|
new Class<?>[] {String.class, List.class},
|
||||||
new RemoteParam(), aclSpec);
|
new RemoteParam(), aclSpec);
|
||||||
rpcClient.invokeSequential(locations, method, null, null);
|
if (rpcServer.isInvokeConcurrent(src)) {
|
||||||
|
rpcClient.invokeConcurrent(locations, method);
|
||||||
|
} else {
|
||||||
|
rpcClient.invokeSequential(locations, method);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1339,7 +1347,11 @@ public class RouterClientProtocol implements ClientProtocol {
|
||||||
rpcServer.getLocationsForPath(src, true);
|
rpcServer.getLocationsForPath(src, true);
|
||||||
RemoteMethod method = new RemoteMethod("removeDefaultAcl",
|
RemoteMethod method = new RemoteMethod("removeDefaultAcl",
|
||||||
new Class<?>[] {String.class}, new RemoteParam());
|
new Class<?>[] {String.class}, new RemoteParam());
|
||||||
rpcClient.invokeSequential(locations, method);
|
if (rpcServer.isInvokeConcurrent(src)) {
|
||||||
|
rpcClient.invokeConcurrent(locations, method);
|
||||||
|
} else {
|
||||||
|
rpcClient.invokeSequential(locations, method);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1351,7 +1363,11 @@ public class RouterClientProtocol implements ClientProtocol {
|
||||||
rpcServer.getLocationsForPath(src, true);
|
rpcServer.getLocationsForPath(src, true);
|
||||||
RemoteMethod method = new RemoteMethod("removeAcl",
|
RemoteMethod method = new RemoteMethod("removeAcl",
|
||||||
new Class<?>[] {String.class}, new RemoteParam());
|
new Class<?>[] {String.class}, new RemoteParam());
|
||||||
rpcClient.invokeSequential(locations, method);
|
if (rpcServer.isInvokeConcurrent(src)) {
|
||||||
|
rpcClient.invokeConcurrent(locations, method);
|
||||||
|
} else {
|
||||||
|
rpcClient.invokeSequential(locations, method);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1364,7 +1380,11 @@ public class RouterClientProtocol implements ClientProtocol {
|
||||||
RemoteMethod method = new RemoteMethod(
|
RemoteMethod method = new RemoteMethod(
|
||||||
"setAcl", new Class<?>[] {String.class, List.class},
|
"setAcl", new Class<?>[] {String.class, List.class},
|
||||||
new RemoteParam(), aclSpec);
|
new RemoteParam(), aclSpec);
|
||||||
rpcClient.invokeSequential(locations, method);
|
if (rpcServer.isInvokeConcurrent(src)) {
|
||||||
|
rpcClient.invokeConcurrent(locations, method);
|
||||||
|
} else {
|
||||||
|
rpcClient.invokeSequential(locations, method);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -38,7 +38,9 @@ import org.apache.hadoop.fs.FileStatus;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Options.Rename;
|
import org.apache.hadoop.fs.Options.Rename;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
|
import org.apache.hadoop.fs.permission.AclEntry;
|
||||||
import org.apache.hadoop.fs.permission.FsPermission;
|
import org.apache.hadoop.fs.permission.FsPermission;
|
||||||
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||||
import org.apache.hadoop.hdfs.DFSTestUtil;
|
import org.apache.hadoop.hdfs.DFSTestUtil;
|
||||||
import org.apache.hadoop.hdfs.DistributedFileSystem;
|
import org.apache.hadoop.hdfs.DistributedFileSystem;
|
||||||
import org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster.RouterContext;
|
import org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster.RouterContext;
|
||||||
|
@ -84,6 +86,7 @@ public class TestRouterRPCMultipleDestinationMountTableResolver {
|
||||||
new RouterConfigBuilder().stateStore().admin().quota().rpc().build();
|
new RouterConfigBuilder().stateStore().admin().quota().rpc().build();
|
||||||
|
|
||||||
Configuration hdfsConf = new Configuration(false);
|
Configuration hdfsConf = new Configuration(false);
|
||||||
|
hdfsConf.setBoolean(DFSConfigKeys.DFS_NAMENODE_ACLS_ENABLED_KEY, true);
|
||||||
|
|
||||||
cluster.addRouterOverrides(routerConf);
|
cluster.addRouterOverrides(routerConf);
|
||||||
cluster.addNamenodeOverrides(hdfsConf);
|
cluster.addNamenodeOverrides(hdfsConf);
|
||||||
|
@ -406,6 +409,38 @@ public class TestRouterRPCMultipleDestinationMountTableResolver {
|
||||||
return addResponse.getStatus();
|
return addResponse.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testACLMultipleDestinations() throws Exception {
|
||||||
|
setupOrderMountPath(DestinationOrder.HASH_ALL);
|
||||||
|
Path mountPath = new Path("/mount/dir/dir");
|
||||||
|
Path nsPath = new Path("/tmp/dir/dir");
|
||||||
|
List<AclEntry> aclSpec = Collections.singletonList(
|
||||||
|
AclEntry.parseAclEntry("default:USER:TestUser:rwx", true));
|
||||||
|
routerFs.setAcl(mountPath, aclSpec);
|
||||||
|
assertEquals(5, nnFs0.getAclStatus(nsPath).getEntries().size());
|
||||||
|
assertEquals(5, nnFs1.getAclStatus(nsPath).getEntries().size());
|
||||||
|
aclSpec = Collections
|
||||||
|
.singletonList(AclEntry.parseAclEntry("USER:User:rwx::", true));
|
||||||
|
|
||||||
|
routerFs.modifyAclEntries(mountPath, aclSpec);
|
||||||
|
assertEquals(7, nnFs0.getAclStatus(nsPath).getEntries().size());
|
||||||
|
assertEquals(7, nnFs1.getAclStatus(nsPath).getEntries().size());
|
||||||
|
|
||||||
|
routerFs.removeAclEntries(mountPath, aclSpec);
|
||||||
|
assertEquals(6, nnFs0.getAclStatus(nsPath).getEntries().size());
|
||||||
|
assertEquals(6, nnFs1.getAclStatus(nsPath).getEntries().size());
|
||||||
|
|
||||||
|
routerFs.modifyAclEntries(mountPath, aclSpec);
|
||||||
|
routerFs.removeDefaultAcl(mountPath);
|
||||||
|
assertEquals(2, nnFs0.getAclStatus(nsPath).getEntries().size());
|
||||||
|
assertEquals(2, nnFs1.getAclStatus(nsPath).getEntries().size());
|
||||||
|
|
||||||
|
routerFs.removeAcl(mountPath);
|
||||||
|
assertEquals(0, nnFs0.getAclStatus(nsPath).getEntries().size());
|
||||||
|
assertEquals(0, nnFs1.getAclStatus(nsPath).getEntries().size());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetDestinationHashAll() throws Exception {
|
public void testGetDestinationHashAll() throws Exception {
|
||||||
testGetDestination(DestinationOrder.HASH_ALL,
|
testGetDestination(DestinationOrder.HASH_ALL,
|
||||||
|
|
Loading…
Reference in New Issue