Fix GetStrictOldestNonRemovableTransactionId() on standby
authorAlexander Korotkov <akorotkov@postgresql.org>
Thu, 15 Aug 2024 21:17:59 +0000 (00:17 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Thu, 15 Aug 2024 21:18:55 +0000 (00:18 +0300)
commite2ed7e32271a82179c3f8c7c93ce52ff93c6dd3c
tree7b6510b0cc499522b32d1401701ed18cb02c198e
parent9e9a2b7031f64e49fcaf28f21a4e70eb1212165f
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
contrib/pg_visibility/pg_visibility.c
contrib/pg_visibility/t/001_concurrent_transaction.pl