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 1n9aI4-0007M2-7g for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Jan 2022 22:15:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n9aI3-0003tN-2X for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Jan 2022 22:15:51 +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 1n9aI1-0003sc-QF for pgsql-hackers@lists.postgresql.org; Mon, 17 Jan 2022 22:15:50 +0000 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9aHy-0003Ux-Uu for pgsql-hackers@postgresql.org; Mon, 17 Jan 2022 22:15:48 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 6B5D22B00284; Mon, 17 Jan 2022 17:15:44 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 17 Jan 2022 17:15:45 -0500 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=KmdtXeAsYcHr5R4gII9NqdADIHmfetxC7+vQClxT1CI=; b=BlFx6toW c2XuKBL4MeIf+uHQTdUxjm+R1f+RD81QNeTuqd4rHcTqetdZtLrbpmH0vo/t6qPz 6gFwPIFzCiyUyjjohOlPkzzJ+awvAGffRM5AU5LaXF5X2zuG4tk5dF/kevU+wuCD P+NC+oT7WbqEXuK50+iTehC6YTjHzEAWFm7rfjciFZvdBgBiEo97n7avzGhGl4XY M6/d9aoUV748zfjQuBat0Hppoy6NsetFdxP9G/pVA6Xc+kRwN+gxVR7qEVXxIuuW oIFICsFNsANwxfYv+KzD6UCLksz+8iKssR0Tmfpk53WpufSw2Up9SH0ceJ/Ww2IE 6+K8IJgQ1maQrg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddruddugdduheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeejjeevffeukeejieekheehleduudehteeiudegteetkefh veelhfefvdduvdfgfeenucffohhmrghinhepphhoshhtghhrrdgvshdpvghnthgvrhhprh hishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 17 Jan 2022 17:15:42 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 286792A06D7; Mon, 17 Jan 2022 19:15:40 -0300 (-03) Date: Mon, 17 Jan 2022 19:15:40 -0300 From: Alvaro Herrera To: Tom Lane Cc: Amit Langote , Andrew Dunstan , Ibrar Ahmed , Arne Roland , "David G. Johnston" , Masahiko Sawada , Peter Eisentraut , PostgreSQL-development , Rahila Syed , Tomas Vondra Subject: Re: a misbehavior of partition row movement (?) Message-ID: <202201172215.2tse3vjjgi2b@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <150333.1642455485@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Jan-17, Tom Lane wrote: > But could we please do it in a way that is designed to keep the > code readable, rather than to minimize the number of lines of diff? > It makes zero sense to have the bits in AFTER_TRIGGER_TUP_BITS not > be adjacent. So what should happen here is to renumber the symbols > in between to move their bits over one place. Is it typical to enumerate bits starting from the right of each byte, when doing it from the high bits of the word? DONE and IN_PROGRESS have been defined as 0x1 and 0x2 of that byte for a very long time and I found that very strange. I am inclined to count from the left, so I'd pick 8 first, defining the set like this: #define AFTER_TRIGGER_OFFSET 0x07FFFFFF /* must be low-order bits */ #define AFTER_TRIGGER_DONE 0x80000000 #define AFTER_TRIGGER_IN_PROGRESS 0x40000000 /* bits describing the size and tuple sources of this event */ #define AFTER_TRIGGER_FDW_REUSE 0x00000000 #define AFTER_TRIGGER_FDW_FETCH 0x20000000 #define AFTER_TRIGGER_1CTID 0x10000000 #define AFTER_TRIGGER_2CTID 0x30000000 #define AFTER_TRIGGER_CP_UPDATE 0x08000000 #define AFTER_TRIGGER_TUP_BITS 0x38000000 (The fact that FDW_REUSE bits is actually an empty mask comes from 7cbe57c34dec, specifically [1]) Is this what you were thinking? [1] https://postgr.es/m/20140306033644.GA3527902@tornado.leadboat.com -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/ "All rings of power are equal, But some rings of power are more equal than others." (George Orwell's The Lord of the Rings)