Re: pg_amcheck contrib application

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: pg_amcheck contrib application
Дата
Msg-id CA+TgmoZkzBXELxd-Dm+kKW2336qCb6vq07FvQVVq1KbfoMS5PQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_amcheck contrib application  (Mark Dilger <mark.dilger@enterprisedb.com>)
Ответы Re: pg_amcheck contrib application  (Mark Dilger <mark.dilger@enterprisedb.com>)
Список pgsql-hackers
On Wed, Mar 31, 2021 at 12:34 AM Mark Dilger
<mark.dilger@enterprisedb.com> wrote:
> I'm not looking at the old VACUUM FULL code, but my assumption is that if the xvac code were resurrected, then when a
tupleis moved off by a VACUUM FULL, the old tuple and associated toast cannot be pruned until concurrent transactions
end. So, if amcheck is running more-or-less concurrently with the VACUUM FULL and has a snapshot xmin no newer than the
xidof the VACUUM FULL's xid, it can check the toast associated with the moved off tuple after the VACUUM FULL commits.
Ifinstead the VACUUM FULL xid was older than amcheck's xmin, then the toast is in danger of being vacuumed away.  So
thelogic in verify_heapam would need to change to think about this distinction.  We don't have to concern ourselves
aboutthat, because VACUUM FULL cannot be running, and so the xid for it must be older than our xmin, and hence the
toastis unconditionally not safe to check. 
>
> I'm changing the comments back to how you had them, but I'd like to know why my reasoning is wrong.

Let's start by figuring out *whether* your reasoning is wrong. My
assumption was that old-style VACUUM FULL would move tuples without
retoasting. That is, if we decided to move a tuple from page 2 of the
main table to page 1, we would just write the tuple into page 1,
marking it moved-in, and on page 2 we would mark it moved-off. And
that we would not examine or follow any TOAST pointers at all, so
whatever TOAST entries existed would be shared between the two tuples.
One tuple or the other would eventually die, depending on whether xvac
went on to commit or abort, but either way the TOAST doesn't need
updating because there's always exactly 1 remaining tuple using
pointers to those TOAST values.

Your assumption seems to be the opposite, that the TOASTed values
would be retoasted as part of VF. If that is true, then your idea is
right.

Do you agree with this analysis? If so, we can check the code and find
out which way it actually worked.

--
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Crash in record_type_typmod_compare
Следующее
От: Julien Rouhaud
Дата:
Сообщение: Re: Idea: Avoid JOINs by using path expressions to follow FKs