You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/01/27 09:40:07 UTC

[GitHub] [flink] tillrohrmann commented on a change in pull request #18526: [FLINK-25831] Retrieve the latest non-null prior property from ExecutionVertex

tillrohrmann commented on a change in pull request #18526:
URL: https://github.com/apache/flink/pull/18526#discussion_r793422305



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java
##########
@@ -283,15 +284,30 @@ public ArchivedExecution getPriorExecutionAttempt(int attemptNumber) {
         }
     }
 
-    public ArchivedExecution getLatestPriorExecution() {
-        synchronized (priorExecutions) {
-            final int size = priorExecutions.size();
-            if (size > 0) {
-                return priorExecutions.get(size - 1);
-            } else {
-                return null;
+    /**
+     * Gets the latest property from a prior execution that is not null.
+     *
+     * @param extractor defining the property to extract
+     * @param <T> type of the property
+     * @return Optional containing the latest property if it exists; otherwise {@code
+     *     Optional.empty()}.
+     */
+    private <T> Optional<T> getLatestPriorProperty(Function<ArchivedExecution, T> extractor) {

Review comment:
       Yes. The `ExecutionGraph` used to be thread safe but not it is only driven by a single thread. This made many things a lot easier.




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org