prashantbh commented on code in PR #28201:
URL: https://github.com/apache/flink/pull/28201#discussion_r3556977655
##########
flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMasterServiceLeadershipRunner.java:
##########
@@ -62,13 +62,21 @@
* <p>All leadership operations are serialized. This means that granting the
leadership has to
* complete before the leadership can be revoked and vice versa.
*
- * <p>The {@link #resultFuture} can be completed with the following values: * *
+ * <p>The {@link #resultFuture} can be completed with the following values:
*
* <ul>
* <li>{@link JobManagerRunnerResult} to signal an initialization failure of
the {@link
- * JobMasterService} or the completion of a job
+ * JobMasterService}, the completion of a job, or a globally terminal
result observed before
+ * leadership revocation could be forwarded
* <li>{@link Exception} to signal an unexpected failure
* </ul>
+ *
+ * <p>To close the race between a globally terminal result and a leadership
revocation that strips
+ * the forwarded result (see FLINK-39704), terminal results are cached in
{@link
+ * #pendingTerminalResult} the moment they are observed. The cache is
populated by {@link
+ * #rememberGloballyTerminalResultIfCurrentProcess}, drained by either {@link
#grantLeadership} (on
+ * re-grant) or {@link #completeResultFutureAfterClose} (on close), and
cleared by {@link
+ * #onJobCompletion} when forwarding succeeds normally.
Review Comment:
Yeah, makes sense, I have kept it at the class level since I feel Flink
tends to avoid inline comments, but you're right, it's an implementation
detail. Moved it onto the pendingTerminalResult field. Done.
--
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]