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

fix: ensure HA slots don't hold xmin #4811

Merged
merged 3 commits into from
Jun 10, 2024
Merged

fix: ensure HA slots don't hold xmin #4811

merged 3 commits into from
Jun 10, 2024

Conversation

mnencia
Copy link
Member

@mnencia mnencia commented Jun 6, 2024

When hot_standby_feedback is enabled, an inactive replication slot
with xmin or catalog_xmin set to not NULL, could prevent the
autovacuum on the primary from cleaning the old tuples.
This issue may occur when a former primary rejoins the cluster after
a switchover.

This patch resolves the issue by recreating any HA replication slot on
a standby instance if it has xmin or catalog_xmin set.

Closes #4802

@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 Jun 6, 2024
Copy link
Contributor

github-actions bot commented Jun 6, 2024

❗ 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

@mnencia
Copy link
Member Author

mnencia commented Jun 6, 2024

@cloudnative-pg cloudnative-pg deleted a comment from github-actions bot Jun 6, 2024
@cloudnative-pg cloudnative-pg deleted a comment from github-actions bot Jun 6, 2024
@mnencia mnencia marked this pull request as ready for review June 6, 2024 12:14
@mnencia mnencia requested a review from a team as a code owner June 6, 2024 12:14
@mnencia mnencia changed the title fix: ensure HA slots doesn't hold xmin fix: ensure HA slots don't hold xmin Jun 6, 2024
@mnencia
Copy link
Member Author

mnencia commented Jun 6, 2024

/ok-to-merge E2E tests are green

mnencia and others added 2 commits June 7, 2024 17:12
Closes #4802

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Jaime Silvela <jaime.silvela@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Copy link
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@mnencia mnencia merged commit d932383 into main Jun 10, 2024
30 of 31 checks passed
@mnencia mnencia deleted the dev/4802 branch June 10, 2024 12:58
cnpg-bot pushed a commit that referenced this pull request Jun 10, 2024
When `hot_standby_feedback` is enabled, an inactive replication slot
with `xmin` or `catalog_xmin` set to `NOT NULL`, could prevent the
autovacuum on the primary from cleaning the old tuples.
This issue may occur when a former primary rejoins the cluster after
a switchover.

This patch resolves the issue by recreating any HA replication slot on
a standby instance if it has `xmin` or `catalog_xmin` set.

Closes #4802

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Jaime Silvela <jaime.silvela@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Jaime Silvela <jaime.silvela@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
(cherry picked from commit d932383)
mnencia added a commit that referenced this pull request Jun 11, 2024
When `hot_standby_feedback` is enabled, an inactive replication slot
with `xmin` or `catalog_xmin` set to `NOT NULL`, could prevent the
autovacuum on the primary from cleaning the old tuples.
This issue may occur when a former primary rejoins the cluster after
a switchover.

This patch resolves the issue by recreating any HA replication slot on
a standby instance if it has `xmin` or `catalog_xmin` set.

Closes #4802

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Jaime Silvela <jaime.silvela@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Jaime Silvela <jaime.silvela@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
(cherry picked from commit d932383)
mnencia added a commit that referenced this pull request Jun 11, 2024
When `hot_standby_feedback` is enabled, an inactive replication slot
with `xmin` or `catalog_xmin` set to `NOT NULL`, could prevent the
autovacuum on the primary from cleaning the old tuples.
This issue may occur when a former primary rejoins the cluster after
a switchover.

This patch resolves the issue by recreating any HA replication slot on
a standby instance if it has `xmin` or `catalog_xmin` set.

Closes #4802

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Jaime Silvela <jaime.silvela@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Jaime Silvela <jaime.silvela@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
(cherry picked from commit d932383)
dougkirkley pushed a commit to dougkirkley/cloudnative-pg that referenced this pull request Jun 11, 2024
When `hot_standby_feedback` is enabled, an inactive replication slot
with `xmin` or `catalog_xmin` set to `NOT NULL`, could prevent the
autovacuum on the primary from cleaning the old tuples.
This issue may occur when a former primary rejoins the cluster after
a switchover.

This patch resolves the issue by recreating any HA replication slot on
a standby instance if it has `xmin` or `catalog_xmin` set.

Closes cloudnative-pg#4802

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Jaime Silvela <jaime.silvela@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Jaime Silvela <jaime.silvela@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Douglass Kirkley <dkirkley@eitccorp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-requested ◀️ This pull request should be backported to all supported releases ok to merge 👌 This PR can be merged release-1.21 release-1.22 release-1.23
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: xmin on standby cluster replication slots causing heavy io on primary due to permanent autovacuum
4 participants