Re: Core reported from vaccum function.

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "Mavinakuli, Prasanna (STSD)" <prasanna(dot)b-m(at)hp(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Rao, Srikanth R (STSD)" <srikanth-r(dot)rao-k(at)hp(dot)com>, "Racharla, Chakravarthy (STSD)" <chakravarthy(dot)racharla(at)hp(dot)com>, "Manchenahalli, Raghunandan (STSD)" <raghunandan(dot)manchenahalli(at)hp(dot)com>, "Hebbar, Raghavendra (STSD)" <raaghav(at)hp(dot)com>
Subject: Re: Core reported from vaccum function.
Date: 2007-07-30 16:30:01
Message-ID: 20070730163001.GC7628@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mavinakuli, Prasanna (STSD) wrote:
>
> Hello Alvaro,
>
> Thanks for your reply.
>
> We could see
> "Fix potential-data-corruption bug in how VACUUM FULL handles UPDATE
> chains (Tom, Pavan Deolasee) " in 7.4.17 release notes.
>
> Could you please elaborate more on the above problem.Meaning what was
> the actual problem and what fix has been done etc?

Here is the CVS log entry:

2007-03-14 14:48 tgl

* src/backend/commands/vacuum.c (1.263.2.3):

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.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Cultural Sublimation 2007-07-30 17:01:13 Optimising SELECT on a table with one million rows
Previous Message Hannes Dorbath 2007-07-30 16:14:12 Re: Data on NAS / NFS