Re: BUG: Postgres 14 + vacuum_defer_cleanup_age + FOR UPDATE + UPDATE
Alexander Law <exclusion@gmail.com>
From: Alexander Lakhin <exclusion@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>,
Andrey Borodin <amborodin86@gmail.com>,
Michail Nikolaev <michail.nikolaev@gmail.com>,
Thomas Munro <thomas.munro@gmail.com>,
Matthias van de Meent <boekewurm+postgres@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
Jakub Wartak <jakub.wartak@enterprisedb.com>,
Mark Dilger <mark.dilger@enterprisedb.com>
Date: 2024-07-05T10:00:01Z
Lists: pgsql-hackers
Hello Andres,
12.03.2023 02:41, Andres Freund wrote:
> CI now finished the tests as well:
> https://cirrus-ci.com/build/6675457702100992
>
> So I'll go ahead and push that.
As I mentioned at [1], `meson test` fails on Windows x86 platform during
the test pg_amcheck/004_verify_heapam (I'm using VS 2022 Version 17.9.7):
meson setup build --wipe -Dcassert=true
cd build & ninja & meson test
... postgresql:pg_amcheck / pg_amcheck/004_verify_heapam ERROR 6.95s exit status 25
004_verify_heapam_test.log contains:
TRAP: failed Assert("FullTransactionIdIsNormal(fxid)"), File: "../contrib/amcheck/verify_heapam.c", Line: 1915, PID: 2560
2024-07-04 20:56:54.592 PDT [9780] LOG: server process (PID 2560) was terminated by exception 0xC0000409
2024-07-04 20:56:54.592 PDT [9780] DETAIL: Failed process was running: SELECT v.blkno, v.offnum, v.attnum, v.msg FROM
pg_catalog.pg_class c, "public".verify_heapam(
relation := c.oid, on_error_stop := false, check_toast := true, skip := 'none'
) v WHERE c.oid = 16438 AND c.relpersistence != 't'
`git bisect` for this anomaly pointed at 4f5d461e0.
(I couldn't compile Postgres on that commit, but with
`git show 53ea2b7ad | git apply` (see also [2]) it's possible.)
The Assert in question is:
else
fxid = FullTransactionIdFromU64(nextfxid_i - diff);
Assert(FullTransactionIdIsNormal(fxid));
It was not clear to me how it comes out that fxid is not normal, until I
looked at the disassembly:
else
fxid = FullTransactionIdFromU64(nextfxid_i - diff);
751812D2 sub ebx,eax
751812D4 sbb edi,edx
Assert(FullTransactionIdIsNormal(fxid));
751812D6 jne FullTransactionIdFromXidAndCtx+0E6h (751812F6h)
751812D8 jb FullTransactionIdFromXidAndCtx+0CFh (751812DFh)
751812DA cmp ebx,3
751812DD jae FullTransactionIdFromXidAndCtx+0E6h (751812F6h)
751812DF push 77Bh
751812E4 push offset string "../contrib/amcheck/verify_heapa@"... (7518C4A4h)
751812E9 push offset string "FullTransactionIdIsNormal(fxid)" (7518DB04h)
751812EE call _ExceptionalCondition (75189FFEh)
The same code fragment for your convenience:
https://ideone.com/8wiGRY
Could you please look at this?
[1] https://www.postgresql.org/message-id/72705e42-42d1-ac6e-e7d5-4baec8a0d2af%40gmail.com
[2] https://postgr.es/m/17967-cd21e34a314141b2@postgresql.org
Best regards,
Alexander
Commits
-
Fix incorrect TAP test ordering
- 92155e15d3cf 16.0 landed
-
pg_amcheck: Minor test speedups
- a4f23f9b3cdd 16.0 landed
-
amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before epoch 0
- b3a83055c235 14.8 landed
- e8a9750d03d7 15.3 landed
- 4f5d461e048b 16.0 landed
-
amcheck: Fix ordering bug in update_cached_xid_range()
- a42f515d6b45 14.8 landed
- 6d9588108a56 15.3 landed
- 16327240da29 16.0 landed
-
Fix corruption due to vacuum_defer_cleanup_age underflowing 64bit xids
- be504a3e974d 16.0 landed
- 3c92f7e9d851 12.15 landed
- e6d77f22c7a8 13.11 landed
- 324281fd5b1b 14.8 landed
- 391f08fd6804 15.3 landed
-
Add hardening to catch invalid TIDs in indexes.
- e7428a99a13f 15.0 cited
-
Use full 64-bit XID for checking if a deleted GiST page is old enough.
- 6655a7299d83 13.0 cited
-
Avoid early reuse of btree pages, causing incorrect query results.
- d3abbbebe52e 9.2.0 cited