1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Revise lock manager to support "session level" locks as well as "transaction

level" locks.  A session lock is not released at transaction commit (but it
is released on transaction abort, to ensure recovery after an elog(ERROR)).
In VACUUM, use a session lock to protect the master table while vacuuming a
TOAST table, so that the TOAST table can be done in an independent
transaction.

I also took this opportunity to do some cleanup and renaming in the lock
code.  The previously noted bug in ProcLockWakeup, that it couldn't wake up
any waiters beyond the first non-wakeable waiter, is now fixed.  Also found
a previously unknown bug of the same kind (failure to scan all members of
a lock queue in some cases) in DeadLockCheck.  This might have led to failure
to detect a deadlock condition, resulting in indefinite waits, but it's
difficult to characterize the conditions required to trigger a failure.
This commit is contained in:
Tom Lane
2000-12-22 00:51:54 +00:00
parent b2145e9365
commit 6cc842abd3
11 changed files with 1030 additions and 972 deletions

View File

@ -33,7 +33,7 @@ user_lock(uint32 id1, uint32 id2, LOCKMODE lockmode)
tag.objId.blkno = (BlockNumber) id2;
tag.offnum = (OffsetNumber) (id1 & 0xffff);
return LockAcquire(USER_LOCKMETHOD, &tag, lockmode);
return LockAcquire(USER_LOCKMETHOD, &tag, InvalidTransactionId, lockmode);
}
int
@ -47,7 +47,7 @@ user_unlock(uint32 id1, uint32 id2, LOCKMODE lockmode)
tag.objId.blkno = (BlockNumber) id2;
tag.offnum = (OffsetNumber) (id1 & 0xffff);
return LockRelease(USER_LOCKMETHOD, &tag, lockmode);
return LockRelease(USER_LOCKMETHOD, &tag, InvalidTransactionId, lockmode);
}
int
@ -89,7 +89,7 @@ user_unlock_all()
}
proc = (PROC *) MAKE_PTR(location);
return LockReleaseAll(USER_LOCKMETHOD, &proc->lockQueue);
return LockReleaseAll(USER_LOCKMETHOD, proc, false, InvalidTransactionId);
}
/* end of file */