Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,18 @@ public UpdateControl<FlinkBlueGreenDeployment> checkAndInitiateDeployment(
.rescheduleAfter(getReconciliationReschedInterval(context));
}

setLastReconciledSpec(context);
try {
return startTransition(
context, currentBlueGreenDeploymentType, currentFlinkDeployment);
var result =
startTransition(
context,
currentBlueGreenDeploymentType,
currentFlinkDeployment);
// Only stamp lastReconciledSpec after the transition
// succeeds. If stamped before and the transition
// fails/aborts, lastReconciledSpec drifts from the
// active child's actual spec
setLastReconciledSpec(context);
return result;
} catch (Exception e) {
var error = "Could not start Transition. Details: " + e.getMessage();
context.getDeploymentStatus().setSavepointTriggerId(null);
Expand All @@ -180,10 +188,12 @@ public UpdateControl<FlinkBlueGreenDeployment> checkAndInitiateDeployment(
"Savepoint redeploy triggered for '{}', using initialSavepointPath: {}",
context.getBgDeployment().getMetadata().getName(),
Objects.toString(jobSpec.getInitialSavepointPath(), "<none>"));
setLastReconciledSpec(context);
try {
return startSavepointRedeployTransition(
context, currentBlueGreenDeploymentType);
var result =
startSavepointRedeployTransition(
context, currentBlueGreenDeploymentType);
setLastReconciledSpec(context);
return result;
} catch (Exception e) {
var error =
"Could not start Savepoint Redeploy Transition. Details: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,13 @@ public void verifySavepointFetchFailureRecovery(FlinkVersion flinkVersion) throw
rs = reconcile(rs.deployment);
assertFailingWithError(rs, "Could not start Transition", error);

// lastReconciledSpec must NOT contain the failed spec change — otherwise
// subsequent deploys see no diff and fall into PATCH_CHILD (in-place
// upgrade) instead of a proper B/G transition
assertFalse(
rs.reconciledStatus.getLastReconciledSpec().contains(customValue),
"lastReconciledSpec should not be stamped when transition fails");

// Recovery: Clear the fetch error and try again with new spec change
flinkService.clearSavepointFetchError();
customValue = UUID.randomUUID().toString() + "_recovery";
Expand Down