pgsql: Fix off-by-one error in txid_status().

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix off-by-one error in txid_status().
Date: 2019-03-27 08:47:49
Message-ID: E1h94Dt-0000Ij-A2@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix off-by-one error in txid_status().

The transaction ID returned by GetNextXidAndEpoch() is in the future,
so we can't attempt to access its status or we might try to read a
CLOG page that doesn't exist. The > vs >= confusion probably stemmed
from the choice of a variable name containing the word "last" instead
of "next", so fix that too.

Back-patch to 10 where the function arrived.

Author: Thomas Munro
Discussion: https://postgr.es/m/CA%2BhUKG%2Buua_BV5cyfsioKVN2d61Lukg28ECsWTXKvh%3DBtN2DPA%40mail.gmail.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/26d4fda37ea10d146e9d35fca70f817a0bfe300c

Modified Files
--------------
src/backend/utils/adt/txid.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2019-03-27 08:48:05 pgsql: Fix off-by-one error in txid_status().
Previous Message Thomas Munro 2019-03-27 08:47:20 pgsql: Fix off-by-one error in txid_status().