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 1rlzWs-005L7J-G0 for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Mar 2024 23:02:59 +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 1rlzWp-00DT3z-9Z for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Mar 2024 23:02:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rlzWn-00DT3r-DG for pgsql-hackers@lists.postgresql.org; Sun, 17 Mar 2024 23:02:55 +0000 Received: from wfout2-smtp.messagingengine.com ([64.147.123.145]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rlzWi-00558K-ER for pgsql-hackers@lists.postgresql.org; Sun, 17 Mar 2024 23:02:52 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfout.west.internal (Postfix) with ESMTP id 92AC91C0009B; Sun, 17 Mar 2024 19:02:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 17 Mar 2024 19:02:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1710716564; x=1710802964; bh=ID4cp3X19k qZiT8Z/QT2IOYqEDs3UbjrU0imNqGkLMM=; b=UGnMaZ6kJhxj2LQL1LOiafd8Up Arut78pgpohkKC6nUGdl7i9jlHvXWTYfTc/gJ+3ITKazE71SH1hkU5hT15qvfJEg 5kvKTEq97JHnK+pXdjC6TftJ1Fqx67ApW8Wc1SFTQmDMEsOKzeA87Xt4Cg7ppfhi kRX85ahtU9k8hbXVth8gXoOD24AhCAR6EAqa31mfi/fLGWstucLXAzDwsYrUyfDN pRm73k4ETzf8ICe4J8iISp6xGVjkMEK4gVINDGNqNwyKD1sSrxVmGMCndwL0iout 6zDOxZuTgz8aweSlr0/xSCACsNJ9qjvcNcl4fGthvlBGxI6dWjthKzTvYOpQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1710716564; x=1710802964; bh=ID4cp3X19kqZiT8Z/QT2IOYqEDs3 UbjrU0imNqGkLMM=; b=mO0IpsTKwKrrmv7R9PC4/q52zMmFRQLhv1ivSP/3WGBZ YVGTrbod1K3MB9N3XRNpS2BJLYeR4FLpTwJi2az6mWvOPd/DML4q4PyQ34rfpXsr 8gqtg0C5sIMDafx+BwMScUi8k74B+wRSV3Rp8yBBHSXi1y1ZXqChCQDXFJvssRDB iVxPchQQUOqGcPad1Vwq3LTfQrdkQWdlB9jp4TcKsPsPItu9Puu7730dYwe8C4+Q x+5ozquIb2pMmdU1ouwwwut9VFQ5DLfP4/wFYGQBF2leJ+Rg8d83fQmmVMACrET5 A1nMnKa9HKhMDuTy8GMO8bF4Vm04uOVGcrjNfu/npA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrkeeigddtiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdefhedmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetteegvddvveeuieduudevkeff veevtdduleehleelffdtvdegfeegtdejtedtkeenucffohhmrghinhepphhoshhtghhrrd gvshenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehm ihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 17 Mar 2024 19:02:41 -0400 (EDT) Date: Mon, 18 Mar 2024 08:02:24 +0900 From: Michael Paquier To: Noah Misch Cc: "Drouvot, Bertrand" , PostgreSQL Hackers Subject: Re: Autogenerate some wait events code and documentation Message-ID: References: <976f4eb1-cbc0-9616-ec26-ebb4a252315c@gmail.com> <69588eaf-02d7-95a8-0da4-3e120de16a59@gmail.com> <0b3cdac7-f078-61a6-76e0-99db7aae78ce@gmail.com> <20240317183114.16@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="VczgSuiIbYBCIHHr" Content-Disposition: inline In-Reply-To: <20240317183114.16@rfd.leadboat.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --VczgSuiIbYBCIHHr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 17, 2024 at 11:31:14AM -0700, Noah Misch wrote: > I like the new developer experience of adding a wait event. After releas= e of > v17, how should we approach back-patching an event, like was done in comm= its > 8fa4a1a 1396b5c 78c0f85? Each of those commits put the new event at the = end > of its released-branch wait_event.h enum. In v17, > generate-wait_event_types.pl sorts events to position them. Indeed, that would be a bad idea. > Adding an event > will renumber others, which can make an extension report the wrong event = until > recompiled. Extensions citus, pg_bulkload, and vector refer to static ev= ents. > If a back-patch added WAIT_EVENT_MESSAGE_QUEUE_SOMETHING_NEW, an old-build > pg_bulkload report of WAIT_EVENT_PARALLEL_CREATE_INDEX_SCAN would show up= in > pg_stat_activity as WAIT_EVENT_PARALLEL_BITMAP_SCAN. (WAIT_EVENT_EXTENSI= ON is > not part of a generated enum, fortunately.) Some options: >=20 > 1. Don't back-patch wait events to v17+. Use the closest existing event. > 2. Let wait_event_names.txt back-patches control the enum order. For exa= mple, > a line could have an annotation that controls its position relative to= the > auto-sorted lines. For another example, the generator could stop sort= ing. > 3. Accept the renumbering, because the consequence isn't that horrible. >=20 > Option (3) is worse than (1), but I don't have a recommendation between (= 1) > and (2). I tend to like (1), a concern being the ease of accidental > violations. If we had the ABI compliance checking that > https://postgr.es/m/flat/CAH2-Wzk7tvgLXzOZ8a22aF-gmO5gHojWTYRvAk5ZgOvTrcE= Qeg@mail.gmail.com > explored, (1) would be plenty safe. Should anything change here, or not? (1) would be annoying, we have backpatched scaling problems in the past even if that does not happen often. And in some cases I can understand why one would want to add a new wait event to track that a patch does what is expected of it. (2) to stop the automated sorting would bring back the problems that this thread has spent time to solve: people tend to not add wait events correctly, so I would suspect issues on HEAD. I've seen that too many times on older branches. I see an option (4), similar to your (2) without the per-line annotation: add a new magic keyword like the existing "Section" that is used in the first lines of generate-wait_event_types.pl where we generate tab-separated lines with the section name as prefix of each line. So I can think of something like: Section: ClassName - WaitEventFoo FOO_1 "Waiting in foo1" FOO_2 "Waiting in foo2" Backpatch: BAR_1 "Waiting in bar1" BAR_2 "Waiting in bar2" Then force the ordering for the docs and keep the elements in the backpatch section at the end of the enums in the order in the txt. One thing that could make sense is to enforce that "Backpatch" is at the end of a section, meaning that we would need a second keyword like a "Section: EndBackpatch" or something like that. That's not strictly necessary IMO as the format of the txt is easy to follow. -- Michael --VczgSuiIbYBCIHHr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmX3doAACgkQnvQgOdby QH2S7Q//f8OHyetGui5Gkze02ryW+RHl6IxwWR0FvgenKi/Y8YqmG8FjWYsZQ5U9 LuIPGzWBsmYsPphBFT41w/t1N+qKaZlfTR4o1niNKGjLf7rv2f3sUFFIG5ZKRL02 bFkVtvgMdE7gb9aI4yUggJIx7oUA5ez2lWOQg1Nns3MMRNE9BtfBT8G9osecvSwB KG5iz5JDaNKmGj7TqyHr5SQB/JRlwaxtkItNORxM9fmDNupc8dmKZPoARn5uTe5n 60Zp62wHtG76zPq2X74iMUpsD/ZT11qvKbaMNrJSktCNFF0dpZVQl1/2U+0N0tuc INlDdSqZOqLFzUN9qacmejfeoGiElRd86uL8g6jDeW5HaQXza6aPX2NoevC6r1KC /zAqAm8mED66p9L688mBNHixymXuTXBRJZO099PD5TyAwaMg8Vl9FsDOv/2Oywp+ EpBnSqCxk2A2nLE98V2CCm22nwVj3G+zdgFRGsK9EqTxOEo9J73fvScHrOJIHC7y 5MepnWJCs326XdqlQL7if4J/yTpIkyf10mDPc3UK0VpWBGV2tAuSYBe1s3yZdKi1 YvPeN58SJIAMCHLv3nsb254rt2DX8+g0KE5wmisAPRnimbwAELRJDUhj/UTKwQdN TA5zad1OXryxMVVkBulQVz5lJPzeh1VeB/2v20VLGHn1MvGM5bA= =4q5i -----END PGP SIGNATURE----- --VczgSuiIbYBCIHHr--