Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20bdc71

Browse files
committed
Prevent lazy_space_alloc from making requests that exceed MaxAllocSize,
per report from Stefan Kaltenbrunner.
1 parent80cadb3 commit20bdc71

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎src/backend/commands/vacuumlazy.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
*
3333
* IDENTIFICATION
34-
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.66 2006/02/11 23:31:34 tgl Exp $
34+
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.67 2006/03/04 19:09:09 tgl Exp $
3535
*
3636
*-------------------------------------------------------------------------
3737
*/
@@ -48,6 +48,7 @@
4848
#include"storage/freespace.h"
4949
#include"storage/smgr.h"
5050
#include"utils/lsyscache.h"
51+
#include"utils/memutils.h"
5152
#include"utils/pg_rusage.h"
5253

5354

@@ -957,6 +958,7 @@ lazy_space_alloc(LVRelStats *vacrelstats, BlockNumber relblocks)
957958

958959
maxtuples= (maintenance_work_mem*1024L) /sizeof(ItemPointerData);
959960
maxtuples=Min(maxtuples,INT_MAX);
961+
maxtuples=Min(maxtuples,MaxAllocSize /sizeof(ItemPointerData));
960962
/* stay sane if small maintenance_work_mem */
961963
maxtuples=Max(maxtuples,MaxHeapTuplesPerPage);
962964

@@ -966,6 +968,7 @@ lazy_space_alloc(LVRelStats *vacrelstats, BlockNumber relblocks)
966968
palloc(maxtuples*sizeof(ItemPointerData));
967969

968970
maxpages=MaxFSMPages;
971+
maxpages=Min(maxpages,MaxAllocSize /sizeof(PageFreeSpaceInfo));
969972
/* No need to allocate more pages than the relation has blocks */
970973
if (relblocks< (BlockNumber)maxpages)
971974
maxpages= (int)relblocks;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp