pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before ep 3+ messages / 1 participants [nested] [flat]
* pgsql: amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before ep @ 2023-03-11 22:55 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 3+ messages in thread From: Andres Freund @ 2023-03-11 22:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before epoch 0 64bit xids can't represent xids before epoch 0 (see also be504a3e974). When FullTransactionIdFromXidAndCtx() was passed such an xid, it'd create a 64bit xid far into the future. Noticed while adding assertions in the course of investigating be504a3e974, as amcheck's test create such xids. To fix the issue, just return FirstNormalFullTransactionId in this case. A freshly initdb'd cluster already has a newer horizon. The most minimal version of this would make the messages for some detected corruptions differently inaccurate. To make those cases accurate, switch FullTransactionIdFromXidAndCtx() to use the 32bit modulo difference between xid and nextxid to compute the 64bit xid, yielding sensible "in the future" / "in the past" answers. Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com> Discussion: https://postgr.es/m/20230108002923.cyoser3ttmt63bfn@awork3.anarazel.de Backpatch: 14-, where heapam verification was introduced Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/4f5d461e048b9c56fe2fa8c7faf7010eed05ba82 Modified Files -------------- contrib/amcheck/verify_heapam.c | 33 ++++++++++++++++++++++++++----- src/bin/pg_amcheck/t/004_verify_heapam.pl | 28 ++++++++++++++++++-------- 2 files changed, 48 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before ep @ 2023-03-11 22:55 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 3+ messages in thread From: Andres Freund @ 2023-03-11 22:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before epoch 0 64bit xids can't represent xids before epoch 0 (see also be504a3e974). When FullTransactionIdFromXidAndCtx() was passed such an xid, it'd create a 64bit xid far into the future. Noticed while adding assertions in the course of investigating be504a3e974, as amcheck's test create such xids. To fix the issue, just return FirstNormalFullTransactionId in this case. A freshly initdb'd cluster already has a newer horizon. The most minimal version of this would make the messages for some detected corruptions differently inaccurate. To make those cases accurate, switch FullTransactionIdFromXidAndCtx() to use the 32bit modulo difference between xid and nextxid to compute the 64bit xid, yielding sensible "in the future" / "in the past" answers. Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com> Discussion: https://postgr.es/m/20230108002923.cyoser3ttmt63bfn@awork3.anarazel.de Backpatch: 14-, where heapam verification was introduced Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e8a9750d03d70de4ecd5aee37971498d90aabca5 Modified Files -------------- contrib/amcheck/verify_heapam.c | 33 ++++++++++++++++++++++++++----- src/bin/pg_amcheck/t/004_verify_heapam.pl | 28 ++++++++++++++++++-------- 2 files changed, 48 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before ep @ 2023-03-11 22:55 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 3+ messages in thread From: Andres Freund @ 2023-03-11 22:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before epoch 0 64bit xids can't represent xids before epoch 0 (see also be504a3e974). When FullTransactionIdFromXidAndCtx() was passed such an xid, it'd create a 64bit xid far into the future. Noticed while adding assertions in the course of investigating be504a3e974, as amcheck's test create such xids. To fix the issue, just return FirstNormalFullTransactionId in this case. A freshly initdb'd cluster already has a newer horizon. The most minimal version of this would make the messages for some detected corruptions differently inaccurate. To make those cases accurate, switch FullTransactionIdFromXidAndCtx() to use the 32bit modulo difference between xid and nextxid to compute the 64bit xid, yielding sensible "in the future" / "in the past" answers. Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com> Discussion: https://postgr.es/m/20230108002923.cyoser3ttmt63bfn@awork3.anarazel.de Backpatch: 14-, where heapam verification was introduced Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b3a83055c23526787701cd93e76a6df4f5a85920 Modified Files -------------- contrib/amcheck/verify_heapam.c | 33 ++++++++++++++++++++++++++----- src/bin/pg_amcheck/t/004_verify_heapam.pl | 30 +++++++++++++++++++--------- 2 files changed, 49 insertions(+), 14 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2023-03-11 22:55 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-03-11 22:55 pgsql: amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before ep Andres Freund <andres@anarazel.de> 2023-03-11 22:55 pgsql: amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before ep Andres Freund <andres@anarazel.de> 2023-03-11 22:55 pgsql: amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before ep Andres Freund <andres@anarazel.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox