forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8e9a16a
committed
Rework tuple freezing protocol
Tuple freezing was broken in connection to MultiXactIds; commit8e53ae0 tried to fix it, but didn't go far enough. As noted byNoah Misch, freezing a tuple whose Xmax is a multi containing an abortedupdate might cause locks in the multi to go ignored by latertransactions. This is because the code depended on a multixact abovetheir cutoff point not having any lock-only member older than the cutoffpoint for Xids, which is easily defeated in READ COMMITTED transactions.The fix for this involves creating a new MultiXactId when necessary.But this cannot be done during WAL replay, and moreover multixactexamination requires using CLOG access routines which are not supposedto be used during WAL replay either; so tuple freezing cannot be donewith the old freeze WAL record. Therefore, separate the freezingcomputation from its execution, and change the WAL record to carry allnecessary information. At WAL replay time, it's easy to re-executefreezing because we don't need to re-compute the new infomask/Xmaxvalues but just take them from the WAL record.While at it, restructure the coding to ensure all page changes occur ina single critical section without much room for failures. The previouscoding wasn't using a critical section, without any explanation as towhy this was acceptable.In replication scenarios using the 9.3 branch, standby servers must beupgraded before their master, so that they are prepared to deal with thenew WAL record once the master is upgraded; failure to do so will causeWAL replay to die with a PANIC message. Later upgrade of the standbywill allow the process to continue where it left off, so there's nodisruption of the data in the standby in any case. Standbys know how todeal with the old WAL record, so it's okay to keep the master runningthe old code for a while.In master, the old freeze WAL record is gone, for cleanliness' sake;there's no compatibility concern there.Backpatch to 9.3, where the original bug was introduced and where theprevious fix was backpatched.Álvaro Herrera and Andres Freund1 parent8122e6f commit8e9a16a
File tree
6 files changed
+682
-156
lines changed- src
- backend
- access
- heap
- rmgrdesc
- transam
- commands
- include/access
6 files changed
+682
-156
lines changed0 commit comments
Comments
(0)