goiri commented on a change in pull request #1480: HDFS-14857 FS operations 
fail in HA mode: DataNode fails to connect to NameNode
URL: https://github.com/apache/hadoop/pull/1480#discussion_r331732560
 
 

 ##########
 File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientFailover.java
 ##########
 @@ -398,4 +402,50 @@ public void testIPFailoverProxyProviderLogicalUri() 
throws Exception {
         HAUtil.useLogicalUri(config, nnUri));
   }
 
+  /**
+   * Test HDFS-14857 FS operations fail in HA mode: DataNode fails to connect 
to NameNode
+   */
+  @Test
+  public void testIpAddressResetOnPerformFailover() throws Exception {
+    NetUtilsTestResolver resolver = NetUtilsTestResolver.install();
+    resolver.addResolvedHost("nn1.b.", "1.1.1.1");
+    resolver.addResolvedHost("nn2.b.", "2.2.2.2");
+    conf.set(HdfsClientConfigKeys.DFS_NAMESERVICES, "nmnode-0");
+    conf.set("dfs.ha.namenodes.nmnode-0", "nn1,nn2");
+    conf.set("dfs.namenode.rpc-address.nmnode-0.nn1", "nn1.b:9000");
+    conf.set("dfs.namenode.rpc-address.nmnode-0.nn2", "nn2.b:9000");
+    conf.set("dfs.client.failover.proxy.provider.nmnode-0",
+            
"org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider");
+
+    URI uri  = new URI("hdfs://nmnode-0");
+    ConfiguredFailoverProxyProvider proxyProvider = 
(ConfiguredFailoverProxyProvider)NameNodeProxiesClient
+            .createFailoverProxyProvider(conf, uri, ClientProtocol.class,
+                    false, null);
+    assertNotNull(proxyProvider);
+
+    AbstractNNFailoverProxyProvider.NNProxyInfo proxyInfo =
+            
(AbstractNNFailoverProxyProvider.NNProxyInfo)proxyProvider.getProxy();
+    assertNotNull(proxyInfo);
+    assertEquals(proxyInfo.getAddress().getAddress(), 
resolver.getByExactName(proxyInfo.getAddress().getHostName()));
 
 Review comment:
   I triggered Yetus in the JIRA, there are a bunch of style check failure here 
(e.g., >80 characters).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to