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 2022/08/08 19:37:44 UTC
[GitHub] [hadoop] snmvaughan commented on a diff in pull request #4692: HADOOP-18365. Update the remote address when a change is detected
snmvaughan commented on code in PR #4692:
URL: https://github.com/apache/hadoop/pull/4692#discussion_r940598156
##########
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:
There is a message in the Connection#updateAddress call. This services that call to update the remoteId to avoid having to re-resolve the updated IP address in subsequent calls. The look like the following:
```
namenode-0 namenode 2022-08-08 13:43:02 WARN Client:639 - Address change detected. Old: journalnode-0.journalnode.hdfs.svc.cluster.local/10.1.6.87:8485 New: journalnode-0.journalnode.hdfs.svc.cluster.local/10.1.6.88:8485
```
--
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.
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org