Skip to content

[cloud 165] Fix deleted deployment version accumulation on passive clusters - #12969

Merged
rkannan82 merged 2 commits into
temporalio:cloud/v1.33.0-165from
rkannan82:kannan/backport-12966-cloud-165
Nov 6, 2026
Merged

rkannan82 merged 2 commits into
temporalio:cloud/v1.33.0-165from
rkannan82:kannan/backport-12966-cloud-165

Conversation

@rkannan82

Copy link
Copy Markdown
Contributor

What changed?

Backports #12966 to Cloud 165. If active deletes A from {A, B}, a newer or equal-clock incoming snapshot now replaces passive deployment data with {B}, removing the orphan. Older incoming snapshots and missing clocks still merge by revision.

matching.enableTaskQueueUserDataRevisionMerge defaults to true. Disabling it restores parent-clock snapshot selection from before the original union fix. An equal or newer incoming snapshot can still remove valid target-only data; this is the same accepted limitation as the main PR.

Release-only union-preservation tests are updated to retain their older/missing-source-clock cases. The backported tests cover equal/newer replacement and missing-target-clock merging.

Original PRs

Why is this necessary as a patch?

The unconditional union merge retains versions deleted on the active. These accumulate on passive clusters and can block new worker builds after failover when the task queue version limit is exceeded.

What testing or retesting is appropriate for this patch after merge?

Matching unit tests and focused replication tests with Go's race detector. Run the standard patch validation.

rkannan82 and others added 2 commits November 5, 2026 20:08
…oralio#12966)

Problem: Deleted deployment versions accumulate on passive clusters.
They can block new builds after failover and eventually make replication
updates too large to store or transmit.

1. **Normal deletion — the case this PR addresses**

**Setup:** Active and passive start with `{A, B}`, clock 10. Active
deletes A and sends `{B}`, clock 20.

   **Before:** The passive unions both snapshots and retains `{A, B}`.

**After:** The passive replaces its deployment data with `{B}`. An equal
incoming clock also replaces, allowing force replication to clear
existing accumulation.

2. **Delayed replication — fixed by
[temporalio#12351](temporalio#12351), which
introduced the normal-deletion issue this PR addresses**

**Setup:** After failover, the target has `{B}`, clock 20. A delayed
snapshot from the old active contains `{A}`, clock 10.

**Before:** The union fix merged to `{A, B}`, preserving valid A despite
its older parent clock.

**After:** Still merges to `{A, B}`. This change retains the original
fix's protection for delayed replication.

3. **Accepted edge case**

**Setup:** The target has valid `{B}`, clock 20, but a delayed incoming
snapshot contains only `{A}`, clock 30, for example because of clock
skew.

   **Before:** Union preserves `{A, B}`.

   **After:** Replacement produces `{A}`, losing valid B.

This remains an accepted limitation outside normal single-active clock
ordering; this fix covers routine deletions and the older-incoming race
in example 2.

**Rollback protection:** `matching.enableTaskQueueUserDataRevisionMerge`
defaults to `true`. If this fix causes issues, turn it off to restore
the parent-clock snapshot selection used before
[temporalio#12351](temporalio#12351). This also
gives up the delayed-replication protection in example 2, so we would
need to revisit a different solution. Missing clocks retain
compatibility merging while enabled.

### Testing

Unit tests; replication tests also run with Go's race detector.

(cherry picked from commit e4160f8)
@rkannan82
rkannan82 requested review from a team November 6, 2026 04:12
@rkannan82
rkannan82 requested review from a team as code owners November 6, 2026 04:12
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@rkannan82
rkannan82 enabled auto-merge (squash) November 6, 2026 14:29
@rkannan82
rkannan82 merged commit 159e025 into temporalio:cloud/v1.33.0-165 Nov 6, 2026
84 of 86 checks passed
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.

5 participants