| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: pgsql: Set HEAP_XMAX_INVALID for tuples updated by aborted subtransacti |
| Date: | 2026-10-28 19:32:44 |
| Message-ID: | CA+TgmoZrp4YX++=ifqBgpw6=KOsprd6+-gSQk87Je510D98KWw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers pgsql-hackers |
On Sun, Oct 25, 2026 at 8:56 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> Set HEAP_XMAX_INVALID for tuples updated by aborted subtransaction
>
> HeapTupleSatisfiesVacuumHorizon() did not set HEAP_XMAX_INVALID on a
> tuple inserted, then updated by a subtransaction that rolled back.
> rewriteheap.c relies on this hint to tell if such tuples should be
> treated as updated and would drop them, causing rewrites to lose some
> tuples.
>
> HeapTupleSatisfiesVacuumHorizon() is updated to set the hint
> HEAP_XMAX_INVALID, so as heap AM is able to redirect such a tuple to its
> correct route, and does not lose it.
Uggh. I think that this is the right fix given that
rewrite_heap_tuple() is documented to rely on hint bits being set for
correctness, but it seems to me to be pretty questionable that we rely
on hint bits being set for correctness. It's not going to be obvious
to someone modifying HeapTupleSatisfiesVacuum() or
HeapTupleSatisfiesVacuumHorizon() that rewrite_heap_tuple() critically
depends on that, and even if we added a comment about that, somebody
reading that comment might justifiably complain about our decision to
create such a dependency.
--
Robert Haas
Databricks
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2026-10-28 19:33:03 | pgsql: pg_plan_advice: Fix multiple problems with NO_GATHER advice. |
| Previous Message | Fujii Masao | 2026-10-28 08:03:35 | pgsql: Remove the redundant interface list and fix function headings in |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Salma Elsayed | 2026-10-28 20:17:37 | Re: PoC: Simplify recovery after dropping a table by LOGGING the restore LSN |
| Previous Message | Sami Imseih | 2026-10-28 18:35:47 | Re: [PATCH] pgstat: Add helper to drop entries from a stats kind's hash |