Thread: pgsql: pgstat: Allow checksum errors to be reported in critical section

pgstat: Allow checksum errors to be reported in critical sections

For AIO we execute completion callbacks in critical sections (to ensure that
AIO can in the future be used for WAL, which in turn requires that we can call
completion callbacks in critical sections, to get the resources for WAL
io). To report checksum errors a backend now has to call
pgstat_prepare_report_checksum_failure(), before entering a critical section,
which guarantees the relevant pgstats entry is in shared memory, the relevant
DSM segment is mapped into the backend's memory and the address is known via a
PgStat_EntryRef.

Reviewed-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/wkjj4p2rmkevutkwc6tewoovdqznj6c6nvjmvii4oo5wmbh5sr@retq7d6uqs4j

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b96d3c389755fc5d20f4a5b9ded58b68541b8ba3

Modified Files
--------------
src/backend/backup/basebackup.c              |  1 +
src/backend/catalog/storage.c                |  1 +
src/backend/storage/buffer/bufmgr.c          |  1 +
src/backend/utils/activity/pgstat_database.c | 51 ++++++++++++++++++++++++++--
src/include/pgstat.h                         |  1 +
5 files changed, 52 insertions(+), 3 deletions(-)