masteryhx commented on code in PR #24497:
URL: https://github.com/apache/flink/pull/24497#discussion_r1525686649


##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/filemerging/AcrossCheckpointFileMergingSnapshotManager.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.checkpoint.filemerging;
+
+import org.apache.flink.core.fs.FSDataOutputStream;
+import org.apache.flink.runtime.state.CheckpointedStateScope;
+
+import javax.annotation.Nonnull;
+
+import java.io.IOException;
+import java.util.concurrent.Executor;
+
+/** A {@link FileMergingSnapshotManager} that merging files across 
checkpoints. */
+public class AcrossCheckpointFileMergingSnapshotManager extends 
FileMergingSnapshotManagerBase {
+
+    private final PhysicalFilePool filePool;
+
+    public AcrossCheckpointFileMergingSnapshotManager(
+            String id, long maxFileSize, PhysicalFilePool.Type filePoolType, 
Executor ioExecutor) {
+        super(id, maxFileSize, filePoolType, ioExecutor);
+        filePool = createPhysicalPool();
+    }
+
+    @Override
+    @Nonnull
+    protected PhysicalFile getOrCreatePhysicalFileForCheckpoint(
+            SubtaskKey subtaskKey, long checkpointID, CheckpointedStateScope 
scope)
+            throws IOException {
+        PhysicalFile result = filePool.pollFile(subtaskKey, scope);
+
+        // a new file could be put into the file pool after closeAndGetHandle()
+        return result == null ? createPhysicalFile(subtaskKey, scope) : result;

Review Comment:
   It's not necessary because current PhysicalFilePool delegate the creator so 
pollFile will always resturn a usable PhysicalFile.



##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/filemerging/FileMergingType.java:
##########
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.checkpoint.filemerging;
+
+/** How the checkpoint files can be segmented. */
+public enum FileMergingType {
+    // do not write logical checkpoint files into file segments
+    // and thus do not merge checkpoint files
+    NO_MERGE,

Review Comment:
   How NO_MERGE will behave ? Will it delegate to the original stream ?
   It will fail in current logic, right ?



##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/filemerging/FileMergingSnapshotManagerBuilder.java:
##########
@@ -29,6 +29,8 @@ public class FileMergingSnapshotManagerBuilder {
     /** The id for identifying a {@link FileMergingSnapshotManager}. */
     private final String id;
 
+    private FileMergingType fileMergingType = FileMergingType.NO_MERGE;

Review Comment:
   nit: some comments consistent with other fields ? 



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