Re: Triggered Data Change check - Mailing list pgsql-hackers

From Zeugswetter Andreas SB SD
Subject Re: Triggered Data Change check
Date
Msg-id 46C15C39FEB2C44BA555E356FBCD6FA41EB403@m0114.s-mxs.net
Whole thread Raw
In response to Triggered Data Change check  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-hackers
 
> Looking back at our discussion around 24-Oct, I recall that I was
> leaning to the idea that the correct interpretation of the spec's
> "triggered data change" rule is that it prohibits scenarios that are
> impossible anyway under MVCC, because of the MVCC tuple visibility
> rules.  Therefore we don't need any explicit test for triggered data
> change.  But I didn't hear anyone else supporting or disproving
> that idea.
> 
> The code as-is is certainly wrong, since it prohibits multiple changes
> within a transaction, not within a statement as the spec says.
> 
> Right at the moment I'd favor ripping the code out entirely ... but
> it'd be good to hear some support for that approach.  Comments anyone?

If I read the code correctly, the "triggered data change" check is only
performed for keys, that have xmin == GetCurrentTransactionId().
Those are tuples that have already been modified by current session.
Since nobody else can touch those (since they are locked), I think the
check is not needed.

(Delete lines 2176 - 2200 and 2211 - 2229, that was your intent, Tom ?)
I think this would be correct.

I somehow wonder on the contrary why a check would not be necessary
for the exact opposite case, where oldtup->t_data->t_xmin != 
GetCurrentTransactionId(), since such a key might have been changed 
from another session. (Or does a referenced key always get a lock ?)

Andreas


pgsql-hackers by date:

Previous
From: "pgsql-hackers"
Date:
Subject: replicate "sequence" using rserv
Next
From: David Eduardo Gomez Noguera
Date:
Subject: timestamp