pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Xuneng Zhou <xunengzhou@gmail.com>
Cc: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19006: Assert(BufferIsPinned) in BufferGetBlockNumber() is triggered for forwarded buffer
Date: Wed, 6 Aug 2025 17:40:33 +0900
Message-ID: <aJMVAbYRcdImR3-V@paquier.xyz> (raw)
In-Reply-To: <992760.1754368986@sss.pgh.pa.us>
References: <19006-80fcaaf69000377e@postgresql.org>
	<CABPTF7VaW0Hw2-KXoiYFTH40LeUgr06gE5q09sq9LXQPH-vjPA@mail.gmail.com>
	<CA+hUKGK5x5Yekufz7a+Jr1neahwE9cLZn9xt3gSzSZgE=Spjpw@mail.gmail.com>
	<CA+hUKGJyqwQs_kQFB1J=bx4pHMrMcPF8_PgNKyeNFEo+yNvyiQ@mail.gmail.com>
	<992760.1754368986@sss.pgh.pa.us>

On Tue, Aug 05, 2025 at 12:43:06AM -0400, Tom Lane wrote:
> I've not looked at the issue actually being fixed, but a drive-by
> comment: these loops
> 
> +	for (int i = 0; i < stream->forwarded_buffers; ++i)
> +		Assert(BufferGetBlockNumber(stream->buffers[stream->next_buffer_index + i]) ==
> +			   stream->pending_read_blocknum + i);
> 
> should be wrapped in "#ifdef USE_ASSERT_CHECKING".  Maybe the
> compiler is smart enough to throw away the useless looping logic
> in a production build, or maybe it isn't.

I'd bet it is usually not that smart..  Embedding these in an extra
#ifdef is a sound defense IMO.
--
Michael

Attachments:

  [application/pgp-signature] signature.asc (832B, ../aJMVAbYRcdImR3-V@paquier.xyz/2-signature.asc)
  download

view thread (29+ messages)  latest in thread

Message-ID: <aJMVAbYRcdImR3-V@paquier.xyz>
Permalink:  ../aJMVAbYRcdImR3-V@paquier.xyz/
Also on:    postgresql.org/message-id/aJMVAbYRcdImR3-V@paquier.xyz

 · 

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: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, tgl@sss.pgh.pa.us, thomas.munro@gmail.com, xunengzhou@gmail.com, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #19006: Assert(BufferIsPinned) in BufferGetBlockNumber() is triggered for forwarded buffer
  In-Reply-To: <aJMVAbYRcdImR3-V@paquier.xyz>

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

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