sjwiesman commented on a change in pull request #13309:
URL: https://github.com/apache/flink/pull/13309#discussion_r483156392



##########
File path: 
flink-libraries/flink-state-processing-api/src/main/java/org/apache/flink/state/api/WritableSavepoint.java
##########
@@ -90,38 +93,37 @@ public final void write(String path) {
 
                List<OperatorState> existingOperators = 
metadata.getExistingOperators();
 
-               DataSet<OperatorState> finalOperatorStates = 
unionOperatorStates(newOperatorStates, existingOperators);
-
-               finalOperatorStates
-                       .reduceGroup(new 
MergeOperatorStates(metadata.getMasterStates()))
-                       .name("reduce(OperatorState)")
-                       .output(new SavepointOutputFormat(savepointPath))
-                       .name(path);
-       }
-
-       private DataSet<OperatorState> 
unionOperatorStates(DataSet<OperatorState> newOperatorStates, 
List<OperatorState> existingOperators) {
                DataSet<OperatorState> finalOperatorStates;
                if (existingOperators.isEmpty()) {
                        finalOperatorStates = newOperatorStates;
                } else {
-                       DataSet<OperatorState> wrappedCollection = 
newOperatorStates
-                               .getExecutionEnvironment()
+                       DataSet<OperatorState> existingOperatorStates = 
newOperatorStates.getExecutionEnvironment()
                                .fromCollection(existingOperators);
 
-                       finalOperatorStates = 
newOperatorStates.union(wrappedCollection);
+                       existingOperatorStates
+                               .flatMap(new StatePathExtractor())

Review comment:
       We need to pin the parallelism of this to `1`. The collection source 
only runs a parallelism `1` so it will chain and then the paths will 
redistribute to the copy method. Otherwise we are not properly distributing 
this work. 
   
   ```suggestion
                                .flatMap(new StatePathExtractor())
                                .setParallelism(1)
   ```




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


Reply via email to