pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: pgstat: Fix transactional stats dropping for indexes 2+ messages / 1 participants [nested] [flat]
* pgsql: pgstat: Fix transactional stats dropping for indexes @ 2022-09-23 20:43 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 2+ messages in thread From: Andres Freund @ 2022-09-23 20:43 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pgstat: Fix transactional stats dropping for indexes Because index creation does not go through heap_create_with_catalog() we didn't call pgstat_create_relation(), leading to index stats of a newly created realtion not getting dropped during rollback. To fix, move the pgstat_create_relation() to heap_create(), which indexes do use. Similarly, because dropping an index does not go through heap_drop_with_catalog(), we didn't drop index stats when the transaction dropping an index committed. Here there's no convenient common path for indexes and relations, so index_drop() now calls pgstat_drop_relation(). Add tests for transactional index stats handling. Author: "Drouvot, Bertrand" <bdrouvot@amazon.com> Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/51bbf286-2b4a-8998-bd12-eaae4b765d99@amazon.com Backpatch: 15-, like 8b1dccd37c71, which introduced the bug Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/d811ce6ea343fa8a0b6b9cd7e9cddcbdaa27962b Modified Files -------------- src/backend/catalog/heap.c | 6 +- src/backend/catalog/index.c | 3 + src/test/regress/expected/stats.out | 109 +++++++++++++++++++++++++++++++++++- src/test/regress/sql/stats.sql | 50 ++++++++++++++++- 4 files changed, 161 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: pgstat: Fix transactional stats dropping for indexes @ 2022-09-23 20:43 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 2+ messages in thread From: Andres Freund @ 2022-09-23 20:43 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pgstat: Fix transactional stats dropping for indexes Because index creation does not go through heap_create_with_catalog() we didn't call pgstat_create_relation(), leading to index stats of a newly created realtion not getting dropped during rollback. To fix, move the pgstat_create_relation() to heap_create(), which indexes do use. Similarly, because dropping an index does not go through heap_drop_with_catalog(), we didn't drop index stats when the transaction dropping an index committed. Here there's no convenient common path for indexes and relations, so index_drop() now calls pgstat_drop_relation(). Add tests for transactional index stats handling. Author: "Drouvot, Bertrand" <bdrouvot@amazon.com> Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/51bbf286-2b4a-8998-bd12-eaae4b765d99@amazon.com Backpatch: 15-, like 8b1dccd37c71, which introduced the bug Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/43e496e242984320efcf42c51c1e2b379aa03344 Modified Files -------------- src/backend/catalog/heap.c | 6 +- src/backend/catalog/index.c | 3 + src/test/regress/expected/stats.out | 109 +++++++++++++++++++++++++++++++++++- src/test/regress/sql/stats.sql | 50 ++++++++++++++++- 4 files changed, 161 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2022-09-23 20:43 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-09-23 20:43 pgsql: pgstat: Fix transactional stats dropping for indexes Andres Freund <andres@anarazel.de> 2022-09-23 20:43 pgsql: pgstat: Fix transactional stats dropping for indexes Andres Freund <andres@anarazel.de>
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