From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Mikheev, Vadim" <vmikheev(at)SECTORBASE(dot)COM> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: Strangeness in xid allocation / snapshot setup |
Date: | 2001-07-12 02:32:25 |
Message-ID: | 10759.994905145@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Mikheev, Vadim" <vmikheev(at)SECTORBASE(dot)COM> writes:
>> Since we are going to treat all xids >= xmax as in-progress anyway,
>> what's wrong with reading xmax before we acquire the SInval lock?
> AFAIR, I made so to prevent following:
> 1. Tx Old is running.
> 2. Tx S reads new transaction ID in GetSnapshotData() and swapped away
> before SInval acquired.
> 3. Tx New gets new transaction ID, makes changes and commits.
> 4. Tx Old changes some row R changed by Tx New and commits.
> 5. Tx S gets snapshot data and now sees R changed by *both* Tx Old and
> Tx New *but* does not see *other* changes made by Tx New =>
> Tx S reads unconsistent data.
Hmm, but that doesn't seem to have anything to do with the way that
GetSnapshotData operates. If Tx New has an XID >= xmax read by Tx S'
GetSnapshotData, then Tx New will be considered uncommitted by S no
matter which order we get the locks in; it hardly matters whether Tx New
manages to physically commit before we finish building the snapshot for
S. On the other side of the coin, if Tx New's XID < xmax for S, then
*with the GetNewTransactionId change that I want* we can be sure that
Tx New will be seen running by S when it does get the SInval lock
(unless New has managed to finish before S gets the lock, in which case
it's perfectly reasonable for S to treat it as committed or aborted).
Anyway, it seems to me that the possibility of inconsistent data is
inherent in the way we handle updated rows in Read Committed mode ---
you can always get to see a row that was emitted by a transaction you
don't see the other effects of.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Elphick | 2001-07-12 02:37:43 | Re: Re: Debian's PostgreSQL packages |
Previous Message | Mikheev, Vadim | 2001-07-12 02:00:27 | RE: Strangeness in xid allocation / snapshot setup |