postgresql/src/tools
Andres Freund 8b1dccd37c pgstat: scaffolding for transactional stats creation / drop.
One problematic part of the current statistics collector design is that there
is no reliable way of getting rid of statistics entries. Because of that
pgstat_vacuum_stat() (called by [auto-]vacuum) matches all stats for the
current database with the catalog contents and tries to drop now-superfluous
entries. That's quite expensive. What's worse, it doesn't work on physical
replicas, despite physical replicas collection statistics entries.

This commit introduces infrastructure to create / drop statistics entries
transactionally, together with the underlying catalog objects (functions,
relations, subscriptions). pgstat_xact.c maintains a list of stats entries
created / dropped transactionally in the current transaction. To ensure the
removal of statistics entries is durable dropped statistics entries are
included in commit / abort (and prepare) records, which also ensures that
stats entries are dropped on standbys.

Statistics entries created separately from creating the underlying catalog
object (e.g. when stats were previously lost due to an immediate restart)
are *not* WAL logged. However that can only happen outside of the transaction
creating the catalog object, so it does not lead to "leaked" statistics
entries.

For this to work, functions creating / dropping functions / relations /
subscriptions need to call into pgstat. For subscriptions this was already
done when dropping subscriptions, via pgstat_report_subscription_drop() (now
renamed to pgstat_drop_subscription()).

This commit does not actually drop stats yet, it just provides the
infrastructure. It is however a largely independent piece of infrastructure,
so committing it separately makes sense.

Bumps XLOG_PAGE_MAGIC.

Author: Andres Freund <andres@anarazel.de>
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de
2022-04-06 18:27:52 -07:00
..
ci ci: Add continuous integration for github repositories via cirrus-ci. 2021-12-30 19:02:44 -08:00
editors Make Emacs perl-mode indent more like perltidy. 2019-01-13 11:32:31 -08:00
ifaddrs Update copyright for 2022 2022-01-07 19:04:57 -05:00
msvc Make upgradecheck a no-op in MSVC's vcregress.pl 2022-04-02 12:06:11 +09:00
perlcheck Prohibit map and grep in void context 2021-08-31 11:07:04 +02:00
pginclude Add missing include guard to win32ntdll.h. 2022-01-12 10:19:00 +13:00
pgindent pgstat: scaffolding for transactional stats creation / drop. 2022-04-06 18:27:52 -07:00
ccsym tools/ccsym: update for modern versions of gcc 2015-01-20 13:02:58 -05:00
check_bison_recursion.pl Update copyright for 2022 2022-01-07 19:04:57 -05:00
codelines Fix remaining stray references to CVS. 2010-09-22 19:51:39 -04:00
copyright.pl Update copyright for 2022 2022-01-07 19:04:57 -05:00
find_badmacros Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
find_static Fix omission of -X (--no-psqlrc) in some psql invocations. 2015-12-28 11:46:43 -05:00
find_typedef Refer to OS X as "macOS", except for the port name which is still "darwin". 2016-09-25 15:40:57 -04:00
fix-old-flex-code.pl Update copyright for 2022 2022-01-07 19:04:57 -05:00
gen_keywordlist.pl Update copyright for 2022 2022-01-07 19:04:57 -05:00
git-external-diff Preserve information on use of git-external-diff 2018-05-24 23:45:31 +09:30
git_changelog Update copyright for 2022 2022-01-07 19:04:57 -05:00
make_ctags Improve missing-program error handling in make_ctags and make_etags. 2019-01-13 13:33:50 -05:00
make_etags Improve missing-program error handling in make_ctags and make_etags. 2019-01-13 13:33:50 -05:00
make_mkid Add another pgdefine path check, and a cvs-git change. 2011-08-26 21:52:35 -04:00
PerfectHash.pm Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgtest pgtest: run clean, build, and check stages separately 2018-07-28 15:34:06 -04:00
RELEASE_CHANGES Doc: further updates for RELEASE_CHANGES process notes. 2021-06-28 18:05:46 -04:00
testint128.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
valgrind.supp Avoid need for valgrind suppressions for pg_atomic_init_u64 on some platforms. 2020-06-08 19:52:19 -07:00
version_stamp.pl Update copyright for 2022 2022-01-07 19:04:57 -05:00
win32tzlist.pl Update copyright for 2022 2022-01-07 19:04:57 -05:00