AlexYinHan commented on code in PR #26696:
URL: https://github.com/apache/flink/pull/26696#discussion_r2156252225


##########
flink-state-backends/flink-statebackend-forst/src/main/java/org/apache/flink/state/forst/datatransfer/CopyDataTransferStrategy.java:
##########
@@ -163,7 +168,10 @@ private HandleAndLocalPath copyFileToCheckpoint(
             List<StreamStateHandle> result =
                     checkpointStreamFactory.duplicate(
                             Collections.singletonList(sourceHandle), 
stateScope);
-            return result.get(0);
+            StreamStateHandle resultStateHandle = result.get(0);
+            tmpResourcesRegistry.registerCloseable(

Review Comment:
   In this copy method, we are not 'discarding state', but are 'registering the 
close logic'. The ```tmpResourcesRegistry``` will trigger all the 'close logic' 
when it decides to do the clean-up.
   
   A typical situation of 'half-uploaded checkpoints' is when a checkpoint is 
aborted before it can register the uploaded files to JM. In this case, we 
should ensure the files can be cleaned by through ```tmpResourcesRegistry```. 
That is really an expected situation in real-world so we cannot 'prevent it'.
   
   Anyway, i've added comments for the clean-up logic.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to