XComp commented on code in PR #22422:
URL: https://github.com/apache/flink/pull/22422#discussion_r1175063876
##########
flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/LeaderElectionEventHandler.java:
##########
@@ -39,12 +40,29 @@ public interface LeaderElectionEventHandler {
*/
void onGrantLeadership(UUID newLeaderSessionId);
+ /**
+ * Called by specific {@link LeaderElectionDriver} when the leadership is
granted.
+ *
+ * <p>This method will trigger the grant event processing in a separate
thread.
+ *
+ * @param newLeaderSessionId the valid leader session id
+ */
+ CompletableFuture<Void> onGrantLeadershipAsync(UUID newLeaderSessionId);
Review Comment:
No, we don't. Initially, I wanted to avoid having two separate thread
involved in the event processing (the one in the driver and the one in the
`DefaultLeaderElectionService`). My concern was that we would destroy the order
of the events while handling them in separate threads. But I noticed that this
is not the case. The only premise is that the event handling methods are always
called from the same thread. We could go ahead and add a single thread to
`DefaultLeaderElectionService` and even leave the thread handling in
`DefaultMultipleComponentLeaderElectionService` (to keep this PR as small as
possible).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]