mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
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.
This commit is contained in:
parent
b2c9b161b8
commit
d19bd29f07
@ -2280,8 +2280,9 @@ PrepareTransaction(void)
|
|||||||
AtEOXact_Files();
|
AtEOXact_Files();
|
||||||
AtEOXact_ComboCid();
|
AtEOXact_ComboCid();
|
||||||
AtEOXact_HashTables(true);
|
AtEOXact_HashTables(true);
|
||||||
/* don't call AtEOXact_PgStat here */
|
/* don't call AtEOXact_PgStat here; we fixed pgstat state above */
|
||||||
AtEOXact_Snapshot(true);
|
AtEOXact_Snapshot(true);
|
||||||
|
pgstat_report_xact_timestamp(0);
|
||||||
|
|
||||||
CurrentResourceOwner = NULL;
|
CurrentResourceOwner = NULL;
|
||||||
ResourceOwnerDelete(TopTransactionResourceOwner);
|
ResourceOwnerDelete(TopTransactionResourceOwner);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user