Re: XMIN semantic at peril ? - Mailing list pgsql-general

From Tom Lane
Subject Re: XMIN semantic at peril ?
Date
Msg-id 22647.1192118627@sss.pgh.pa.us
Whole thread Raw
In response to Re: XMIN semantic at peril ?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Responses Re: XMIN semantic at peril ?  (Erik Jones <erik@myemma.com>)
Re: XMIN semantic at peril ?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List pgsql-general
Karsten Hilbert <Karsten.Hilbert@gmx.net> writes:
> On Thu, Oct 11, 2007 at 10:44:17AM -0400, Tom Lane wrote:
>> One question I'd have though is whether "freezing" of old tuples is
>> likely to confuse your app.

> Well, what we do is this:

> - read row including XMIN
> - do some UI stuff without open transactions
> - update row with "... where pk = ... and XMIN = old_xmin_from_read"

> If in the meantime another writer changed the data we
> originally read we would detect that by xmin having changed
> hence no row to be updated. So, yes, there is a *tiny*
> failure condition:

Hmm.  I think the failure condition is not what you are thinking: in
your example, you'd correctly conclude that some other transaction
modified the row.  The problem case is

- read (a rather old) row including XMIN
- VACUUM comes along and decides to set XMIN = FrozenTransactionId
- update row with "... where pk = ... and XMIN = old_xmin_from_read"
- update fails, when there is no need to fail

As long as the failure is "soft", ie, you recover reasonably, this
shouldn't be a big problem.  But it's certainly not a scenario you
should dismiss as not credible because of timescales.

            regards, tom lane

pgsql-general by date:

Previous
From: Nis Jørgensen
Date:
Subject: Re: Calculation of per Capita on-the-fly - problems with SQL syntax
Next
From: Benjamin Arai
Date:
Subject: Re: [PERFORM] Slow TSearch2 performance for table with 1 million documents.