Re: UNDO with FILEOPS, and the FLUX table AM

From: Manu <manuelreyesbravo(at)gmail(dot)com>
To: Greg Burd <greg(at)burd(dot)me>
Cc: shihao zhong <zhong950419(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Hannu Krosing <hannuk(at)google(dot)com>
Subject: Re: UNDO with FILEOPS, and the FLUX table AM
Date: 2026-11-16 00:34:35
Message-ID: 179478927526.529955.9686015828954869807@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Greg,

The four fixes hold: your tests pass and each fails when I revert its
fix. Two cases outside the window you document still end with files
that differ from what the committed transactions imply; the attached
oracle runs 186 scenarios.

On Wed, Nov 11, 2026 at 1:09 PM Greg Burd <greg(at)burd(dot)me> wrote:
> The abort record carries the transaction's FILEOPS inverses, and abort
> redo applies them, so a standby, and the primary after a crash, end up
> with the files the primary had after ROLLBACK

Not for a crash loser: the primary's startup undo phase removes its
files, but a crash writes no abort record, so a streaming standby keeps
them until it is promoted. I see it for create, mkdir, link, rename and
write, and on v9 for the two I tried there. After a link, if another
transaction then creates that name, the standby's source file ends up
with that transaction's bytes.

FileOpsCreate() opens without O_EXCL and writes the create UNDO even if
the file existed, so a rollback unlinks a committed file, on the
primary, the standby and after a crash. No in-core caller does that;
the first diff makes it an ERROR, as FileOpsMkdir() already does.

The hold-off in InsertXactUndoData() and ROLLBACK PREPARED keeping
DELAY_CHKPT_START have no test that fails without them. The second
diff adds one for each (the hold-off one drives gdb, so take it as a
repro rather than a test for the tree), the crash-loser repro, and a
copy of 024 with three failures.

> Perhaps I should separate them into a 4th patch to make that explicit.

In 0001 the subtransaction and 2PC functions are about 140 of the 1,626
lines gcov counts; at most 58 lines run only under the tests using them.

Manu

Attachment Content-Type Size
nocfbot-fileops-create-excl-on-v10.diff.txt text/plain 4.4 KB
nocfbot-fileops-tests-on-v10.diff.txt text/plain 12.4 KB
fileops-oracle-on-v10.txt text/plain 17.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Fujii Masao 2026-11-16 00:33:06 Re: psql: Don't offer USING INDEX after REPACK (CONCURRENTLY) or (ANALYZE)