Re: Race condition in TransactionIdIsInProgress
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Andres Freund <andres@anarazel.de>
Cc: Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>,
Simon Riggs <simon.riggs@enterprisedb.com>,
Konstantin Knizhnik <knizhnik@garret.ru>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2022-06-25T09:18:51Z
Lists: pgsql-hackers
Attachments
- 0001-Fix-visibility-check-when-XID-is-committed-in-CLOG-b.patch (text/x-patch) patch 0001
On 24/06/2022 04:43, Andres Freund wrote: > On 2022-06-23 22:03:27 +0300, Heikki Linnakangas wrote: >> In summary, I think we should: >> - commit and backpatch Simon's >> just_remove_TransactionIdIsKnownCompleted_call.v1.patch >> - fix pg_xact_status() to check TransactionIdIsInProgress() >> - in v15, remove TransationIdIsKnownCompleted function altogether >> >> I'll try to get around to that in the next few days, unless someone beats me >> to it. > > Makes sense. This is what I came up with for master. One difference from Simon's original patch is that I decided to not expose the TransactionIdIsKnownNotInProgress(), as there are no other callers of it in core, and it doesn't seem useful to extensions. I inlined it into the caller instead. BTW, should we worry about XID wraparound with the cache? Could you have a backend sit idle for 2^32 transactions, without making any TransactionIdIsKnownNotInProgress() calls? That's not new with this patch, though, it could happen with the single-item cache in transam.c, too. - Heikki
Commits
-
Fix visibility check when XID is committed in CLOG but not in procarray.
- 4822b4627261 10.22 landed
- b49889f3c0fa 11.17 landed
- af530898ebc8 12.12 landed
- 7ba325fd7fd4 13.8 landed
- e24615a0057a 14.5 landed
- adf6d5dfb209 15.0 landed
-
Fix possible HOT corruption when RECENTLY_DEAD changes to DEAD while pruning.
- 18b87b201f73 15.0 cited
-
Make TransactionIdIsInProgress check transam.c's single-item XID status cache
- 611b4393f22f 8.4.0 cited