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 1qA7t4-0002Zh-6V for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Jun 2023 11:45:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qA7t2-0000cN-BA for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Jun 2023 11:45:04 +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 1qA7t2-0000c5-1h for pgsql-hackers@lists.postgresql.org; Fri, 16 Jun 2023 11:45:04 +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 1qA7su-002WVn-Sg for pgsql-hackers@lists.postgresql.org; Fri, 16 Jun 2023 11:45:02 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id 55B2F6063B; Fri, 16 Jun 2023 20:44:53 +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: Fri, 16 Jun 2023 20:44:53 +0900 From: Masahiro Ikeda To: Michael Paquier Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Support to define custom wait events for extensions In-Reply-To: References: User-Agent: Roundcube Webmail/1.4.11 Message-ID: <9b7a7edfc9fbe8dad9f0e35ada6d0c7e@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-06-16 16:46, Michael Paquier wrote: > On Fri, Jun 16, 2023 at 11:14:05AM +0900, Masahiro Ikeda wrote: >> I tried to query on pg_stat_activity to check the background worker >> invoked by pg_prewarm. But, I found that pg_stat_activity doesn't show >> it although I may be missing something... >> >> So, I tried to implement TAP tests. But I have a problem with it. >> I couldn't find the way to check the status of another backend >> while the another backend wait with custom wait events. > > Hmm. Right. It seems to me that BGWORKER_BACKEND_DATABASE_CONNECTION > is required in this case, with BackgroundWorkerInitializeConnection() > to connect to a database (or not, like the logical replication > launcher if only access to shared catalogs is wanted). > > I have missed that the leader process of pg_prewarm does not use that, > because it has no need to connect to a database, but its workers do. > So it is not going to show up in pg_stat_activity. Yes. Thanks to your advice, I understood that BGWORKER_BACKEND_DATABASE_CONNECTION is the reason. I could make the TAP test that invokes a background worker waiting forever and checks its custom wait event in pg_stat_activity. So, I'll make patches including test codes next week. Regards, -- Masahiro Ikeda NTT DATA CORPORATION