|
@@ -17,6 +17,8 @@
|
|
|
*/
|
|
|
package org.apache.hadoop.hdfs.server.federation.router;
|
|
|
|
|
|
+import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_CALLER_CONTEXT_MAX_SIZE_KEY;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_AUDIT_LOG_WITH_REMOTE_PORT_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_REDUNDANCY_CONSIDERLOAD_KEY;
|
|
|
import static org.apache.hadoop.hdfs.server.federation.FederationTestUtils.addDirectory;
|
|
|
import static org.apache.hadoop.hdfs.server.federation.FederationTestUtils.countContents;
|
|
@@ -25,6 +27,7 @@ import static org.apache.hadoop.hdfs.server.federation.FederationTestUtils.delet
|
|
|
import static org.apache.hadoop.hdfs.server.federation.FederationTestUtils.getFileStatus;
|
|
|
import static org.apache.hadoop.hdfs.server.federation.FederationTestUtils.verifyFileExists;
|
|
|
import static org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster.TEST_STRING;
|
|
|
+import static org.apache.hadoop.ipc.CallerContext.PROXY_USER_PORT;
|
|
|
import static org.apache.hadoop.test.GenericTestUtils.assertExceptionContains;
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
import static org.junit.Assert.assertArrayEquals;
|
|
@@ -209,10 +212,12 @@ public class TestRouterRpc {
|
|
|
Configuration namenodeConf = new Configuration();
|
|
|
namenodeConf.setBoolean(DFSConfigKeys.HADOOP_CALLER_CONTEXT_ENABLED_KEY,
|
|
|
true);
|
|
|
+ namenodeConf.set(HADOOP_CALLER_CONTEXT_MAX_SIZE_KEY, "256");
|
|
|
// It's very easy to become overloaded for some specific dn in this small
|
|
|
// cluster, which will cause the EC file block allocation failure. To avoid
|
|
|
// this issue, we disable considerLoad option.
|
|
|
namenodeConf.setBoolean(DFS_NAMENODE_REDUNDANCY_CONSIDERLOAD_KEY, false);
|
|
|
+ namenodeConf.setBoolean(DFS_NAMENODE_AUDIT_LOG_WITH_REMOTE_PORT_KEY, true);
|
|
|
cluster = new MiniRouterDFSCluster(false, NUM_SUBCLUSTERS);
|
|
|
cluster.setNumDatanodesPerNameservice(NUM_DNS);
|
|
|
cluster.addNamenodeOverrides(namenodeConf);
|
|
@@ -2116,6 +2121,8 @@ public class TestRouterRpc {
|
|
|
// Real user is added to the caller context.
|
|
|
assertTrue("The audit log should contain the real user.",
|
|
|
logOutput.contains(String.format("realUser:%s", realUser.getUserName())));
|
|
|
+ assertTrue("The audit log should contain the proxyuser port.",
|
|
|
+ logOutput.contains(PROXY_USER_PORT));
|
|
|
}
|
|
|
|
|
|
@Test
|