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 1w4YCx-002Ito-0l for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Mar 2026 05:52:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w4YBw-00FdxQ-0g for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Mar 2026 05:51:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w4YBv-00FdxH-2y for pgsql-hackers@lists.postgresql.org; Mon, 23 Mar 2026 05:51:08 +0000 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w4YBt-00000000blk-3ntM for pgsql-hackers@lists.postgresql.org; Mon, 23 Mar 2026 05:51:08 +0000 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-4152698e745so845589fac.1 for ; Sun, 22 Mar 2026 22:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774245064; cv=none; d=google.com; s=arc-20240605; b=KHhCbqGhuzdM3vLeu+CYKm+732kAalxdwUtN2A38dW8+YLCRQxnByMHzG0DcY8tGvB 8xetfsNlvwJXS/PYiIbrxnpyQKNa4jgTF2obOU+9loKL2ezjGn9RHuG38oYV+H/DKj4M H4VUPxHd/yB0u4ub8+P7GnLpZsadhr3wUJ5tjeUYfRvrG11vJ5PGF2XYgjHh7i/qtlBg NhnqPQx/3dHUcwc7UvBSyV5RDgHzetlqIqOtzdwP/72r0Vl2vl3KMxxiPtD++FDke2RP fIc0tllfRmqLiGTcFzmtUaIfDIliETxLbj6dl++BfkxaoGZEvN/IZl1mS3GQZYRGu4EQ cb1w== 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=f2G598uwmpua6MReGuqfRTMDskO8t9LAxSeWZ3+hvOM=; fh=99cPETC/63IsvQoFoENkZwbGQFmSkW+Huy3VpGrhYuI=; b=i1ZcZ2tf3vuZq8ukTyk7l4f/8UQmTKki/CiUJCnbjUtE7xlzd2t/wKcdDZlxqa22h/ /yErkc+nLVrfWVLa5TYjVTyRPiNqo+akyV3meTZJmi5wLMTmJ3RbdNaQu30gY6f9vb8M 4MdJcOGb+X6llhbSxe/Pr4MN6xGwrGHMlgcMealthAO40DzM/OXeSLH5tmmJzJ/3h+Au FWqD2v/eVDBav3UwwH3RsvcY12g68ByJAn8VZraGvbU/DXvSbZ4hXrW0hNCiwQW9aoDg n+b6kCwisoPciwU3WQ/EBEKP62fuAxVGZRwNBsJCo7GAUOz6kGMaPLDPgjhKGJsvW0bV jATw==; 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=1774245064; x=1774849864; 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=f2G598uwmpua6MReGuqfRTMDskO8t9LAxSeWZ3+hvOM=; b=M3RegKCwwFG7D0FbNXMAUSIYb1yyBdeADGMWVJxBhkzg04pQpWY3QrmAFIzYUHngIK vqdPJnXtv4gjEiotpNdMtAW5ALXh4SrifU73HFrbss96a5dPprJg1O7UTrPAgKRTf8kV GPFJw5H0fUoAb/4I2vNrpJifs3opxCLVbdyyQgFliLxsjuFez8mBMOaE9jO9I5UWn0Bd W2CU7ricti8+8gYxRomoNSC6fL6TpnKVbzBA3Kkl/5FUajKtT7CAoI3MdH0b6zkrilOy MprPiUwy0kizXuMVVB2eZxy9K3wZQdE+dgVANpkvIhaKH/Tc+EVL3vNQacKMiMCfYnrG tjyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774245064; x=1774849864; 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=f2G598uwmpua6MReGuqfRTMDskO8t9LAxSeWZ3+hvOM=; b=WMR7VUg9fJ8eNw8yaPfIVWBoloR4VTKdcON+EZBnMWaKcGUx5Xj67IEA7TPDzKXciH ojWWLTMUuHwZfnDNOHMFGQm5JIFWgrqlAgz7LuzeOsZ9geO9t3tXtHVZclB1RSRlvy3A e1afA2qd8DEZATZSsSSdQSmQPZRhuxSm8iwkYK22c4zpJTmJwntp/X05YUwpJAbafsS1 MSr7qFIIZIUsyFe+aR8IUIZhqboi0zTxwmCNhEBw/LXjtrhDpsIMlCu2PR+hSrpaZHWU rPhXe3B6E84UJ1XXq991FJBzhXG/EObGa9+QH7k4F+kL/ocObEk552AxHtvceXWF2PwL fdPQ== X-Gm-Message-State: AOJu0YwwW5h23sWeHRLEy92Tv0/dbnQWZMp6nXLmwZKykZG/x+ZeVME2 P6lDpOLOgU9GUB9GiYruBPKg95+GYL8JcQh+uckz3e/WuceWKUB3ayyOGkojewbmbtRWR21zXcE PeeBBhaWst37DwNGjfNjbIrYL4630qwU= X-Gm-Gg: ATEYQzyaOpAoztrxD/bNsdJYq4euRksqP2oiJIZDb9Y5zlk+LyHIVDh+XVffdHbFszQ TwOBzLhNJZ2uL10XcDXg5tRc5jrJvWpIWXTeIcP5tL6+6IFZhMR1lB34BSh45QsGbj6afAzTASV pKmzqd66aCChAeZlQr3uUYU8mfVlrn3j2O8K+v9zGS9N7E6V1MbSyMasf1nM4Wi42AySX70pdG7 tGG+ank2Pg4d3A9WvYv8s8nlgvLDAfhLt5Don38lKCgTmwUgo5TML0fo8TFY49/tGMSqIyaxdNV 3JH+oCA4q5Nh7Y6SUcezRxSZjLEwuaMBifiVf1Q5 X-Received: by 2002:a05:6820:f033:b0:67d:ead4:cf3c with SMTP id 006d021491bc7-67dead4e1bcmr2032692eaf.64.1774245064304; Sun, 22 Mar 2026 22:51:04 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fujii Masao Date: Mon, 23 Mar 2026 14:50:52 +0900 X-Gm-Features: AQROBzAQUTXZphLeryN3cWF2ILG6NCgdcnSFvoHEcQw74pvmRaD34Fn68ofuW_w Message-ID: Subject: Re: Use SIGTERM instead of SIGUSR1 for slotsync worker to exit during promotion? To: Amit Kapila 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 Sun, Mar 22, 2026 at 1:52=E2=80=AFAM Amit Kapila wrote: > > On Wed, Mar 18, 2026 at 9:35=E2=80=AFPM Fujii Masao wrote: > > > > 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? > > > > IIRC, this same signal is used for both the backend executing > pg_sync_replication_slots() and slotsync worker. We want the worker to > exit and error_out backend. Using SIGTERM for backend could result in > its exit. Why do we want the backend running pg_sync_replication_slots() to throw an error here, rather than just exit? If emitting an error is really requir= ed, another option would be to store the process type in SlotSyncCtx and send different signals accordingly, for example, SIGTERM for the slotsync worker and another signal for a backend. But it seems simpler and sufficient to ha= ve the backend exit in this case as well. > Also, we want the last slotsync cycle to complete before > promotion so that chances of subscribers that do failover/switchover > to new primary has better chances of finding failover slots > sync-ready. I'm not sure how much this behavior helps in failover/switchover scenarios. But the main issue is that if a primary crash triggers standby promotion, that last slotsync cycle can get stuck waiting for input from the primary, which delays promotion. IOW, failover time can become unnecessarily long due to the slotsync worker. I'd like to address that problem. Regards, --=20 Fujii Masao