Skip to content

fix: do not require restart for replica cluster promotion#10666

Draft
leonardoce wants to merge 3 commits into
cloudnative-pg:mainfrom
leonardoce:archive-mode-always
Draft

fix: do not require restart for replica cluster promotion#10666
leonardoce wants to merge 3 commits into
cloudnative-pg:mainfrom
leonardoce:archive-mode-always

Conversation

@leonardoce
Copy link
Copy Markdown
Contributor

When promoting a replica cluster to a primary cluster, PostgreSQL previously needed a restart because archive_mode changed from "always" to "on", which is a fixed parameter.

This change always sets archive_mode to "always" and moves the decision of whether to actually ship WAL into the archiver:

  • Primary clusters: the archiver archives from the current primary, skips silently on HA replicas (standby.signal is present), and keeps WAL in the ready queue on a former primary being demoted (standby.signal absent, CurrentPrimary no longer matches).
  • Replica clusters: behaviour is unchanged — only the designated primary (CurrentPrimary or TargetPrimary) archives WAL.

Promoting a replica cluster to a primary cluster does not requires a restart.

@leonardoce
Copy link
Copy Markdown
Contributor Author

/test

@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.25 release-1.28 release-1.29 labels May 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@leonardoce leonardoce added no-issue do not backport This PR must not be backported - it will be in the next minor release and removed backport-requested ◀️ This pull request should be backported to all supported releases release-1.25 release-1.28 release-1.29 labels May 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

@leonardoce, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/25672508809

@leonardoce leonardoce force-pushed the archive-mode-always branch 4 times, most recently from dc7900a to 389207d Compare May 12, 2026 11:32
@leonardoce
Copy link
Copy Markdown
Contributor Author

/test

@github-actions
Copy link
Copy Markdown
Contributor

@leonardoce, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/25731672471

@leonardoce leonardoce force-pushed the archive-mode-always branch 2 times, most recently from 28a5013 to 9c8453e Compare May 12, 2026 14:34
When promoting a replica cluster to a primary cluster, PostgreSQL
previously needed a restart because archive_mode changed from
"always" to "on", which is a fixed parameter.

This change always sets archive_mode to "always" and moves the
decision of whether to actually ship WAL into the archiver:

- Primary clusters: the archiver archives from the current primary,
  skips silently on HA replicas (standby.signal is present), and
  keeps WAL in the ready queue on a former primary being demoted
  (standby.signal absent, CurrentPrimary no longer matches).
- Replica clusters: behaviour is unchanged — only the designated
  primary (CurrentPrimary or TargetPrimary) archives WAL.

Promoting a replica cluster to a primary cluster does not requires
a restart.

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
@leonardoce leonardoce force-pushed the archive-mode-always branch from 9c8453e to 45569ac Compare May 12, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not backport This PR must not be backported - it will be in the next minor release no-issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants