Content-Length: 254274 | pFad | http://github.com/postgres/postgres/commit/82fbd88a7b0d7f31be524a9ca3f195f06940349a

97 Reset pg_stat_activity.xact_start during PREPARE TRANSACTION. · postgres/postgres@82fbd88 · GitHub
Skip to content

Commit 82fbd88

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 2d06f61 commit 82fbd88

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
@@ -1963,8 +1963,9 @@ PrepareTransaction(void)
19631963
AtEOXact_Files();
19641964
AtEOXact_ComboCid();
19651965
AtEOXact_HashTables(true);
1966-
/* don't call AtEOXact_PgStat here */
1966+
/* don't call AtEOXact_PgStat here; we fixed pgstat state above */
19671967
AtEOXact_Snapshot(true);
1968+
pgstat_report_xact_timestamp(0);
19681969

19691970
CurrentResourceOwner = NULL;
19701971
ResourceOwnerDelete(TopTransactionResourceOwner);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgres/postgres/commit/82fbd88a7b0d7f31be524a9ca3f195f06940349a

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy