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

Commit3390ef1

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 parent076f4d9 commit3390ef1

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

‎doc/src/sgml/monitoring.sgml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,6 +2254,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
22542254
<entry>Waiting during recovery when WAL data is not available from any
22552255
source (<filename>pg_wal</filename>, archive or stream).</entry>
22562256
</row>
2257+
<row>
2258+
<entry><literal>RegisterSyncRequest</literal></entry>
2259+
<entry>Waiting while sending synchronization requests to the
2260+
checkpointer, because the request queue is full.</entry>
2261+
</row>
22572262
<row>
22582263
<entry><literal>VacuumDelay</literal></entry>
22592264
<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
@@ -31,6 +31,7 @@
3131
#include"storage/bufmgr.h"
3232
#include"storage/fd.h"
3333
#include"storage/ipc.h"
34+
#include"storage/latch.h"
3435
#include"storage/md.h"
3536
#include"utils/hsearch.h"
3637
#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
@@ -497,6 +497,9 @@ pgstat_get_wait_timeout(WaitEventTimeout w)
497497
caseWAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL:
498498
event_name="RecoveryRetrieveRetryInterval";
499499
break;
500+
caseWAIT_EVENT_REGISTER_SYNC_REQUEST:
501+
event_name="RegisterSyncRequest";
502+
break;
500503
caseWAIT_EVENT_VACUUM_DELAY:
501504
event_name="VacuumDelay";
502505
break;

‎src/include/utils/wait_event.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ typedef enum
145145
WAIT_EVENT_PG_SLEEP,
146146
WAIT_EVENT_RECOVERY_APPLY_DELAY,
147147
WAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL,
148+
WAIT_EVENT_REGISTER_SYNC_REQUEST,
148149
WAIT_EVENT_VACUUM_DELAY,
149150
WAIT_EVENT_VACUUM_TRUNCATE
150151
}WaitEventTimeout;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp