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

Matthias Pohl commented on FLINK-30474:
---------------------------------------

The leader check is actually handled in the 
{{MultipleComponentLeaderElectionDriver}} implementations (see 
[ZooKeeperMultipleComponentLeaderElectionDriver:203|https://github.com/apache/flink/blob/8ddfd590ebba7fc727e79db41b82d3d40a02b56a/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/ZooKeeperMultipleComponentLeaderElectionDriver.java#L203]
 and 
[ZooKeeperMultipleComponentLeaderElectionDriver:223|https://github.com/apache/flink/blob/8ddfd590ebba7fc727e79db41b82d3d40a02b56a/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/ZooKeeperMultipleComponentLeaderElectionDriver.java#L223]
 for ZooKeeper and 
[KubernetesMultipleComponentLeaderElectionDriver:238|https://github.com/apache/flink/blob/0290715a57b8d243586ab747b0cd2416c8081012/flink-kubernetes/src/main/java/org/apache/flink/kubernetes/highavailability/KubernetesMultipleComponentLeaderElectionDriver.java#L238]
 for Kubernetes. But this only triggers the sending of the change information 
which is then executed in a separate thread in 
[DefaultMultipleComponentLeaderElectionService#sendLeaderInformationChange|https://github.com/apache/flink/blob/715c3fdef515c4b7ac70c4abd52910c08d6ca662/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/DefaultMultipleComponentLeaderElectionService.java#L247].
 Therefore, the leader role could have changed in the meantime.

> DefaultMultipleComponentLeaderElectionService triggers HA backend change even 
> if it's not the leader
> ----------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-30474
>                 URL: https://issues.apache.org/jira/browse/FLINK-30474
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Coordination
>    Affects Versions: 1.16.0, 1.17.0, 1.15.3
>            Reporter: Matthias Pohl
>            Assignee: Matthias Pohl
>            Priority: Critical
>
> {{DefaultMultipleComponentLeaderElectionService}} calls 
> {{LeaderElectionEventHandler#onLeaderInformationChange}} in any case even 
> though the contracts of that method states that it should be only called by 
> the leader to update the HA backend information (see 
> [JavaDoc|https://github.com/apache/flink/blob/5a2f220e31c50306a60aae8281f0ab4073fb85e1/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/LeaderElectionEventHandler.java#L46-L50]).



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

Reply via email to