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

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

On Fri, Aug 8, 2025 at 4:39 PM Xuneng Zhou <xunengzhou(at)gmail(dot)com> wrote:
> Thanks a lot for the exceptionally detailed and insightful
> explanation—it’s far more comprehensive than I anticipated. It is
> excellent for unpacking the intricate interplay and state transitions
> between submodules, which is what makes this topic challenging to
> grasp. I’ll need some time to fully digest it, so I’m bookmarking this
> email for future reference. I’m also considering turning it into a
> blog post after studying—it’s the kind of deep, clear writing that
> could benefit more interested audiences.

Well, one benefit of trying to describe a complex system from the top
is that higher level stupidity can sometimes become clear... I
realised that the queue wouldn't even need to be initialised or
cleared if StartReadBuffers() had an explicit in/out npinned argument
to transmit the count between calls along with the buffers, or
examined after each call. This is a draft alternative fix that I am
studying that removes quite a lot of lines and fragility, though time
is not on my side so I might push the one-liner fix ahead of the
upcoming freeze and then see what to do about this.

Attachment Content-Type Size
0001-Fix-and-refactor-read_stream.c-s-split-IO-handling.patch application/octet-stream 13.6 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Merlin Moncure 2025-08-08 22:03:54 Re: Postgres: Queries are too slow after upgrading to PG17 from PG15
Previous Message Masahiko Sawada 2025-08-08 07:15:19 Re: TRAP: failed Assert("outerPlan != NULL") in postgres_fdw.c