aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonfuncs.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2023-03-11 14:12:51 -0800
committerAndres Freund <andres@anarazel.de>2023-03-11 14:17:51 -0800
commitb3a83055c23526787701cd93e76a6df4f5a85920 (patch)
treecf20964ee7e06eca183a2121216ba6b08de441c5 /src/backend/utils/adt/jsonfuncs.c
parenta42f515d6b45ea19b96fb2868d8acb77251d911d (diff)
downloadpostgresql-b3a83055c23526787701cd93e76a6df4f5a85920.tar.gz
postgresql-b3a83055c23526787701cd93e76a6df4f5a85920.zip
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
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
0 files changed, 0 insertions, 0 deletions