test: add patroni reinit integration test for versioned storage layout#1699
Draft
marceloneppel wants to merge 1 commit into
Draft
test: add patroni reinit integration test for versioned storage layout#1699marceloneppel wants to merge 1 commit into
marceloneppel wants to merge 1 commit into
Conversation
Validate that patronictl reinit correctly rebuilds a replica when PostgreSQL data lives under the 16/main subdirectory path. This operation was previously broken when data resided at mount point roots. 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
PR #1649 migrated all four storage mounts from bare mount roots to versioned
16/mainsubdirectories. During validation,patronictl reinitwas found to fail when PostgreSQL data lives under the versioned path — Patroni's reinit rebuilds a replica by streaming a base backup from the primary, and this operation was broken when data resided at mount point roots (wherelost+foundand other artifacts interfere).There was no integration test covering the
patronictl reinitflow, so regressions in this path would go undetected.Solution
Add a dedicated integration test (
tests/integration/high_availability/test_patroni_reinit.py) that validatespatronictl reinitworks correctly with the versioned storage layout.The test deploys a 3-unit PostgreSQL cluster with continuous writes, then:
pg_controlto simulate data corruption, and restarts Patroni — PostgreSQL fails to start.pg_controlstartup failure.patronictl reinitto rebuild the replica from the primary via base backup.running/streamingstate, thatpg_controlis present at the versioned path (/var/snap/charmed-postgresql/common/var/lib/postgresql/16/main/global/pg_control), and that data integrity is maintained across all units.Also adds the corresponding spread task (
tests/spread/test_patroni_reinit.py/task.yaml) for CI execution.Checklist