postgresql/src/backend/commands
Tom Lane 7bae0284ee Avoid transaction-commit race condition while receiving a NOTIFY message.
Use TransactionIdIsInProgress, then TransactionIdDidCommit, to distinguish
whether a NOTIFY message's originating transaction is in progress,
committed, or aborted.  The previous coding could accept a message from a
transaction that was still in-progress according to the PGPROC array;
if the client were fast enough at starting a new transaction, it might fail
to see table rows added/updated by the message-sending transaction.  Which
of course would usually be the point of receiving the message.  We noted
this type of race condition long ago in tqual.c, but async.c overlooked it.

The race condition probably cannot occur unless there are multiple NOTIFY
senders in action, since an individual backend doesn't send NOTIFY signals
until well after it's done committing.  But if two senders commit in close
succession, it's certainly possible that we could see the second sender's
message within the race condition window while responding to the signal
from the first one.

Per bug #9557 from Marko Tiikkaja.  This patch is slightly more invasive
than what he proposed, since it removes the now-redundant
TransactionIdDidAbort call.

Back-patch to 9.0, where the current NOTIFY implementation was introduced.
2014-03-13 12:02:54 -04:00
..
aggregatecmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
alter.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
analyze.c Introduce logical decoding. 2014-03-03 16:32:18 -05:00
async.c Avoid transaction-commit race condition while receiving a NOTIFY message. 2014-03-13 12:02:54 -04:00
cluster.c Allow VACUUM FULL/CLUSTER to bump freeze horizons even for pg_class. 2014-03-04 11:08:18 -05:00
collationcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
comment.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
constraint.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
conversioncmds.c Make various variables const (read-only). 2014-01-18 16:04:32 -05:00
copy.c Provide a FORCE NULL option to COPY in CSV mode. 2014-03-04 17:31:59 -05:00
createas.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
dbcommands.c Introduce logical decoding. 2014-03-03 16:32:18 -05:00
define.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
discard.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
dropcmds.c Make DROP IF EXISTS more consistently not fail 2014-01-23 14:40:29 -03:00
event_trigger.c Mark some more variables as static or include the appropriate header 2014-02-08 21:21:46 -05:00
explain.c Include planning time in EXPLAIN ANALYZE output. 2014-01-29 16:09:15 -05:00
extension.c Prefer pg_any_to_server/pg_server_to_any over pg_do_encoding_conversion. 2014-02-23 16:59:05 -05:00
foreigncmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
functioncmds.c Prevent privilege escalation in explicit calls to PL validators. 2014-02-17 09:33:31 -05:00
indexcmds.c Avoid repeated name lookups during table and index DDL. 2014-02-17 09:33:31 -05:00
lockcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
Makefile Add a materialized view relations. 2013-03-03 18:23:31 -06:00
matview.c Avoid getting more than AccessShareLock when deparsing a query. 2014-03-06 19:31:05 -05:00
opclasscmds.c Make DROP IF EXISTS more consistently not fail 2014-01-23 14:40:29 -03:00
operatorcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
portalcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
prepare.c Include planning time in EXPLAIN ANALYZE output. 2014-01-29 16:09:15 -05:00
proclang.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
schemacmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
seclabel.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
sequence.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
tablecmds.c C comments: improve description of relfilenode uniqueness 2014-03-08 12:20:30 -05:00
tablespace.c Fix unsafe references to errno within error messaging logic. 2014-01-29 20:04:43 -05:00
trigger.c Avoid repeated name lookups during table and index DDL. 2014-02-17 09:33:31 -05:00
tsearchcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
typecmds.c Make DROP IF EXISTS more consistently not fail 2014-01-23 14:40:29 -03:00
user.c Shore up ADMIN OPTION restrictions. 2014-02-17 09:33:31 -05:00
vacuum.c Introduce logical decoding. 2014-03-03 16:32:18 -05:00
vacuumlazy.c Introduce logical decoding. 2014-03-03 16:32:18 -05:00
variable.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
view.c Update copyright for 2014 2014-01-07 16:05:30 -05:00