Skip to content

Clean up orphaned Citus local shard copies when cloning the coordinator (Backport PR#8651) #8656

Open
codeforall wants to merge 1 commit into
release-14.0from
muusama/bp-PR-8651-14.2
Open

Clean up orphaned Citus local shard copies when cloning the coordinator (Backport PR#8651) #8656
codeforall wants to merge 1 commit into
release-14.0from
muusama/bp-PR-8651-14.2

Conversation

@codeforall

Copy link
Copy Markdown
Contributor

DESCRIPTION: Drop orphaned Citus local table shard copies on a worker promoted from a clone of the coordinator

A clone node is a byte-for-byte physical replica, so a clone of the coordinator also carries the coordinator's Citus local table shard data. Citus local tables live only on the coordinator: the promotion shard-split (AdjustShardsForPrimaryCloneNodeSplit) relocates distributed shards and replicates reference tables, but it left the clone's physical copies of Citus local shards in place. Their metadata placement correctly stays on the coordinator, so the copies became untracked orphans on the new worker.

When the split source is the coordinator, schedule cleanup of the Citus local tables' shard copies from the clone group; the shell table and its sequences remain, exactly as on any other worker. The metadata needs no adjustment, since the single placement stays on the coordinator.

Add regression coverage (multi_add_node_from_backup_coordinator) that clones and promotes the coordinator with distributed, reference and Citus local tables present, asserting: the Citus local placement stays on group 0, the orphaned shard copy is cleaned up on the clone while the shell remains, the clone becomes a worker, and the coordinator keeps serving the Citus local table. Without the fix the orphaned copy lingers, so the test guards the change.

(cherry picked from commit c89af2b)

…or (Backport PR#8651)

A clone node is a byte-for-byte physical replica, so a clone of the coordinator
also carries the coordinator's Citus local table shard data. Citus local tables
live only on the coordinator: the promotion shard-split
(AdjustShardsForPrimaryCloneNodeSplit) relocates distributed shards and
replicates reference tables, but it left the clone's physical copies of Citus
local shards in place. Their metadata placement correctly stays on the
coordinator, so the copies became untracked orphans on the new worker.

When the split source is the coordinator, schedule cleanup of the Citus local
tables' shard copies from the clone group; the shell table and its sequences
remain, exactly as on any other worker. The metadata needs no adjustment, since
the single placement stays on the coordinator.

Add regression coverage (multi_add_node_from_backup_coordinator) that clones and
promotes the coordinator with distributed, reference and Citus local tables
present, asserting: the Citus local placement stays on group 0, the orphaned
shard copy is cleaned up on the clone while the shell remains, the clone becomes
a worker, and the coordinator keeps serving the Citus local table. Without the
fix the orphaned copy lingers, so the test guards the change.

(cherry picked from commit c89af2b)
@codeforall codeforall changed the title Backport PR#8651) Clean up orphaned Citus local shard copies when cloning the coordinat… Backport PR#8651) Clean up orphaned Citus local shard copies when cloning the coordinator Jul 9, 2026
@codeforall codeforall changed the title Backport PR#8651) Clean up orphaned Citus local shard copies when cloning the coordinator Clean up orphaned Citus local shard copies when cloning the coordinator (Backport PR#8651) Jul 9, 2026
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.62%. Comparing base (0b4d05e) to head (0703a19).

Additional details and impacted files
@@               Coverage Diff                @@
##           release-14.0    #8656      +/-   ##
================================================
- Coverage         88.63%   88.62%   -0.02%     
================================================
  Files               288      288              
  Lines             64157    64165       +8     
  Branches           8048     8050       +2     
================================================
  Hits              56864    56864              
- Misses             4973     4976       +3     
- Partials           2320     2325       +5     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant