Re: BUG: Postgres 14 + vacuum_defer_cleanup_age + FOR UPDATE + UPDATE

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Andrey Borodin <amborodin86(at)gmail(dot)com>, Michail Nikolaev <michail(dot)nikolaev(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
Subject: Re: BUG: Postgres 14 + vacuum_defer_cleanup_age + FOR UPDATE + UPDATE
Date: 2024-07-05 10:00:01
Message-ID: 2b319458-63f4-1396-f23e-b8353acfa2aa@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2024-07-05 11:03:51 Re: Adding skip scan (including MDAM style range skip scan) to nbtree
Previous Message Hayato Kuroda (Fujitsu) 2024-07-05 09:51:22 RE: Parallel heap vacuum