Re: MultiXacts & WAL

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: paolo romano <paolo(dot)romano(at)yahoo(dot)it>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: MultiXacts & WAL
Date: 2006-06-17 19:09:01
Message-ID: Pine.OSF.4.61.0606172113310.312139@kosh.hut.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 17 Jun 2006, paolo romano wrote:

> The original point I was moving is if there were any concrete reason
> (which still I can't see) to require Multixacts recoverability (by means
> of logging).
> Concerning the prepare state of two phase commit, as I was pointing out
> in my previous post, shared locks can safely be released once a
> transaction gets precommitted, hence they do not have to be made
> durable.

No, it's not safe to release them until 2nd phase commit.

Imagine table foo and table bar. Table bar has a foreign key reference to
foo.

1. Transaction A inserts a row to bar, referencing row R in foo. This
acquires a shared lock on R.
2. Transaction A precommits, releasing the lock.
3. Transaction B deletes R. The new row inserted by A is not visible to
B, so the delete succeeds.
4. Transaction A and B commit. Oops, the new row in bar references R that
doesn't exist anymore.

Holding the lock until the true end of transaction, the 2nd phase
of commit, blocks B from deleting R.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2006-06-17 19:19:40 Re: [HACKERS] Sun Donated a Sun Fire T2000 to the PostgreSQL
Previous Message Tom Lane 2006-06-17 18:56:47 oprofile results for stats collector test