You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Zakelly (via GitHub)" <gi...@apache.org> on 2024/04/09 12:22:31 UTC

[PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Zakelly opened a new pull request, #24644:
URL: https://github.com/apache/flink/pull/24644

   ## What is the purpose of the change
   
   This is a sub-task of FLIP-306. The life-cycle maintenance of underlying files in file merging manager needs the info of state handle reusing. This PR provide a callback for state handle reusing in `CheckpointStreamFactory` and integrate this with RocksDBKeyedStateBackend.
   
   
   ## Brief change log
   
    - Add interface `reusePreviousStateHandle` in `CheckpointStreamFactory`, implement this in `FsMergingCheckpointStorageLocation`
    - Call `reusePreviousStateHandle` during uploading.
   
   ## Verifying this change
   
    - New UT `testReuseCallbackAndAdvanceWatermark`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: yes
     - The S3 file system connector: yes
   
   ## Documentation
   
     - Does this pull request introduce a new feature?  no
     - If yes, how is the feature documented? not applicable
   


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


Re: [PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #24644:
URL: https://github.com/apache/flink/pull/24644#issuecomment-2045072093

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "be934f9e818e19f1511933f82034918a68618a29",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "be934f9e818e19f1511933f82034918a68618a29",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * be934f9e818e19f1511933f82034918a68618a29 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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


Re: [PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on code in PR #24644:
URL: https://github.com/apache/flink/pull/24644#discussion_r1568486250


##########
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/snapshot/RocksIncrementalSnapshotStrategy.java:
##########
@@ -349,6 +350,13 @@ private long uploadSnapshotFiles(
                                 ? CheckpointedStateScope.EXCLUSIVE
                                 : CheckpointedStateScope.SHARED;
 
+                // Report the reuse of state handle to stream factory, which is essential for file
+                // merging mechanism.
+                checkpointStreamFactory.reusePreviousStateHandle(

Review Comment:
   Nope. This could be optimized later. (This PR considers the file reusing only, not newly introduced files)



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


Re: [PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Posted by "fredia (via GitHub)" <gi...@apache.org>.
fredia merged PR #24644:
URL: https://github.com/apache/flink/pull/24644


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


Re: [PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Posted by "ljz2051 (via GitHub)" <gi...@apache.org>.
ljz2051 commented on code in PR #24644:
URL: https://github.com/apache/flink/pull/24644#discussion_r1562362549


##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/filemerging/FileMergingSnapshotManagerBase.java:
##########
@@ -70,6 +72,9 @@ public abstract class FileMergingSnapshotManagerBase implements FileMergingSnaps
     @GuardedBy("lock")
     protected TreeMap<Long, Set<LogicalFile>> uploadedStates = new TreeMap<>();
 
+    /** The map that holds all the known live logical files. */
+    protected final Map<LogicalFileId, LogicalFile> knownLogicalFiles = new ConcurrentHashMap<>();

Review Comment:
   It could be a private variable?



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


Re: [PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on PR #24644:
URL: https://github.com/apache/flink/pull/24644#issuecomment-2048883029

   @ljz2051 @fredia Would you please take a look?


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


Re: [PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on code in PR #24644:
URL: https://github.com/apache/flink/pull/24644#discussion_r1565161944


##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/filemerging/FileMergingSnapshotManagerBase.java:
##########
@@ -459,13 +470,28 @@ public void notifyCheckpointSubsumed(SubtaskKey subtaskKey, long checkpointId)
                     uploadedStates.headMap(checkpointId, true).entrySet().iterator();
             while (uploadedStatesIterator.hasNext()) {
                 Map.Entry<Long, Set<LogicalFile>> entry = uploadedStatesIterator.next();
-                if (discardLogicalFiles(subtaskKey, entry.getKey(), entry.getValue())) {
+                if (discardLogicalFiles(subtaskKey, checkpointId, entry.getValue())) {

Review Comment:
   FYI: This is a bug found by newly added UTs.



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


Re: [PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on code in PR #24644:
URL: https://github.com/apache/flink/pull/24644#discussion_r1566633317


##########
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/snapshot/RocksIncrementalSnapshotStrategy.java:
##########
@@ -349,6 +350,13 @@ private long uploadSnapshotFiles(
                                 ? CheckpointedStateScope.EXCLUSIVE
                                 : CheckpointedStateScope.SHARED;
 
+                // Report the reuse of state handle to stream factory, which is essential for file
+                // merging mechanism.
+                checkpointStreamFactory.reusePreviousStateHandle(

Review Comment:
   Actually, only previous logical files are updated here, the `sstFiles` stands for the previous handle at this position.



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


Re: [PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Posted by "fredia (via GitHub)" <gi...@apache.org>.
fredia commented on code in PR #24644:
URL: https://github.com/apache/flink/pull/24644#discussion_r1565310108


##########
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/snapshot/RocksIncrementalSnapshotStrategy.java:
##########
@@ -349,6 +350,13 @@ private long uploadSnapshotFiles(
                                 ? CheckpointedStateScope.EXCLUSIVE
                                 : CheckpointedStateScope.SHARED;
 
+                // Report the reuse of state handle to stream factory, which is essential for file
+                // merging mechanism.
+                checkpointStreamFactory.reusePreviousStateHandle(

Review Comment:
   If the following uploading fails, the logic files will be deleted with delay?
   
   And I think the `reusePreviousStateHandle` is a little bit indirect. In fact, the `lastUsedCheckpoint` of the newly generated and previous logical files are both updated here.



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


Re: [PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Posted by "fredia (via GitHub)" <gi...@apache.org>.
fredia commented on code in PR #24644:
URL: https://github.com/apache/flink/pull/24644#discussion_r1566649212


##########
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/snapshot/RocksIncrementalSnapshotStrategy.java:
##########
@@ -349,6 +350,13 @@ private long uploadSnapshotFiles(
                                 ? CheckpointedStateScope.EXCLUSIVE
                                 : CheckpointedStateScope.SHARED;
 
+                // Report the reuse of state handle to stream factory, which is essential for file
+                // merging mechanism.
+                checkpointStreamFactory.reusePreviousStateHandle(

Review Comment:
   If the following uploading fails, can the logical files be deleted immediately? instead of deleting when receiving checkpoint abort notification.



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


Re: [PR] [FLINK-34936][Checkpointing] Register reused shared state handle to FileMergingSnapshotManager [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on PR #24644:
URL: https://github.com/apache/flink/pull/24644#issuecomment-2058127691

   > Thanks for this pr! Overall, LGTM. I have one question:
   > 
   > If a subtask completes its checkpoint but the job's overall checkpoint fails, the FileMergingSnapshotManager will still delete the successfully uploaded files upon checkpoint abort. Does this imply that, for FileMergingSnapshotManager, there is no feasible way to reuse the checkpoint files which were "partially uploaded successfully" within a checkpoint?
   
   For now, yes, they cannot be reused.


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