Skip to content

[FLINK-39108][checkpoint] Respect disabled interval-during-backlog for the first checkpoint - #29110

Open
NestDream wants to merge 1 commit into
apache:masterfrom
NestDream:fix-checkpoint-backlog-first-trigger
Open

[FLINK-39108][checkpoint] Respect disabled interval-during-backlog for the first checkpoint#29110
NestDream wants to merge 1 commit into
apache:masterfrom
NestDream:fix-checkpoint-backlog-first-trigger

Conversation

@NestDream

Copy link
Copy Markdown
Contributor

What is the purpose of the change

Fixes FLINK-39108. execution.checkpointing.interval-during-backlog is honored for steady-state scheduling but not for the first checkpoint. Two things combine to let it through:

  • ScheduledTrigger#run parks itself when it finds the effective interval disabled, but still triggers the current run. This is the path the disabled ITCase hits: the source reports backlog before its task is running, the scheduler is (re)started at task RUNNING with a zero initial delay, and that first run fires a checkpoint before parking.
  • CheckpointCoordinator#setIsProcessingBacklog only reschedules the periodic trigger when the new effective interval would fire earlier and skips the disabled case, so a trigger that is already armed when the backlog is reported stays armed and wakes up only to park.

Net effect: at least one checkpoint is triggered during backlog even when checkpointing during backlog is disabled, which is what the ticket and the disabled CheckpointIntervalDuringBacklogITCase#testNoCheckpointDuringBacklog describe.

Brief change log

  • ScheduledTrigger#run no longer triggers a checkpoint when it finds the effective interval disabled; it only parks
  • setIsProcessingBacklog cancels an already armed periodic trigger when the effective interval becomes disabled instead of letting it wake up and park; when the backlog ends, the existing reschedule-if-earlier path re-arms it (the parked trigger's next fire time is Long.MAX_VALUE), so the first checkpoint after a backlog comes one full interval after the backlog ends
  • re-enabled CheckpointIntervalDuringBacklogITCase#testNoCheckpointDuringBacklog; the @Disabled annotation referenced FLINK-39018, a typo for FLINK-39108

Verifying this change

This change added tests and can be verified as follows:

  • CheckpointIntervalDuringBacklogITCase#testNoCheckpointDuringBacklog (the test disabled in [FLINK-34099][tests] Harden and disable CheckpointIntervalDuringBacklogITCase #27630) reproduces the reported behavior against unmodified master: it fails with Expecting AtomicInteger(2) to have value: 0, i.e. two checkpoints ran while the first source was still in backlog. With the change the whole class passes, 4/4.
  • CheckpointCoordinatorTriggeringTest#testFirstScheduledCheckpointNotTriggeredWhenBacklogCheckpointingDisabled: new unit test for a periodic trigger that is already armed when the backlog is reported. It checks that the trigger is cancelled right away, that no checkpoint is triggered during the backlog, and that exactly one checkpoint is triggered once the backlog ends. Fails on master at the first assertion (the trigger stays armed), passes with the change.
  • CheckpointCoordinatorTriggeringTest#testSchedulerStartedDuringBacklogDoesNotTriggerWhenBacklogCheckpointingDisabled: new unit test for the ordering the ITCase hits (backlog reported before the scheduler is started). It checks that the first run of the armed trigger does not trigger a checkpoint and that checkpointing resumes once the backlog ends. Fails on master (one checkpoint is triggered), passes with the change.
  • End to end on a local MiniCluster: a job reading a HybridSource of two NumberSequenceSources with interval 1s and interval-during-backlog 0. On master, checkpoints 1 and 2 complete while the first source is still in backlog; with this change no checkpoint runs during backlog and checkpointing resumes right after the switch to the second source (7 checkpoints). Same result in 4 runs each.

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, Checkpointing (scheduling of the periodic trigger)
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

…r the first checkpoint

When a source reported isProcessingBacklog=true while
execution.checkpointing.interval-during-backlog was disabled, the
periodic trigger armed by startCheckpointScheduler stayed scheduled:
setIsProcessingBacklog only reschedules when the new effective interval
is shorter and skips the disabled case entirely. On top of that,
ScheduledTrigger#run stopped future scheduling when the effective
interval was disabled but still triggered the current run. As a result
at least one checkpoint fired during backlog processing even though
checkpointing should have been suspended.

Cancel the armed periodic trigger when the effective interval becomes
disabled, and make ScheduledTrigger re-check the effective interval
before triggering so a pending run is skipped once checkpointing is
disabled. The trigger is re-armed by setIsProcessingBacklog when the
backlog ends.

This also re-enables
CheckpointIntervalDuringBacklogITCase#testNoCheckpointDuringBacklog,
which was disabled waiting for this fix (its annotation referenced
FLINK-39018, a typo for FLINK-39108).
@NestDream

Copy link
Copy Markdown
Contributor Author

@rkhachatryan this re-enables testNoCheckpointDuringBacklog, the test you disabled in #27630. Could you take a look when you get a chance?

@flinkbot

flinkbot commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants