pgsql: Fix wrong logic in TransactionIdInRecentPast() - Mailing list pgsql-committers

From Alexander Korotkov
Subject pgsql: Fix wrong logic in TransactionIdInRecentPast()
Date
Msg-id E1rYOY0-005NYx-PB@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix wrong logic in TransactionIdInRecentPast()

The TransactionIdInRecentPast() should return false for all the transactions
older than TransamVariables->oldestClogXid.  However, the function contains
a bug in comparison FullTransactionId to TransactionID allowing full
transactions between nextXid - 2^32 and oldestClogXid - 2^31.

This commit fixes TransactionIdInRecentPast() by turning the oldestClogXid into
FullTransactionId first, then performing the comparison.

Backpatch to all supported versions.

Reported-by: Egor Chindyaskin
Bug: 18212
Discussion: https://postgr.es/m/18212-547307f8adf57262%40postgresql.org
Author: Karina Litskevich
Reviewed-by: Kyotaro Horiguchi
Backpatch-through: 12

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d44060cfcc49d512da1ae9b1b846385748e46d04

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


pgsql-committers by date:

Previous
From: Alexander Korotkov
Date:
Subject: pgsql: Fix wrong logic in TransactionIdInRecentPast()
Next
From: Alexander Korotkov
Date:
Subject: pgsql: Fix usage of aggregate pathkeys in group_keys_reorder_by_pathkey