tillrohrmann commented on a change in pull request #13511:
URL: https://github.com/apache/flink/pull/13511#discussion_r497305693
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/SharedSlot.java
##########
@@ -215,10 +218,19 @@ public void release(Throwable cause) {
slotContextFuture.isDone(),
"Releasing of the shared slot is expected only from its
successfully allocated physical slot ({})",
physicalSlotRequestId);
- for (ExecutionVertexID executionVertexId :
requestedLogicalSlots.keySetA()) {
- LOG.debug("Release {}",
getLogicalSlotString(executionVertexId));
+ LOG.debug("Release shared slot ({})", physicalSlotRequestId);
+
+ // copy the logical slot collection to avoid
ConcurrentModificationException
+ // if logical slot releases cause cancellation of other
executions
+ // which will try to call returnLogicalSlot and modify
requestedLogicalSlots collection
+ Map<ExecutionVertexID, CompletableFuture<SingleLogicalSlot>>
logicalSlotFutures = requestedLogicalSlots
+ .keySetA()
+ .stream()
+ .collect(Collectors.toMap(executionVertexId ->
executionVertexId, requestedLogicalSlots::getValueByKeyA));
Review comment:
Are we only creating this map because of the debug logging? Wouldn't it
be simpler and computationally cheaper to take `requestedLogicalSlots.values()`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]