Skip site navigation (1) Skip section navigation (2)

Re: A 2 phase commit weirdness

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)surnet(dot)cl>,Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A 2 phase commit weirdness
Date: 2005-05-27 14:24:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Thu, 26 May 2005, Tom Lane wrote:

> Alvaro Herrera <alvherre(at)surnet(dot)cl> writes:
>> I'm wondering what should happen at prepare time so that "my own cache"
>> is correct.
> Good point.  As far as the local caches are concerned, we probably have
> to make it look like the transaction rolled back.  I think Heikki
> already had code in there to send the right inval messages when the
> prepared transaction ultimately commits ... but we'll have to check that
> that sequence does the right things ...

Looking at the sequence, at least the relcache init file stuff looks if 
not broken at least a bit heavy-handed...

BTW: Is there a race condition in the relcache init file invalidation, 
even without 2PC?

AtEOXact_Inval does basically this:

1. Unlink init file
2. Send inval messages
3. Unlink the init file again

Now consider this scenario:

backend A: Do updates that cause an init file invalidation
backend A: Commit begins
backend A: unlink init file
backend B starts and recreates init file
backend A: send inval message
backend C starts and reads the now stale init file

The window is admittedly very small, but it just caught my eye. Or am I 
missing some lock etc?

- Heikki

In response to


pgsql-hackers by date

Next:From: Mark Cave-AylandDate: 2005-05-27 15:01:00
Subject: Re: Cost of XLogInsert CRC calculations
Previous:From: Neil ConwayDate: 2005-05-27 14:21:18
Subject: Re: foreign keys and RI triggers

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group