diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-07-01 00:52:04 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-07-01 00:52:04 +0000 |
commit | 573a71a5da70d6e2503c8f53e3b4f26b3b6d738d (patch) | |
tree | 070f677b0043631518f83ce84ff201bf8fda700f /src/backend/storage/lmgr/proc.c | |
parent | 4c9aa572fa2ee60e8ac557b866eccc7310df0a09 (diff) | |
download | postgresql-573a71a5da70d6e2503c8f53e3b4f26b3b6d738d.tar.gz postgresql-573a71a5da70d6e2503c8f53e3b4f26b3b6d738d.zip |
Nested transactions. There is still much left to do, especially on the
performance front, but with feature freeze upon us I think it's time to
drive a stake in the ground and say that this will be in 7.5.
Alvaro Herrera, with some help from Tom Lane.
Diffstat (limited to 'src/backend/storage/lmgr/proc.c')
-rw-r--r-- | src/backend/storage/lmgr/proc.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index dbf5b414153..abe44e808ad 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.148 2004/05/29 22:48:20 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.149 2004/07/01 00:50:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -380,26 +380,34 @@ LockWaitCancel(void) /* * ProcReleaseLocks() -- release locks associated with current transaction - * at transaction commit or abort + * at main transaction and subtransaction commit or abort * - * At commit, we release only locks tagged with the current transaction's XID, - * leaving those marked with XID 0 (ie, session locks) undisturbed. At abort, - * we release all locks including XID 0, because we need to clean up after - * a failure. This logic will need extension if we ever support nested - * transactions. + * The options for which locks to release are the same as for the underlying + * LockReleaseAll() function. * - * Note that user locks are not released in either case. + * Notes: + * + * At main transaction commit, we release all locks except session locks. + * At main transaction abort, we release all locks including session locks; + * this lets us clean up after a VACUUM FULL failure. + * + * At subtransaction commit, we don't release any locks (so this func is not + * called at all); we will defer the releasing to the parent transaction. + * At subtransaction abort, we release all locks held by the subtransaction; + * this is implemented by passing in the Xids of the failed subxact and its + * children in the xids[] array. + * + * Note that user locks are not released in any case. */ void -ProcReleaseLocks(bool isCommit) +ProcReleaseLocks(LockReleaseWhich which, int nxids, TransactionId *xids) { if (!MyProc) return; /* If waiting, get off wait queue (should only be needed after error) */ LockWaitCancel(); /* Release locks */ - LockReleaseAll(DEFAULT_LOCKMETHOD, MyProc, - !isCommit, GetCurrentTransactionId()); + LockReleaseAll(DEFAULT_LOCKMETHOD, MyProc, which, nxids, xids); } @@ -432,11 +440,11 @@ ProcKill(int code, Datum arg) LockWaitCancel(); /* Remove from the standard lock table */ - LockReleaseAll(DEFAULT_LOCKMETHOD, MyProc, true, InvalidTransactionId); + LockReleaseAll(DEFAULT_LOCKMETHOD, MyProc, ReleaseAll, 0, NULL); #ifdef USER_LOCKS /* Remove from the user lock table */ - LockReleaseAll(USER_LOCKMETHOD, MyProc, true, InvalidTransactionId); + LockReleaseAll(USER_LOCKMETHOD, MyProc, ReleaseAll, 0, NULL); #endif SpinLockAcquire(ProcStructLock); |