Re: New vacuum option to do only freezing

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: New vacuum option to do only freezing
Дата
Msg-id CA+TgmoYKg_qs0vA+WA_hN2tHvje_78ytHSxTw=Wtwdmku-J_qw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: New vacuum option to do only freezing  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: New vacuum option to do only freezing  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Tue, Apr 16, 2019 at 12:44 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> So after thinking about this a bit more ...
>
> ISTM that what we have here is a race condition (ie, tuple changed state
> since heap_page_prune), and that ideally we want the code to resolve it
> as if no race had happened.  That is, either of these behaviors would
> be acceptable:
>
> 1. Delete the tuple, just as heap_page_prune would've done if it had seen
> it DEAD.  (Possibly we could implement that by jumping back and doing
> heap_page_prune again, but that seems pretty messy and bug-prone.
> In any case, if we're not doing index cleanup then this must reduce to
> "replace tuple by a dead line pointer", not remove it altogether.)
>
> 2. Act as if the tuple were still live, just as would've happened if the
> state didn't change till just after we looked instead of just before.
>
> Option #2 is a lot simpler and safer, and can be implemented as I
> suggested earlier, assuming we're all good with the assumption that
> heap_prepare_freeze_tuple isn't going to do anything bad.

After studying this more carefully, I agree.  You and Andres and
Alvaro are all correct, and I'm plain wrong.  Thanks for explaining.
I have committed a patch that changes the logic as per your
suggestion, and also removes nleft_dead_tuples and nleft_dead_itemids.

I'll reply separately to your other point about tups_vacuumed reporting.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Fixing order of resowner cleanup in 12, for Windows
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: pgbench - add option to show actual builtin script code