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.96) (envelope-from ) id 1w3mNK-001XS9-33 for pgsql-hackers@arkaria.postgresql.org; Sat, 21 Mar 2026 02:47:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3mMJ-008haf-0y for pgsql-hackers@arkaria.postgresql.org; Sat, 21 Mar 2026 02:46:39 +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.96) (envelope-from ) id 1w3mMI-008haX-26 for pgsql-hackers@lists.postgresql.org; Sat, 21 Mar 2026 02:46:39 +0000 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w3mMC-00000000GHh-2YVx for pgsql-hackers@postgresql.org; Sat, 21 Mar 2026 02:46:38 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 4AC6D1400200; Fri, 20 Mar 2026 22:46:31 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Fri, 20 Mar 2026 22:46:31 -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=fm1; t=1774061191; x=1774147591; bh=n3LC85ExTZ lD8LSMtJslaeK5as8cVHTjAqU1wi2OCTE=; b=UvqoN/XP5kfQfa87bbNFCSAP6m Duyp1OeNvxUule5KGg+CrJKLg262laBXjuWm81XtBXZvYjYD4RcM4NMIz/ts+pDe tM2nfSJ0ppnvfwDdlJYUWsHYx4x4d+Glo0Deb/nd9jPR3Ykrvo0Z4NZ62gRDAMLh wiEVNNfeMcMcmdgRHHbQtzFFbt9tiRwJSqMTinXdQU8QCrhFfPicSSffE6lp8i/R Od13DiRnkcP58CV9cB0yW4JoqZJk9e6/+s1aWrpp76d+UtqrVtv42YlJR/VAIowN FSfP/0rpJcFBPqk7+viaXybdnenFWpbYfNC9eklWpeUalca0m73oGYNQE9CQ== 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-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1774061191; x=1774147591; bh=n3LC85ExTZlD8LSMtJslaeK5as8cVHTjAqU 1wi2OCTE=; b=ufPXmi7T4bJuZfyK45FIebbY31NuGGRZ2OoLZH2Pc7b9IHchjES JGWRtI2fxzXoaAEvq9e4MgOl7DZeb1BCODx0NZJ0SCwtSlhXBa+aRtXGT3SS+c+s FFt82eGWUC76ZFuoE7IBh6PSatb043bLJWnRbDpkT9NUtllT67WM9zbLcU3FdDl8 rQv+yWEQQbqI7P72dB7sJkt7hZISGOTZrTiwcZiokYD5iAKKWXjKsBKoXwCBDn0s ZoOq7zX6Tmd3nx3Pe66ytbL92+FcA4iFYMFlW+V/6N6cETlXN+72Ec0jxY9Wm4oq j/rZzP/3WvEbJ7gJ9f9bSTq2Q4woX9PHgJA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdefudduieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdlfeehmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepgeffjeevgfevuddvjedtvddtieej heduueelvddufedtgfefjedvkeevkeeivddvnecuffhomhgrihhnpehpohhsthhgrhgvsh hqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiipdhnsggprhgtphhtthhopeekpd hmohguvgepshhmthhpohhuthdprhgtphhtthhopehtghhlsehsshhsrdhpghhhrdhprgdr uhhspdhrtghpthhtohepvgigtghluhhsihhonhesghhmrghilhdrtghomhdprhgtphhtth hopehifigrthgrrdgrhigrsehfuhhjihhtshhurdgtohhmpdhrtghpthhtohepshhmihht hhhpsgdvvdehtdesghhmrghilhdrtghomhdprhgtphhtthhopehkuhhrohgurgdrhhgrhi grthhosehfuhhjihhtshhurdgtohhmpdhrtghpthhtohepphgrvhgvlhdrshhtvghhuhhl vgesghhmrghilhdrtghomhdprhgtphhtthhopehlihdrvghvrghnrdgthhgrohesghhmrg hilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehpohhsthhgrhgv shhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Mar 2026 22:46:28 -0400 (EDT) Date: Sat, 21 Mar 2026 11:46:23 +0900 From: Michael Paquier To: Tom Lane Cc: Alexander Lakhin , =?utf-8?B?SXdhdGEsIEF5YS/lsqnnlLAg5b2p?= , Peter Smith , =?utf-8?B?S3Vyb2RhLCBIYXlhdG8v6buS55SwIOmavOS6ug==?= , Pavel Stehule , Chao Li , pgsql-hackers Subject: Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE Message-ID: References: <1020519.1773863522@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KMNwu+aFFu8hPoZK" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --KMNwu+aFFu8hPoZK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 19, 2026 at 09:54:04AM +0900, Michael Paquier wrote: > For now I am planning for the attached to get more information from > widowbird, which should take a few days at worst. That would make > clear if we have a timing issue with the requests sent to the > postmaster. Launching the queries for worker_spi_launch() and > pg_stat_activity on the database postgres may also improve things, but > I don't really buy it, even if I may be wrong. A couple of days later after 79a5911fe65b, widowbird seems to have cooled down a bit: https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=3Dwidowbird&br= =3Dmaster The extra debugging information is proving to be useful. For example, looking at this one for the RENAME TO case: https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=3Dwidowbird&d= t=3D2026-03-19%2003%3A35%3A03&stg=3Dmodule-worker_spi-check And some problematic pattern logs: 2026-03-19 04:49:07.848 UTC [271557:4] 002_worker_terminate.pl LOG: statement: ALTER DATABASE testdb RENAME TO renameddb =20 2026-03-19 04:49:07.849 UTC [271557:5] 002_worker_terminate.pl DEBUG: attempting worker termination for database 16413 =20 2026-03-19 04:49:07.849 UTC [271557:6] 002_worker_terminate.pl DEBUG: termination requested for worker (PID 271553) on database 16413 [...] 2026-03-19 04:49:08.732 UTC [271557:19] 002_worker_terminate.pl DEBUG: attempting worker termination for database 16413 =20 2026-03-19 04:49:08.732 UTC [271557:20] 002_worker_terminate.pl DEBUG: termination requested for worker (PID 271553) on database 16413 =20 So we are able to send the requests to the workers, and these can take a long time before being processed by the postmaster. Querying directly "postgres" for the worker_spi_launch() and pg_stat_activity queries seems to have reduced the friction, with less requests to send. However, I don't think that this is the end of the story, even after 79a5911fe65b I have spotted one case of RENAME TO where the requests were sent for a bit more than 4s, before the postmaster had the idea to catch up. RENAME TO is the only one that can get slow (really no idea why), so I guess that we could always tweak things a bit more: 1) Extra injection point to increase the timeout (30s or 60s?) and give the postmaster more room to proceed the requests. 2) Remove this portion of the test, but it would be sad. I'll keep an eye for more failures, even if the situation is looking slightly better. -- Michael --KMNwu+aFFu8hPoZK Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmm+Bn8ACgkQnvQgOdby QH2wqg/+N9+jf6YWU0mkDroPW2A8Q4zc7SR1Zlym0jGeOz4g20UdXUEfEqrfSErP ftXna81uJOpzYlksupeVvlLg8Nbn1ntGsTIytvScXeA/7g2L3gBcoA1Nucld76TQ vEOjddMyPo7ghkOJ82Q/E05n4gaSFUzM1MJpap3Qo55wHAc/AaxtcDXE8h4MGKZ3 aAC+GVnL/ZPtIWFgcL61IOQq5/fPxn0a5kBeaNIRE9vV2Kw1MTCglYlZMxw+/6TW 1Tlls9FzIxlM6NFw9+HWHhMAtyY9tnM/9Pt5iru+AJhkqtwhIqY7A8XKWh9GDYNR L/7YfaXy6/NAHKgPTd9qi5yui+mZNp+Q5/HbdgBbUbmEvE8hhePKpXVO7mIndmEH ZL1JxksVM9Fyo7yJVDbSAumfk5pS4/Fo959NVZj4cbnvoNHs2ImQxquNoBH/8AvN 5lgjnYrnUbwGJS4fRsyDikK/HPjERQRUFm9GYjRP5BQMMj5FzXUU1RqrOQFixBD5 JbrFD3vRiFsZeyDtQkKYK+S9yVz5JKGjgODe0gqOgwmOdSrLvGIJMX+2fIKOsHRa kSG366b+pq0El3SPkdFADzlyuS/hKFSePW1OGPJIJvqpbtKxWscI/cNWuUYOIC4I bpywgLqhBysYeLG3INuvxO9fK6ZCxs0cHFHvh9pSCqYntEitTVs= =vrzi -----END PGP SIGNATURE----- --KMNwu+aFFu8hPoZK--