https://github.com/postgres/postgres
Revision 43e496e242984320efcf42c51c1e2b379aa03344 authored by Andres Freund on 23 September 2022, 20:00:55 UTC, committed by Andres Freund on 23 September 2022, 20:13:50 UTC
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
1 parent e956325
History
Tip revision: 43e496e242984320efcf42c51c1e2b379aa03344 authored by Andres Freund on 23 September 2022, 20:00:55 UTC
pgstat: Fix transactional stats dropping for indexes
Tip revision: 43e496e
File Mode Size
config
contrib
doc
src
.cirrus.yml -rw-r--r-- 18.2 KB
.dir-locals.el -rw-r--r-- 730 bytes
.editorconfig -rw-r--r-- 183 bytes
.git-blame-ignore-revs -rw-r--r-- 9.5 KB
.gitattributes -rw-r--r-- 1.4 KB
.gitignore -rw-r--r-- 504 bytes
COPYRIGHT -rw-r--r-- 1.2 KB
GNUmakefile.in -rw-r--r-- 4.1 KB
HISTORY -rw-r--r-- 277 bytes
Makefile -rw-r--r-- 1.8 KB
README -rw-r--r-- 1.2 KB
README.git -rw-r--r-- 721 bytes
aclocal.m4 -rw-r--r-- 397 bytes
configure -rwxr-xr-x 584.4 KB
configure.ac -rw-r--r-- 87.0 KB

README

back to top