-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-18365. Update the remote address when a change is detected #4692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Avoid reconnecting to the old address after detecting that the address has been updated.
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks @snmvaughan for your report.
Please fix the checkstyle and check the failed UT hadoop.ipc.TestIPC
💔 -1 overall
This message was automatically generated. |
The ConnectionId is used as a key in the connections map, and updating the remoteId caused problems with the cleanup of connections when the removeMethod was used. Instead of updating the address within the remoteId, use the removeMethod to cleanup references to the current identifier and then replace it with a new identifier using the updated address.
Mark non-test fields as private and final, and add a missing accessor.
💔 -1 overall
This message was automatically generated. |
I need to add an additional test to demonstrate that the in addition to the update being handled, it avoids having to repeat the process. The current patch fixed the existing unit test that correctly identified that the updated address caused problems with cleanup, but it didn't catch that the original (incorrect) IP address would be attempted again. |
🎊 +1 overall
This message was automatically generated. |
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java
Show resolved
Hide resolved
Once the address has been updated, it should be used in future calls. Check to ensure that a second request succeeds and that it uses the existing updated address instead of having to re-resolve.
🎊 +1 overall
This message was automatically generated. |
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java
Show resolved
Hide resolved
* | ||
* @param address the updated address | ||
* @throws IllegalArgumentException if the hostname or port doesn't match | ||
* @see Connection#updateAddress() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IllegalAddressException throw is unsettling but makes sense as long as the caller #updateAddress keeps making the currentAddr in the same way... I was going to say this method comment could be more explicit about what is happening in here and presumptions but I think the pointer to #updateAddress takes care of it....
throws IOException { | ||
return getProxy(protocol, clientVersion, connId.getAddress(), | ||
connId.ticket, conf, factory, connId.getRpcTimeout(), | ||
connId.getTicket(), conf, factory, connId.getRpcTimeout(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice but unrelated change.
} | ||
|
||
/** | ||
* The {@link ConnectionId#hashCode} has to be stable despite updates that occur as the the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double 'the'.
server.stop(); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test.
…ache#4692) Back port to branch-3.3, to avoid reconnecting to the old address after detecting that the address has been updated. * Use a stable hashCode to allow safe IP addr changes * Add test that updated address is used Once the address has been updated, it will be used in future calls. Test verifies that a second request succeeds and that it uses the existing updated address instead of having to re-resolve.
) (#4768) Back port to branch-3.3, to avoid reconnecting to the old address after detecting that the address has been updated. * Use a stable hashCode to allow safe IP addr changes * Add test that updated address is used Once the address has been updated, it will be used in future calls. Test verifies that a second request succeeds and that it uses the existing updated address instead of having to re-resolve. Co-authored-by: Steve Vaughan Jr <s_vaughan@apple.com>
…ache#4692) Avoid reconnecting to the old address after detecting that the address has been updated. * Fix Checkstyle line length violation * Keep ConnectionId as Immutable for map key The ConnectionId is used as a key in the connections map, and updating the remoteId caused problems with the cleanup of connections when the removeMethod was used. Instead of updating the address within the remoteId, use the removeMethod to cleanup references to the current identifier and then replace it with a new identifier using the updated address. * Use final to protect immutable ConnectionId Mark non-test fields as private and final, and add a missing accessor. * Use a stable hashCode to allow safe IP addr changes * Add test that updated address is used Once the address has been updated, it should be used in future calls. Check to ensure that a second request succeeds and that it uses the existing updated address instead of having to re-resolve. Signed-off-by: Nick Dimiduk <ndimiduk@apache.org> Signed-off-by: sokui Signed-off-by: XanderZu Signed-off-by: stack <stack@apache.org>
…ge is detected (apache#4692) (apache#4768) Back port to branch-3.3, to avoid reconnecting to the old address after detecting that the address has been updated. * Use a stable hashCode to allow safe IP addr changes * Add test that updated address is used Once the address has been updated, it will be used in future calls. Test verifies that a second request succeeds and that it uses the existing updated address instead of having to re-resolve. Co-authored-by: Steve Vaughan Jr <s_vaughan@apple.com>
…ache#4… (apache#356) * HADOOP-18365. Update the remote address when a change is detected (apache#4692) (apache#4768) Back port to branch-3.3, to avoid reconnecting to the old address after detecting that the address has been updated. * Use a stable hashCode to allow safe IP addr changes * Add test that updated address is used Once the address has been updated, it will be used in future calls. Test verifies that a second request succeeds and that it uses the existing updated address instead of having to re-resolve. Co-authored-by: Steve Vaughan Jr <s_vaughan@apple.com> * ACLOVERRIDE --------- Co-authored-by: Steve Vaughan <email@stevevaughan.me> Co-authored-by: Steve Vaughan Jr <s_vaughan@apple.com>
Avoid reconnecting to the old address after detecting that the address has been updated.
Description of PR
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.
How was this patch tested?
HA configuration deployed on a Kubernetes cluster, using Java 11.
JounalNodeSyncer
to wrap back around to the Restarted JournalNode to ensure that the message wasn't repeated and communications went directly to the new instanceFor code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?