Re: Re: Strangeness in xid allocation / snapshot setup

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: Re: Strangeness in xid allocation / snapshot setup
Date: 2001-07-12 17:24:17
Message-ID: 6300.994958657@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:
> 1.1 For this case acquiring SInval lock before ReadNewTransactionId()
> changes behavior of Tx Old: it postpones change of Tx Old'
> (and Tx New') MyProc->xid in xact.c:CommitTransaction(), so Tx S
> will see Tx Old as running, ie Tx Old' changes will be invisible
> to Tx S on the base of analyzing MyProc.xid-s, just like Tx New'
> changes will be invisible on the base of analyzing next Tx ID.

Oh, now I get it: the point is to prevent Tx Old from exiting the set
of "still running" xacts as seen by Tx S. Okay, it makes sense.
I'll try to add some documentation to explain it.

Given this, I'm wondering why we bother with having a separate
XidGenLock spinlock at all. Why not eliminate it and use SInval
spinlock to lock GetNewTransactionId and ReadNewTransactionId?

What did you think about reordering the vacuum qual tests and
AbortTransaction sequence?

BTW, I'm starting to think that it would be really nice if we could
replace our spinlocks with not just a semaphore, but something that has
a notion of "shared" and "exclusive" lock requests. For example,
if GetSnapshotData could use a shared lock on SInvalLock, it'd
improve concurrency.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-07-12 17:28:21 Re: Prefixing libpq error message with function names
Previous Message Mikheev, Vadim 2001-07-12 17:11:02 RE: Re: Strangeness in xid allocation / snapshot setup