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 1pD0Ys-0003UD-Nn for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Jan 2023 09:59:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pD0Yq-0003NQ-Lw for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Jan 2023 09:59:52 +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 1pCs3G-000300-QN for pgsql-hackers@lists.postgresql.org; Wed, 04 Jan 2023 00:54:44 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pCs3D-0001Ue-9a for pgsql-hackers@postgresql.org; Wed, 04 Jan 2023 00:54:41 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 168003200932; Tue, 3 Jan 2023 19:54:37 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 03 Jan 2023 19:54:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc: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=1672793676; x=1672880076; bh=IveBjJv6PS i5LWLVB+nAoWm2nwnU6QC4t+dFDBF/SQI=; b=wFR68vT03X8PT8bWBG1e5r09cf jBbl+kACvXc5qOchzv76qwQ8Kkg9vLCwVPXHwNidZ2NwXQL9PWYOGAuj502huh8/ Dc7EQ388XKeAjsPsy83O50IVW/nhVk+UqjRzZBXI7Z/Ce9PYdhFc5cq6Gi+QL9Wf n7ZsfVAf/1j9MuXmR+3mVXCf4VTBQgg6+DVAiZnuF6GtwkdEIjHZCDXXEU60VaoM adCnxuym3RK7uGUXEaXZ0at/BpUYAgGiHa9ntz3Q0U6JvMaHkzIpEXEsDSGB94mv yB8e1g5hi4ZjhKqQf6IQFHoLIl7+xn72xyyAZJKQhXlgNBwcp92Jxgdes1MQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=1672793676; x=1672880076; bh=IveBjJv6PSi5LWLVB+nAoWm2nwnU 6QC4t+dFDBF/SQI=; b=EqJKPbwdCyMBDE4IIJ3lZywRT+4J9TinSnSD7hHMvElT ifFZ0tuYhuNWil8lLCOguR+n8PvZ+MtW6VNhLFcG/Sl3333GCtgWhjaGm8SYaB63 88OiAqEEo7IomhgHCiimEMtFbytoPEST1OuVdQZJ2KIFihaLZAYFoFF/H5CPuYuP ly5j8lcHTejw3hFnFQlQJaJEe4AgZl+0r+rct3Y83EUOL52nUPfX8i0wqMLYpkTp 6yQHngtcbotPx7MzMO0raO2g78SbgFC0Cc54OUhLXIgFy/kWAmcZDM8FminzdW0v yjAE2avYDzNg4qfVxBnQNnVchngcB07uqZOuDtbcBA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeehgddvlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpeegteevjeduueduuefhfedtffehtefgvedufedtfeevgfeifefgjeduvdff geefkeenucffohhmrghinhepphhoshhtghhrrdgvshenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghlrdgu vg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Jan 2023 19:54:35 -0500 (EST) Date: Tue, 3 Jan 2023 16:54:33 -0800 From: Andres Freund To: Peter Geoghegan , pgsql-hackers@postgresql.org Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Delay commit status checks until freezing executes. Message-ID: <20230104005433.k5aptjbqx75fksfm@awork3.anarazel.de> 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 2023-01-03 19:23:41 +0000, Peter Geoghegan wrote: > Delay commit status checks until freezing executes. > > pg_xact lookups are relatively expensive. Move the xmin/xmax commit > status checks from the point that freeze plans are prepared to the point > that they're actually executed. Otherwise we'll repeat many commit > status checks whenever multiple successive VACUUM operations scan the > same pages and decide against freezing each time, which is a waste of > cycles. > > Oversight in commit 1de58df4, which added page-level freezing. > > Author: Peter Geoghegan > Discussion: https://postgr.es/m/CAH2-WzkZpe4K6qMfEt8H4qYJCKc2R7TPvKsBva7jc9w7iGXQSw@mail.gmail.com There's some changes from TransactionIdDidCommit() to !TransactionIdDidAbort() that don't look right to me. If the server crashed while xid X was in-progress, TransactionIdDidCommit(X) will return false, but so will TransactionIdDidAbort(X). So besides moving when the check happens you also changed what's being checked in a more substantial way. Also, why did you change when MarkBufferDirty() happens? Previously it happened before we modify the page contents, now after. That's probably fine (it's the order suggested in transam/README), but seems like a mighty subtle thing to change at the same time as something unrelated, particularly without even mentioning it? Greetings, Andres Freund