pgsql: Disallow serialized callbacks for fixed-sized custom stats kinds

Started by Michael Paquierabout 1 month ago1 messagescommitters
Jump to latest
#1Michael Paquier
michael@paquier.xyz

Disallow serialized callbacks for fixed-sized custom stats kinds

The pgstats callbacks to_serialized_name() and from_serialized_name()
are documented as being for variable-sized stats only, as they map an
entry hash key to a name written to the on-disk stats file.

pgstat_register_kind() did not enforce this policy for custom stats
kinds. Enforcing this behavior is more interesting since 44539786b829,
where a stats kind can begin pointing at its own hash table, offering as
guarantee that a PGSTAT_FILE_ENTRY_NAME will never match a fixed-sized
stats kind at startup, should the same kind ID be reused across restart
with a different kind info.

See also 0d110901f0ef that has dealt with a similar issue, for
PGSTAT_FILE_ENTRY_HASH.

Author: Sami Imseih <samimseih.pg@gmail.com>
Discussion: /messages/by-id/CAN4CZFMxuOOuYV14+i3YcPG-16q02eBtSVa82J111=ZnDwSicA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3c6665bf0266a7ae78117c3ed0299bfbd1f1331a

Modified Files
--------------
src/backend/utils/activity/pgstat.c | 4 ++++
1 file changed, 4 insertions(+)