8000 pg_prewarm: Allow autoprewarm to use more than 1GB to dump blocks. · postgres/postgres@1694292 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1694292

Browse files
committed
pg_prewarm: Allow autoprewarm to use more than 1GB to dump blocks.
Reported-by: Daria Shanina <vilensipkdm@gmail.com> Author: Daria Shanina <vilensipkdm@gmail.com> Author: Robert Haas <robertmhaas@gmail.com> Backpatch-through: 13
1 parent aad8bd6 commit 1694292

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

contrib/pg_prewarm/autoprewarm.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,15 @@ apw_dump_now(bool is_bgworker, bool dump_unlogged)
608608
return 0;
609609
}
610610

611-
block_info_array =
612-
(BlockInfoRecord *) palloc(sizeof(BlockInfoRecord) * NBuffers);
611+
/*
612+
* With sufficiently large shared_buffers, allocation will exceed 1GB, so
613+
* allow for a huge allocation to prevent outright failure.
614+
*
615+
* (In the future, it might be a good idea to redesign this to use a more
616+
* memory-efficient data structure.)
617+
*/
618+
block_info_array = (BlockInfoRecord *)
619+
palloc_extended((sizeof(BlockInfoRecord) * NBuffers), MCXT_ALLOC_HUGE);
613620

614621
for (num_blocks = 0, i = 0; i < NBuffers; i++)
615622
{

0 commit comments

Comments
 (0)
0