[ 
https://issues.apache.org/jira/browse/HADOOP-18365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17576960#comment-17576960
 ] 

ASF GitHub Bot commented on HADOOP-18365:
-----------------------------------------

sokui commented on code in PR #4692:
URL: https://github.com/apache/hadoop/pull/4692#discussion_r940590359


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java:
##########
@@ -1753,7 +1756,28 @@ public ConnectionId(InetSocketAddress address, Class<?> 
protocol,
     InetSocketAddress getAddress() {
       return address;
     }
-    
+
+    /**
+     * This is used to update the remote address when an address change is 
detected.  This method
+     * ensures that the {@link #hashCode()} won't change.
+     *
+     * @param address the updated address
+     * @throws IllegalArgumentException if the hostname or port doesn't match
+     * @see Connection#updateAddress()
+     */
+    void setAddress(InetSocketAddress address) {
+      if (!Objects.equals(this.address.getHostName(), address.getHostName())) {
+        throw new IllegalArgumentException("Hostname must match: " + 
this.address + " vs "
+            + address);
+      }
+      if (this.address.getPort() != address.getPort()) {
+        throw new IllegalArgumentException("Port must match: " + this.address 
+ " vs " + address);
+      }
+
+      this.address = address;

Review Comment:
   Should we add some log saying the Address is changed from XXX to XXX?





> Updated addresses are still accessed using the old IP address
> -------------------------------------------------------------
>
>                 Key: HADOOP-18365
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18365
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: common
>         Environment: Demonstrated in a Kubernetes environment running Java 11.
>            Reporter: Steve Vaughan
>            Assignee: Steve Vaughan
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> When the IPC Client recognizes that an IP address has changed, it updates the 
> server field and logs a message:
> Address change detected. Old: 
> journalnode-1.journalnode.hdfs.svc.cluster.local/10.1.0.178:8485 New: 
> journalnode-1.journalnode.hdfs.svc.cluster.local/10.1.0.182:8485
> Although the change is detected, the client will continue to connect to the 
> old IP address, resulting in repeated log messages.  This is seen in managed 
> environments when JournalNode syncing is enabled and a JournalNode is 
> restarted, with the remaining nodes in the set repeatedly logging this 
> message when syncing to the restarted JournalNode.
> The source of the problem is that the remoteId.address is not updated.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to