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 1pEH2o-0000Hc-DT for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Jan 2023 21:48:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pEH2n-000119-CR for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Jan 2023 21:48:01 +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 1pEH2n-00010y-3i for pgsql-hackers@lists.postgresql.org; Sat, 07 Jan 2023 21:48:01 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pEH2k-0000iS-Qo for pgsql-hackers@postgresql.org; Sat, 07 Jan 2023 21:48:00 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 3EB445C00A8; Sat, 7 Jan 2023 16:47:58 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 07 Jan 2023 16:47:58 -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=1673128078; x=1673214478; bh=5MNiIF7qSS I43QAnJVfVve75ElhRN6Ho9xuuOVxvV0o=; b=dCtgecj9Ejr6O/Ox8qYdUN88xh 8gsdScSWFmr2l26OA4F7dQN3PudA7pXUF4FmZ4R+rpW6f/3/LH+FPyAlE3AGv1Vs oFmF7JMfYQQAtYbXZZnNaRi+hehWAX0bK89t3HTrpknGgR4avTQzHcp8VuKQo/BW Qz2+fh9PFqkI1q2gclF7AkZh3Jm4HGGCN1IJCjLvK8YMHM8Sp8lG5MTuJqaLvqiG ogLKsgZ8kQnDEFnGUofrUHTrIAkIf7e4Lb18LQ3Ro/dboOCVw3W0nVT2nybDpFsj fqRq3kRq+euBuIPLrOmyINuTFNiMGrQfJEPecWMAccYB6qHjbHl7644VCzYQ== 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=1673128078; x=1673214478; bh=5MNiIF7qSSI43QAnJVfVve75ElhR N6Ho9xuuOVxvV0o=; b=R7PSjfjmZM8oimZAfhiTZ4qp43rvMUuV/rnttsggsfv1 N3EM9GD1Yn7qdH8Fcmt1yI5lAeBpQ70LM8esBkRcbUJU5wIFtClmQ3Fmv0JeGfE1 Fd1WM54Apx17JRw/tIp3Y4nJVLbKpRiWrrT1AQA9bK21vivObOQqEXTuwB5CRZH0 5MBq6o2YChkWm/I97SRX2bRfoB5rZdH1PcxnKFkLm2LlKSajGD7ElR+9avR8l4M4 DmSOB3m9VDRzQWwOrdskKLkz46R5vHX89BSTlPaRYARb2H+AAirTt08FwD3qwXau JMPhkMSim1Pdzd1eF1FoBe7urYROzobT8T1RhH02KA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrkedvgdduhedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 7 Jan 2023 16:47:57 -0500 (EST) Date: Sat, 7 Jan 2023 13:47:56 -0800 From: Andres Freund To: Peter Geoghegan Cc: pgsql-hackers@postgresql.org Subject: Re: pgsql: Delay commit status checks until freezing executes. Message-ID: <20230107214756.fyrk735xkeetkkby@awork3.anarazel.de> References: <20230104005433.k5aptjbqx75fksfm@awork3.anarazel.de> <20230104035636.hy5djyr2as4gbc4q@awork3.anarazel.de> <20230104063325.32xq2gpnwlelhogo@awork3.anarazel.de> <20230104064740.6mnwcml6oqp3sxnr@awork3.anarazel.de> 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-06 11:16:00 -0800, Peter Geoghegan wrote: > On Tue, Jan 3, 2023 at 10:52 PM Peter Geoghegan wrote: > > > And it'd make sense to have > > > the explanation of why TransactionIdDidAbort() isn't the same as > > > !TransactionIdDidCommit(), even for !TransactionIdIsInProgress() xacts, near > > > the explanation for doing TransactionIdIsInProgress() first. > > > > I think that we should definitely have a comment directly over > > TransactionIdDidAbort(). Though I wouldn't mind reorganizing these > > other comments, or making the comment over TransactionIdDidAbort() > > mostly just point to the other comments. > > What do you think of the attached patch, which revises comments over > TransactionIdDidAbort, and adds something about it to the top of > heapam_visbility.c? Mostly looks good to me. I think it'd be good to add a reference to the heapam_visbility.c? comment to the top of transam.c (or move it). > * Assumes transaction identifier is valid and exists in clog. > + * > + * Not all transactions that must be treated as aborted will be > + * explicitly marked as such in clog. Transactions that were in > + * progress during a crash are never reported as aborted by us. > */ > bool /* true if given transaction aborted */ > TransactionIdDidAbort(TransactionId transactionId) I think it's currently very likely to be true, but I'd weaken the "never" a bit nonetheless. I think it'd also be good to point to what to do instead. How about: Note that TransactionIdDidAbort() returns true only for explicitly aborted transactions, as transactions implicitly aborted due to a crash will commonly still appear to be in-progress in the clog. Most of the time TransactionIdDidCommit(), with a preceding TransactionIdIsInProgress() check, should be used instead of TransactionIdDidAbort(). Greetings, Andres Freund