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 1w2uPv-000ikZ-33 for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 17:10:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2uPu-00CmMP-2f for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Mar 2026 17:10:46 +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 1w2uPt-00Cm3o-2a for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 17:10:45 +0000 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2uPq-00000000OSp-2GEP for pgsql-hackers@lists.postgresql.org; Wed, 18 Mar 2026 17:10:44 +0000 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-7d7c76e1951so76111a34.1 for ; Wed, 18 Mar 2026 10:10:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773853843; cv=none; d=google.com; s=arc-20240605; b=N/aTCU1A7AWonbQ+t1YRZNAVz2Z8zcDBJ/sBWEnTiRCWNRJ9MNW0/4/xBktM/Cd1hY 8+r+UyhqrtGIQw+Z0d9J/5C0u4mnbz/YHTzcENgJhBqg9G8uidHrQ65T/ED8Vmc7Gxk3 K6g0pr1Ks+K9epNz6tqCSZBEtG53hq6nrzkvghlGD/yyPfGqvmkQgqo6XL+PT7lycrjJ CEktv2ShY+b7eIe3ays2eEFxbyFCSE8iafhVh+lausOmEl72Bhhk/Kpy9LSfTkhVVo9m yYNwdfC/HQ0zSQcTyFqxxfoLdQFOhR5+H4qR9ZaY+5g2MypUDrcIhlO4xXLihvf3A5f0 aYiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=QNkDWRq/TEZwtj2xZiykT2F0nyUtLbmTax/ob7dF2jw=; fh=YhmxPC0NYagsxVMppzYMgO0XMWsRSWzMegLjmIklu8U=; b=CLkeNecmEWavUHEjHUiWPG9UKzBpSw/ZyCE1ui/e566mo4nOxTtJVG4z2MfSHwmsLT R9Vb2AWPTgOtv/Q+x+t+a6rYJ+kbmcwI4dC6MC5wfVuGWLSLi7rV0tr8M/QY9oy5N9Mq u7vir37Z0TQhknpLAY94bLNUKOxs17gJRgy2qXwxxqhyIzItN+qr4Rus8kCcddGlF3KA rgpt5hHsU9PzXsq0jeFhI5V6VrdnmETB03ggCuVGi3REQnNI7fw6egu4r85GtYBlXS3t gdzgxg0rTBilmb0cG9zu82HgJpmZ9+mQpM5qQUUq4Ga6p/ihwI4k8qdFmvCw1IYX8W/M 3/nw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773853843; x=1774458643; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QNkDWRq/TEZwtj2xZiykT2F0nyUtLbmTax/ob7dF2jw=; b=GWkB53Rmg+v65unM7uofYmOLdkRqu6UBkRY3iDNxF8/Ln1sGZkFkNV4zFTu2WGcLiZ TgUw4fSD/6OHIk7GEY9wYxVO06+5syZ3Ifulf6qMmxtP866wlU/c7HK+hmc6uRDcze0S AWtKzf8QncZj3EzJcsrFO2F2SHpY1mqglo7VlcrPm0LAVdFZIM3BBYwInmWsqiD+Szu2 TlymeBU0BjPxijDw1VdHQkvEkHBXtYxHlgqjBDArJN6cIT/MGAIe9BfhxlWmI6+2h7V3 5ms5a0VXlSaknMJ+xKPt9BTUbuIrt9yKystphQlZBfsiecW8dKpZl4N5FGZuGdZLeeD7 1EfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773853843; x=1774458643; h=content-transfer-encoding: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=QNkDWRq/TEZwtj2xZiykT2F0nyUtLbmTax/ob7dF2jw=; b=FNWJjG81dQ3fGDmFKVLAuN1UNeNhlwpPIqaHGgtN3IHRDEdhbyAIOK7dDP3LNhG3q6 ERRiaDe9AnQqSaSTOZ796sm0tCajT8KZKU6atoI1wCLCMmfocN2bfow2gSDrGyZeiGza nZUqK+YmmnT/Nxa2Jp9X9rvP5PYbBwtr4xkGtm5y07jBVzlFm42guGcorLkvJ3YXuz/U 45wblqvDEH/sbz5GsR+aTOJDSQUjLfNesjjINYY1+S0YD5FRj3jdZCrlbfjFv5Hhqk/W dQEHnkX24HV85aRXllxh6iPrNf9Rj8cQKQRriWDcM/K8XYK3vVFccTUMT4yVDoiKnGIs OxUg== X-Gm-Message-State: AOJu0Yy4zMXCYILylLfpa/k/1U7apQtm+vBIMrVW+6vgdutsp2N6i1jM ph+mR2/9ZDN+S4CqUAaR/bo6kTsaYq5VPXWOspHy647VMOyH3pPGxDjudpMKffosI192VwcnE/Z xv8pAiP0NVrssw40SdWIq7dnBVSsdQf2Z6KXmNk0= X-Gm-Gg: ATEYQzyYi/2N4m/HwwRwb/A1YfKj18XK3rgQ/nnlZD+6pRAciQqmJn36qCKXHaae6UT qFSauULgM/zmOXUq8qy29WcuAjZ6RTAI0terp+yqp1jym/tJiDZvxPaUllkZ3keqBTJmUs8c++9 sqhhiYkPkues9ZZntRvAw8WU1V8ZPZrqCEc3hCY6P9CussegQIzpfa+C4OtFTO77N7h93sq2HDW HtOzzDC1e4RWZoFkzVPEtcqWzckQa7c9j6c0ogK+8wZr+2gFHEzXfXihL26Z7vCNPPk8YiX4NHo e80mUHyc7iEeKSIrxmEDcLOosf+6oMLHBqichnDhrw== X-Received: by 2002:a05:6820:2981:b0:677:4fc0:a852 with SMTP id 006d021491bc7-67c0dae9889mr2823443eaf.34.1773853843332; Wed, 18 Mar 2026 10:10:43 -0700 (PDT) MIME-Version: 1.0 References: <768857.1773851031@sss.pgh.pa.us> In-Reply-To: <768857.1773851031@sss.pgh.pa.us> From: Fujii Masao Date: Thu, 19 Mar 2026 02:10:30 +0900 X-Gm-Features: AaiRm53xADUAEdzDAqleRedV7E8btuK3UD2GtedTAjPJzToD_sq1aSRWt9-ssCs Message-ID: Subject: Re: Use SIGTERM instead of SIGUSR1 for slotsync worker to exit during promotion? To: Tom Lane Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 19, 2026 at 1:23=E2=80=AFAM Tom Lane wrote: > > Fujii Masao writes: > > I noticed that during standby promotion the startup process sends SIGUS= R1 to > > the slotsync worker to make it exit. Is there a reason for using SIGUSR= 1? > > Would it make sense to send SIGTERM instead, so the worker can exit pro= mptly > > even while waiting? > > One consideration here is that we expect all processes to receive > SIGTERM from init at the beginning of an operating system shutdown > sequence. Background workers should exit at that point only if their > services will not be needed during database shutdown. While it > sounds plausible that a slotsync worker should exit immediately, > I'm not quite sure if that's what we want. Currently, when the slotsync worker receives SIGUSR1 during promotion, it exits at the next interrupt check (i.e., in ProcessSlotSyncInterrupts())= . There's no additional termination handling, so it seems the worker is expec= ted to exit promptly once the startup process requests it. Given that, using SIGTERM to make the worker exit immediately seems OK to m= e... With the patch, on SIGTERM, the worker basically still exits at the next interrupt check. The difference is that if it's waiting for input from the primary (i.e., DoingCommandRead =3D true), it calls ProcessInterrupts() in the SIGTERM signal handler (die()) and exits immediately. Regards. --=20 Fujii Masao