This is an automated email from the ASF dual-hosted git repository.

gyfora pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-kubernetes-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new 53504653a [FLINK-39967] Fix `backoffLimit=-1` to mean unlimited 
retries in FlinkStateSnapshot
53504653a is described below

commit 53504653a6a570efb86f0a545a8dcd7c65aff2eb
Author: Santwana Verma <[email protected]>
AuthorDate: Mon Jun 22 19:08:58 2026 +0530

    [FLINK-39967] Fix `backoffLimit=-1` to mean unlimited retries in 
FlinkStateSnapshot
---
 .../controller/FlinkStateSnapshotController.java    |  3 ++-
 .../FlinkStateSnapshotControllerTest.java           | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git 
a/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/controller/FlinkStateSnapshotController.java
 
b/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/controller/FlinkStateSnapshotController.java
index 8c36dc0ef..97e9075d0 100644
--- 
a/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/controller/FlinkStateSnapshotController.java
+++ 
b/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/controller/FlinkStateSnapshotController.java
@@ -128,7 +128,8 @@ public class FlinkStateSnapshotController
                 resource.getStatus().getError(),
                 ctx.getKubernetesClient());
 
-        if (resource.getStatus().getFailures() > 
resource.getSpec().getBackoffLimit()) {
+        var backoffLimit = resource.getSpec().getBackoffLimit();
+        if (backoffLimit >= 0 && resource.getStatus().getFailures() > 
backoffLimit) {
             LOG.info(
                     "Snapshot {} failed and won't be retried as failure count 
exceeded the backoff limit",
                     resource.getMetadata().getName());
diff --git 
a/flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/controller/FlinkStateSnapshotControllerTest.java
 
b/flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/controller/FlinkStateSnapshotControllerTest.java
index ce36f4268..c23478ad4 100644
--- 
a/flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/controller/FlinkStateSnapshotControllerTest.java
+++ 
b/flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/controller/FlinkStateSnapshotControllerTest.java
@@ -154,6 +154,27 @@ public class FlinkStateSnapshotControllerTest {
         assertThat(snapshot.getStatus().getState()).isEqualTo(FAILED);
     }
 
+    @Test
+    public void testReconcileBackoffUnlimited() {
+        var deployment = createDeployment();
+        context = TestUtils.createSnapshotContext(client, deployment);
+        // Default backoffLimit is -1, meaning unlimited retries
+        var snapshot = createSavepoint(deployment, false, -1);
+        snapshot.setStatus(new FlinkStateSnapshotStatus());
+
+        flinkService.setTriggerSavepointFailure(true);
+
+        // With unlimited retries, the snapshot should never transition to 
FAILED
+        for (int i = 0; i < 10; i++) {
+            controller.updateErrorStatus(snapshot, context, new Exception());
+            assertThat(snapshot.getStatus().getState())
+                    .as(
+                            "Snapshot with backoffLimit=-1 should retry 
indefinitely, but failed after attempt %d",
+                            i + 1)
+                    .isEqualTo(TRIGGER_PENDING);
+        }
+    }
+
     @ParameterizedTest
     @ValueSource(booleans = {true, false})
     public void testReconcileSavepointAlreadyExists(boolean jobReferenced) {

Reply via email to