public inbox for [email protected]  
help / color / mirror / Atom feed
From: Heikki Linnakangas <[email protected]>
To: Anthonin Bonnefoy <[email protected]>
Cc: Amul Sul <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Fix possible 'unexpected data beyond EOF' on replica restart
Date: Thu, 15 Jan 2026 21:11:54 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAO6_XqpUbQG5-=50fNiZDqscgN4b2cjSTHPvwfGZOoktk=8uLg@mail.gmail.com>
References: <CAO6_Xqrv-snNJNhbj1KjQmWiWHX3nYGDgAc=vxaZP3qc4g1Siw@mail.gmail.com>
	<CAAJ_b94FEArRqXd4q+drOh=yS4_2sPrdHTGXTVH+wHRP0EPuCw@mail.gmail.com>
	<CAO6_XqojxYb=j_rqSi_MH-DB=tZ-OtMQHqEx6xRh9DQrr2uDuQ@mail.gmail.com>
	<[email protected]>
	<CAO6_XqrK-rpYnSfXP+sf=DdQR6ugO_p2W6Sw6XetmtqokeK3uA@mail.gmail.com>
	<CAO6_XqpUbQG5-=50fNiZDqscgN4b2cjSTHPvwfGZOoktk=8uLg@mail.gmail.com>

On 12/01/2026 10:34, Anthonin Bonnefoy wrote:
> Here's a new version with a bit of rewording.

Applied to all branches. Thanks!

I left out this comment change on smgrtruncate():

> @@ -870,6 +870,9 @@ smgrnblocks_cached(SMgrRelation reln, ForkNumber forknum)
>   * be called in a critical section, but the current size must be checked
>   * outside the critical section, and no interrupts or smgr functions relating
>   * to this relation should be called in between.
> + *
> + * If the specified number of blocks is higher than the current size, the
> + * request is ignored when we are InRecovery, otherwise, an error is raised.
>   */
>  void
>  smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks,

I would love to have a comment along those lines, but I think it's 
misleading here, because smgrtruncate() actually does a few things even 
when the requested size is greater than the current size: it 
nevertheless calls DropRelationBuffers(), CacheInvalidateSmgr(), and 
updates the cached sizes in the SmgrRelation. So it seems misleading to 
say the request is ignored.

I wasn't sure how to phrase that, so I just left out that comment 
change. I'm open to proposals on a good wording though.

(The similar comment in mdnblocks() is accurate, mdnblocks() bails out 
very early, so I kept that)

- Heikki







view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Fix possible 'unexpected data beyond EOF' on replica restart
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox