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 1puSeO-00036Q-5E for pgsql-hackers@arkaria.postgresql.org; Thu, 04 May 2023 06:41:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1puSeN-0001xs-1i for pgsql-hackers@arkaria.postgresql.org; Thu, 04 May 2023 06:41:11 +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 1puSeM-0001xj-L4 for pgsql-hackers@lists.postgresql.org; Thu, 04 May 2023 06:41:10 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1puSeJ-000RDU-Q6 for pgsql-hackers@lists.postgresql.org; Thu, 04 May 2023 06:41:09 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-2fc3f1d6f8cso3782911f8f.3 for ; Wed, 03 May 2023 23:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683182466; x=1685774466; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=uOUyNK8MU86Whc27IYwNqenta3F+oxnDeQoYit5bUPk=; b=FwOJ6E/MIXi283DEK7xgxU6iYP1Ctx2OvH8Q1wvwSnFtAHKf+SVJK2jZJfyQKbSgaw KaZxhbN+3fSvN8ASpsUUwdhw8Uksfs6s8UgspL2iDE+TtpikeBNkpNu7RQ0MSbDw1cWc VStoRtRFE5LuGPMbHjrY6zUqh2B3hrH+ufn/mfigK/kFaSi9Ma4/H/lC+5unVIFpESxp 2s8THtEn2dObN5NdMrcsZhpNrWn8XvSV361NQKsICJHQsqcCINzooex+MOwGZvKoaPIP GsaTz4pZAp0z0lJeIO8ESZe3fPxiK8ftSROxuYyYGMNcVXD6Z71/4NJ8fuk7C4aZfG5A I3Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683182466; x=1685774466; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uOUyNK8MU86Whc27IYwNqenta3F+oxnDeQoYit5bUPk=; b=j5bSfg4AB6vtZrQ/t8NLaCM188AWIrrYa3iYJgZCfyadr7hKSEisZ8L3BvoADGiYtD 8dQ/Gun9lEH8oVfqRNEWs1bPW6c2ckp97tN5wFfvVPWN9CxkuP42sxi0KeN4NCWMWDdD pblcUdTCee46dOdR2vampwdDNJ74rZZDH7uX2cI76XzY9irzmxCRU7i6VAB79eSpc2vl 67EziEQiz1bSJB7akIMMdUt5f/nMDlyXJqGcuO4ndleo2YFy1g7m4VcoDXH6YA0v7PG4 dUgsiB+gAv0NPQRJ+siVug5r2JmN3/ZIUtWVsuvmFjJQWYbs9Fcvuz7gOZiYwT2Ug0f6 5wZg== X-Gm-Message-State: AC+VfDwddmkPtZ18hnjfeGmw+tNWfDMqMuFMqd6e5MIqV70XMKbNLqIm 1UXVbryLjBXc9Qv1gajT5YU= X-Google-Smtp-Source: ACHHUZ4+PTNizbTdfqBegm+AUN8rCYfJ6q+Ub5KiQqBbrPx9auSkBqsRcPuUIwH97E88dcDK2M/HLw== X-Received: by 2002:adf:fa4a:0:b0:306:3814:e323 with SMTP id y10-20020adffa4a000000b003063814e323mr1723087wrr.56.1683182465532; Wed, 03 May 2023 23:41:05 -0700 (PDT) Received: from [192.168.9.11] ([54.239.6.186]) by smtp.gmail.com with ESMTPSA id z1-20020a5d44c1000000b00304a876c3c1sm20216268wrr.5.2023.05.03.23.41.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 May 2023 23:41:05 -0700 (PDT) Message-ID: <124bdcea-bdc8-e3d2-2357-0c6a857bc557@gmail.com> Date: Thu, 4 May 2023 08:39:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: Autogenerate some wait events code and documentation Content-Language: en-US To: Michael Paquier Cc: PostgreSQL Hackers References: <6b6cdc76-e10e-95f8-62cf-3a3137c86df5@gmail.com> <2e649ed7-6c66-5d6a-16d4-5d5367d40e69@gmail.com> <64fc361e-f4ed-45eb-0cfb-c8110872530d@gmail.com> 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 5/1/23 1:59 AM, Michael Paquier wrote: > On Fri, Apr 28, 2023 at 02:29:13PM +0200, Drouvot, Bertrand wrote: >> On 4/27/23 8:13 AM, Michael Paquier wrote: >>> >>> But do we need to merge more data than necessary? We could do things >>> in the simplest fashion possible while making the docs and code >>> user-friendly in the ordering: just add a section for Lock and LWLocks >>> in waiteventnames.txt with an extra comment in their headers and/or >>> data files to tell that waiteventnames.txt also needs a refresh. >> >> Agree that it would fix the doc ordering and that we could do that. > > Not much a fan of the part where a full paragraph of the SGML docs is > added to the .txt, particularly with the new handling for "Notes". I understand your concern. > I'd rather shape the perl script to be minimalistic and simpler, even > if it means moving this paragraph about LWLocks after all the tables > are generated. I'm not sure I like it. First, it does break the "Note" ordering as compare to the current documentation. That's not a big deal though. Secondly, what If we need to add some note(s) in the future for another wait class? Having all the notes after all the tables are generated would sound weird to me. We could discuss another approach for the "Note" part if there is a need to add one for an existing/new wait class though. > > Do we also need the comments in the generated header as well? My > initial impression was to just move these as comments of the .txt file > because that's where the new events would be added, as the .txt is the > main point of reference. > Oh I see. The advantage of the previous approach is to have them at both places (.txt and header). But that said I understand your point about having the perl script minimalistic and simpler. >> Please note that it creates 2 new "wait events": >> WAIT_EVENT_EXTENSION and WAIT_EVENT_BUFFER_PIN. > > Noted. Makes sense here. Yup and that may help to add "custom" wait event for extensions too (need to think about it once this refactoring is done). > So, the change here.. > + # Exception here > + if ($last =~ /^BufferPin/) > + { > + $last = "Buffer_Pin"; > + } > > .. Implies the two following changes: > typedef enum > { > - WAIT_EVENT_BUFFER_PIN = PG_WAIT_BUFFER_PIN > + WAIT_EVENT_BUFFER_PIN = PG_WAIT_BUFFERPIN > } WaitEventBufferPin; > [...] > static const char * > -pgstat_get_wait_buffer_pin(WaitEventBufferPin w) > +pgstat_get_wait_bufferpin(WaitEventBufferPin w) > > I would be OK to remove this exception in the script as it does not > change anything for the end user (the wait event string is still > reported as "BufferPin"). This way, we keep things simpler in the > script. Good point, agree. > This has as extra consequence to require a change in > wait_event.h so as PG_WAIT_BUFFER_PIN is renamed to PG_WAIT_BUFFERPIN, > equally fine by me. Logically, this rename should be done in a patch > of its own, for clarity. Yes, I can look at it. > > @@ -185,6 +193,7 @@ distprep: > $(MAKE) -C utils distprep > $(MAKE) -C utils/adt jsonpath_gram.c jsonpath_gram.h jsonpath_scan.c > $(MAKE) -C utils/misc guc-file.c > + $(MAKE) -C utils/actvity wait_event_types.h pgstat_wait_event.c > Incorrect order, and incorrect name (s/actvity/activity/, lacking an > 'i'). > Nice catch. > +printf $h $header_comment, 'wait_event_types.h'; > +printf $h "#ifndef WAITEVENTNAMES_H\n"; > +printf $h "#define WAITEVENTNAMES_H\n\n"; > Inconsistency detected here. > > It seems to me that we'd better have a .gitignore in utils/activity/ > for the new files. > Agree. > @@ -237,7 +237,7 @@ autoprewarm_main(Datum main_arg) > (void) WaitLatch(MyLatch, > WL_LATCH_SET | WL_EXIT_ON_PM_DEATH, > -1L, > - PG_WAIT_EXTENSION); > + WAIT_EVENT_EXTENSION); > > Perhaps this should also be part of a first, separate patch, with the > introduction of the new pgstat_get_wait_extension/bufferpin() > functions. Okay, it is not a big deal because the main patch > generates the enum for extensions which would be used here, but for > the sake of history clarity I'd rather refactor and rename all that > first. > Agree, I'll look at this. > The choices of LWLOCK and LOCK for the internal names was a bit > surprising, while we can be consistent with the rest and use "LWLock" > and "Lock". > > Attached is a v7 with the portions I have adjusted, which is mostly OK > by me at this point. We are still away from the next CF, but I'll > look at that again when the v17 branch opens. Thanks for the v7! I did not look at the details but just replied to this thread. I'll look at v7 when the v17 branch opens and propose the separate patch mentioned above at that time too. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com