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 1vUgj0-004Wfe-1U for pgsql-hackers@arkaria.postgresql.org; Sun, 14 Dec 2025 07:41:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vUgix-00CN6i-0k for pgsql-hackers@arkaria.postgresql.org; Sun, 14 Dec 2025 07:41:00 +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 1vUgiw-00CN6Z-2S for pgsql-hackers@lists.postgresql.org; Sun, 14 Dec 2025 07:40:59 +0000 Received: from mail-yw1-x1133.google.com ([2607:f8b0:4864:20::1133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vUgiw-000abS-0W for pgsql-hackers@postgresql.org; Sun, 14 Dec 2025 07:40:58 +0000 Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-78c33d0df85so35609167b3.0 for ; Sat, 13 Dec 2025 23:40:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765698057; x=1766302857; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=x5m+Y1q75ysntXdzwiXqB+J5IH1VSjJbtpqA9pIT1/0=; b=AlecCwIejqL4Xut5UWSC+/1mGqnosJnwWHeY6u/EVdPbKlSGENotbdl2A/7QC5Q4Hd 5QxMiQarPZJRHju9DxOXw80lTxtyKKmpJbceJpa626HDkXEZPccArXL5Zmc/V0dDLCGD EtT7VMhMmRNJAHQlBy6qA0da1hKCQumPAFbHaimxiglw43p6Nw/7+iIt0TVRtSIAvmC3 U6npmTMOc6aw2/0ylWUl2xkELjNxgUcIHLwVSstx9ExpOnD5Azo/DjKKvhORCQYIEJKZ 6i8eHhQBhDK2/POR1BPc9IlfxjfI9WP/m6xwCigaXEJzVkEYTVBuRe0TcZ+6WPef1JFc Q4ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765698057; x=1766302857; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=x5m+Y1q75ysntXdzwiXqB+J5IH1VSjJbtpqA9pIT1/0=; b=pMfX3JpeV6neQmvbd+gEpk7ZuHqyZFRxLPloFhlugICvK9BdOTJMz23FxuHuHrsev+ WRXnPKcarKu9Pb4v4iIacRBLc/fuz8wPU081/dhEjFVF5wO+Xmv9eytHYYh2i1BFVa/J xO09IZrYnFAgQggEW+diHV+3AABDMqIf1KNedg5n7G5teHQF6g+ZO026MLq62W9Gk7CU K9uDVDkZhqScE4HhEN+Pyfe6uHkDJw6u10qQ8bF1R4BLKjYfiyt/xLTCKsTJrJjzglYS BK8p29f6mRagEa3aYATX2Fs1bPLfSSd6plBghZaUMQ3KlhWhvfQW4htVGECb7ZHJspFo BtkA== X-Forwarded-Encrypted: i=1; AJvYcCU60vWE+1VyH7pBM2ETY+y9sBJ82eEkr7n1jNRFc/0vvpcsMaIUAcAlpVBm6/jkMnOvD/+dy7tm4m1A8Xa7@postgresql.org X-Gm-Message-State: AOJu0Yz9YMEDm4gS5NN96D0vvffI/B0XX4rxO9DaPAqKci7xrxeuCmkP j5Q8lDMKShUgde81nY8ACzIBwzlaQNy+776ra7c/JTVeqQToXNZknx9OC99r50oFcgZFec6lXcm 6zUlnaPHXxjk2lKYCeeOBK/Ca/aCyhNE= X-Gm-Gg: AY/fxX4gZ0yAGkOrqlpIEv6E+c+HeTQjxVv+eHu/md5YReRTApmowWw2oRqtdXgles2 N+p8xZ26463XgyHg5/SsEhvFs4YbrMIJA9Hk2rBu33n1DFUfnkNqaFS+XfGKImuLvA9FLSMLpjX oRvO+wY9qfkLn6GA0U9GYWDknURj3LhQYeCl4oPSHvu/vVWMBnjFsVioXNAjauxknQq3rX7VecR 8tT92JpDhM75UG+2E6zlyp4Fxx2Q2Xio7EF/lEghRRhp6DeT5cEhksRwfnpRZcNCITZVqBpbjl4 LQIAasyOf7jsxn0i+T/hcRPwYm3IYsYa6ol/CyQ52YblFxq8M70HokxD+XpktuQ+SX1I6Zz3KHJ vT3v1PHBVJwdHpA== X-Google-Smtp-Source: AGHT+IFMW5nwThmAbVY75rT6dbcPatM9oDIHU3G8Cn7iiSic6XjSyjQwA+QDOOfxVTQ8wN0QH5sCx2sRlN3jeHckFfo= X-Received: by 2002:a05:690c:f8d:b0:78d:6551:2913 with SMTP id 00721157ae682-78e66d46084mr66072077b3.14.1765698057017; Sat, 13 Dec 2025 23:40:57 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Pavel Stehule Date: Sun, 14 Dec 2025 08:40:20 +0100 X-Gm-Features: AQt7F2rzHGaTa4DMgA4jQME9ZR0fP88GBmMgIgpeKiKJeAnalDyXYRDgork2_78 Message-ID: Subject: Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE To: Michael Paquier Cc: "Aya Iwata (Fujitsu)" , Peter Smith , Chao Li , "Hayato Kuroda (Fujitsu)" , pgsql-hackers Content-Type: multipart/alternative; boundary="000000000000781cf80645e49d6d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000781cf80645e49d6d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi ne 14. 12. 2025 v 8:26 odes=C3=ADlatel Michael Paquier napsal: > On Wed, Oct 15, 2025 at 02:48:43AM +0000, Aya Iwata (Fujitsu) wrote: > > Thank you for your comments. I updated this patch to v0007. > > + * Exit the bgworker when its database is dropped, renamed, moved to a > + * different tablespace, or used as a template for CREATE DATABASE. > > I don't think that we need to list all these operations in details > here. We could just say "if its database is involved in a CREATE, > ALTER or DROP database command". The docs should provide these > details, of course. > > +#define BGWORKER_EXIT_AT_DATABASE_CHANGE 0x0004 > > I am checking this patch, and I think so used names can be little bit confusing BGWORKER_EXIT_AT_DATABASE_CHANGE - it is used for disconnecting workers on the template database, and this database is not changing. TerminateBgWorkersByDbOid - it doesn't terminate all workers, but only workers with some special flags Maybe BGWORKER_INTERRUPTABLE and TerminateInterruptableBgWorkersByDbOid ? Another question is if this cancellation should be implicit and should not require some special flag. When I want to disconnect connections to database when I do drop, I have to use FORCE flag So maybe there should be ALTER DATABASE ... RENAME ... FORCE - or if FORCE can terminare all workers (without special FLAG) ? Regards Pavel --000000000000781cf80645e49d6d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

ne 14. 12. 2025 v=C2=A08:26 o= des=C3=ADlatel Michael Paquier <m= ichael@paquier.xyz> napsal:
On Wed, Oct 15, 2025 at 02:48:43AM +0000, Aya Iwata (Fuj= itsu) wrote:
> Thank you for your comments. I updated this patch to v0007.

+ * Exit the bgworker when its database is dropped, renamed, moved to a
+ * different tablespace, or used as a template for CREATE DATABASE.

I don't think that we need to list all these operations in details
here. We could just say "if its database is involved in a CREATE,
ALTER or DROP database command".=C2=A0 The docs should provide these details, of course.

+#define BGWORKER_EXIT_AT_DATABASE_CHANGE=C2=A0 =C2=A0 =C2=A0 =C2=A00x0004 =


I am checking this patch, and I think so us= ed names can be little bit confusing

= BGWORKER_EXIT_AT_DATABASE_CHANGE - it is used for disconnecting workers on = the template database, and this database is not changing.

TerminateBgWorkersByD= bOid - it doesn't terminate all workers, but only workers with some spe= cial flags

Maybe BGWORKER_INTERRUPTABLE and=C2=A0T= erminateInterruptableBgWorkersByDbOid ?

Another qu= estion is if this cancellation should be implicit and should not require so= me special flag.

When I want to disconnect connect= ions to database when I do drop, I have to use FORCE flag

So maybe there should be ALTER DATABASE ... RENAME ... FORCE - or i= f FORCE can terminare all workers (without special FLAG) ?

Regards

Pavel



--000000000000781cf80645e49d6d--