Re: BUG #13530: sort receives "unexpected out-of-memory situation during sort"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #13530: sort receives "unexpected out-of-memory situation during sort"
Дата
Msg-id 20722.1438402315@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #13530: sort receives "unexpected out-of-memory situation during sort"  (brent_despain@selinc.com)
Ответы Re: BUG #13530: sort receives "unexpected out-of-memory situation during sort"
Список pgsql-bugs
brent_despain@selinc.com writes:
> We are occasionally receiving "unexpected out-of-memory situation during
> sort".

Hmm.  Looking at the code here, it suddenly strikes me that it's assuming
that LACKMEM() wasn't true to begin with, and that this is not guaranteed,
because we adjust the memory consumption counter *before* we call
puttuple_common.  So it would fail only if we exhausted allowedMem on
the same tuple that would cause an enlargement of the memtuples[] array,
which would be unusual enough to explain why this isn't terribly
reproducible.

Could you try something like this at the head of grow_memtuples() to
see if it makes things better?

    /* Forget it if we've already maxed out memtuples, per comment above */
    if (!state->growmemtuples)
        return false;
+    /* Forget it if we already exhausted memory */
+    if (LACKMEM(state))
+        return false;


            regards, tom lane

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

Предыдущее
От: brent_despain@selinc.com
Дата:
Сообщение: BUG #13530: sort receives "unexpected out-of-memory situation during sort"
Следующее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: 9.5alpha1: Partial index not used