| From: | Joao Rito <joaovictor(dot)rito(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | shihao zhong <zhong950419(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
| Subject: | Re: Checkpoints stuck after a failed bulk write inside a savepoint |
| Date: | 2026-11-16 11:39:17 |
| Message-ID: | 20261116113917.567-1-joaovictor.rito@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Shihao,
Thank you for the patch. I tested v1-0001 together with the test in
noncfbot-repro.patch. It worked for me. These are my results.
Setup: master at 5ffc82103773 (2026-11-16), Debian, gcc 14,
--enable-cassert --enable-injection-points --enable-tap-tests.
Without the fix, the test cannot run as posted, because
noncfbot-repro.patch places the injection point in the fixed code.
So I added the injection point by hand in master, just before
smgrregistersync(), inside the DELAY_CHKPT_START window. The test
then hangs: the CHECKPOINT after ROLLBACK TO SAVEPOINT does not
finish and the TAP timeout fires (about 62 seconds in my run).
This matches your description, but it is my own placement of the
injection point, not the one in your patch.
With v1-0001 and the test:
- t/016_bulk_write_savepoint.pl passes.
- The other 15 test_misc tests pass (257 tests in total).
- make check passes (243 tests).
On the idea: registering the sync request first and checking the
redo pointer after it looks right to me. It removes the flag, so
nothing can leak when an ERROR is caught by a savepoint.
A small remark. If the redo pointer did move, the request registered
earlier is redundant, as the new comment says. I assume that costs
at most one extra fsync in a checkpoint, but I did not measure it.
What I did not test:
- Real I/O failure (lseek or out of memory). I used only the
injection point.
- Concurrent checkpoints racing with smgr_bulk_finish(). I read the
new ordering but did not stress it.
- The backpatch to 17. I used master only.
- wal_level=minimal, meson build, other platforms.
- Crash recovery after the sequence.
- A proof that the new ordering never loses an fsync. I only read it.
- The Assert at COMMIT (xact.c): the test failed first in my red
run, so I did not see it.
Thanks again.
Best regards,
Joao Rito
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joao Rito | 2026-11-16 11:39:23 | Re: transaction_timeout is not enforced during ClientWrite |
| Previous Message | Greg Burd | 2026-11-16 11:30:12 | Re: Hash index: stop registering pin-only bucket pages in WAL (remove REGBUF_NO_CHANGE) |