flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tillrohrmann <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2354] Add job graph and checkpoint reco...
Date Mon, 05 Oct 2015 10:04:04 GMT
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1153#discussion_r41127760
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/LeaderElectionService.java
---
    @@ -67,4 +67,20 @@
     	 * @return true if the associated {@link LeaderContender} is the leader, otherwise false
     	 */
     	boolean hasLeadership();
    +
    +	/**
    +	 * [EXPERIMENTAL] Returns <code>true</code> if the {@link LeaderContender}
is leader. A call
    +	 * to this method might block.
    +	 *
    +	 * <p>This forces a synchronous check at the respective state backend. It is possible
    +	 * that is does not reflect the current state at the {@link LeaderContender}, which
is notified
    +	 * asynchronously. Therefore it is possible that {@link #hasLeadership()} and {@link
    +	 * #syncHasLeadership()} have different return values.
    +	 *
    +	 * @TODO @tillrohrmann Is it OK to collapse this with {@link #hasLeadership()}?
    +	 *
    +	 * @return true if the associated {@link LeaderContender} is the leader, otherwise false
    +	 */
    +	boolean syncHasLeadership();
    --- End diff --
    
    I do not know, whether this method adds much value. The problem is that reading the leader
path data and comparing the leader session ID do not happen atomically. Thus, the moment you've
just read the leader path, it can happen that the node's data and, thus, the leader changed.
IMO, this is the same problem as with `leaderLatch.hasLeadership`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message