aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2020-08-16 14:21:37 -0700
committerAndres Freund <andres@anarazel.de>2020-08-16 14:21:37 -0700
commitf6661d3df228dbbf50efb04f2b760774a6f2bfff (patch)
treed676b30544bc4d4d8a62a6ba4f8a621763ba0d30
parent49967da65aec970fcda123acc681f1df5d70bfc6 (diff)
downloadpostgresql-f6661d3df228dbbf50efb04f2b760774a6f2bfff.tar.gz
postgresql-f6661d3df228dbbf50efb04f2b760774a6f2bfff.zip
Fix use of wrong index in ComputeXidHorizons().
This bug, recently introduced in 941697c3c1a, at least lead to vacuum failing because it found tuples inserted by a running transaction, but below the freeze limit. The freeze limit in turn is directly affected by the aforementioned bug. Thanks to Tom Lane figuring how to make the bug reproducible. We should add a few more assertions to make sure this type of bug isn't as hard to notice, but it's not yet clear how to best do so. Co-Diagnosed-By: Tom Lane <tgl@sss.pgh.pa.us> Author: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/1013484.1597609043@sss.pgh.pa.us
-rw-r--r--src/backend/storage/ipc/procarray.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 8262abd42e6..96e4a878576 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -1663,7 +1663,7 @@ ComputeXidHorizons(ComputeXidHorizonsResult *h)
TransactionId xmin;
/* Fetch xid just once - see GetNewTransactionId */
- xid = UINT32_ACCESS_ONCE(other_xids[pgprocno]);
+ xid = UINT32_ACCESS_ONCE(other_xids[index]);
xmin = UINT32_ACCESS_ONCE(proc->xmin);
/*