Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc

Поиск
Список
Период
Сортировка
От Greg Nancarrow
Тема Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc
Дата
Msg-id CAJcOf-e2w1e-juDrBKWU-nQ8CEF0CTV3B5EyAK=z3D-9Kz2m8A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc  (Ranier Vilela <ranier.vf@gmail.com>)
Список pgsql-hackers
On Wed, Jun 23, 2021 at 11:01 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>
> The code is correct as-is; the proposed change would result in taking
> more snapshots than needed.  Perhaps the comment needs revision, since
> you both misread it.  The comment is written in terms of "when can we
> skip taking a snapshot", while the test in the code is written for
> the inverse condition "when do we need a snapshot".

Yes, you're right.
Even though I did realise that the comment was talking about the
inverse, the condition for needing a snapshot still seemed too narrow,
based on the comment, but checking the cases again, it is correct.

Perhaps that code could have been written as the following, to better
align with the comments:

    skip_snapshot = (!expr->expr_simple_mutable || estate->readonly_func);
    if (!skip_snapshot)
    {
        ...
    }

    ...

    if (!skip_snapshot)
        PopActiveSnapshot();


Regards,
Greg Nancarrow
Fujitsu Australia



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

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Deadlock risk while inserting directly into partition?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Deadlock risk while inserting directly into partition?