summaryrefslogtreecommitdiff
path: root/src/include/utils/formatting.h
diff options
context:
space:
mode:
authorAlexander Korotkov2025-07-27 12:07:47 +0000
committerAlexander Korotkov2025-07-27 12:07:47 +0000
commit258bf0a2ea8ff86257f750018bfd44397ce7e554 (patch)
treef7e865fceaeac6c03f5b4103d3a0be6b4d420bc1 /src/include/utils/formatting.h
parent6f22a82a401d267e4bf1fcbcff8d6adb24e14d58 (diff)
Process sync requests incrementally in AbsorbSyncRequestsHEADmaster
If the number of sync requests is big enough, the palloc() call in AbsorbSyncRequests() will attempt to allocate more than 1 GB of memory, resulting in failure. This can lead to an infinite loop in the checkpointer process, as it repeatedly fails to absorb the pending requests. This commit introduces the following changes to cope with this problem: 1. Turn pending checkpointer requests array in shared memory into a bounded ring buffer. 2. Limit maximum ring buffer size to 10M items. 3. Make AbsorbSyncRequests() process requests incrementally in 10K batches. Even #2 makes the whole queue size fit the maximum palloc() size of 1 GB. of continuous lock holding. This commit is for master only. Simpler fix, which just limits a request queue size to 10M, will be backpatched. Reported-by: Ekaterina Sokolova <e.sokolova@postgrespro.ru> Discussion: https://postgr.es/m/db4534f83a22a29ab5ee2566ad86ca92%40postgrespro.ru Author: Maxim Orlov <orlovmg@gmail.com> Co-authored-by: Xuneng Zhou <xunengzhou@gmail.com> Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Diffstat (limited to 'src/include/utils/formatting.h')
0 files changed, 0 insertions, 0 deletions