Re: Exposing the Xact commit order to the user

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Exposing the Xact commit order to the user
Date: 2010-05-26 20:45:10
Message-ID: 4BFD8856.8000608@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 26/05/10 23:32, Jan Wieck wrote:
> Consider two transactions A and B that due to transaction batching
> between snapshots get applied together. Let the order of actions be
>
> 1. A starts
> 2. B starts
> 3. B selects a row for update, then updates the row
> 4. A tries to do the same and blocks
> 5. B commits
> 6. A gets the lock, the row, does the update
> 7. A commits
>
> If Slony (or Londiste) would not record the exact order of those
> individual row actions, then it would not have any idea if within that
> batch the action of B (higher XID) actually came first. Without that
> knowledge there is a 50/50 chance of getting your replica out of sync
> with that simple conflict.

Hmm, I don't see how even a fully reliable WAL-logged commit-order log
would save you then. It seems that you need to not only know the
relative order of commits, but the order of commits relative to actions
within the transactions. I.e. in the above example it's not enough to
know that B committed before A, you also have to know that A updated the
row only after B committed.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2010-05-26 20:49:06 Re: Exposing the Xact commit order to the user
Previous Message Peter Eisentraut 2010-05-26 20:44:30 functional call named notation clashes with SQL feature