Skip to content
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

feat: enhance shutdown process for demotion of the cluster #4411

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

armru
Copy link
Member

@armru armru commented Apr 30, 2024

This patch enhances the shutdown process for demoting a primary cluster in CloudNativePG by:

  • Introducing the shutdownCheckpointToken in the Cluster status, containing information in JSON format retrieved from pg_controldata. This includes the database system identifier, latest checkpoint's TimeLineID, latest checkpoint's REDO location, latest checkpoint's REDO WAL file, and the time of the latest checkpoint.
  • Archiving the checkpoint REDO WAL file (which contains the shutdown checkpoint) as a .partial file. This facilitates the controlled promotion of a replica cluster by relying solely on the WAL archive.

Note that this implementation does not cover the hibernation case, which will be addressed in a separate patch.

Closes #3790
Closes #4586

@github-actions github-actions bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.21 release-1.22 release-1.23 labels Apr 30, 2024
Copy link
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

@armru
Copy link
Member Author

armru commented May 1, 2024

/test limit=local

Copy link
Contributor

github-actions bot commented May 1, 2024

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

@armru
Copy link
Member Author

armru commented May 6, 2024

/test limit=local

Copy link
Contributor

github-actions bot commented May 6, 2024

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

@armru
Copy link
Member Author

armru commented May 7, 2024

/test limit=local

Copy link
Contributor

github-actions bot commented May 7, 2024

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

@armru
Copy link
Member Author

armru commented May 7, 2024

/test limit=local

Copy link
Contributor

github-actions bot commented May 7, 2024

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

@armru armru removed backport-requested ◀️ This pull request should be backported to all supported releases release-1.21 release-1.22 release-1.23 labels May 7, 2024
@leonardoce leonardoce requested a review from jsilvela as a code owner May 17, 2024 09:45
@leonardoce leonardoce requested review from NiccoloFei, litaocdl and a team as code owners May 17, 2024 09:45
@armru armru force-pushed the dev/3790 branch 4 times, most recently from e66b119 to 657be55 Compare May 30, 2024 12:11
armru and others added 9 commits May 30, 2024 14:48
Closes #3790

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Comment on lines +927 to +932
// ShutdownCheckpointToken is a json token containing the following information from pg_controldata:
// Database system identifier
// Latest checkpoint's TimeLineID
// Latest checkpoint's REDO location
// Latest checkpoint's REDO WAL file
// Time of latest checkpoint
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// ShutdownCheckpointToken is a json token containing the following information from pg_controldata:
// Database system identifier
// Latest checkpoint's TimeLineID
// Latest checkpoint's REDO location
// Latest checkpoint's REDO WAL file
// Time of latest checkpoint
// shutdownCheckpointToken is a JSON token containing the information
// from pg_controldata such as Database system identifier, Latest checkpoint's
// TimeLineID, Latest checkpoint's REDO location, Latest checkpoint's REDO
// WAL file, and Time of latest checkpoint

@gbartolini gbartolini changed the title feat: add ShutdownCheckpointToken feat: enhance Cluster shutdown process for demotion May 30, 2024
@gbartolini gbartolini changed the title feat: enhance Cluster shutdown process for demotion feat: enhance shutdown process for demotion of the cluster May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants