what happens when...?

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: what happens when...?
Date: 2007-01-16 13:51:31
Message-ID: 871wlvm658.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


How do we handle this situation?

We go to insert a record in the heap, find no free space, so we extend the
table and insert it into a new page. Then we insert an index entry pointing
to the new tuple. Then some other backend (or bgwriter) comes along and
decides the index page is a good candidate for eviction and forces an xlog
buffer 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2007-01-16 14:06:44 Re: what happens when...?
Previous Message Gurjeet Singh 2007-01-16 11:03:52 Re: [PATCHES] [HACKERS] [Fwd: Index Advisor]