akalash commented on a change in pull request #18852:
URL: https://github.com/apache/flink/pull/18852#discussion_r816696039



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java
##########
@@ -565,20 +563,44 @@ private void 
startTriggeringCheckpoint(CheckpointTriggerRequest request) {
                                                     request.props,
                                                     checkpointInfo.f0,
                                                     request.isPeriodic,
-                                                    
checkpointInfo.f1.checkpointId,
-                                                    
checkpointInfo.f1.checkpointStorageLocation,
+                                                    checkpointInfo.f1,
                                                     
request.getOnCompletionFuture()),
                                     timer);
 
             final CompletableFuture<?> coordinatorCheckpointsComplete =
-                    pendingCheckpointCompletableFuture.thenComposeAsync(
-                            (pendingCheckpoint) ->
-                                    OperatorCoordinatorCheckpoints
-                                            
.triggerAndAcknowledgeAllCoordinatorCheckpointsWithCompletion(
-                                                    coordinatorsToCheckpoint,
-                                                    pendingCheckpoint,
-                                                    timer),
-                            timer);
+                    pendingCheckpointCompletableFuture
+                            .thenApplyAsync(
+                                    pendingCheckpoint -> {
+                                        try {
+                                            CheckpointStorageLocation 
checkpointStorageLocation =
+                                                    
initializeCheckpointLocation(
+                                                            
pendingCheckpoint.getCheckpointID(),
+                                                            request.props,
+                                                            
request.externalSavepointLocation,
+                                                            
initializeBaseLocations);
+                                            return Tuple2.of(
+                                                    pendingCheckpoint, 
checkpointStorageLocation);
+                                        } catch (Throwable e) {
+                                            throw new CompletionException(e);
+                                        }
+                                    },
+                                    executor)
+                            .thenApplyAsync(
+                                    (checkpointInfo) -> {
+                                        PendingCheckpoint pendingCheckpoint = 
checkpointInfo.f0;
+                                        
pendingCheckpoint.setCheckpointTargetLocation(

Review comment:
       Sorry, perhaps, I wasn't clear enough. But I meant that you should use 
the lock here rather than inside of pendingCheckpoint. So please remove 
synchronization from `setCheckpointTargetLocation` and add it here:
   ```
   synchronization(lock) {
     pendingCheckpoint.setCheckpointTargetLocation(checkpointInfo.f1);
   }
   ```
   We need it because as you can see `targetLocation` in 
`PendingCheckpoint#discard` is used outside of PendingCheckpoint#lock but it is 
always used with CheckpointCoordinator#lock or in `timer` thread.




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