]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix race condition in committing a serializable transaction
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 21 Oct 2024 06:49:21 +0000 (09:49 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 21 Oct 2024 06:49:32 +0000 (09:49 +0300)
commit22665f2106248793cfd8dd0a49fe3c5f7a4bfdfe
tree08319d627bc465b31fac0c419428ae63bce89953
parent1257fea164ee32798f271407974943e7ee23b848
Fix race condition in committing a serializable transaction

The finished transaction list can contain XIDs that are older than the
serializable global xmin. It's a short-lived state;
ClearOldPredicateLocks() removes any such transactions from the list,
and it's called whenever the global xmin advances. But if another
backend calls SummarizeOldestCommittedSxact() in that window, it will
call SerialAdd() on an XID that's older than the global xmin, or if
there are no more transactions running, when global xmin is
invalid. That trips the assertion in SerialAdd().

Fixes bug #18658 reported by Andrew Bille. Thanks to Alexander Lakhin
for analysis. Backpatch to all versions.

Discussion: https://www.postgresql.org/message-id/18658-7dab125ec688c70b%40postgresql.org
src/backend/storage/lmgr/predicate.c