Skip to content

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

Merged
mnencia merged 3 commits into
mainfrom
dev/4802
Jun 10, 2024
Merged

mnencia merged 3 commits into
mainfrom
dev/4802

Conversation

@mnencia

@mnencia mnencia commented Jun 6, 2024 •

Copy link
Copy Markdown
Member

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 labels Jun 6, 2024
@github-actions

github-actions Bot commented Jun 6, 2024

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

@mnencia

mnencia commented Jun 6, 2024 •

Copy link
Copy Markdown
Member Author

@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 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

mnencia commented Jun 6, 2024

Copy link
Copy Markdown
Member Author

/ok-to-merge E2E tests are green

@cnpg-bot cnpg-bot added the ok to merge 👌 This PR can be merged label Jun 6, 2024
mnencia and others added 2 commits June 7, 2024 17:12
Closes #4802

Signed-off-by: Marco Nenciarini <[email protected]>
Signed-off-by: Jaime Silvela <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
@github-actions

Copy link
Copy Markdown
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
@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 <[email protected]>
Signed-off-by: Jaime Silvela <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]>
Co-authored-by: Armando Ruocco <[email protected]>
(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 <[email protected]>
Signed-off-by: Jaime Silvela <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]>
Co-authored-by: Armando Ruocco <[email protected]>
(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 <[email protected]>
Signed-off-by: Jaime Silvela <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
Co-authored-by: Jaime Silvela <[email protected]>
Co-authored-by: Armando Ruocco <[email protected]>
(cherry picked from commit d932383)
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

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