pgsql: Fix waiting in RegisterSyncRequest().

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix waiting in RegisterSyncRequest().
Date: 2022-03-16 02:49:26
Message-ID: E1nUJj4-000GF1-De@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)anarazel(dot)de>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/20220226213942.nb7uvb2pamyu26dj%40alap3.anarazel.de

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1396b5c6ed2bf46433c77ad0ce7f1ddaa984c224

Modified Files
--------------
doc/src/sgml/monitoring.sgml | 5 +++++
src/backend/storage/sync/sync.c | 4 +++-
src/backend/utils/activity/wait_event.c | 3 +++
src/include/utils/wait_event.h | 3 ++-
4 files changed, 13 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2022-03-16 02:49:51 pgsql: Fix waiting in RegisterSyncRequest().
Previous Message Thomas Munro 2022-03-16 02:49:14 pgsql: Fix waiting in RegisterSyncRequest().