Thread: pgsql: Fix off-by-one error in calculating subtrans/multixact truncatio

pgsql: Fix off-by-one error in calculating subtrans/multixact truncatio

From
Heikki Linnakangas
Date:
Fix off-by-one error in calculating subtrans/multixact truncation point.

If there were no subtransactions (or multixacts) active, we would calculate
the oldestxid == next xid. That's correct, but if next XID happens to be
on the next pg_subtrans (pg_multixact) page, the page does not exist yet,
and SimpleLruTruncate will produce an "apparent wraparound" warning. The
warning is harmless in this case, but looks very alarming to users.

Backpatch to all supported versions. Patch and analysis by Thomas Munro.

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/a9b3a22aa18345451a20696fe272b6e02f5a2bbb

Modified Files
--------------
src/backend/access/transam/multixact.c |   13 ++++++++++---
src/backend/access/transam/subtrans.c  |    7 ++++++-
2 files changed, 16 insertions(+), 4 deletions(-)