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.94.2) (envelope-from ) id 1ujZhT-009LwA-Nf for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Aug 2025 08:40:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ujZhS-00EPnE-Nk for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Aug 2025 08:40:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ujZhS-00EPn2-2c for pgsql-bugs@lists.postgresql.org; Wed, 06 Aug 2025 08:40:42 +0000 Received: from fout-b8-smtp.messagingengine.com ([202.12.124.151]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1ujZhP-0010YV-0m for pgsql-bugs@lists.postgresql.org; Wed, 06 Aug 2025 08:40:41 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id 19F811D0010A; Wed, 6 Aug 2025 04:40:39 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 06 Aug 2025 04:40:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1754469638; x=1754556038; bh=rpOPsjbEN4 ZDZxqwEJepdZsKAAcBDkKDX2ZaZ2o1ngc=; b=VGO3vkVzWXR8Xe0nS4OAHHszvQ W6EnrgzAT4QqsOkxwqNhMiQs98fm5SEyvBYBVLUFcOdr+D2wmMozYOh6SDpsRZqh XxVkboGPfGpdXx5OlGHjgM4sHIXPDkdScmcbMm6dBUTgA+h0br5KGP28NuR1V8qw r7TRxPWugivTItveEB9htLds0qEPznAhVB/b3gHShfftgemPfQvAUeDIWXCeJ4Hv rZFpC0MIA+ftD4h0laqeWHpS14/MQDpYEtwYlTasbRsV1Fu6c8F/DW3NcUp1yQ2v 53N4Cr/SWGu8UV9bAwGsUSort3TEjHlJSZUasKMvaBSezA4O72kp1lgCKv3Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1754469638; x=1754556038; bh=rpOPsjbEN4ZDZxqwEJepdZsKAAcBDkKDX2Z aZ2o1ngc=; b=A7Aprnx4EOA9p6F+0MTzhX2dbBXcH05dtNIzBhksVHXChbyXryB oAmIydWtgKNerFxW28ch875jeEU2mBcs+UnHrMUADuE02VxcUgiM33fhwN8yzazX r+hGhzmnTQNTbKpzRqfI/lNDADwl7ZTTGrOscAT0pajI0l4GZh55VPtm9NQR1MMu nhb0ou5FTiP4cyCk20bOivChFLQxuUqzriHyMllMPFHpWYC4sivgZJKlUZZ4cMcd OnNzo3Qx+2cDlJL8tsDpFqdgWl8qQKnSVQQ22HUw/wkF2g6M1CVQyuA1xErrjyWu sp2/nIjNyEza5Vs4uP8xtdse0TimprWATQA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduudejiedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepthhglh esshhsshdrphhghhdrphgrrdhushdprhgtphhtthhopehthhhomhgrshdrmhhunhhrohes ghhmrghilhdrtghomhdprhgtphhtthhopeiguhhnvghnghiihhhouhesghhmrghilhdrtg homhdprhgtphhtthhopegvgigtlhhushhiohhnsehgmhgrihhlrdgtohhmpdhrtghpthht ohepphhgshhqlhdqsghughhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Aug 2025 04:40:36 -0400 (EDT) Date: Wed, 6 Aug 2025 17:40:33 +0900 From: Michael Paquier To: Tom Lane Cc: Thomas Munro , Xuneng Zhou , exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19006: Assert(BufferIsPinned) in BufferGetBlockNumber() is triggered for forwarded buffer Message-ID: References: <19006-80fcaaf69000377e@postgresql.org> <992760.1754368986@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="MUZm0cX0eHbte1PH" Content-Disposition: inline In-Reply-To: <992760.1754368986@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --MUZm0cX0eHbte1PH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 >=20 > + for (int i =3D 0; i < stream->forwarded_buffers; ++i) > + Assert(BufferGetBlockNumber(stream->buffers[stream->next_buffer_index = + i]) =3D=3D > + stream->pending_read_blocknum + i); >=20 > 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 --MUZm0cX0eHbte1PH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmiTFQEACgkQnvQgOdby QH0aLBAAjtaocbcCQgDEb8rWIqcOmcj7TX6hPONqinwhXi1LUTjSEYgQ+goQaG8W eVTMCqeZBWmBSE2R+N/7CAPSJwMru4Q+hr/DGNIa03JiM3UB6oJngq9KPQLPmUeG U2N8cmpoVGqQ79c4NRB9ungPkO8Bve46q7+hQZMUQrbycaT7s2szddiFnIJ8Pq+u LAXJn0fA1z5RRiQbRNdvdsheR6UfGhBSKEFdvm0dP/KqpGeejwicoV0DndNChNrM ffxUBseZ5pF3odlXnq6TaIGfu8f9aEy7Ij6y37o4L5zsXhTkxOAv1Q2eGontMCdN 1/BE3UyigqkRZ5e5wbHHCxsWbD3TGSdoyDW8TJ6QNv1mv+RxYePKWtfPOvcsQboy yueRtKMVNAyHqqRILCj6JAT1FDCH1W98CiBlmXWT8WfBdjHvyFCdn47bpeWTvqIa 1MFdruqvWmSsA2ItvnZNN8VukxNIdlWn44Z95Qu0acnhp7MkKaX+ONiSxzhSaC6/ qfrKlVTkmNCN6uXDU17zaKCHajnLQioNiLFtwsKD8urqTjd1ssQHhluZT73E8Miz A4sk6mvHpQfMUNkMFPD0fy+ufk557b4zUVOr/HmQGRwVgzNGNhiYGoOiPcrTtGxh RRbQDRmYS9a8floXMS7p81BUHav7dfCtIc1PlWgnOGnjJ33r3nM= =NDi4 -----END PGP SIGNATURE----- --MUZm0cX0eHbte1PH--