Repository: hadoop
Updated Branches:
  refs/heads/HDFS-12943 742205333 -> b5497070a


HDFS-14120. [SBN read] ORFPP should also clone DT for the virtual IP. 
Contributed by Chen Liang.


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

Branch: refs/heads/HDFS-12943
Commit: b5497070ac69472bcb87fd365e5c66376fd728a6
Parents: 7422053
Author: Chen Liang <[email protected]>
Authored: Mon Dec 3 17:05:07 2018 -0800
Committer: Chen Liang <[email protected]>
Committed: Mon Dec 3 17:05:07 2018 -0800

----------------------------------------------------------------------
 ...ObserverReadProxyProviderWithIPFailover.java | 24 +++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b5497070/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProviderWithIPFailover.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProviderWithIPFailover.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProviderWithIPFailover.java
index 751bc3b..22f6dd3 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProviderWithIPFailover.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProviderWithIPFailover.java
@@ -17,9 +17,12 @@
  */
 package org.apache.hadoop.hdfs.server.namenode.ha;
 
+import java.net.InetSocketAddress;
 import java.net.URI;
 
+import java.util.Collections;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdfs.HAUtilClient;
 import org.apache.hadoop.hdfs.protocol.ClientProtocol;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -58,7 +61,8 @@ import static 
org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_CLIENT_FAIL
  * dfs.ha.namenodes.mycluster = ha1,ha2
  * dfs.namenode.rpc-address.mycluster.ha1 = nn01-ha1.com:8020
  * dfs.namenode.rpc-address.mycluster.ha2 = nn01-ha2.com:8020
- * dfs.client.failover.ipfailover.virtual-address.mycluster = nn01.com:8020
+ * dfs.client.failover.ipfailover.virtual-address.mycluster =
+ *     hdfs://nn01.com:8020
  * dfs.client.failover.proxy.provider.mycluster =
  *     org.apache...ObserverReadProxyProviderWithIPFailover
  * }</pre>
@@ -97,6 +101,24 @@ public class ObserverReadProxyProviderWithIPFailover<T 
extends ClientProtocol>
       Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory,
       AbstractNNFailoverProxyProvider<T> failoverProxy) {
     super(conf, uri, xface, factory, failoverProxy);
+    cloneDelegationTokenForVirtualIP(conf, uri);
+  }
+
+  /**
+   * Clone delegation token for the virtual IP. Specifically
+   * clone the dt that corresponds to the name service uri,
+   * to the configured corresponding virtual IP.
+   *
+   * @param conf configuration
+   * @param haURI the ha uri, a name service id in this case.
+   */
+  private void cloneDelegationTokenForVirtualIP(
+      Configuration conf, URI haURI) {
+    URI virtualIPURI = getFailoverVirtualIP(conf, haURI.getHost());
+    InetSocketAddress vipAddress = new InetSocketAddress(
+        virtualIPURI.getHost(), virtualIPURI.getPort());
+    HAUtilClient.cloneDelegationTokenForLogicalUri(
+        ugi, haURI, Collections.singleton(vipAddress));
   }
 
   private static URI getFailoverVirtualIP(


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to