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

Commit5cfbff4

Browse files
committed
Fix checkpointer shared memory allocation
Use Min(NBuffers, MAX_CHECKPOINT_REQUESTS) instead of NBuffers inCheckpointerShmemSize() to match the actual array size limit set inCheckpointerShmemInit(). This prevents wasting shared memory whenNBuffers > MAX_CHECKPOINT_REQUESTS. Also, fix the comment.Reported-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/1439188.1754506714%40sss.pgh.pa.usAuthor: Xuneng Zhou <xunengzhou@gmail.com>Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>
1 parent2ae8280 commit5cfbff4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/backend/postmaster/checkpointer.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -940,11 +940,14 @@ CheckpointerShmemSize(void)
940940
Sizesize;
941941

942942
/*
943-
* Currently, the size of the requests[] array is arbitrarily set equal to
944-
* NBuffers. This may prove too large or small ...
943+
* The size of the requests[] array is arbitrarily set equal to NBuffers.
944+
* But there is a cap of MAX_CHECKPOINT_REQUESTS to prevent accumulating
945+
* too many checkpoint requests in the ring buffer.
945946
*/
946947
size= offsetof(CheckpointerShmemStruct,requests);
947-
size=add_size(size,mul_size(NBuffers,sizeof(CheckpointerRequest)));
948+
size=add_size(size,mul_size(Min(NBuffers,
949+
MAX_CHECKPOINT_REQUESTS),
950+
sizeof(CheckpointerRequest)));
948951

949952
returnsize;
950953
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp