Re: Out of Memory - 8.2.4

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Out of Memory - 8.2.4
Дата
Msg-id 3726.1188497277@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Out of Memory - 8.2.4  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: Out of Memory - 8.2.4
Список pgsql-general
Alvaro Herrera <alvherre@commandprompt.com> writes:
> !         /* no need to allocate more space than we have pages */
> !         maxtuples = LAZY_ALLOC_TUPLES * relblocks;

Uh ... you need to guard against integer overflow in this calculation.
Perhaps leave the current initialization alone, and then after the
Min-reduction steps add

        /* curious coding to ensure the multiplication can't overflow */
    if ((BlockNumber) (maxtuples / LAZY_ALLOC_TUPLES) > relblocks)
        maxtuples = relblocks * LAZY_ALLOC_TUPLES;

which is demonstrably overflow-proof once maxtuples has been clamped to
less than INT_MAX.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: Reliable and fast money transaction design
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: Out of Memory - 8.2.4