Prevent lazy_space_alloc from making requests that exceed MaxAllocSize,
per report from Stefan Kaltenbrunner.
This commit is contained in:
parent
80cadb303c
commit
20bdc71369
@ -31,7 +31,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.66 2006/02/11 23:31:34 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.67 2006/03/04 19:09:09 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -48,6 +48,7 @@
|
||||
#include "storage/freespace.h"
|
||||
#include "storage/smgr.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/pg_rusage.h"
|
||||
|
||||
|
||||
@ -957,6 +958,7 @@ lazy_space_alloc(LVRelStats *vacrelstats, BlockNumber relblocks)
|
||||
|
||||
maxtuples = (maintenance_work_mem * 1024L) / sizeof(ItemPointerData);
|
||||
maxtuples = Min(maxtuples, INT_MAX);
|
||||
maxtuples = Min(maxtuples, MaxAllocSize / sizeof(ItemPointerData));
|
||||
/* stay sane if small maintenance_work_mem */
|
||||
maxtuples = Max(maxtuples, MaxHeapTuplesPerPage);
|
||||
|
||||
@ -966,6 +968,7 @@ lazy_space_alloc(LVRelStats *vacrelstats, BlockNumber relblocks)
|
||||
palloc(maxtuples * sizeof(ItemPointerData));
|
||||
|
||||
maxpages = MaxFSMPages;
|
||||
maxpages = Min(maxpages, MaxAllocSize / sizeof(PageFreeSpaceInfo));
|
||||
/* No need to allocate more pages than the relation has blocks */
|
||||
if (relblocks < (BlockNumber) maxpages)
|
||||
maxpages = (int) relblocks;
|
||||
|
Loading…
x
Reference in New Issue
Block a user