Fix/dpe 10284 standby create extension#1765
Draft
marceloneppel wants to merge 4 commits into
Draft
Conversation
…ster A standby cluster's PostgreSQL runs as a read-only hot standby, so its predefined roles, system users, default database and extensions are provisioned on the primary cluster and arrive through streaming replication. After a full-cluster outage and restart, the standby leader's deferred start event re-enters the bootstrap path and runs that write DDL (CREATE EXTENSION ...) against the read-only instance, which PostgreSQL rejects with ReadOnlySqlTransaction. The start hook then fails on every retry, leaving the standby leader stuck in error even though replication is healthy. Skip user/role setup when the unit belongs to a standby cluster. Standby detection is derived from the async-replication relation state, which survives a cold reboot and does not depend on the Patroni API being up (unlike a leader-role lookup), so it holds in exactly the all-units-rebooting window where this bug occurs. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
Standby-cluster detection now lives on the charm as is_standby_cluster, so the backups handler no longer needs its own delegating wrapper. Call the charm property directly to keep this check in a single place and drop the dead indirection. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
…dby-create-extension Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
The existing async-replication and stereo-mode suites never restart an entire standby cluster, so the DPE-10284 regression (the standby leader crashing its start hook with ReadOnlySqlTransaction after a full outage) had no integration coverage. Add a dedicated test that deploys two clusters, establishes async replication, force-stops and restarts every unit on both sides, and asserts the standby leader recovers to an active standby instead of getting stuck in error. Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Solution
Checklist