| From: | Greg Burd <greg(at)burd(dot)me> |
|---|---|
| To: | vignesh C <vignesh21(at)gmail(dot)com>, Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, shihao zhong <zhong950419(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Jeff Davis <pgsql(at)j-davis(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Hash index: stop registering pin-only bucket pages in WAL (remove REGBUF_NO_CHANGE) |
| Date: | 2026-11-12 13:25:38 |
| Message-ID: | avW8qXU-OcjYSO1G@werk |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello,
Thanks Vignesh for catching that, and the 068b test.
Also, thanks Hayato-san for the review and comments.
Agreed, InHotStandby becomes true as soon as the first
XLOG_RUNNING_XACTS is replayed, well before recovery reaches
consistency, so with hot_standby = on redo can still read the torn page
in that window. Thanks for the 068b reproducer.
v7 uses HotStandbyActiveInReplay() instead, as you suggested. That is
true only after recovery has reached consistency and the postmaster has
been told connections can start, so there is no scan to serialize
against before then, and by then any full-page image that repairs the
page has been replayed. I made HotStandbyActiveInReplay() extern for
this. 068b now passes, and so does 068a.
I folded your 068b into 0001 next to 068a, with one change: the primary
bucket page is found from blkref #0 or #1, since after 0002 the page is
registered as block 0 rather than 1 when it is the modified page, and
the test runs against the whole series as well as master.
I've applied both of Hayato-san's comments in 0002:
hash_xlog_lock_bucket() is renamed to hash_xlog_lock_primary_bucket(),
and the "block 0 is absent" comment now reads:
/*
* If the primary bucket page is modified, it is registered as block 0
* and read for redo. Otherwise, acquire its cleanup lock separately.
*/
v7:
0001 Fix hash index redo reading a torn primary bucket page
(now with 068a and 068b, and HotStandbyActiveInReplay)
0002 Don't register pin-only primary bucket pages in hash WAL records
(hash_xlog_lock_primary_bucket, carries the same guard)
0003 Add a recovery test for the hash WAL pin-only bucket page fix
0004 Remove REGBUF_NO_CHANGE
0001 stands on its own against master; the rest build on it.
best.
-greg
| Attachment | Content-Type | Size |
|---|---|---|
| v7-0002-Don-t-register-pin-only-primary-bucket-pages-in-h.patch | text/x-patch | 24.6 KB |
| v7-0003-Add-a-recovery-test-for-the-hash-WAL-pin-only-buc.patch | text/x-patch | 11.5 KB |
| v7-0001-Fix-hash-index-redo-reading-a-torn-primary-bucket.patch | text/x-patch | 19.9 KB |
| v7-0004-Remove-REGBUF_NO_CHANGE.patch | text/x-patch | 5.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2026-11-12 13:37:41 | Re: ISBN range table |
| Previous Message | vignesh C | 2026-11-12 13:23:07 | Re: Hash index: stop registering pin-only bucket pages in WAL (remove REGBUF_NO_CHANGE) |