diff options
author | Robert Haas | 2025-06-06 12:18:23 +0000 |
---|---|---|
committer | Robert Haas | 2025-06-06 12:18:23 +0000 |
commit | 169429264d0638b18e01926977b910ab70457f14 (patch) | |
tree | 56eb6449f1c29d8bed00eaeced403779156da8a5 | |
parent | aad8bd69530bd76f94df87c3e043687cbf29ee70 (diff) |
pg_prewarm: Allow autoprewarm to use more than 1GB to dump blocks.
Reported-by: Daria Shanina <[email protected]>
Author: Daria Shanina <[email protected]>
Author: Robert Haas <[email protected]>
Backpatch-through: 13
-rw-r--r-- | contrib/pg_prewarm/autoprewarm.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c index 93835449c0e..b1655d66861 100644 --- a/contrib/pg_prewarm/autoprewarm.c +++ b/contrib/pg_prewarm/autoprewarm.c @@ -608,8 +608,15 @@ apw_dump_now(bool is_bgworker, bool dump_unlogged) return 0; } - block_info_array = - (BlockInfoRecord *) palloc(sizeof(BlockInfoRecord) * NBuffers); + /* + * With sufficiently large shared_buffers, allocation will exceed 1GB, so + * allow for a huge allocation to prevent outright failure. + * + * (In the future, it might be a good idea to redesign this to use a more + * memory-efficient data structure.) + */ + block_info_array = (BlockInfoRecord *) + palloc_extended((sizeof(BlockInfoRecord) * NBuffers), MCXT_ALLOC_HUGE); for (num_blocks = 0, i = 0; i < NBuffers; i++) { |