Fix waiting in RegisterSyncRequest().

Thomas Munro <tmunro@postgresql.org>

Commit: cfdb303be756d846031ba1c1d1ff2cae39a62c15
Author: Thomas Munro <tmunro@postgresql.org>
Date: 2022-03-16T02:37:15Z
Releases: 13.7
Fix waiting in RegisterSyncRequest().

If we run out of space in the checkpointer sync request queue (which is
hopefully rare on real systems, but common with very small buffer pool),
we wait for it to drain.  While waiting, we should report that as a wait
event so that users know what is going on, and also handle postmaster
death, since otherwise the loop might never terminate if the
checkpointer has exited.

Back-patch to 12.  Although the problem exists in earlier releases too,
the code is structured differently before 12 so I haven't gone any
further for now, in the absence of field complaints.

Reported-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20220226213942.nb7uvb2pamyu26dj%40alap3.anarazel.de

Files

PathChange+/−
doc/src/sgml/monitoring.sgml modified +5 −0
src/backend/postmaster/pgstat.c modified +3 −0
src/backend/storage/sync/sync.c modified +3 −1
src/include/pgstat.h modified +2 −1

Documentation touched

Discussion