what happens when...? - Mailing list pgsql-hackers

From Gregory Stark
Subject what happens when...?
Date
Msg-id 871wlvm658.fsf@stark.xeocode.com
Whole thread Raw
Responses Re: what happens when...?  (Heikki Linnakangas <heikki@enterprisedb.com>)
List pgsql-hackers
How do we handle this situation?
We go to insert a record in the heap, find no free space, so we extend thetable and insert it into a new page. Then we
insertan index entry pointingto the new tuple. Then some other backend (or bgwriter) comes along anddecides the index
pageis a good candidate for eviction and forces an xlogbuffer flush for that buffer. Then the system crashes.
 

Now when the system comes back up the index will have a pointer to a page
beyond the end of the heap. Even if we have a WAL log entry for the extension
the index pointer would be pointing to a zeroed block so vacuum would never
get the chance to note the tuple is dead and remove the index pointer.

I know there's some special code in lazyvacuum to handle zeroed pages but I
don't think it does anything special to note those zeroed pages and check
index entries against them, does it?

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Hubert FONGARNAND
Date:
Subject: Temparary disable constraint
Next
From: Heikki Linnakangas
Date:
Subject: Re: what happens when...?