Re: HOT chain validation in verify_heapam()
Aleksander Alekseev <aleksander@timescale.com>
From: Aleksander Alekseev <aleksander@timescale.com>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Cc: Himanshu Upadhyaya <upadhyaya.himanshu@gmail.com>,
Robert Haas <robertmhaas@gmail.com>
Date: 2022-09-19T14:57:36Z
Lists: pgsql-hackers
Attachments
- v4-0001-Implement-HOT-chain-validation-in-verify_heapam.patch (application/octet-stream) patch v4-0001
Hi Himanshu,
> Done, updated in the v3 patch.
Thanks for the updated patch.
Here is v4 with fixed compiler warnings and some minor tweaks from me.
I didn't put too much thought into the algorithm but I already see
something strange. At verify_heapam.c:553 you declared curr_xmax and
next_xmin. However the variables are not used/initialized until you
do:
```
if (lp_valid[nextoffnum] && lp_valid[ctx.offnum] &&
TransactionIdIsValid(curr_xmax) &&
TransactionIdEquals(curr_xmax, next_xmin)) {
/* ... */
```
In v4 I elected to initialize both curr_xmax and next_xmin with
InvalidTransactionId for safety and in order to silence the compiler
but still there is no way this condition can succeed.
Please make sure there is no logic missing.
--
Best regards,
Aleksander Alekseev
Commits
-
amcheck: Generalize one of the recently-added update chain checks.
- c87aff065c33 16.0 landed
-
amcheck: Tighten up validation of redirect line pointers.
- 80d5e3a61551 16.0 landed
-
amcheck: Fix verify_heapam for tuples where xmin or xmax is 0.
- 8fd5aa76c367 14.8 landed
- 701ec5557968 15.3 landed
- e88754a1965c 16.0 landed
-
amcheck: Fix a few bugs in new update chain validation.
- 949e2e7c4f68 16.0 landed
-
Fix new test case to work on (some?) big-endian architectures.
- c75a623304bc 16.0 landed
-
Don't test HEAP_XMAX_INVALID when freezing xmax.
- 02d647bbf057 16.0 landed