On Mon, 16 Nov 2026 at 16:23, Amit Kapila <[email protected]> wrote:
>
> On Sun, Nov 15, 2026 at 2:06 AM Greg Burd <[email protected]> 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: v13_REL16-0001-Fix-hash-index-redo-reading-a-torn-primary.patch
Description: Binary data

Attachment: v13-0001-Fix-hash-index-redo-reading-a-torn-primary-bucke.patch
Description: Binary data

Reply via email to