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 1mdBoU-0004eU-S6 for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Oct 2021 13:39:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mdBoT-0007ZZ-M5 for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Oct 2021 13:39:25 +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 1mdBoS-0007ZP-Ba for pgsql-hackers@lists.postgresql.org; Wed, 20 Oct 2021 13:39:25 +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 1mdBoP-0003mJ-Q3 for pgsql-hackers@lists.postgresql.org; Wed, 20 Oct 2021 13:39:23 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 05D0E5C00C6; Wed, 20 Oct 2021 09:39:19 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 20 Oct 2021 09:39:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=AhcSZ+y2FdOgB+iFFG2YqJWEb7GqvWHT9C6mnEFfkd0=; b=bYU6gyM6 c/owDJqid42mBZJwuX+fTwlM4/r3znzUD5qhfV5RrvQfPRk/fPL+U60y+my+2Wd8 pf5G7i2Appzjnpdp6mip2i0Vad2x5wwhIVb8i3zDpn/U3706xoEuyEke3fcjiaOq klBpOHpJR0sSgyynpfYY1YFZnzez8xO8HsLjKAiWSP6/NkAFoj5atsyIInTOrcyq ZNxOGnoEVHDo3hmALYo8C+ufL5lN2dXJVYEMTELS6lwOMm6Z9u9jsT23algHvST9 B470k++/MxDwwHWZC0l2lRjser/DzbViH1U3J1LW4qbaO9UnrCL6x6lM/1gUTm2N /qemk9P08EFPqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvgedgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedujeevjeffjeevuddutedvkeeiueeitddvieelfeekveej udefgeeuvdejhfeuleenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 20 Oct 2021 09:39:18 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 1A0E72A0608; Wed, 20 Oct 2021 10:39:15 -0300 (-03) Date: Wed, 20 Oct 2021 10:39:15 -0300 From: Alvaro Herrera To: Amit Kapila Cc: Dilip Kumar , Robert Haas , PostgreSQL Hackers Subject: Re: pgsql: Document XLOG_INCLUDE_XID a little better Message-ID: <202110201339.vrrwchc7jkwo@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 API-wise, this seems a good improvement and it brings a lot of clarity to what is really going on. Thanks for working on it. Some minor comments: Please do not revert the comment change in xlogrecord.h. It is not wrong. The exceptions mentioned are values 252-255, so "a few" is better than "a couple". In IsTopTransactionIdLogPending(), I suggest to reorder the tests so that the faster ones are first -- or at least, the last one should be at the top, so in some cases we can return without additional function calls. I don't think it'd be extremely noticeable, but as Tom likes to say, a cycle shaved is a cycle earned. XLogRecordAssemble's comment should explain its new output argument. Maybe "*topxid_included is set if the topmost transaction ID is logged with the current subtransaction". I think these new routines IsTopTransactionIdLogPending and MarkTopTransactionIdLogged should not be at the end of the file; a location closer to where MarkCurrentTransactionIdLoggedIfAny() seems more appropriate. Keep related things closer. (In this case these are operating on TransactionStateData, and it looks right that they would appear somewhat about AssignTransactionId and GetStableLatestTransactionId.) Does MarkTopTransactionIdLogged() have to be inside XLogInsertRecord's critical section? The names IsTopTransactionIdLogPending() and MarkTopTransactionIdLogged() irk me somewhat. It's not at all obvious from these names that these routines are mostly about actions taken for a subtransaction. I propose IsSubxactTopXidLogPending() and MarkSubxactTopXidLogged(). I don't feel the need to expand "Xid" to "TransactionId" in these function names. In TransactionStateData, I propose this wording for the comment: bool topXidLogged; /* for a subxact: is top-level XID logged? */ Thanks! -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Cuando mañana llegue pelearemos segun lo que mañana exija" (Mowgli)