From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Overdue code review for transaction-level advisory locks patch. |
Date: | 2012-05-04 21:44:43 |
Message-ID: | E1SQQIt-0000If-5z@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Overdue code review for transaction-level advisory locks patch.
Commit 62c7bd31c8878dd45c9b9b2429ab7a12103f3590 had assorted problems, most
visibly that it broke PREPARE TRANSACTION in the presence of session-level
advisory locks (which should be ignored by PREPARE), as per a recent
complaint from Stephen Rees. More abstractly, the patch made the
LockMethodData.transactional flag not merely useless but outright
dangerous, because in point of fact that flag no longer tells you anything
at all about whether a lock is held transactionally. This fix therefore
removes that flag altogether. We now rely entirely on the convention
already in use in lock.c that transactional lock holds must be owned by
some ResourceOwner, while session holds are never so owned. Setting the
locallock struct's owner link to NULL thus denotes a session hold, and
there is no redundant marker for that.
PREPARE TRANSACTION now works again when there are session-level advisory
locks, and it is also able to transfer transactional advisory locks to the
prepared transaction, but for implementation reasons it throws an error if
we hold both types of lock on a single lockable object. Perhaps it will be
worth improving that someday.
Assorted other minor cleanup and documentation editing, as well.
Back-patch to 9.1, except that in the 9.1 branch I did not remove the
LockMethodData.transactional flag for fear of causing an ABI break for
any external code that might be examining those structs.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/71b9549d053b2f0a9e76e829c917385841f84bee
Modified Files
--------------
doc/src/sgml/func.sgml | 67 +++++-----
doc/src/sgml/mvcc.sgml | 76 ++++++----
src/backend/storage/lmgr/README | 16 +-
src/backend/storage/lmgr/lock.c | 289 ++++++++++++++++++++++----------------
src/backend/storage/lmgr/proc.c | 10 +-
src/include/storage/lock.h | 12 +-
6 files changed, 264 insertions(+), 206 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2012-05-05 16:00:09 | pgsql: Fix psql doc typo. |
Previous Message | Tom Lane | 2012-05-04 16:58:51 | Re: Beta time? |