wanglijie95 commented on code in PR #21111:
URL: https://github.com/apache/flink/pull/21111#discussion_r1005237222


##########
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java:
##########
@@ -1548,7 +1548,18 @@ private void updateAccumulatorsAndMetrics(
             }
         }
         if (metrics != null) {
-            this.ioMetrics = metrics;
+            // The IOMetrics#resultPartitionBytes will not be used anymore, so 
we clear it here to
+            // reduce the space usage.
+            this.ioMetrics =

Review Comment:
   Fixed



##########
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/IOMetrics.java:
##########
@@ -42,30 +47,52 @@ public class IOMetrics implements Serializable {
     protected double accumulateBusyTime;
     protected long accumulateIdleTime;
 
-    protected final Map<IntermediateResultPartitionID, Long> 
numBytesProducedOfPartitions =
-            new HashMap<>();
+    @Nullable
+    protected Map<IntermediateResultPartitionID, ResultPartitionBytes> 
resultPartitionBytes;
 
     public IOMetrics(
             Meter recordsIn,
             Meter recordsOut,
             Meter bytesIn,
             Meter bytesOut,
-            Map<IntermediateResultPartitionID, Counter> 
numBytesProducedCounters,
             Gauge<Long> accumulatedBackPressuredTime,
             Gauge<Long> accumulatedIdleTime,
-            Gauge<Double> accumulatedBusyTime) {
+            Gauge<Double> accumulatedBusyTime,
+            Map<IntermediateResultPartitionID, ResultPartitionBytesCounter>
+                    resultPartitionBytesCounters) {
         this.numRecordsIn = recordsIn.getCount();
         this.numRecordsOut = recordsOut.getCount();
         this.numBytesIn = bytesIn.getCount();
         this.numBytesOut = bytesOut.getCount();
         this.accumulateBackPressuredTime = 
accumulatedBackPressuredTime.getValue();
         this.accumulateBusyTime = accumulatedBusyTime.getValue();
         this.accumulateIdleTime = accumulatedIdleTime.getValue();
+        this.resultPartitionBytes =
+                resultPartitionBytesCounters.entrySet().stream()
+                        .collect(
+                                Collectors.toMap(
+                                        Map.Entry::getKey,
+                                        entry -> 
entry.getValue().createSnapshot()));
+    }
 
-        for (Map.Entry<IntermediateResultPartitionID, Counter> counter :
-                numBytesProducedCounters.entrySet()) {
-            numBytesProducedOfPartitions.put(counter.getKey(), 
counter.getValue().getCount());
-        }
+    public IOMetrics(

Review Comment:
   Yes, fixed



-- 
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]

Reply via email to