1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

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
This commit is contained in:
Robert Haas
2025-06-06 08:18:22 -04:00
parent 74637fb797
commit d59ff3be24

View File

@ -609,8 +609,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++)
{