From bedb78d386a47fd66b6cda2040e0a5fb545ee371 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 28 Apr 2005 21:47:18 +0000 Subject: 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. --- src/include/parser/parse_node.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/include/parser/parse_node.h') diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h index 3999918f248..bfcf00fd47d 100644 --- a/src/include/parser/parse_node.h +++ b/src/include/parser/parse_node.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/parser/parse_node.h,v 1.42 2004/12/31 22:03:38 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/parser/parse_node.h,v 1.43 2005/04/28 21:47:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ typedef struct ParseState Oid *p_paramtypes; /* OIDs of types for $n parameter symbols */ int p_numparams; /* allocated size of p_paramtypes[] */ int p_next_resno; /* next targetlist resno to assign */ - List *p_forUpdate; /* FOR UPDATE clause, if any (see gram.y) */ + List *p_lockedRels; /* FOR UPDATE/SHARE, if any (see gram.y) */ Node *p_value_substitute; /* what to replace VALUE with, if * any */ bool p_variableparams; -- cgit v1.2.3