Thread: pgsql: Fix GetStrictOldestNonRemovableTransactionId() on standby

pgsql: Fix GetStrictOldestNonRemovableTransactionId() on standby

From
Alexander Korotkov
Date:
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(-)


Re: pgsql: Fix GetStrictOldestNonRemovableTransactionId() on standby

From
Alexander Korotkov
Date:
On Fri, Aug 16, 2024 at 12:19 AM Alexander Korotkov
<akorotkov@postgresql.org> wrote:
>
> 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.

I see the buildfarm failures.  I will try to fix them shortly.

------
Regards,
Alexander Korotkov
Supabase