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

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix off-by-one error in calculating subtrans/multixact truncatio
Date: 2015-07-22 22:31:44
Message-ID: E1ZI2YC-0001xA-El@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/766dcfb16ca385274d510eaed01724bb3836efdd

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

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2015-07-23 07:19:42 Re: pgsql: This routine was calling ecpg_alloc to allocate to memory but di
Previous Message Tom Lane 2015-07-22 00:04:09 pgsql: Fix add_rte_to_flat_rtable() for recent feature additions.