pgsql: Fix a longstanding bug in VACUUM FULL's handling of update

Поиск
Список
Период
Сортировка
От tgl@postgresql.org (Tom Lane)
Тема pgsql: Fix a longstanding bug in VACUUM FULL's handling of update
Дата
Msg-id 20070314184912.30D3F9FB4CE@postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
Fix a longstanding bug in VACUUM FULL's handling of update chains.  The code
did not expect that a DEAD tuple could follow a RECENTLY_DEAD tuple in an
update chain, but because the OldestXmin rule for determining deadness is a
simplification of reality, it is possible for this situation to occur
(implying that the RECENTLY_DEAD tuple is in fact dead to all observers,
but this patch does not attempt to exploit that).  The code would follow a
chain forward all the way, but then stop before a DEAD tuple when backing
up, meaning that not all of the chain got moved.  This could lead to copying
the chain multiple times (resulting in duplicate copies of the live tuple at
its end), or leaving dangling index entries behind (which, aside from
generating warnings from later vacuums, creates a risk of wrong query
results or bogus duplicate-key errors once the heap slot the index entry
points to is repopulated).

The fix is to recheck HeapTupleSatisfiesVacuum while following a chain
forward, and to stop if a DEAD tuple is reached.  Each contiguous group
of RECENTLY_DEAD tuples will therefore be copied as a separate chain.
The patch also adds a couple of extra sanity checks to verify correct
behavior.

Per report and test case from Pavan Deolasee.

Tags:
----
REL8_1_STABLE

Modified Files:
--------------
    pgsql/src/backend/commands:
        vacuum.c (r1.317.2.3 -> r1.317.2.4)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuum.c.diff?r1=1.317.2.3&r2=1.317.2.4)

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

Предыдущее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Fix a longstanding bug in VACUUM FULL's handling of update
Следующее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Fix a longstanding bug in VACUUM FULL's handling of update