| From: | surya poondla <suryapoondla4(at)gmail(dot)com> |
|---|---|
| To: | "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com> |
| Subject: | Re: Compression of bigger WAL records |
| Date: | 2026-08-17 22:33:53 |
| Message-ID: | CAOVWO5q5mWyGjLABCiKRa1LaGq95OiV0ShXmDnFyUT6Rjjgb7A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Andrey,
Thank you for the patch.
I like the idea of compacting the WAL, but I think there's a problem in the
current v1 design with not advancing the page LSN.
FlushBuffer() implements the WAL-before-data rule entirely through the page
LSN:
recptr = BufferGetLSN(buf);
...
if (pg_atomic_read_u64(&buf->state) & BM_PERMANENT)
XLogFlush(recptr);
/* "Force XLOG flush up to buffer's LSN. This implements the basic
WAL rule that log updates must hit disk before any of the
data-file changes they describe do." */
The mechanism today is that a page's permanent LSN is always at least the
LSN of some WAL record that references that block in the current
checkpoint cycle.
The v1 patch breaks this for hint-only changes. The compact record goes in
at LSN L, but the page LSN stays at whatever it was, let's call it L0, from
an
earlier checkpoint cycle, so XLogFlush(L0) is a no-op and the page can be
written while record L is still sitting in wal_buffers.
Because the page LSN is left alone, nothing ties record L to the page it
describes.
If the page is written first and the crash comes before L is flushed, the
hint bits end up present on the page while WAL holds no
record of them, and recovery has nothing to replay, so the page carries a
change that WAL never recorded.
So, I think the record needs the PageSetLSN().
Regards,
Surya Poondla
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-08-17 22:50:27 | Re: pg_stat_database.checksum_failures misses single-page failures in backups |
| Previous Message | Daniel Gustafsson | 2026-08-17 22:27:30 | Re: Clarify or fix SIGINT handling in data checksums launcher |