diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2011-06-10 23:15:05 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2011-06-10 23:41:10 +0300 |
commit | cb2d158c5808c72cbd12cbffe0b7f5dbe830760b (patch) | |
tree | 2528c1607ed60d1641d4d681686e352febed2bc3 /src/backend/utils/adt/pgstatfuncs.c | |
parent | d69149ed71cc4f073f222f11f702a20a6d279e0c (diff) | |
download | postgresql-cb2d158c5808c72cbd12cbffe0b7f5dbe830760b.tar.gz postgresql-cb2d158c5808c72cbd12cbffe0b7f5dbe830760b.zip |
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.
Diffstat (limited to 'src/backend/utils/adt/pgstatfuncs.c')
0 files changed, 0 insertions, 0 deletions