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

Commitcfdb303

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 parentd3a9b83 commitcfdb303

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
@@ -2160,6 +2160,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
21602160
<entry>Waiting during recovery when WAL data is not available from any
21612161
source (<filename>pg_wal</filename>, archive or stream).</entry>
21622162
</row>
2163+
<row>
2164+
<entry><literal>RegisterSyncRequest</literal></entry>
2165+
<entry>Waiting while sending synchronization requests to the
2166+
checkpointer, because the request queue is full.</entry>
2167+
</row>
21632168
<row>
21642169
<entry><literal>VacuumDelay</literal></entry>
21652170
<entry>Waiting in a cost-based vacuum delay point.</entry>

‎src/backend/postmaster/pgstat.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3919,6 +3919,9 @@ pgstat_get_wait_timeout(WaitEventTimeout w)
39193919
caseWAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL:
39203920
event_name="RecoveryRetrieveRetryInterval";
39213921
break;
3922+
caseWAIT_EVENT_REGISTER_SYNC_REQUEST:
3923+
event_name="RegisterSyncRequest";
3924+
break;
39223925
caseWAIT_EVENT_VACUUM_DELAY:
39233926
event_name="VacuumDelay";
39243927
break;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include"postmaster/bgwriter.h"
2828
#include"storage/bufmgr.h"
2929
#include"storage/ipc.h"
30+
#include"storage/latch.h"
3031
#include"storage/md.h"
3132
#include"utils/hsearch.h"
3233
#include"utils/inval.h"
@@ -585,7 +586,8 @@ RegisterSyncRequest(const FileTag *ftag, SyncRequestType type,
585586
if (ret|| (!ret&& !retryOnError))
586587
break;
587588

588-
pg_usleep(10000L);
589+
WaitLatch(NULL,WL_EXIT_ON_PM_DEATH |WL_TIMEOUT,10,
590+
WAIT_EVENT_REGISTER_SYNC_REQUEST);
589591
}
590592

591593
returnret;

‎src/include/pgstat.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,8 @@ typedef enum
902902
WAIT_EVENT_PG_SLEEP,
903903
WAIT_EVENT_RECOVERY_APPLY_DELAY,
904904
WAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL,
905-
WAIT_EVENT_VACUUM_DELAY
905+
WAIT_EVENT_VACUUM_DELAY,
906+
WAIT_EVENT_REGISTER_SYNC_REQUEST
906907
}WaitEventTimeout;
907908

908909
/* ----------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp