pgsql: Fix GetStrictOldestNonRemovableTransactionId() on standby

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix GetStrictOldestNonRemovableTransactionId() on standby
Date: 2024-08-15 21:19:07
Message-ID: E1sehsB-004Kuu-6f@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix GetStrictOldestNonRemovableTransactionId() on standby

e85662df44 implemented GetStrictOldestNonRemovableTransactionId() function
for computation of xid horizon that avoid reporting of false errors.
However, GetStrictOldestNonRemovableTransactionId() uses
GetRunningTransactionData() even on standby leading to an assertion failure.

Given that we decided to ignore KnownAssignedXids and standby can't have
own running xids, we switch to use TransamVariables->nextXid as a xid horizon.

Also, revise the comment regarding ignoring KnownAssignedXids with more
detailed reasoning provided by Heikki.

Reported-by: Heikki Linnakangas
Discussion: https://postgr.es/m/42218c4f-2c8d-40a3-8743-4d34dd0e4cce%40iki.fi
Reviewed-by: Heikki Linnakangas

Branch
------
master

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

Modified Files
--------------
contrib/pg_visibility/pg_visibility.c | 26 +++++++++++++++++++---
.../pg_visibility/t/001_concurrent_transaction.pl | 19 ++++++++++++++--
2 files changed, 40 insertions(+), 5 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2024-08-15 21:51:48 Re: pgsql: Fix GetStrictOldestNonRemovableTransactionId() on standby
Previous Message Nathan Bossart 2024-08-15 21:01:59 Re: pgsql: Introduce hash_search_with_hash_value() function