You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[FLINK-37605][runtime] Infer checkpoint id on endInput in sink
So far, we used a special value for the final checkpoint on endInput. However, as shown in the description of this ticket, final doesn't mean final. Hence, multiple committables with EOI could be created at different times.
With this commit, we stop using a special value for such committables and instead try to guess the checkpoint id of the next checkpoint. There are various factors that influence the checkpoint id but we can mostly ignore them all because we just need to pick a checkpoint id that is
- higher than all checkpoint ids of the previous, successful checkpoints of this attempt
- higher than the checkpoint id of the restored checkpoint
- lower than any future checkpoint id.
Hence, we just remember the last observed checkpoint id (initialized with max(0, restored id)), and use last id + 1 for endInput. Naturally, multiple endInput calls happening through restarts will result in unique checkpoint ids. Note that aborted checkpoints before endInput may result in diverged checkpoint ids across subtasks. However, each of the id satisfies above requirements and any id of endInput1 will be smaller than any id of endInput2. Thus, diverged checkpoint ids will not impact correctness at all.
Copy file name to clipboardExpand all lines: flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/sink/compactor/operator/CompactorOperator.java
Copy file name to clipboardExpand all lines: flink-runtime/src/main/java/org/apache/flink/streaming/runtime/operators/sink/committables/CheckpointCommittableManagerImpl.java
Copy file name to clipboardExpand all lines: flink-runtime/src/main/java/org/apache/flink/streaming/runtime/operators/sink/committables/CommittableCollector.java
-12
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,6 @@
33
33
importjava.util.Map.Entry;
34
34
importjava.util.NavigableMap;
35
35
importjava.util.Objects;
36
-
importjava.util.Optional;
37
36
importjava.util.TreeMap;
38
37
importjava.util.stream.Collectors;
39
38
@@ -49,8 +48,6 @@
49
48
*/
50
49
@Internal
51
50
publicclassCommittableCollector<CommT> {
52
-
privatestaticfinallongEOI = Long.MAX_VALUE;
53
-
54
51
/** Mapping of checkpoint id to {@link CheckpointCommittableManagerImpl}. */
Copy file name to clipboardExpand all lines: flink-runtime/src/test/java/org/apache/flink/streaming/runtime/operators/sink/GlobalCommitterOperatorTest.java
0 commit comments