Re: WAL record CRC calculated incorrectly because of underlying buffer modification

From: Andres Freund <andres(at)anarazel(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Greg Burd <greg(at)burd(dot)me>, pgsql-hackers(at)postgresql(dot)org, pgsql(at)j-davis(dot)com, thomas(dot)munro(at)gmail(dot)com, exclusion(at)gmail(dot)com, amit(dot)kapila16(at)gmail(dot)com, hlinnaka(at)iki(dot)fi
Subject: Re: WAL record CRC calculated incorrectly because of underlying buffer modification
Date: 2026-10-26 13:46:18
Message-ID: o564wjvhkq7o7jl7fwbst5dw5rowekcfizmbp4odstjvoh5vve@6jt34ntyeca4
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-10-26 12:17:55 +0900, Michael Paquier wrote:
> > 2. Jeff asked why hash can't just follow the rules and exclusive-lock +
> > dirty the buffer. That is the better long-term answer, but it is a
> > non-trivial rework of the hash cleanup/squeeze locking and does not
> > back-patch cleanly. The attached fix is the minimal, back-patchable
> > change and does not foreclose the rework.
>
> I'm still wondering if this would not be the best thing long-term.
> Perhaps not, so [shrug].

I frankly think it's pretty much unacceptable for a niche index like hash to
violate the rules like that. If it were btree, it'd perhaps be worthwhile to
add generic infrastructure for this, but here it doesn't seem like the juice
is worth the squeeze.

> As of this commit, never take an image for a REGBUF_NO_CHANGE buffer, even
> under XLR_CHECK_CONSISTENCY. There is no need to do a consistency check on
> a block not changed by a record. verifyBackupPageConsistency() is taught to
> skip a registered block that carries no image rather than asserting one
> should be present.

I'm not really convinced by that argument. It's probably the best answer in
the back branches, but I think we shouldn't do this in master.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2026-10-26 13:51:37 Re: SQL-level pg_datum_image_equal
Previous Message Aidar Imamov 2026-10-26 13:41:42 Re: Disable startup progress timeout during standby WAL replay