Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1396b5c

Browse files
committed
Fix waiting in RegisterSyncRequest().
If we run out of space in the checkpointer sync request queue (which ishopefully 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 waitevent so that users know what is going on, and also handle postmasterdeath, since otherwise the loop might never terminate if thecheckpointer 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 anyfurther 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
1 parentb61e621 commit1396b5c

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

‎doc/src/sgml/monitoring.sgml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,6 +2242,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
22422242
<entry>Waiting during recovery when WAL data is not available from any
22432243
source (<filename>pg_wal</filename>, archive or stream).</entry>
22442244
</row>
2245+
<row>
2246+
<entry><literal>RegisterSyncRequest</literal></entry>
2247+
<entry>Waiting while sending synchronization requests to the
2248+
checkpointer, because the request queue is full.</entry>
2249+
</row>
22452250
<row>
22462251
<entry><literal>VacuumDelay</literal></entry>
22472252
<entry>Waiting in a cost-based vacuum delay point.</entry>

‎src/backend/storage/sync/sync.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include"postmaster/bgwriter.h"
3131
#include"storage/bufmgr.h"
3232
#include"storage/ipc.h"
33+
#include"storage/latch.h"
3334
#include"storage/md.h"
3435
#include"utils/hsearch.h"
3536
#include"utils/inval.h"
@@ -606,7 +607,8 @@ RegisterSyncRequest(const FileTag *ftag, SyncRequestType type,
606607
if (ret|| (!ret&& !retryOnError))
607608
break;
608609

609-
pg_usleep(10000L);
610+
WaitLatch(NULL,WL_EXIT_ON_PM_DEATH |WL_TIMEOUT,10,
611+
WAIT_EVENT_REGISTER_SYNC_REQUEST);
610612
}
611613

612614
returnret;

‎src/backend/utils/activity/wait_event.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,9 @@ pgstat_get_wait_timeout(WaitEventTimeout w)
485485
caseWAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL:
486486
event_name="RecoveryRetrieveRetryInterval";
487487
break;
488+
caseWAIT_EVENT_REGISTER_SYNC_REQUEST:
489+
event_name="RegisterSyncRequest";
490+
break;
488491
caseWAIT_EVENT_VACUUM_DELAY:
489492
event_name="VacuumDelay";
490493
break;

‎src/include/utils/wait_event.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ typedef enum
141141
WAIT_EVENT_RECOVERY_APPLY_DELAY,
142142
WAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL,
143143
WAIT_EVENT_VACUUM_DELAY,
144-
WAIT_EVENT_CHECKPOINT_WRITE_DELAY
144+
WAIT_EVENT_CHECKPOINT_WRITE_DELAY,
145+
WAIT_EVENT_REGISTER_SYNC_REQUEST
145146
}WaitEventTimeout;
146147

147148
/* ----------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp