]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Lift shutdown assertion in pgstats for WAL senders REL_17_STABLE github/REL_17_STABLE
authorMichael Paquier <michael@paquier.xyz>
Fri, 5 Jun 2026 23:52:19 +0000 (08:52 +0900)
committerMichael Paquier <michael@paquier.xyz>
Fri, 5 Jun 2026 23:52:19 +0000 (08:52 +0900)
commit4801610f7c66661f2b8722a2c5561273e210960b
treeae11f42875b53370b70b39ee1674c9e2efa53320
parent0bcf19c9e8fc553b2a9bd731d90020fe22def18f
Lift shutdown assertion in pgstats for WAL senders

Before v17, WAL senders can shut down after the checkpointer.  If a WAL
sender still has pending statistics when the checkpointer has already
exited, its shutdown callback may attempt to report those statistics and
trigger assertions in pgstats.  In that case, the pending statistics are
lost.

This commit adjusts the assertion handling so that attempts to report
pending WAL sender statistics after the checkpointer has completed its
final stats flush are skipped.

Preserving the existing assertion would require backpatching an
equivalent of 87a6690cc69, ensuring that the checkpointer is always the
last process to exit.  Such a change would be considerably more invasive
and risky for stable branches because it alters the shutdown sequence,
and the consequence is only some loss of stats data for the WAL sender.

This assertion failure was periodically detected in the buildfarm,
leading to spurious failures.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/18158-88f667028dbc7e7b@postgresql.org
Backpatch-through: 15-17
src/backend/utils/activity/pgstat.c