pgsql: Reset pg_stat_activity.xact_start during PREPARE TRANSACTION.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Reset pg_stat_activity.xact_start during PREPARE TRANSACTION.
Date: 2014-04-24 17:30:44
Message-ID: E1WdNTw-0004eU-Se@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Reset pg_stat_activity.xact_start during PREPARE TRANSACTION.

Once we've completed a PREPARE, our session is not running a transaction,
so its entry in pg_stat_activity should show xact_start as null, rather
than leaving the value as the start time of the now-prepared transaction.

I think possibly this oversight was triggered by faulty extrapolation
from the adjacent comment that says PrepareTransaction should not call
AtEOXact_PgStat, so tweak the wording of that comment.

Noted by Andres Freund while considering bug #10123 from Maxim Boguk,
although this error doesn't seem to explain that report.

Back-patch to all active branches.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/b7a3e1173991a147a43dcd3f67b98be051153b4b

Modified Files
--------------
src/backend/access/transam/xact.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2014-04-24 19:18:51 pgsql: Fix race when updating a tuple concurrently locked by another pr
Previous Message Magnus Hagander 2014-04-24 07:31:57 pgsql: Properly build pg_recvlogical in the msvc build system