Fix bug in SetOffsetVacuumLimit() triggered by find_multixact_start() failure.
authorAndres Freund <andres@anarazel.de>
Mon, 14 Dec 2015 10:34:16 +0000 (11:34 +0100)
committerAndres Freund <andres@anarazel.de>
Mon, 14 Dec 2015 10:34:50 +0000 (11:34 +0100)
commitccde00b9b97ed8b7307e39f95bd48922bf955bb2
tree1222e0dc24497adb33f8bbf9cb71f45e355215ab
parentcb89644bb0df1921c6a15aa294903a9458c2a67d
Fix bug in SetOffsetVacuumLimit() triggered by find_multixact_start() failure.

Previously, if find_multixact_start() failed, SetOffsetVacuumLimit() would
install 0 into MultiXactState->offsetStopLimit if it previously succeeded.
Luckily, there are no known cases where find_multixact_start() will return
an error in 9.5 and above. But if it were to happen, for example due to
filesystem permission issues, it'd be somewhat bad: GetNewMultiXactId()
could continue allocating mxids even if close to a wraparound, or it could
erroneously stop allocating mxids, even if no wraparound is looming.  The
wrong value would be corrected the next time SetOffsetVacuumLimit() is
called, or by a restart.

Reported-By: Noah Misch, although this is not his preferred fix
Discussion: 20151210140450.GA22278@alap3.anarazel.de
Backpatch: 9.5, where the bug was introduced as part of 4f627f
src/backend/access/transam/multixact.c