aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2024-03-14 13:08:53 +0200
committerAlexander Korotkov <akorotkov@postgresql.org>2024-03-14 13:12:05 +0200
commite85662df44ff47acdf5d2d413339445d60a9c30c (patch)
tree4bb7568145ead39658fd113921e2ca01775601e3 /src/backend/tcop/postgres.c
parentcc6e64afda530576d83e331365d36c758495a7cd (diff)
downloadpostgresql-e85662df44ff47acdf5d2d413339445d60a9c30c.tar.gz
postgresql-e85662df44ff47acdf5d2d413339445d60a9c30c.zip
Fix false reports in pg_visibility
Currently, pg_visibility computes its xid horizon using the GetOldestNonRemovableTransactionId(). The problem is that this horizon can sometimes go backward. That can lead to reporting false errors. In order to fix that, this commit implements a new function GetStrictOldestNonRemovableTransactionId(). This function computes the xid horizon, which would be guaranteed to be newer or equal to any xid horizon computed before. We have to do the following to achieve this. 1. Ignore processes xmin's, because they consider connection to other databases that were ignored before. 2. Ignore KnownAssignedXids, because they are not database-aware. At the same time, the primary could compute its horizons database-aware. 3. Ignore walsender xmin, because it could go backward if some replication connections don't use replication slots. As a result, we're using only currently running xids to compute the horizon. Surely these would significantly sacrifice accuracy. But we have to do so to avoid reporting false errors. Inspired by earlier patch by Daniel Shelepanov and the following discussion with Robert Haas and Tom Lane. Discussion: https://postgr.es/m/1649062270.289865713%40f403.i.mail.ru Reviewed-by: Alexander Lakhin, Dmitry Koval
Diffstat (limited to 'src/backend/tcop/postgres.c')
0 files changed, 0 insertions, 0 deletions