dawidwys commented on a change in pull request #17946:
URL: https://github.com/apache/flink/pull/17946#discussion_r760223520
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/ExecutionAttemptMappingProvider.java
##########
@@ -56,14 +56,16 @@ protected boolean removeEldestEntry(
}
public Optional<ExecutionVertex> getVertex(ExecutionAttemptID id) {
- if (!cachedTasksById.containsKey(id)) {
- cachedTasksById.putAll(getCurrentAttemptMappings());
+ synchronized (cachedTasksById) {
Review comment:
I looked into the code and I think it is rather unlikely we would
request again an id that caused the miss. As far as I can tell it is possible
if we had multiple aborted checkpoints on a single task manager which is rather
unlikely. However I am not 100% sure if there are no other hidden reasons for
it...
If we want to maintain the special treatment of `null` I think we can do:
```
public Optional<ExecutionVertex> getVertex(ExecutionAttemptID id) {
if (cachedTasksById.containsKey(id)) {
return Optional.ofNullable(cachedTasksById.get(id));
}
return updateAndGet(id);
}
private Optional<ExecutionVertex> updateAndGet(ExecutionAttemptID id) {
synchronized (tasks) {
if (cachedTasksById.containsKey(id)) {
return Optional.ofNullable(cachedTasksById.get(id));
}
cachedTasksById = getCurrentAttemptMappings();
if (!cachedTasksById.containsKey(id)) {
cachedTasksById.put(id, null);
return Optional.empty();
}
return Optional.ofNullable(cachedTasksById.get(id));
}
}
```
--
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]