postgresql/src/backend
Tom Lane d3ff180163 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.
2007-03-14 18:48:55 +00:00
..
access Reverted waiting for further fixes: 2007-03-13 14:32:25 +00:00
bootstrap First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
catalog Fix for COPY-after-truncate feature. 2007-03-03 20:08:41 +00:00
commands Fix a longstanding bug in VACUUM FULL's handling of update chains. The code 2007-03-14 18:48:55 +00:00
executor First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
lib Add resetStringInfo(), which clears the content of a StringInfo, and 2007-03-03 19:32:55 +00:00
libpq Add lo_truncate() to backend and libpq for large object truncation. 2007-03-03 19:52:47 +00:00
main Cleanup the bootstrap code a little, and rename "dummy procs" in the code 2007-03-07 13:35:03 +00:00
nodes First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
optimizer First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
parser First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
po Translation updates 2006-12-02 01:16:16 +00:00
port Fix typo in comment. 2007-02-06 16:20:23 +00:00
postmaster First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
regex Wording cleanup for error messages. Also change can't -> cannot. 2007-02-01 19:10:30 +00:00
rewrite First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
storage Cleanup the bootstrap code a little, and rename "dummy procs" in the code 2007-03-07 13:35:03 +00:00
tcop First phase of plan-invalidation project: create a plan cache management 2007-03-13 00:33:44 +00:00
utils Reverted waiting for further fixes: 2007-03-13 14:32:25 +00:00
Makefile Replace useless uses of := by = in makefiles. 2007-02-09 15:56:00 +00:00
nls.mk Add _ to gettext triggers. Must have been forgotten here when it was introduced. 2005-10-04 11:14:03 +00:00