Skip to content

Handle end-of-recovery checkpoints in Neon Postgres' startup code #650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 5, 2025

Conversation

knizhnik
Copy link

No description provided.

Copy link

@MMeent MMeent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contents have changed away from the title of the PR, so please adjust that.

E.g. "Handle end-of-recovery checkpoints in Neon Postgres' startup code" or something like that.

@knizhnik knizhnik changed the title Do not perform recovery during replica promotion Handle end-of-recovery checkpoints in Neon Postgres' startup code Jun 4, 2025
github-merge-queue bot pushed a commit to neondatabase/neon that referenced this pull request Jun 5, 2025
## Problem

This PR is part of larger computes support activity:

https://www.notion.so/neondatabase/Larger-computes-114f189e00478080ba01e8651ab7da90

Epic: neondatabase/cloud#19010

In case of planned node restart, we are going to 
1. create new read-only replica
2. capture LFC state at primary
3. use this state to prewarm replica
4. stop old primary
5. promote replica to primary

Steps 1-3 are currently implemented and support from compute side.
This PR provides compute level implementation of replica promotion.

Support replica promotion

## Summary of changes

Right now replica promotion is done in three steps:
1. Set safekeepers list (now it is empty for replica)
2. Call `pg_promote()` top promote replica
3. Update endpoint setting to that it ids not more treated as replica.

May be all this three steps should be done by some function in
compute_ctl. But right now this logic is only implement5ed in test.

Postgres submodules PRs:
neondatabase/postgres#648
neondatabase/postgres#649
neondatabase/postgres#650
neondatabase/postgres#651

---------

Co-authored-by: Matthias van de Meent <[email protected]>
Co-authored-by: Konstantin Knizhnik <[email protected]>
@knizhnik knizhnik merged commit 6770bc2 into REL_14_STABLE_neon Jun 5, 2025
1 check passed
@knizhnik knizhnik deleted the replica_promotion_v14 branch June 5, 2025 11:26
github-merge-queue bot pushed a commit to neondatabase/neon that referenced this pull request Jun 5, 2025
## Problem

This PR is part of larger computes support activity:

https://www.notion.so/neondatabase/Larger-computes-114f189e00478080ba01e8651ab7da90

Epic: neondatabase/cloud#19010

In case of planned node restart, we are going to 
1. create new read-only replica
2. capture LFC state at primary
3. use this state to prewarm replica
4. stop old primary
5. promote replica to primary

Steps 1-3 are currently implemented and support from compute side.
This PR provides compute level implementation of replica promotion.

Support replica promotion

## Summary of changes

Right now replica promotion is done in three steps:
1. Set safekeepers list (now it is empty for replica)
2. Call `pg_promote()` top promote replica
3. Update endpoint setting to that it ids not more treated as replica.

May be all this three steps should be done by some function in
compute_ctl. But right now this logic is only implement5ed in test.

Postgres submodules PRs:
neondatabase/postgres#648
neondatabase/postgres#649
neondatabase/postgres#650
neondatabase/postgres#651

---------

Co-authored-by: Matthias van de Meent <[email protected]>
Co-authored-by: Konstantin Knizhnik <[email protected]>
skyzh pushed a commit to neondatabase/neon that referenced this pull request Jun 6, 2025
## Problem

This PR is part of larger computes support activity:

https://www.notion.so/neondatabase/Larger-computes-114f189e00478080ba01e8651ab7da90

Epic: neondatabase/cloud#19010

In case of planned node restart, we are going to 
1. create new read-only replica
2. capture LFC state at primary
3. use this state to prewarm replica
4. stop old primary
5. promote replica to primary

Steps 1-3 are currently implemented and support from compute side.
This PR provides compute level implementation of replica promotion.

Support replica promotion

## Summary of changes

Right now replica promotion is done in three steps:
1. Set safekeepers list (now it is empty for replica)
2. Call `pg_promote()` top promote replica
3. Update endpoint setting to that it ids not more treated as replica.

May be all this three steps should be done by some function in
compute_ctl. But right now this logic is only implement5ed in test.

Postgres submodules PRs:
neondatabase/postgres#648
neondatabase/postgres#649
neondatabase/postgres#650
neondatabase/postgres#651

---------

Co-authored-by: Matthias van de Meent <[email protected]>
Co-authored-by: Konstantin Knizhnik <[email protected]>
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.

2 participants