Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick: Fix MVCC bug with prepared xact with subxacts on standby (v14) #449

Merged

Conversation

hlinnaka
Copy link
Contributor

See neondatabase/neon#8152 for the main PR in the neon repo

We did not recover the subtransaction IDs of prepared transactions
when starting a hot standby from a shutdown checkpoint. As a result,
such subtransactions were considered as aborted, rather than
in-progress. That would lead to hint bits being set incorrectly, and
the subtransactions suddenly becoming visible to old snapshots when
the prepared transaction was committed.

To fix, update pg_subtrans with prepared transactions's subxids when
starting hot standby from a shutdown checkpoint. The snapshots taken
from that state need to be marked as "suboverflowed", so that we also
check the pg_subtrans.

Discussion: https://www.postgresql.org/message-id/6b852e98-2d49-4ca1-9e95-db419a2696e0%40iki.fi

NEON: cherry-picked from the upstream thread ahead of time, to unblock
neondatabase/neon#7288. I expect this to be
committed to upstream in the next few days, superseding this. NOTE: I
did not include the new regression test on v15 and v14 branches,
because the test would need some adapting, and we don't run the perl
tests on Neon anyway.
@knizhnik knizhnik changed the base branch from REL_16_STABLE_neon to REL_14_STABLE_neon June 25, 2024 11:46
@hlinnaka hlinnaka merged commit 7845c12 into REL_14_STABLE_neon Jun 25, 2024
@hlinnaka hlinnaka deleted the cherry-pick-twophase-shutdown-visibility-fix-v14 branch June 25, 2024 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants