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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]