Skip to content

Commit a4b9707

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 09498d2 commit a4b9707

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
@@ -593,8 +593,15 @@ apw_dump_now(bool is_bgworker, bool dump_unlogged)
593593
return 0;
594594
}
595595

596-
block_info_array =
597-
(BlockInfoRecord *) palloc(sizeof(BlockInfoRecord) * NBuffers);
596+
/*
597+
* With sufficiently large shared_buffers, allocation will exceed 1GB, so
598+
* allow for a huge allocation to prevent outright failure.
599+
*
600+
* (In the future, it might be a good idea to redesign this to use a more
601+
* memory-efficient data structure.)
602+
*/
603+
block_info_array = (BlockInfoRecord *)
604+
palloc_extended((sizeof(BlockInfoRecord) * NBuffers), MCXT_ALLOC_HUGE);
598605

599606
for (num_blocks = 0, i = 0; i < NBuffers; i++)
600607
{

0 commit comments

Comments
 (0)