[
https://issues.apache.org/jira/browse/FLINK-9573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16513210#comment-16513210
]
ASF GitHub Bot commented on FLINK-9573:
---------------------------------------
Github user zhangminglei commented on a diff in the pull request:
https://github.com/apache/flink/pull/6154#discussion_r195613671
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java
---
@@ -356,8 +357,8 @@ public void confirmLeaderSessionID(UUID
leaderSessionID) {
}
@Override
- public boolean hasLeadership() {
- return isLeader;
+ public boolean hasLeadership(@Nonnull UUID leaderSessionId) {
+ return isLeader &&
leaderSessionId.equals(currentLeaderSessionId);
}
--- End diff --
Thanks @tillrohrmann Makes sense better to me now. Yea, I did not see there
has a volatile in there before. Thanks again.
> Check for leadership with leader session id
> -------------------------------------------
>
> Key: FLINK-9573
> URL: https://issues.apache.org/jira/browse/FLINK-9573
> Project: Flink
> Issue Type: Improvement
> Components: Distributed Coordination
> Affects Versions: 1.5.0, 1.6.0
> Reporter: Till Rohrmann
> Assignee: Till Rohrmann
> Priority: Major
> Fix For: 1.6.0, 1.5.1
>
>
> In order to check whether a {{LeaderContender}} is still the leader, it is
> not sufficient to simply provide a {{LeaderElectionService#hasLeadership()}}.
> Instead, we should extend this method to also take the leader session id as a
> parameter to distinguish between different calls from the same leader
> contender with different leader session ids.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)