From: | Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix locking while setting flags in MySerializableXact. |
Date: | 2011-06-10 20:41:25 |
Message-ID: | E1QV8WD-0006y2-Ug@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix locking while setting flags in MySerializableXact.
Even if a flag is modified only by the backend owning the transaction, it's
not safe to modify it without a lock. Another backend might be setting or
clearing a different flag in the flags field concurrently, and that
operation might be lost because setting or clearing a bit in a word is not
atomic.
Make did-write flag a simple backend-private boolean variable, because it
was only set or tested in the owning backend (except when committing a
prepared transaction, but it's not worthwhile to optimize for the case of a
read-only prepared transaction). This also eliminates the need to add
locking where that flag is set.
Also, set the did-write flag when doing DDL operations like DROP TABLE or
TRUNCATE -- that was missed earlier.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/cb2d158c5808c72cbd12cbffe0b7f5dbe830760b
Modified Files
--------------
src/backend/storage/lmgr/predicate.c | 85 ++++++++++++++++++-----------
src/include/storage/predicate_internals.h | 15 +++---
2 files changed, 61 insertions(+), 39 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-06-10 21:04:46 | pgsql: Work around gcc 4.6.0 bug that breaks WAL replay. |
Previous Message | Alvaro Herrera | 2011-06-10 19:28:52 | pgsql: Add comment about pg_ctl stop |