Re: toast table corrupted by vacuum - missing chunk number 0 for toast value - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: toast table corrupted by vacuum - missing chunk number 0 for toast value
Date
Msg-id CAFj8pRD1Y_HjSpxQe9_fx0nHH2vPL0Ld0yPabyp4jXeWnT06bg@mail.gmail.com
Whole thread
In response to Re: toast table corrupted by vacuum - missing chunk number 0 for toast value  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers


ne 23. 8. 2026 v 1:59 odesílatel Peter Geoghegan <pg@bowt.ie> napsal:
On Sat, Aug 22, 2026 at 10:25 AM Pavel Stehule <pavel.stehule@gmail.com> wrote:
> Unfortunately these backups was overwritten month ago

I thought that your complaint might be related to a recently reported
issue with subxact corruption:

https://postgr.es/m/447185db-3f06-4a38-8518-ecbd42d8b7d5@gmail.com

That case involves a subtransaction that has already subcommitted
being forced to abort. This reminded me of what Tomas said about it
being weird that the TOAST table's entry appears to be for a
committing transaction, yet other evidence suggests that the same XID
aborted.

I asked Opus 5 to build a test case (based on one from Andrey Borodin
on that other thread) that produces symptoms consistent with Pavel's
report. It succeeded in doing so -- see the attached patch adding
these tests.

These tests fail, demonstrating the same symptoms (you might have to
comment-out an assertion in clog.c to allow the script to get as far
as executing the pageinspect steps that show those specific details).
With Bryan Green's bug fix patch from the other thread applied, the
tests all pass.

Of course, I'm not claiming that this is incontrovertible proof that
Pavel's case was an example of this bug causing corruption in the
field; other bugs have had similar symptoms. For example, the snapshot
export bug I'm working on [1] can make committed subxacts temporarily
appear to have aborted, albeit on a standby (that one doesn't fit
Pavel's reported symptoms but isn't too far off). I still think this
explanation has a decent chance of being the correct one.

With that said, Pavel should look at this test case and try to find
any factor that might rule this explanation out. It would be worth
working out which ERROR actually happened. We simulate an OOM or other
error using the test's subxact-after-childxids-transfer injection
point; we don't know what ERROR actually occurred in the field (if we
assume this really was the bug involved, then some specific error must
have triggered it).

Question for Pavel: When I run the failing test, I see "WARNING:
AbortSubTransaction while in COMMIT state" in the test server logs. Do
any of the logs that you collected show that? If they do, then this
diagnosis is almost certainly correct.

I'll ask the customer - now he it out of office, but I afraid so logs from this time are already thrown

but I remember so on same server we found a vaccum errors "cannot to freeze commtted xmax" - I don't know if this is related to this bug, but it was few weeks after problem with broken TOAST

regards

Pavel



Regards

Pavel
 

[1] https://postgr.es/m/CAH2-WzmHVeYY=pjz9x8DhhxVjXHX0pvoQ-MdiB1Tt6=o2GTiKg@mail.gmail.com
--
Peter Geoghegan

pgsql-hackers by date:

Previous
From: "chee.wooson"
Date:
Subject: Re: [PATCH v5] Fix exported snapshot xmin handoff race
Next
From: Pavel Stehule
Date:
Subject: Re: missing possibility to use alternative translated month names in to_char function