Skip to content

Commit d19bd29

Browse files
committed
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.
1 parent b2c9b16 commit d19bd29

File tree

1 file changed

+2
-1
lines changed
  • src/backend/access/transam

1 file changed

+2
-1
lines changed

src/backend/access/transam/xact.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2280,8 +2280,9 @@ PrepareTransaction(void)
22802280
AtEOXact_Files();
22812281
AtEOXact_ComboCid();
22822282
AtEOXact_HashTables(true);
2283-
/* don't call AtEOXact_PgStat here */
2283+
/* don't call AtEOXact_PgStat here; we fixed pgstat state above */
22842284
AtEOXact_Snapshot(true);
2285+
pgstat_report_xact_timestamp(0);
22852286

22862287
CurrentResourceOwner = NULL;
22872288
ResourceOwnerDelete(TopTransactionResourceOwner);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy