pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Assert lack of hazardous buffer locks before possible catalog re 5+ messages / 1 participants [nested] [flat]
* pgsql: Assert lack of hazardous buffer locks before possible catalog re @ 2025-04-17 12:04 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 5+ messages in thread From: Noah Misch @ 2025-04-17 12:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Assert lack of hazardous buffer locks before possible catalog read. Commit 0bada39c83a150079567a6e97b1a25a198f30ea3 fixed a bug of this kind, which existed in all branches for six days before detection. While the probability of reaching the trouble was low, the disruption was extreme. No new backends could start, and service restoration needed an immediate shutdown. Hence, add this to catch the next bug like it. The new check in RelationIdGetRelation() suffices to make autovacuum detect the bug in commit 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704 that led to commit 0bada39. This also checks in a number of similar places. It replaces each Assert(IsTransactionState()) that pertained to a conditional catalog read. No back-patch for now, but a back-patch of commit 243e9b4 should back-patch this, too. A back-patch could omit the src/test/regress changes, since back branches won't gain new index columns. Reported-by: Alexander Lakhin <exclusion@gmail.com> Discussion: https://postgr.es/m/20250410191830.0e.nmisch@google.com Discussion: https://postgr.es/m/10ec0bc3-5933-1189-6bb8-5dec4114558e@gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f4ece891fc2f3f96f0571720a1ae30db8030681b Modified Files -------------- src/backend/catalog/catalog.c | 31 ++++++++++++++ src/backend/storage/buffer/bufmgr.c | 70 +++++++++++++++++++++++++++++++ src/backend/storage/lmgr/lwlock.c | 15 +++++++ src/backend/utils/adt/pg_locale.c | 2 + src/backend/utils/cache/catcache.c | 51 +++++++++++++++------- src/backend/utils/cache/inval.c | 14 ++++++- src/backend/utils/cache/relcache.c | 26 +++++++++--- src/backend/utils/mb/mbutils.c | 2 +- src/include/catalog/catalog.h | 1 + src/include/storage/bufmgr.h | 3 ++ src/include/storage/lwlock.h | 2 + src/include/utils/relcache.h | 8 ++++ src/test/regress/expected/type_sanity.out | 19 +++++++++ src/test/regress/regress.c | 8 ++++ src/test/regress/sql/type_sanity.sql | 20 +++++++++ 15 files changed, 248 insertions(+), 24 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Assert lack of hazardous buffer locks before possible catalog re @ 2025-12-17 00:14 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 5+ messages in thread From: Noah Misch @ 2025-12-17 00:14 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Assert lack of hazardous buffer locks before possible catalog read. Commit 0bada39c83a150079567a6e97b1a25a198f30ea3 fixed a bug of this kind, which existed in all branches for six days before detection. While the probability of reaching the trouble was low, the disruption was extreme. No new backends could start, and service restoration needed an immediate shutdown. Hence, add this to catch the next bug like it. The new check in RelationIdGetRelation() suffices to make autovacuum detect the bug in commit 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704 that led to commit 0bada39. This also checks in a number of similar places. It replaces each Assert(IsTransactionState()) that pertained to a conditional catalog read. Back-patch to v14 - v17. This a back-patch of commit f4ece891fc2f3f96f0571720a1ae30db8030681b (from before v18 branched) to all supported branches, to accompany the back-patch of commits 243e9b4 and 0bada39. For catalog indexes, the bttextcmp() behavior that motivated IsCatalogTextUniqueIndexOid() was v18-specific. Hence, this back-patch doesn't need that or its correction from commit 4a4ee0c2c1e53401924101945ac3d517c0a8a559. Reported-by: Alexander Lakhin <exclusion@gmail.com> Discussion: https://postgr.es/m/20250410191830.0e.nmisch@google.com Discussion: https://postgr.es/m/10ec0bc3-5933-1189-6bb8-5dec4114558e@gmail.com Backpatch-through: 14-17 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/bcb784e7d2f9539ff65e63ffdb89631574034ec8 Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 67 +++++++++++++++++++++++++++++++++++++ src/backend/storage/lmgr/lwlock.c | 15 +++++++++ src/backend/utils/adt/pg_locale.c | 3 ++ src/backend/utils/cache/catcache.c | 51 +++++++++++++++++++--------- src/backend/utils/cache/inval.c | 14 ++++++-- src/backend/utils/cache/relcache.c | 20 +++++++++-- src/backend/utils/mb/mbutils.c | 3 +- src/include/storage/bufmgr.h | 3 ++ src/include/storage/lwlock.h | 2 ++ src/include/utils/relcache.h | 8 +++++ 10 files changed, 166 insertions(+), 20 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Assert lack of hazardous buffer locks before possible catalog re @ 2025-12-17 00:14 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 5+ messages in thread From: Noah Misch @ 2025-12-17 00:14 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Assert lack of hazardous buffer locks before possible catalog read. Commit 0bada39c83a150079567a6e97b1a25a198f30ea3 fixed a bug of this kind, which existed in all branches for six days before detection. While the probability of reaching the trouble was low, the disruption was extreme. No new backends could start, and service restoration needed an immediate shutdown. Hence, add this to catch the next bug like it. The new check in RelationIdGetRelation() suffices to make autovacuum detect the bug in commit 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704 that led to commit 0bada39. This also checks in a number of similar places. It replaces each Assert(IsTransactionState()) that pertained to a conditional catalog read. Back-patch to v14 - v17. This a back-patch of commit f4ece891fc2f3f96f0571720a1ae30db8030681b (from before v18 branched) to all supported branches, to accompany the back-patch of commits 243e9b4 and 0bada39. For catalog indexes, the bttextcmp() behavior that motivated IsCatalogTextUniqueIndexOid() was v18-specific. Hence, this back-patch doesn't need that or its correction from commit 4a4ee0c2c1e53401924101945ac3d517c0a8a559. Reported-by: Alexander Lakhin <exclusion@gmail.com> Discussion: https://postgr.es/m/20250410191830.0e.nmisch@google.com Discussion: https://postgr.es/m/10ec0bc3-5933-1189-6bb8-5dec4114558e@gmail.com Backpatch-through: 14-17 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/27e4fad9804c0dabe15b00168ad9b65696bedff5 Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 67 +++++++++++++++++++++++++++++++++++++ src/backend/storage/lmgr/lwlock.c | 15 +++++++++ src/backend/utils/adt/pg_locale.c | 3 ++ src/backend/utils/cache/catcache.c | 51 +++++++++++++++++++--------- src/backend/utils/cache/inval.c | 14 ++++++-- src/backend/utils/cache/relcache.c | 20 +++++++++-- src/backend/utils/mb/mbutils.c | 3 +- src/include/storage/bufmgr.h | 3 ++ src/include/storage/lwlock.h | 2 ++ src/include/utils/relcache.h | 8 +++++ 10 files changed, 166 insertions(+), 20 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Assert lack of hazardous buffer locks before possible catalog re @ 2025-12-17 00:14 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 5+ messages in thread From: Noah Misch @ 2025-12-17 00:14 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Assert lack of hazardous buffer locks before possible catalog read. Commit 0bada39c83a150079567a6e97b1a25a198f30ea3 fixed a bug of this kind, which existed in all branches for six days before detection. While the probability of reaching the trouble was low, the disruption was extreme. No new backends could start, and service restoration needed an immediate shutdown. Hence, add this to catch the next bug like it. The new check in RelationIdGetRelation() suffices to make autovacuum detect the bug in commit 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704 that led to commit 0bada39. This also checks in a number of similar places. It replaces each Assert(IsTransactionState()) that pertained to a conditional catalog read. Back-patch to v14 - v17. This a back-patch of commit f4ece891fc2f3f96f0571720a1ae30db8030681b (from before v18 branched) to all supported branches, to accompany the back-patch of commits 243e9b4 and 0bada39. For catalog indexes, the bttextcmp() behavior that motivated IsCatalogTextUniqueIndexOid() was v18-specific. Hence, this back-patch doesn't need that or its correction from commit 4a4ee0c2c1e53401924101945ac3d517c0a8a559. Reported-by: Alexander Lakhin <exclusion@gmail.com> Discussion: https://postgr.es/m/20250410191830.0e.nmisch@google.com Discussion: https://postgr.es/m/10ec0bc3-5933-1189-6bb8-5dec4114558e@gmail.com Backpatch-through: 14-17 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/86091202a8b11f67d42ad8ea97c4f71d36a8f745 Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 66 +++++++++++++++++++++++++++++++++++++ src/backend/storage/lmgr/lwlock.c | 15 +++++++++ src/backend/utils/adt/pg_locale.c | 3 ++ src/backend/utils/cache/catcache.c | 51 +++++++++++++++++++--------- src/backend/utils/cache/inval.c | 14 ++++++-- src/backend/utils/cache/relcache.c | 20 +++++++++-- src/backend/utils/mb/mbutils.c | 3 +- src/include/storage/bufmgr.h | 3 ++ src/include/storage/lwlock.h | 2 ++ src/include/utils/relcache.h | 8 +++++ 10 files changed, 165 insertions(+), 20 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Assert lack of hazardous buffer locks before possible catalog re @ 2025-12-17 00:14 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 5+ messages in thread From: Noah Misch @ 2025-12-17 00:14 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Assert lack of hazardous buffer locks before possible catalog read. Commit 0bada39c83a150079567a6e97b1a25a198f30ea3 fixed a bug of this kind, which existed in all branches for six days before detection. While the probability of reaching the trouble was low, the disruption was extreme. No new backends could start, and service restoration needed an immediate shutdown. Hence, add this to catch the next bug like it. The new check in RelationIdGetRelation() suffices to make autovacuum detect the bug in commit 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704 that led to commit 0bada39. This also checks in a number of similar places. It replaces each Assert(IsTransactionState()) that pertained to a conditional catalog read. Back-patch to v14 - v17. This a back-patch of commit f4ece891fc2f3f96f0571720a1ae30db8030681b (from before v18 branched) to all supported branches, to accompany the back-patch of commits 243e9b4 and 0bada39. For catalog indexes, the bttextcmp() behavior that motivated IsCatalogTextUniqueIndexOid() was v18-specific. Hence, this back-patch doesn't need that or its correction from commit 4a4ee0c2c1e53401924101945ac3d517c0a8a559. Reported-by: Alexander Lakhin <exclusion@gmail.com> Discussion: https://postgr.es/m/20250410191830.0e.nmisch@google.com Discussion: https://postgr.es/m/10ec0bc3-5933-1189-6bb8-5dec4114558e@gmail.com Backpatch-through: 14-17 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0dfbd191a939d6307cd7e3e1c69c7dcf3a17a65e Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 66 +++++++++++++++++++++++++++++++++++++ src/backend/storage/lmgr/lwlock.c | 15 +++++++++ src/backend/utils/adt/pg_locale.c | 3 ++ src/backend/utils/cache/catcache.c | 51 +++++++++++++++++++--------- src/backend/utils/cache/inval.c | 14 ++++++-- src/backend/utils/cache/relcache.c | 20 +++++++++-- src/backend/utils/mb/mbutils.c | 3 +- src/include/storage/bufmgr.h | 3 ++ src/include/storage/lwlock.h | 2 ++ src/include/utils/relcache.h | 8 +++++ 10 files changed, 165 insertions(+), 20 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2025-12-17 00:14 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-04-17 12:04 pgsql: Assert lack of hazardous buffer locks before possible catalog re Noah Misch <noah@leadboat.com> 2025-12-17 00:14 pgsql: Assert lack of hazardous buffer locks before possible catalog re Noah Misch <noah@leadboat.com> 2025-12-17 00:14 pgsql: Assert lack of hazardous buffer locks before possible catalog re Noah Misch <noah@leadboat.com> 2025-12-17 00:14 pgsql: Assert lack of hazardous buffer locks before possible catalog re Noah Misch <noah@leadboat.com> 2025-12-17 00:14 pgsql: Assert lack of hazardous buffer locks before possible catalog re Noah Misch <noah@leadboat.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox