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 1sJzHi-007htN-91 for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Jun 2024 17:39:50 +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 1sJzHg-003bQf-1P for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Jun 2024 17:39:48 +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 1sJzHf-003bQS-Ke for pgsql-hackers@lists.postgresql.org; Wed, 19 Jun 2024 17:39:48 +0000 Received: from fhigh8-smtp.messagingengine.com ([103.168.172.159]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJzHd-0027Eg-Se for pgsql-hackers@lists.postgresql.org; Wed, 19 Jun 2024 17:39:47 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.nyi.internal (Postfix) with ESMTP id EA7691140148; Wed, 19 Jun 2024 13:39:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 19 Jun 2024 13:39:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1718818784; x= 1718905184; bh=i4ELtZVugABxXuTRCAc9/COVXx6NH+kaSOY4HYF6NFk=; b=q 4QiS8gr627D+tK2oixd83B9p+lcsmBnwy/GFkfhL6PR7jRIETUKFKBTaF8cnR05q 7szqEGzw/aIzwkrsFo/Vi2sws9lUS3tYbAxcNbFx8QUufNaJfEgvCna9AmYIJ69y dLx+ZE737/SaVhMkJWxZer8NqeREU3mRpD7ktIyhhtKxs7K6kyHUKDh0b2F5UFwO UO2Utm4VUxNkoNIdfizJmqpkZS2arrpxmYBHjLxh6Ds1xWaboAi56QB1yHco4pXX uBS4hHPg3Yw3zNqs5tpqmmrJ4Hftnyqz06PHe+c7C9lw0Nq+Te3MWfpDD0TuU1GZ A06hym0TG/yI9ymOX9/ng== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeeftddgudduhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 19 Jun 2024 13:39:43 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1718818782; bh=+o6wYAwB5M50WHxQsK7LRrP/f4XgZhS7WgmvUD03w+Q=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=SQLUVoh8HVmV6ACoDwWd7JaWQqz/Pyxd9/fMB6JVR7p9lvBfIfZ/5aXMbd6Z1dJ1/ eWFuanuA0fCxkPgeGG8S2D4WAd3YIyUVCdt4EUEYGHlYmrsJoZgQMT+Wjz98cHb0oj 8lXWoLTxs9fJcqKCNLTFUDe6SirwV+Fswir9aazFBjwG7zdtymumUQ12OJXlqTKdEm XNH6hNib6rhDYckCOfXx5PJNR8SB+BHUpx95QrZrfANeIcbnV8R/HypwAZNATJ0TGV sDRB08IRwcWnv4cwQbHXryhMnG0muaTtr+c7CmTeInP6ZLWEeZHneaBsj/+oBSeu19 50kCs5u6/Ed7g== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id B2C7E527; Wed, 19 Jun 2024 10:39:42 -0700 (PDT) Date: Wed, 19 Jun 2024 19:39:42 +0200 From: Alvaro Herrera To: Peter Geoghegan Cc: Yura Sokolov , Maxim Orlov , "Anton A. Melnikov" , PostgreSQL Hackers Subject: Re: Maybe don't process multi xmax in FreezeMultiXactId() if it is already marked as invalid? Message-ID: <202406191739.qcywak7ljplz@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Jun-19, Peter Geoghegan wrote: > On Wed, Jun 19, 2024 at 1:00 PM Yura Sokolov wrote: > > So it is quite different code paths, and one could not be used > > to decline or justify other. > > The point is that we shouldn't need to rely on what is formally a > hint. It might be useful to use the hint to decide whether or not > freezing now actually makes sense, but that isn't the same thing as > relying on the hint (we could make the same decision for a number of > different reasons). FWIW I don't think HEAP_XMAX_INVALID as purely a hint. HEAP_XMAX_COMMITTED is a hint, for sure, as is HEAP_XMIN_COMMITTED on its own; but as far as I recall, the INVALID flags must persist once set. Consider the HEAP_XMIN_COMMITTED+ HEAP_XMIN_INVALID combination, which we use to represent HEAP_XMIN_FROZEN; if that didn't persist, we'd have a pretty serious data corruption issue, because we don't reset the Xmin field when freezing the tuple. So if we fail to keep the flag, the tuple is no longer frozen. (My point here is that some infomask bits are hints, but not all them are only hints.) So XMAX_INVALID gives certainty that the Xmax value must not be read. That is to say, I think there are (or there were) situations in which we set the bit but don't bother to reset the actual Xmax field. We should never try to read the Xmax flag if the bit is set. I think the problem being investigated in this thread is that HEAP_XMAX_IS_MULTI is being treated as persistent, that is, it can only be set if the xmax is not invalid, but apparently that's not always the case (or we wouldn't be having this conversation). -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/