Improve comment about dropped entries in pgstat.c
authorMichael Paquier <michael@paquier.xyz>
Mon, 9 Dec 2024 05:35:48 +0000 (14:35 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 9 Dec 2024 05:35:48 +0000 (14:35 +0900)
commita0ab20f16541cab2a2094433b3b812b1db2392f1
tree8e9bfd1c7fe2c87038620ee02e9e541daa5f51d4
parent1df1e1e787621cefeb9741b6e9fe74cd38143eee
Improve comment about dropped entries in pgstat.c

pgstat_write_statsfile() discards any entries marked as dropped from
being written to the stats file at shutdown, and also included an
assertion based on the same condition.

The intention of the assertion is to track that no pgstats entries
should be left around as terminating backends should drop any entries
they still hold references on before the stats file is written by the
checkpointer, and it not worth taking down the server in this case if
there is a bug making that possible.

Let's improve the comment of this area to document clearly what's
intended.

Based on a discussion with Bertrand Drouvot and Anton A. Melnikov.

Author: Bertrand Drouvot
Discussion: https://postgr.es/m/a13e8cdf-b97a-4ecb-8f42-aaa367974e29@postgrespro.ru
Backpatch-through: 15
src/backend/utils/activity/pgstat.c