Fix race condition in multixact code: it's possible to try to read a

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 1986ca5ce5031b27a0e35ea0ab7d7c2f479e2afc
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2005-10-28T17:27:29Z
Releases: 8.1.0
Fix race condition in multixact code: it's possible to try to read a
multixact's starting offset before the offset has been stored into the
SLRU file.  A simple fix would be to hold the MultiXactGenLock until the
offset has been stored, but that looks like a big concurrency hit.  Instead
rely on knowledge that unset offsets will be zero, and loop when we see
a zero.  This requires a little extra hacking to ensure that zero is never
a valid value for the offset.  Problem reported by Matteo Beccati, fix
ideas from Martijn van Oosterhout, Alvaro Herrera, and Tom Lane.

Files

PathChange+/−
src/backend/access/transam/multixact.c modified +110 −35