Github user uce commented on a diff in the pull request:
https://github.com/apache/flink/pull/640#discussion_r31136136
--- 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);
+ }
+ }
+
+ for (int i = 0; i < numConsumers; i++) {
+ resultPartition.pin();
--- End diff --
Pinning a result partition, increases the pending references count by the
total number of subpartitions. We need to adjust it to just increment it for
each call.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---