Github user StephanEwen commented on the issue: https://github.com/apache/flink/pull/5982 Good point about the renaming on `close()` in case close is called for cleanup, rather than success. We could follow the same semantics as in [CheckpointStateOutputStream](https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/state/CheckpointStreamFactory.java#L61) There the semantics are: - `close()` means "close on error / cleanup" and closes the stream and deletes the temp file. - `closeAndPublish()` would mean "close on success" and close the stream and rename the file. - After ``closeAndPublish()` has been called, `close()` becomes a no-op. The [FsCheckpointMetadataOutputStream](https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsCheckpointMetadataOutputStream.java) implements that pattern, I think it worked well and is easy to use.
---