Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wBO0I-0010fD-0Z for pgsql-bugs@arkaria.postgresql.org; Sat, 11 Apr 2026 02:23:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wBO0F-00FHBj-0y for pgsql-bugs@arkaria.postgresql.org; Sat, 11 Apr 2026 02:23:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wBO0F-00FHBb-09 for pgsql-bugs@lists.postgresql.org; Sat, 11 Apr 2026 02:23:19 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wBO0C-00000000S7o-18zG for pgsql-bugs@lists.postgresql.org; Sat, 11 Apr 2026 02:23:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 63B2MuPB323817; Fri, 10 Apr 2026 22:22:56 -0400 From: Tom Lane To: Thomas Munro cc: Xuneng Zhou , exclusion@gmail.com, pgsql-bugs@lists.postgresql.org, Michael Paquier , nathandbossart@gmail.com, Melanie Plageman , Heikki Linnakangas Subject: Re: BUG #19006: Assert(BufferIsPinned) in BufferGetBlockNumber() is triggered for forwarded buffer In-reply-to: References: <19006-80fcaaf69000377e@postgresql.org> Comments: In-reply-to Thomas Munro message dated "Sat, 11 Apr 2026 13:55:30 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <323815.1775874176.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 10 Apr 2026 22:22:56 -0400 Message-ID: <323816.1775874176@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Munro writes: > Unfortunately this fell through the cracks (sorry) and I didn't push > it before the freeze. Any objections to pushing it now? I can live > with deferring it until master reopens if that's the call (CC RMT), > but it would be nice to tidy up this design wart if we can. This doesn't seem to me to be a "new feature", so I'm not sure that feature freeze applies. > This patch shifts some of that responsibility to a more natural place: > * it now seems obvious that StartReadBuffers() should just allow an > in/out npinned counter to travel along with the in/out buffers array > * read_stream.c still needs to know how many there are for pin limit pur= poses > * it also needs to know in the unusual case that the stream ends > earlier and it has to unpin them > * other than that, it's StartReadBuffers()'s private business to manage = them > * StartReadBuffers() can do that with trivial arithmetic, no need to > distinguish and count the buffers > * the end result is much simpler and more robust IIUC, this is basically fixing StartReadBuffers' API, and if we don't do it now then the v19 code will differ from both earlier and later branches. That doesn't seem like a great place to be when you think about having to back-patch bug fixes in this area. So yeah, squeezing this in now seems like a good bet to me. regards, tom lane