hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cli...@apache.org
Subject [hadoop] 34/50: HDFS-14120. [SBN read] ORFPP should also clone DT for the virtual IP. Contributed by Chen Liang.
Date Fri, 28 Jun 2019 23:06:37 GMT
This is an automated email from the ASF dual-hosted git repository.

cliang pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git

commit f7f7cac2e4afff67c38ee72220a4cc14bd6f797b
Author: Chen Liang <cliang@apache.org>
AuthorDate: Mon Dec 3 17:05:07 2018 -0800

    HDFS-14120. [SBN read] ORFPP should also clone DT for the virtual IP. Contributed by Chen
Liang.
---
 .../ObserverReadProxyProviderWithIPFailover.java   | 24 +++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

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: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message