-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
[FLINK-18677] Added handling of suspended or lost connections #13055
Conversation
…thin the ZooKeeperLeaderRetrievalService. The listener needs to be notified in case of a connection loss so that it is able to initiate necessary actions on its side.
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit f5df4b1 (Sat Aug 28 11:16:01 UTC 2021) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
@tillrohrmann the PR is ready to be reviewed. |
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.
Thanks for creating this PR @XComp. The changes look good. I had a couple of comments concerning the thread safety of the addition and some smaller suggestions. Please take a look at my comments.
.../src/main/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalService.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalService.java
Outdated
Show resolved
Hide resolved
...a/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionConnectionHandlingTest.java
Show resolved
Hide resolved
...a/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionConnectionHandlingTest.java
Outdated
Show resolved
Hide resolved
...a/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionConnectionHandlingTest.java
Outdated
Show resolved
Hide resolved
...a/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionConnectionHandlingTest.java
Outdated
Show resolved
Hide resolved
...a/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionConnectionHandlingTest.java
Outdated
Show resolved
Hide resolved
...a/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionConnectionHandlingTest.java
Outdated
Show resolved
Hide resolved
...a/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionConnectionHandlingTest.java
Outdated
Show resolved
Hide resolved
…Apache Flink code styles.
…k and removed redundant code. The redundant code was moved into notifyIfNewLeaderAddress(String, UUID) which is then used by notifyLeaderLoss() and within nodeChanged(). Additionally, the method call of notifyLeaderLoss() is guarded now by a lock to synchronize the state change (i.e. lastLeaderAddress and lastLeaderSessionID).
…it that the method is not expected to be called.
…ce we're not expecting any objects. The test does not expect any calls happening. Hence, no CompletableFuture instance will be queued. The longer wait time would just result in a longer running test.
The previous implementation had a fixed timeout. Slower machines might need longer to process the test which might result in test failures. The new implementation removes the timeout so that the test wouldn't fail just because of a poor performance of the machine the test is running on.
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.
Thanks for addressing my comments. I had a few minor comments left.
.../src/main/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalService.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalService.java
Outdated
Show resolved
Hide resolved
...a/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionConnectionHandlingTest.java
Outdated
Show resolved
Hide resolved
…thin the ZooKeeperLeaderRetrievalService. The listener needs to be notified in case of a connection loss so that it is able to initiate necessary actions on its side. [FLINK-18677][runtime] [style] Replaced spaces by TABs to follow the Apache Flink code styles. [FLINK-18677][runtime] [fix] Synchronize notifyLeaderLoss through lock and removed redundant code. The redundant code was moved into notifyIfNewLeaderAddress(String, UUID) which is then used by notifyLeaderLoss() and within nodeChanged(). Additionally, the method call of notifyLeaderLoss() is guarded now by a lock to synchronize the state change (i.e. lastLeaderAddress and lastLeaderSessionID). [FLINK-18677][runtime] The exception was added to make it more explicit that the method is not expected to be called. [FLINK-18677][runtime] Decreased wait time the queue to be filled since we're not expecting any objects. The test does not expect any calls happening. Hence, no CompletableFuture instance will be queued. The longer wait time would just result in a longer running test. [FLINK-18677][runtime] Added infinite wait time to happy test. The previous implementation had a fixed timeout. Slower machines might need longer to process the test which might result in test failures. The new implementation removes the timeout so that the test wouldn't fail just because of a poor performance of the machine the test is running on. [FLINK-18677][runtime] Moved log messages out of synchronization blocks. This closes #13055.
…thin the ZooKeeperLeaderRetrievalService. The listener needs to be notified in case of a connection loss so that it is able to initiate necessary actions on its side. [FLINK-18677][runtime] [style] Replaced spaces by TABs to follow the Apache Flink code styles. [FLINK-18677][runtime] [fix] Synchronize notifyLeaderLoss through lock and removed redundant code. The redundant code was moved into notifyIfNewLeaderAddress(String, UUID) which is then used by notifyLeaderLoss() and within nodeChanged(). Additionally, the method call of notifyLeaderLoss() is guarded now by a lock to synchronize the state change (i.e. lastLeaderAddress and lastLeaderSessionID). [FLINK-18677][runtime] The exception was added to make it more explicit that the method is not expected to be called. [FLINK-18677][runtime] Decreased wait time the queue to be filled since we're not expecting any objects. The test does not expect any calls happening. Hence, no CompletableFuture instance will be queued. The longer wait time would just result in a longer running test. [FLINK-18677][runtime] Added infinite wait time to happy test. The previous implementation had a fixed timeout. Slower machines might need longer to process the test which might result in test failures. The new implementation removes the timeout so that the test wouldn't fail just because of a poor performance of the machine the test is running on. [FLINK-18677][runtime] Moved log messages out of synchronization blocks. This closes #13055.
I added handling of suspended or lost connections within the ZooKeeperLeaderRetrievalService.
The listener needs to be notified in case of a connection loss so that it is able to initiate necessary actions on its side.
What is the purpose of the change
Brief change log
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: noDocumentation