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 1w7b6G-005VT0-10 for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 15:33:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7b6E-00Aw37-1A for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 15:33:50 +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 1w7b6E-00Aw2z-04 for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 15:33:50 +0000 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7b65-00000001zKa-0BWp for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 15:33:49 +0000 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-67bb39a1122so3067089eaf.3 for ; Tue, 31 Mar 2026 08:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774971220; cv=none; d=google.com; s=arc-20240605; b=jfZma+DuALv9g0lFznH4SqsBEU+F++XpdL1/5Z68x8wSj9nCthmglEXMIBygjXtiSx 50S6+foFUZp1UvftcwdwBhook6k/1mmUAAzP+pTeO9dltj/SrczjrWmLqCRTwwJDK6Qt y0vQDHw3WZov6KryJxyLTsqwEHkL4Sdxzxpiv4DfUOWsQdTrocCwTDkxwsY72t9nIvRq xAmazItSpqMsoXGRm+suRo2sb+uhqsiayrF6lJWgaftknhdJQetiqiTtUH9tvicdI4D3 DtWgzXHfdFPQezdCmg6rIRtVYuH2PyH/6/T2/P+oDM9Wb1LjhVU3mRJmNfEWktULwsCh h1xw== 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=Kfra1iIIAe2B6ZopYXbnxDWZyD7DkmSWDrOO9Fmr7Yw=; fh=uP6RZsNRoo7/bkSSWQo6UV+8E3MTWWVSeDOL4uy17P0=; b=Qq5CMmItslfEWN2oHZCslAS4xXOv2e/Ak/r1DAheAbO9xeWwkY3ZD9qYo3qeZmbcbj eIYkv+zl35AE5UAumTKolrI7GFn7HCFwRxVKvjk5MFsQsdfwpXVo3zihzNHumpo2Ttn7 gf23Ozg+CMwsX8DNrTbcFd0ciE2fEsDugTp/VaSJHNKQafaO+6ma77jeidI5XJWE08H9 fbIlrRP+cF1bPD0aZsP/tmFI03PXbPB/vE8GwPublTi89U1ivk3QAZPHjQ6aSvTxh3cX 9zSmdta/MjlL4yxHLhm1aSYsxzJB4Siq/utrOHllsmDh+YT0SfaGJBL4OOqFoAlctAEl CfbQ==; 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=20251104; t=1774971220; x=1775576020; 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=Kfra1iIIAe2B6ZopYXbnxDWZyD7DkmSWDrOO9Fmr7Yw=; b=Gm3wTRf2FcTYP6K/2lwB57AkvCEypzZ76QZ8CCoXzilfxCuVUqf9Tjgq3vbSHoEmne uM/Ha+OwbHxgYUXgOoBG6q4gddD5NdZYjQJGXsdfEXfXSQa3IqvajbWCev+KmtUNo1D1 zNysmssN5nDDqTP3f8gsJjYKYOxI1OI2pPld8YEXYeenMq8SZC61Js4khBYHMvNainNG IR0Y0lWlly3mpD3bPOwCUoBrN6IOVPutKzgccA3NqlDrGnz+AOngZPvu+Z9YkZ5o7FdD vwXVZMIiKbcRph66fZgtI9kONdvw1ljonQx2WtmtO3rjj23lXmSWZ2rT4fq2UHooH4hT uIrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774971220; x=1775576020; 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=Kfra1iIIAe2B6ZopYXbnxDWZyD7DkmSWDrOO9Fmr7Yw=; b=eaeC4awqhm1uHR/GCy5a3G3G2ARj4Cc2sZK/0eIdotczr/erEi4WkklaQroAh7Bu02 5l65CClKa3Mx2L9n01mv1JnuIlXJ7z2KRJEezA2rjUBHI9yfre6ViT9xAZ2uWtZmBC+w iCeMnZR/39GpaBUTP90HYFdkD/6p2vmxBTMy1w2wBHp5yxkyvtwevMq2bNBL0R6fEnJJ oIM65eioOwPcEJrNMuxTsRYLc5Bo4xo1L7CWlDxZ4rmQHFUM/VRZ5zlHr0/DAvklLsSp G98zwBYxg277BESEuMMVWWtETfy4GUWEeOGpE6ij5bMFVrZRcq+x8y25vH8qmqxSG+zv QSxQ== X-Forwarded-Encrypted: i=1; AJvYcCW1HuIPLbjdcoOZpcdTwIRShyP/AASC8Ee2etbnFv426RBGhPWRMVVxrdnFOOdRifv6CpryxzBHSI+ze0wY@lists.postgresql.org X-Gm-Message-State: AOJu0YyLYCiuNM87zz/s6STk7FOKHkg9ZJV0X0KU9nYpnbrvMaWAUWNF Wu1lr+qqUC8OXWAkoIOiDAxFwRfxExktMd/C/Vz8rGGQbsQGvZoDPI3CmF+WpoUIuDlQwe6TTbq 1xnS4+4TNeUGkZf2VTRhJVLKYVMF0zeE= X-Gm-Gg: ATEYQzz3L+yoqhd/KKU7EnecbYQVDLvM338C0vBe64e0pvxERyknGSYqBkjTzOX0E5Q 4qEnHf7POGmxi2EKobui3wwZouO+GpsDrWlLnP6os8uW86TWNkhZcssgRu/5JXfoK8+jJJjzkIP p6oJDYxRly9jxXxWXeFbc6vc/X/C0IhMgCcfEOK5YFkxMZzWUG+et3QZf0Rzy+MlubaKr9GiGV1 1ZrQb0Qv1PE+u+xuZcEjuUgXa3zZM4z/wicf1jyevPymwv2VsTLHxHAP7Sk9GtyQaRq1MRZWiJx vo8weIL9SxuvmiLObA2n2+xC/2TLzBxUIeYEHwh/Kdmy/KQMGaS1 X-Received: by 2002:a05:6820:a290:10b0:67e:16b4:aa13 with SMTP id 006d021491bc7-67e1873b930mr6153537eaf.58.1774971219750; Tue, 31 Mar 2026 08:33:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fujii Masao Date: Wed, 1 Apr 2026 00:33:27 +0900 X-Gm-Features: AQROBzDNgo03R0SnOIuAcmQoxwO9DX2BAHyGjNmVpIXq22CUqpzErJu5gq48Do8 Message-ID: Subject: Re: Use SIGTERM instead of SIGUSR1 for slotsync worker to exit during promotion? To: shveta malik Cc: Nisha Moond , Amit Kapila , 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 Tue, Mar 31, 2026 at 7:42=E2=80=AFPM shveta malik wrote: > > > One idea would be to prevent the restart altogether. For example, > > > ProcessSlotSyncMessage() could set SlotSyncCtx->last_start_time to > > > a special value (like -1), and SlotSyncWorkerCanRestart() could retur= n > > > false (i.e., prevent postmater from starting up slotsync worker) when > > > it sees that. Alternatively, SlotSyncWorkerCanRestart() could simply > > > check SlotSyncCtx->stopSignaled. > > > > > > That said, as far as I remember correctly, postmaster is generally no= t > > > supposed to touch shared memory (per the comments in postmaster.c), > > > so I'm not sure this approach is acceptable. On the other hand, > > > postmaster and the slotsync worker already rely on SlotSyncCtx->last_= start_time, > > > so perhaps there's some precedent here. > > > > > IIUC, checking SlotSyncCtx->stopSignaled in SlotSyncWorkerCanRestart() > > may not be ideal, as it requires a spinlock to avoid races with the > > startup process and it is disallowed to take lock in postmaster main > > loop. Whereas, SlotSyncCtx->last_start_time doesn=E2=80=99t need a lock= since > > the postmaster accesses it only when the worker is not alive. > > > > I agree. Could you clarify what issue might arise from checking SlotSyncCtx->stopSignaled without holding a spinlock in SlotSyncWorkerCanRestart()? Is it actually problematic? That said, since the postmaster should generally avoid touching shared memory, it doesn't seem like a good idea for it to check SlotSyncCtx->stopSignaled. So I'm fine with instead lowering the log level for the "worker will not start" message to DEBUG1. Regards, --=20 Fujii Masao