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

Commitbae5078

Browse files
committed
Limit checkpointer requests queue size
If the number of sync requests is big enough, the palloc() call inAbsorbSyncRequests() will attempt to allocate more than 1 GB of memory,resulting in failure. This can lead to an infinite loop in the checkpointerprocess, as it repeatedly fails to absorb the pending requests.This commit limits the checkpointer requests queue size to 10M items. Inaddition to preventing the palloc() failure, this change helps to avoid longqueue processing time.Also, this commit is for backpathing only. The master branch receivesa more invasive yet comprehensive fix for this problem.Discussion:https://postgr.es/m/db4534f83a22a29ab5ee2566ad86ca92%40postgrespro.ruBackpatch-through: 13
1 parent75f633f commitbae5078

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎src/backend/postmaster/checkpointer.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ static CheckpointerShmemStruct *CheckpointerShmem;
135135
/* interval for calling AbsorbSyncRequests in CheckpointWriteDelay */
136136
#defineWRITES_PER_ABSORB1000
137137

138+
/* Max number of requests the checkpointer request queue can hold */
139+
#defineMAX_CHECKPOINT_REQUESTS 10000000
140+
138141
/*
139142
* GUC parameters
140143
*/
@@ -970,7 +973,7 @@ CheckpointerShmemInit(void)
970973
*/
971974
MemSet(CheckpointerShmem,0,size);
972975
SpinLockInit(&CheckpointerShmem->ckpt_lck);
973-
CheckpointerShmem->max_requests=NBuffers;
976+
CheckpointerShmem->max_requests=Min(NBuffers,MAX_CHECKPOINT_REQUESTS);
974977
ConditionVariableInit(&CheckpointerShmem->start_cv);
975978
ConditionVariableInit(&CheckpointerShmem->done_cv);
976979
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp