You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/10/24 08:58:31 UTC

[GitHub] [flink] ChangjiGuo commented on a diff in pull request #20689: [FLINK-28984][runtime] Fix the problem that FsCheckpointStateOutputStream is not being released normally

ChangjiGuo commented on code in PR #20689:
URL: https://github.com/apache/flink/pull/20689#discussion_r1003062484


##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStreamFactory.java:
##########
@@ -454,6 +460,14 @@ private void createStream() throws IOException {
                                     fs, createStatePath(), WriteMode.NO_OVERWRITE);
                     this.outStream = streamAndPath.stream();
                     this.statePath = streamAndPath.path();
+                    if (closed) {

Review Comment:
   @Myasuka, Thanks for your review. Here are my views on these two cases:
   > 1. Check the closed flag before createStream to avoid unnecessary EntropyInjector#createEntropyAware.
   
   If we check `closed` before `createStream`, and the file is being created when close, we still can't solve the problem. This case usually occurs in scenarios where the storage system has high latency in creating files.
   
   > 2. What will happen if the stream is closed just after the check if (closed) in line-463? Will we also have the output stream left over?
   
   If the stream is closed just after the check `if (closed)` in line-463, output stream can still be closed normally. Because `this.outStream` has been assigned in line-461, when the `close` method is called, `this.outStream` is not null, and `this.outStream` and `this.statePath` can be released.



-- 
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-unsubscribe@flink.apache.org

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