Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pj6NH-0003HE-5B for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Apr 2023 22:40:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pj6NF-0003fg-If for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Apr 2023 22:40:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pj6ND-0003cQ-ON for pgsql-hackers@lists.postgresql.org; Sun, 02 Apr 2023 22:40:33 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pj6NA-0004Qg-MV for pgsql-hackers@postgresql.org; Sun, 02 Apr 2023 22:40:30 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 9BAFD32003AC; Sun, 2 Apr 2023 18:40:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 02 Apr 2023 18:40:27 -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:sender :subject:subject:to:to; s=fm2; t=1680475226; x=1680561626; bh=Q/ 6syzVls4iRbUA15YcKcgYEkgGjIRyqhlrKB22G9jE=; b=IZtKFDXNQf5PR2h8F+ USE2l6SMxtiSgbSHcR4+ZKusa0LkABzdjWCUNuzro3ED8WTs48YELiu3NiOwiAER ig4mM29QP17F8YQu6fVZNhDduDtcjjPlyNqqifY0+ywZ52YuBC/21N2RUQOsTCHf LRa/+VzQDBNpgwUjD62hLR7O4S2c56fIhTqXt3qAFZKeJtG30alk5GIm8qaLoV5T JKDLcaUvCpT+rBVVHRMjkIEILX7Xj962VW0c9H0kWuABuQYelcK0cqUkBxgR9mmc HwLWQ66wgq0P8yDEefYWCsNqF1pw9A8wc0YZ0XJyNU7SQDg7kIHhtH5+AWt2W1uN SAAw== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1680475226; x=1680561626; bh=Q/6syzVls4iRb UA15YcKcgYEkgGjIRyqhlrKB22G9jE=; b=NiSFLMJTmJnLqZImw8QqDnhEqwGrA FEAXqoN1KBVeOhMqg9c5hXhs53gdIDPxmnePMLyZnChPVT4dXE+qj6khB1RS+AYr qhfCeheTDc1cnDLDE9ZcQT7FA2/d06apc1b+DUypboii+IrLwpuAVQExVW6pJ358 I3RywxA/8tyjNF1IS6ltdTXit9StMfeaxW/IiqyuLuEoKAglzqLap3thq9gPyTXq T3UD2DpH1hQpwHADkQRBuva8jLXHgzSOJuVPnvSnT10fXB/UqM3HkHJeFmZdnsCM XJlzc2Aos+hCjX8jSODLb1iCeC1QKq1JH0Kn3fPKhhiNWIuTLAcMvMhXw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeiiedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 2 Apr 2023 18:40:25 -0400 (EDT) Date: Sun, 2 Apr 2023 15:40:24 -0700 From: Andres Freund To: Tom Lane Cc: Tomas Vondra , pgsql-hackers@postgresql.org, Tomas Vondra , Anastasia Lubennikova , Pavan Deolasee , Jeff Janes Subject: Re: hio.c does visibilitymap_pin()/IO while holding buffer lock Message-ID: <20230402224024.aealekgu2df4cnhs@awork3.anarazel.de> References: <20230325025740.wzvchp2kromw4zqz@awork3.anarazel.de> <0c11032a-d91b-8875-ab7b-4554776390c5@enterprisedb.com> <20230325163903.eu67kqcqo4llhc4u@awork3.anarazel.de> <2602455.1679763437@sss.pgh.pa.us> <20230325181707.at3kwsh7uvkhfype@awork3.anarazel.de> <20230329012102.zpviu2e7kyfrovxn@awork3.anarazel.de> <20230329021721.l3rujmv3jjmktt5i@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230329021721.l3rujmv3jjmktt5i@awork3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-03-28 19:17:21 -0700, Andres Freund wrote: > On 2023-03-28 18:21:02 -0700, Andres Freund wrote: > > Here's a draft patch. > > Attached is v2, with a stupid bug fixed and a bit of comment / pgindent > polish. I'd welcome some review (Tomas?), but otherwise I'm planning to push ahead with this. I'm still debating with myself whether this commit (or a prerequisite commit) should move logic dealing with the buffer ordering into GetVisibilityMapPins(), so we don't need two blocks like this: if (otherBuffer == InvalidBuffer || targetBlock <= otherBlock) GetVisibilityMapPins(relation, buffer, otherBuffer, targetBlock, otherBlock, vmbuffer, vmbuffer_other); else GetVisibilityMapPins(relation, otherBuffer, buffer, otherBlock, targetBlock, vmbuffer_other, vmbuffer); ... if (otherBuffer != InvalidBuffer) { if (GetVisibilityMapPins(relation, otherBuffer, buffer, otherBlock, targetBlock, vmbuffer_other, vmbuffer)) unlockedTargetBuffer = true; } else { if (GetVisibilityMapPins(relation, buffer, InvalidBuffer, targetBlock, InvalidBlockNumber, vmbuffer, InvalidBuffer)) unlockedTargetBuffer = true; } } Greetings, Andres Freund