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 1qVTMg-000I6O-8V for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Aug 2023 08:55:54 +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 1qVTMe-002VK5-Np for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Aug 2023 08:55:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qVTMe-002VJw-DQ for pgsql-hackers@lists.postgresql.org; Mon, 14 Aug 2023 08:55:52 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qVTMX-0003Hf-Tn for pgsql-hackers@lists.postgresql.org; Mon, 14 Aug 2023 08:55:51 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id 69E8060688; Mon, 14 Aug 2023 17:55:42 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 14 Aug 2023 17:55:42 +0900 From: Masahiro Ikeda To: Michael Paquier Cc: Andres Freund , Bharath Rupireddy , Tristan Partin , pgsql-hackers@lists.postgresql.org Subject: Re: Support to define custom wait events for extensions In-Reply-To: References: <20230808225954.vh6xwikz4fxjbprz@awork3.anarazel.de> <20230809003710.qhys7nvwhdujd4pm@awork3.anarazel.de> <0850ea2f23217b3a87340dd2d721d051@oss.nttdata.com> <53dc58793eb3df17d2da8c2fc2275fac@oss.nttdata.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <4f5e455cde9805dd81332d515376bc12@oss.nttdata.com> X-Sender: ikedamsh@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-08-14 15:28, Michael Paquier wrote: > On Mon, Aug 14, 2023 at 12:31:05PM +0900, Masahiro Ikeda wrote: >> Thanks! I confirmed the changes, and all tests passed. > > Okay, cool. I got some extra time today and applied that, with a few > more tweaks. Thanks for applying master branch! > This looks correct, but perhaps we need to think harder about the > custom event names and define a convention when more of this stuff is > added to the core modules. I checked the source code how many functions use WAIT_EVENT_EXTENSION. There are 3 contrib modules and a test module use WAIT_EVENT_EXTENSION and there are 8 places where it is called as an argument. * dblink - dblink_get_conn(): the wait event is set until the connection establishment succeeded - dblink_connect(): same as above * autoprewarm - autoprewarm_main(): the wait event is set until shutdown request is received - autoprewarm_main(): the wait event is set until the next dump time * postgres_fdw - connect_pg_server(): the wait event is set until connection establishment succeeded - pgfdw_get_result(): the wait event is set until the results are received - pgfdw_get_cleanup_result(): same as above except for abort cleanup * test_sh_mq - wait_for_workers_to_become_ready(): the wait event is set until the workers become ready I'm thinking a name like "contrib name + description summary" would be nice. The "contrib name" is namespace-like and the "description summary" is the same as the name of the waiting event name in core. For example, "DblinkConnect" for dblink. In the same as the core one, I thought the name should be the camel case. BTW, is it better to discuss this in a new thread because other developers might be interested in user-facing wait event names? I also would like to add documentation on the wait events for each modules, as they are not mentioned now. Regards, -- Masahiro Ikeda NTT DATA CORPORATION