Re: Hash index: stop registering pin-only bucket pages in WAL (remove REGBUF_NO_CHANGE)

From: Greg Burd <greg(at)burd(dot)me>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, 'vignesh C' <vignesh21(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Joao Rito <joaovictor(dot)rito(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>
Subject: Re: Hash index: stop registering pin-only bucket pages in WAL (remove REGBUF_NO_CHANGE)
Date: 2026-11-18 18:24:59
Message-ID: 179502339196.2319251.16351899054884685823@burd.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wednesday, November 18th, 2026 at 8:11 AM, Hayato Kuroda (Fujitsu) <kuroda(dot)hayato(at)fujitsu(dot)com> wrote:

> Hi,

Hi Hayato-san,

> Thanks for updating the patch! I checked 0001 again and here is my comment.
> While reading the code again, I came up with another idea to clean up
> the code: how about making the code similar with the WAL generation
> side? Something like attached. Or is it matter of taste?

It reads better, thanks. XLogRecHasBlockRef(record, 0) on the redo side
is exactly mod_wbuf on the generation side (nitups > 0 ||
is_prev_bucket_same_wrt), which is when _hash_freeovflpage() registers
block 0, so folding the two branches into one writebuf_registered flag
is equivalent and mirrors the writer. I took it in v15.

The one thing I kept from the original is reading the primary bucket
page's cleanup lock before the write buffer in the non-same-wrt case,
which your version preserves: hash_xlog_lock_primary_bucket() still runs
first when the write page is not the primary bucket page.

v15 attached, rebased onto b8cbc63dcc7.
0001: fold your simplification into hash_xlog_squeeze_page().

0001 passes the recovery suite under the CI UBSan flags and 061 passes,
as before. I think 0001 and 0002 are ready; does one of you want to
take them, or is there more you want to see first?

best.

-greg

Attachment Content-Type Size
v15-0001-Don-t-register-pin-only-primary-bucket-pages-in-.patch text/x-patch 24.6 KB
v15-0002-Add-a-recovery-test-for-the-hash-WAL-pin-only-bu.patch text/x-patch 12.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tristan Partin 2026-11-18 18:34:24 Add ids to catalog/view columns in documentation
Previous Message Srinath Reddy Sadipiralla 2026-11-18 18:18:41 Fix FATAL error when using recovery_target = 'immediate' on cleanly shut down clusters