mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Implement sharable row-level locks, and use them for foreign key references
to eliminate unnecessary deadlocks. This commit adds SELECT ... FOR SHARE paralleling SELECT ... FOR UPDATE. The implementation uses a new SLRU data structure (managed much like pg_subtrans) to represent multiple- transaction-ID sets. When more than one transaction is holding a shared lock on a particular row, we create a MultiXactId representing that set of transactions and store its ID in the row's XMAX. This scheme allows an effectively unlimited number of row locks, just as we did before, while not costing any extra overhead except when a shared lock actually has to be shared. Still TODO: use the regular lock manager to control the grant order when multiple backends are waiting for a row lock. Alvaro Herrera and Tom Lane.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.59 2004/12/31 22:03:21 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.60 2005/04/28 21:47:17 tgl Exp $
|
||||
*/
|
||||
#ifndef XLOG_H
|
||||
#define XLOG_H
|
||||
@@ -133,6 +133,7 @@ extern void ShutdownXLOG(int code, Datum arg);
|
||||
extern void InitXLOGAccess(void);
|
||||
extern void CreateCheckPoint(bool shutdown, bool force);
|
||||
extern void XLogPutNextOid(Oid nextOid);
|
||||
extern void XLogPutNextMultiXactId(MultiXactId multi);
|
||||
extern XLogRecPtr GetRedoRecPtr(void);
|
||||
|
||||
#endif /* XLOG_H */
|
||||
|
||||
Reference in New Issue
Block a user