You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2019/10/04 06:52:14 UTC

[GitHub] [hadoop] hadoop-yetus commented on a change in pull request #1480: HDFS-14857 FS operations fail in HA mode: DataNode fails to connect to NameNode

hadoop-yetus 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_r331361449
 
 

 ##########
 File path: hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ConfiguredFailoverProxyProvider.java
 ##########
 @@ -93,4 +98,24 @@ public synchronized void close() throws IOException {
   public boolean useLogicalURI() {
     return true;
   }
+
+  /**
+   * Resets the NameNode proxy address in case it's stale
+   */
+  protected void resetProxyAddress(List<NNProxyInfo<T>> proxies, int index) {
+    try {
+      stopProxy(proxies.get(index).proxy);
+      InetSocketAddress oldAddress = proxies.get(index).getAddress();
+      InetSocketAddress address = NetUtils.createSocketAddr(
+              oldAddress.getHostName() + ":" + oldAddress.getPort());
+      LOG.debug("oldAddress {}, newAddress {}", oldAddress, address);
+      proxies.set(index, new NNProxyInfo<T>(address));
+    } catch (Exception e) {
+      throw new RuntimeException("Could not refresh NN address", e);
+    }
+  }
+  
 
 Review comment:
   whitespace:end of line
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org