Skip to content

[DPE-7882] fix(logical-replication): block restore with an active logical replication relation (7/8) - #338

Draft
marceloneppel wants to merge 6 commits into
lr-5b-unit-coveragefrom
lr-6-restore-guard
Draft

marceloneppel wants to merge 6 commits into
lr-5b-unit-coveragefrom
lr-6-restore-guard

Conversation

@marceloneppel

@marceloneppel marceloneppel commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Issue

Seventh PR of the logical replication migration series (after #350): restore must be blocked while a logical replication relation is active.

Solution

  • RestoreManager._pre_restore_cluster_checks gains the LR guard beside the async one: restore is rejected with Unit cannot restore backup with an active logical replication relation when the cluster has an active logical-replication or logical-replication-offer relation.
  • Covered on both substrates and both endpoints, mirroring the existing active-async-relation rejection test. The message follows the async guard's wording.

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

@marceloneppel
marceloneppel requested a review from a team as a code owner October 2, 2026 18:45
@marceloneppel
marceloneppel marked this pull request as draft October 2, 2026 18:51
@marceloneppel
marceloneppel added this pull request to stack #343 October 5, 2026 17:45
@marceloneppel marceloneppel changed the title [DPE-7882] fix(logical-replication): block restore with an active logical replication relation (6/6) [DPE-7882] fix(logical-replication): block restore with an active logical replication relation (6/7) Oct 7, 2026
@marceloneppel marceloneppel changed the title [DPE-7882] fix(logical-replication): block restore with an active logical replication relation (6/7) [DPE-7882] fix(logical-replication): block restore with an active logical replication relation (6/8) Oct 7, 2026
@marceloneppel
marceloneppel removed this pull request from stack #343 October 7, 2026 22:36
@marceloneppel
marceloneppel changed the base branch from lr-5-harden to lr-5b-unit-coverage October 7, 2026 22:36
@marceloneppel
marceloneppel added this pull request to stack #351 October 7, 2026 22:40
@marceloneppel marceloneppel changed the title [DPE-7882] fix(logical-replication): block restore with an active logical replication relation (6/8) [DPE-7882] fix(logical-replication): block restore with an active logical replication relation (7/8) Oct 7, 2026
…ation relation

The charms' pre-migration restore flow guarded against an active logical replication relation, but only ever as commented-out dead code in src/backups.py ('Unit cannot restore backup with an active logical replication connection'); when the backups world moved the restore guards into the library, RestoreManager inherited the standby-cluster and async-relation guards while the LR check was dropped, and the module-port series does not add it. Restoring while the cluster publishes or subscribes over logical replication replaces the PGDATA the relation replicates, so it must be blocked like the async case.

Reject the restore in _pre_restore_cluster_checks beside the async guard: the requires-side relation via get_relation (limit 1) and every relation on the logical-replication-offer endpoint (no limit in the metadata). The message follows the async guard's 'relation' wording; the original charm string said 'connection' but the check was never active, so nothing depends on that text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant