Skip to content

Commit 40ced69

Browse files
author
Antonin Houska
committed
Try harder to avoid overflow of the tuple array during the initial load.
1 parent 750903e commit 40ced69

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pg_squeeze.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,10 +2237,13 @@ perform_initial_load(Relation rel_src, RangeVar *cluster_idx_rv,
22372237
/*
22382238
* Besides being of valid size, the new array should allow
22392239
* for storing some data w/o exceeding
2240-
* maintenance_work_mem. XXX Consider tuning the portion
2241-
* of maintenance_work_mem that the array can use.
2240+
* maintenance_work_mem. Check also batch_max_size_new for
2241+
* overflow although AllocSizeIsValid() probably should
2242+
* detect a problem much earlier. XXX Consider tuning the
2243+
* portion of maintenance_work_mem that the array can use.
22422244
*/
22432245
if (!AllocSizeIsValid(tuple_array_size_new) ||
2246+
batch_max_size_new < 0 ||
22442247
tuple_array_size_new / 1024 >=
22452248
maintenance_work_mem / 16)
22462249
tuple_array_can_expand = false;

0 commit comments

Comments
 (0)