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



##########
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:
       If we have a huge savepoint (e.g., in TB range) to process, do we also 
do with parallelism=1?  meaning only one thread does the file copy, potentially 
many of them. 




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to