From b266031e362b59ae9ed2caadd0263100bd1ab7fb Mon Sep 17 00:00:00 2001 From: Rui Fan <1996fanrui@gmail.com> Date: Sun, 25 Oct 2026 21:40:22 +0100 Subject: [PATCH] [FLINK-41193][checkpointing] Disable checkpointing during recovery when aligned-checkpoint-timeout > 0 Generated-by: Claude Opus 5.5 --- .../generated/checkpointing_configuration.html | 2 +- .../generated/common_checkpointing_section.html | 2 +- .../flink/configuration/CheckpointingOptions.java | 12 +++++++++++- .../configuration/CheckpointingOptionsTest.java | 9 +++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/layouts/shortcodes/generated/checkpointing_configuration.html b/docs/layouts/shortcodes/generated/checkpointing_configuration.html index e5fb53d40ca78d..cc6a1b6d5adafe 100644 --- a/docs/layouts/shortcodes/generated/checkpointing_configuration.html +++ b/docs/layouts/shortcodes/generated/checkpointing_configuration.html @@ -54,7 +54,7 @@
execution.checkpointing.unaligned.recover-output-on-downstream.enabled to be enabled. It does not require unaligned checkpoints to be currently enabled, because a job may restore from an unaligned checkpoint while having unaligned checkpoints disabled for the new execution.execution.checkpointing.unaligned.recover-output-on-downstream.enabled to be enabled. It does not require unaligned checkpoints to be currently enabled, because a job may restore from an unaligned checkpoint while having unaligned checkpoints disabled for the new execution.execution.checkpointing.aligned-checkpoint-timeout is greater than 0, and will be disabled in this case.execution.checkpointing.unaligned.recover-output-on-downstream.enabled to be enabled. It does not require unaligned checkpoints to be currently enabled, because a job may restore from an unaligned checkpoint while having unaligned checkpoints disabled for the new execution.execution.checkpointing.unaligned.recover-output-on-downstream.enabled to be enabled. It does not require unaligned checkpoints to be currently enabled, because a job may restore from an unaligned checkpoint while having unaligned checkpoints disabled for the new execution.execution.checkpointing.aligned-checkpoint-timeout is greater than 0, and will be disabled in this case.Requires both {@link #UNALIGNED_RECOVER_OUTPUT_ON_DOWNSTREAM} and unaligned checkpoints to * be enabled, because checkpointing during recovery is only supported on the unaligned - * barrier-handler path. + * barrier-handler path. It is also disabled when {@link #ALIGNED_CHECKPOINT_TIMEOUT} is + * positive. * * @param config the configuration to check * @return {@code true} if unaligned checkpointing during recovery is enabled, {@code false} @@ -868,6 +874,10 @@ public static boolean isCheckpointingDuringRecoveryEnabled(Configuration config) if (!config.get(UNALIGNED_RECOVER_OUTPUT_ON_DOWNSTREAM)) { return false; } + // TODO FLINK-40526: Support checkpointing during recovery with aligned checkpoint timeout. + if (!config.get(ALIGNED_CHECKPOINT_TIMEOUT).isZero()) { + return false; + } return config.get(CHECKPOINTING_DURING_RECOVERY_ENABLED) && isUnalignedCheckpointEnabled(config); } diff --git a/flink-core/src/test/java/org/apache/flink/configuration/CheckpointingOptionsTest.java b/flink-core/src/test/java/org/apache/flink/configuration/CheckpointingOptionsTest.java index 9c8940eb2462d6..c1192204a0317b 100644 --- a/flink-core/src/test/java/org/apache/flink/configuration/CheckpointingOptionsTest.java +++ b/flink-core/src/test/java/org/apache/flink/configuration/CheckpointingOptionsTest.java @@ -386,6 +386,15 @@ void testIsCheckpointingDuringRecoveryEnabled() { .as("During-recovery should be disabled when unaligned checkpoints are disabled") .isFalse(); + // Test when all three prerequisites are enabled but aligned checkpoint timeout is positive + Configuration alignedTimeoutConfig = new Configuration(allEnabledConfig); + alignedTimeoutConfig.set( + CheckpointingOptions.ALIGNED_CHECKPOINT_TIMEOUT, Duration.ofSeconds(1)); + assertThat(CheckpointingOptions.isCheckpointingDuringRecoveryEnabled(alignedTimeoutConfig)) + .as( + "During-recovery should be disabled when aligned checkpoint timeout is positive") + .isFalse(); + // Test when recover-output-on-downstream is explicitly false and during-recovery is true Configuration explicitlyDisabledConfig = new Configuration(); explicitlyDisabledConfig.set(