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 1qIOe0-0007AF-Mp for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Jul 2023 07:15:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qIOdz-0004wW-A1 for pgsql-hackers@arkaria.postgresql.org; Sun, 09 Jul 2023 07:15:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qIOdy-0004wN-VC for pgsql-hackers@lists.postgresql.org; Sun, 09 Jul 2023 07:15:43 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qIOds-0033OG-P0 for pgsql-hackers@lists.postgresql.org; Sun, 09 Jul 2023 07:15:42 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fbd33a57dcso37947555e9.0 for ; Sun, 09 Jul 2023 00:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688886935; x=1691478935; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vEs2kpsh1zv0siIiy2/cnXTesUKmBPTZkwrsBYe9tKY=; b=XFUOwD3P170f/MT52ZjZROH0M5bLu8uZYMJmA17ggUzkvhfMKrA3pCd5thWC1v6VOa ZUYkueVfTwsEUH+MD3/BFTnel/jcNtFaFdehypH14j0jRgEoET8W7r6ne+cohfq/xUR9 FTFoEXQ5dHm+zTtRiJ/GAQiBXYayKSHQrZ7l6pp21QymAsKt6ynJhCgOg813touQcHC9 o3pv/D7E4s0bLRkx8LpC6Rri4IbqFpFX91K7wMd7EAm6gpHQc+68QYzifD3jPcq1+ESi 1LjNcBRQ4euTqY1924J2/RfZGG33iFJH8UXwdSCccV/sl3cHsf3dYfiF95lIuo1NiIt6 hJ4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688886935; x=1691478935; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vEs2kpsh1zv0siIiy2/cnXTesUKmBPTZkwrsBYe9tKY=; b=CflOHs0oj/CuJo1ZtoQ6+k1B+HZvom9qRlhMROLbGyWC6XSwiNWP1hwBAZN3L+31fL XrRWBijcIeQeDOSyVRKyOtsnPovXCVtB3CPN+4x+ICeBlYjfGjJsDJhOvDzhs0Zh7gUS ttXZ3IQm8x6nkoNoSxkpW6QJ88QUqjL3YGJSg6vMkj+7I/jgthg3/PRoKfLV+j9GlPRP iXzPrLxtMTX7Q2AYUgo8mqa0bz5rMYDCyus/+OPfGb3LSvcv+OwPG+swvqHnP5mXAcvo qC6FEIy0lgiKwhzTB+FtRFFoqYiKFXNBU5RpY/Px/EmvhH7BKS40ZEecXBB4ah7iKEeb VasQ== X-Gm-Message-State: ABy/qLa/XVH/zu+uiH24rcl73+5HjJ8MpPfCe3RS8Y7sgzDE55QxsK9i OP2/2X8L+Uud2Zzw12eUZLY= X-Google-Smtp-Source: APBJJlF57KWIBDHZebCCQhpn2Yt2KEAam+CJ/fxSLz+6uwGlXkYF5tF1q4/24ti8bBY8cLNXpXdhug== X-Received: by 2002:a05:600c:c8:b0:3fb:ce46:c0b3 with SMTP id u8-20020a05600c00c800b003fbce46c0b3mr9217912wmm.35.1688886935153; Sun, 09 Jul 2023 00:15:35 -0700 (PDT) Received: from ?IPV6:2a01:cb11:55e:1700:a:ef87:3511:743? ([2a01:cb11:55e:1700:a:ef87:3511:743]) by smtp.gmail.com with ESMTPSA id p11-20020a1c740b000000b003fbe36a4ce6sm6881990wmc.10.2023.07.09.00.15.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Jul 2023 00:15:34 -0700 (PDT) Message-ID: <1f74adab-5ed8-450a-853a-f0b4bfe0e751@gmail.com> Date: Sun, 9 Jul 2023 09:15:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: Autogenerate some wait events code and documentation To: Michael Paquier , Andres Freund Cc: PostgreSQL Hackers References: <69588eaf-02d7-95a8-0da4-3e120de16a59@gmail.com> <0b3cdac7-f078-61a6-76e0-99db7aae78ce@gmail.com> <20230705215939.ulnfbr4zavb2x7ri@awork3.anarazel.de> <20230707011943.qxbj3vj2iwsfgqvq@awork3.anarazel.de> Content-Language: en-US From: "Drouvot, Bertrand" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 7/9/23 6:32 AM, Michael Paquier wrote: > On Fri, Jul 07, 2023 at 01:49:24PM +0900, Michael Paquier wrote: >> Hmm. If we go down this road I would make the choice of simplicity >> and remove entirely a column, then, generating the snakecase from the >> camelcase or vice-versa (say like a $string =~ s/([a-z]+)/$1_/g;), >> even if it means having slightly incompatible strings showing to the >> users. And I'd rather minimize the number of exceptions we need to >> handle in this automation (aka no exception rules for some keywords >> like "SSL" or "WAL", etc.). > > After pondering more about that, the attached patch set does exactly > that. Thanks! > Patch 0001 includes an update of the wait event names so as > these are more consistent with the enum elements generated. With this > change, users can apply lower() or upper() across monitoring queries > and still get the same results as before. An exception was the > message queue events, which the enums used "MQ" but the event names > used "MessageQueue", but this concerns only four lines of code in the > backend. The newly-generated enum elements match with the existing > ones, except for MQ. > > Patch 0002 introduces a set of simplifications for the format of > wait_event_names.txt: > - Removal of the first column for the enums. > - Removal of the quotes for the event name. We have a single keyword > for these, so that's kind of annoying to cope with that for new > entries. > - Build of the enum elements using the event names, by applying a > rebuild as simple as that: > + $waiteventenumname =~ s/([a-z])([A-Z])/$1_$2/g; > + $waiteventenumname = uc($waiteventenumname); > > Thoughts? That's great and it does simplify the wait_event_names.txt format (and the impact on "MQ" does not seem like a big deal). I also noticed that you now provide the culprit line in case of parsing failure (thanks for that). # -# "C symbol in enums" "format in the system views" "description in the docs" +# "format in the system views" "description in the docs" Should we add a note here about the impact of the "format in the system views" on the auto generated enum? (aka how it is generated based on its format)? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com