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 1w2YOx-000ORW-0A for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2026 17:40:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2YOv-003iGG-1e for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2026 17:40:17 +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 1w2YOv-003iG7-0l for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2026 17:40:17 +0000 Received: from fhigh-b7-smtp.messagingengine.com ([202.12.124.158]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w2YOs-00000000dxt-0ul0 for pgsql-hackers@postgresql.org; Tue, 17 Mar 2026 17:40:16 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 998CF7A0123; Tue, 17 Mar 2026 13:40:11 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Tue, 17 Mar 2026 13:40:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; 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=fm1; t=1773769211; x=1773855611; bh=CkRD3LW7CP B8IoVGIDePqSu3267dLYVxZnjW7GyXt7U=; b=vvft6YmC7FNx6AiBqxu9Bu/cGu C+r+dA0uSCEQyMcKOWY73tH5Xj/HRqjRgwlWzfgjiplZQY35ExIUccO3IN/TNf6X XvuGn1DElEVKIycXO6RKfSNVr9mfWusPJYpP/oaH3nU3KkLiiZE6j5RueU0SGP/Y T9OSwGy6kpesoX/AgJ1rWN+2Web81CjPSctMYxuzA6b7wzgSezU6Lt6mCilHNmSc nulAVk97yJmU7rS+8pvHif/HkqK1d20NkH+P4ZADMpauD+hDkCbsaDToJcGiPDX5 E87+Rv7/N+m5Xq6/HKY4nhNXwurb4bvoCT51BgHHtCX+BN+XOJ2LJSI8Iq9g== 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=fm1; t= 1773769211; x=1773855611; bh=CkRD3LW7CPB8IoVGIDePqSu3267dLYVxZnj W7GyXt7U=; b=dLhcjzkfUlB01WHmRXxj6o03uT6BkCHdDO5TAUdbnabl1k/Wjma MeI8s0KAnGJ/dINIWptEnFTom16hFAW5NXbyn90195JUHlWRR+nVZPyVQCQ4WM10 94zmFHEDU/b+JZuszz9mQ+YpuFm7AQswXmPVY6PFm7ryedU4ewhQkfVmmg1/rtj6 fw9LYv93rMgpC+IIRLhel5i2udlI157MN87H6CGK9iIq4gwcr24VdSqXRvfkefZS jrReTt7DoUznONLQFTqBbjBFFDrWd9QOthK4ZI4pVzF2ZzaE/mtwjgk+HTTOEKcb ZsALt9tRygCchitPmuGLW/sFwn0xq88KdrA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeftddukeejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtsfdttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepgedtveeifeehjeefveelgeehgeeigeffiefhgfekleethfehueekueefleeg uddunecuffhomhgrihhnpehpohhsthhgrhdrvghsnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggv pdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrsh hhuhdrtghovghkkeeksehgmhgrihhlrdgtohhmpdhrtghpthhtohephhhlihhnnhgrkhgr sehikhhirdhfihdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehpohhsthhgrh gvshhqlhdrohhrghdprhgtphhtthhopegrkhhuiihmvghnkhhovhesthhighgvrhgurght rgdrtghomh X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 Mar 2026 13:40:10 -0400 (EDT) Date: Tue, 17 Mar 2026 13:40:10 -0400 From: Andres Freund To: Heikki Linnakangas Cc: "pgsql-hackers@postgresql.org" , Alexander Kuzmenkov , Ashutosh Sharma Subject: Re: Assertion failure in hash_kill_items() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-03-17 19:15:10 +0200, Heikki Linnakangas wrote: > I bumped into an assertion failure, while playing with variants of the test > case that Alexander Kuzmenkov wrote to exercise hash index page cleanup [1]. > This is master-only, related to the recent changes in how buffers are marked > dirty. Sorry, I had hoped to push a fix for that already, after it was reported in https://postgr.es/m/vjtmvwvbxt7w5uyacxpzibpj65ewcb7uqaqbhd4arvnjbp5jqz%405ksdh6fsyqve but real life intervened. I was planning to commit it together with an addition to src/test/modules/index/specs/killtuples.spec Unfortunately that made the change a good bit more verbose, as a naive addition would report a number of buffer accesses that seemed not necessarily reliable to me. So I updated the 'result' step to just return true/false depending on whether there were any accesses. I'll go and work on pushing that. > The first attached patch fixes it. It's pretty straightforward: the function > was using so->currPos.buf, but that's only valid if the page was already > pinned on entry to the function. It should be using the local 'buf' variable > instead. Yea, that was a stupid bug on my part. No idea how I ended up with it. At first I thought it might have been a rebase issue, but I didn't see any relevant change that could have caused that. > The second patch simplifies the condition in the 'unlock_page' part. This > isn't new, and isn't needed to fix the bug, it just caught my eye while > looking at this. I don't understand why the condition was the way it was, > checking just 'havePin' seems sufficient and more correct to me. Am I > missing something? I can't see anything either, quite odd. Most likely explanation seems to be that something changed during the development of 7c75ef571579. Indeed, the first version of the patch from https://postgr.es/m/CAE9k0Pm3KTx93K8_5j6VMzG4h5F%2BSyknxUwXrN-zqSZ9X8ZS3w%40mail.gmail.com was using "if (so->hashso_bucket_buf == so->currPos.buf)" both at the start and end of _hash_kill_items(). So likely it was just an accident during patch revisions. Greetings, Andres Freund