Github user uce commented on a diff in the pull request: https://github.com/apache/flink/pull/640#discussion_r31134168 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionManager.java --- @@ -119,10 +153,50 @@ public void shutdown() { } } + /** + * Registers and pins a cached ResultPartition that holds the data for an IntermediateResultPartition. + * @param partitionID The IntermediateResultPartitionID to find a corresponding ResultPartition for. + * @param numConsumers The number of consumers that want to access the ResultPartition + * @return true if the registering/pinning succeeded, false otherwise. + */ + public boolean pinCachedResultPartition(IntermediateResultPartitionID partitionID, int numConsumers) { + synchronized (cachedResultPartitions) { + ResultPartition resultPartition = cachedResultPartitions.get(partitionID); + if (resultPartition != null) { + try { + // update its least recently used value + updateIntermediateResultPartitionCache(resultPartition); + + synchronized (registeredPartitions) { + if (!registeredPartitions.containsValue(resultPartition)) { + LOG.debug("Registered previously cached ResultPartition {}.", resultPartition); + registerResultPartition(resultPartition); --- End diff -- I think there is a race between pinning and releasing. It could happen that a pinned result is removed by a concurrent release (in the onConsumed callback).
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---