Re: BUG #19006: Assert(BufferIsPinned) in BufferGetBlockNumber() is triggered for forwarded buffer

From: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19006: Assert(BufferIsPinned) in BufferGetBlockNumber() is triggered for forwarded buffer
Date: 2025-08-07 11:37:19
Message-ID: CABPTF7V7HeZmpYK-zdjq4bS4UBGjRH-2niF4bdi_jgQr7Ujy+Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On Wed, Aug 6, 2025 at 4:40 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> 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

+1

Best,
Xuneng

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message hubert depesz lubaczewski 2025-08-07 13:30:23 Re: BUG #19014: Automatic aggressive VACUUM on template0 and template1 pg_shdepend runs every minute
Previous Message PG Bug reporting form 2025-08-07 07:47:58 BUG #19014: Automatic aggressive VACUUM on template0 and template1 pg_shdepend runs every minute