| From: | vignesh C <vignesh21(at)gmail(dot)com> |
|---|---|
| To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
| Cc: | Greg Burd <greg(at)burd(dot)me>, Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(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>, 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-17 11:20:51 |
| Message-ID: | CALDaNm3nUFQOb92O2iD6JBL9X1LhrZUvC13g3_Sq=SVmEw5bNA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, 16 Nov 2026 at 16:23, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Sun, Nov 15, 2026 at 2:06 AM Greg Burd <greg(at)burd(dot)me> wrote:
> >
> > Hayato, vignesh, Joao,
> >
> > v12 attached. Same series as v11, with one fix: the new torn-page test
> > failed CI on 32-bit, and this corrects it. Code is unchanged from v11.
> >
>
> I don't think we want to commit the test to create a torn-page as it
> appears complex and not sure if we have any other similar test though
> it is good to use for testing the fix. I suggest let's first commit
> the fix for torn-page reads issue (Fix hash index redo reading a torn
> primary bucket page) as that needs to be backpatched. Once that is
> committed, we can look at HEAD-only code improvements separately. If
> we agree on this, can one of you separate out the test and share
> bug-fix patches?
Thanks, here is the updated v13 version patch to remove the test.
Apart from this, the following changes were done:
a) Retain the comment which was there to indicate we skip checking
return value of XLogReadBufferForRedoExtended:
+ if (HotStandbyActiveInReplay())
+ {
+ /*
+ * we don't care for return value as the
purpose of reading
+ * bucketbuf is to ensure a cleanup lock on
primary bucket page.
+ */
+ (void) XLogReadBufferForRedoExtended(record,
0, RBM_NORMAL, true, &bucketbuf);
+ }
b) Improved the comments to mention about how
XLogReadBufferForRedoExtended is not required when hot standby is
active and how torn page problem will resolved by later wal record:
/*
- * we don't care for return value as the purpose of
reading bucketbuf
- * is to ensure a cleanup lock on primary bucket page.
+ * The cleanup lock is needed only when hot standby is
active, because
+ * scans cannot run before that. Skipping the read
also avoids a torn
+ * copy of the primary page. This record does not
modify that page, so
+ * it has no full-page image of it. In crash recovery,
or on a standby
+ * started from a base backup, the page on disk can be
torn and the
+ * image that repairs it can come later in the WAL.
*/
c) Added Amit and Joao Rito as reviewers who also reviewed the patch.
The v13-0001-Fix-hash-index-redo-reading-a-torn-primary-bucke.patch
patch applies till PG17 branch and
v13_REL16-0001-Fix-hash-index-redo-reading-a-torn-primary.patch
applies in PG16 and PG15 branches.
Regards,
Vignesh
| Attachment | Content-Type | Size |
|---|---|---|
| v13_REL16-0001-Fix-hash-index-redo-reading-a-torn-primary.patch | application/octet-stream | 7.6 KB |
| v13-0001-Fix-hash-index-redo-reading-a-torn-primary-bucke.patch | application/octet-stream | 7.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Maksim.Melnikov | 2026-11-17 10:52:30 | Re: race condition when writing pg_control |