Skip to content

Commit 016e407

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 c37be39 commit 016e407

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
@@ -693,8 +693,15 @@ apw_dump_now(bool is_bgworker, bool dump_unlogged)
693693
return 0;
694694
}
695695

696-
block_info_array =
697-
(BlockInfoRecord *) palloc(sizeof(BlockInfoRecord) * NBuffers);
696+
/*
697+
* With sufficiently large shared_buffers, allocation will exceed 1GB, so
698+
* allow for a huge allocation to prevent outright failure.
699+
*
700+
* (In the future, it might be a good idea to redesign this to use a more
701+
* memory-efficient data structure.)
702+
*/
703+
block_info_array = (BlockInfoRecord *)
704+
palloc_extended((sizeof(BlockInfoRecord) * NBuffers), MCXT_ALLOC_HUGE);
698705

699706
for (num_blocks = 0, i = 0; i < NBuffers; i++)
700707
{

0 commit comments

Comments
 (0)