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 1w5c1m-003QQx-2v for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 04:09: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 1w5c1l-000vVV-1U for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 04:09:01 +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 1w5byg-000s7q-1w for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 04:05:51 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5byf-0000000155U-0ygL for pgsql-hackers@postgresql.org; Thu, 26 Mar 2026 04:05:50 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-661ce258878so7358a12.0 for ; Wed, 25 Mar 2026 21:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774497948; cv=none; d=google.com; s=arc-20240605; b=cARP8B4gvcW4RzzRKG58KJCCQa9heLI4eZ1x9MWhTl7y8Iy4utSoIZHOfxWJVK7J7H b3tSbyTculnPLv/kunFqeB2HWcT6xFtO/hjPUDYR2TDBdO4LYTfFc+WOGpAiGeripnpP djYoNXwTG3mTzG3zjNSsr6IbZ1+/3qM3miKbZYSCcR9WtS1NkLMj5fl2bw0DcXIy+k5H uJHrh0vu9jRO/UJA75IlkuVsst3oRpe6LazO3yYAsqsEU98JeZf1Ri47Sm79ItvoqJ3Z 9uyQO77Gja23JxQ1zp5bYy717YxcPli9AkuZgF0v43MDNOmaRNk+RsPhUQ25lhrHRKuC 9lMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=WE2REszyzNwmTq7UK1gNIJiInaD8aTwYEmbDgIkB2J0=; fh=6yOQdcTwO7avR30wiiRYxljiN75rrf2oO/1f2pMPoSo=; b=gCoIZ1oXRZGGtLD6lA0+UG920xUJ+GIw0Bb3SfcYzqB58QEe8H+55sU7T1Byv1CbM+ o+wDMrj0T6rPgJaSF1zxNgPjh1/4wiNER1e9P+4bssQarvze3M9ZSpa+t1HhZc2LxZ7U 8NFO0K6vX3vJqPyy+QVbTVklB9iytVZe0SM+wA+j8aXtH+c9fgt0DuMbuY5qbeNq/o7d +65RoRlvsCUq4LoUwPnptMsQcqys68dhgwS07ZX7rmaPww1wwOcQGCIg1W/IP2RtygcP Ku1Jdf8E/SPuYAoIxuu/xxBfZijFpYpJl0/l+BhJj7M/9gBkloGJYLiZFhydlA3RIyzN TjBw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1774497948; x=1775102748; 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=WE2REszyzNwmTq7UK1gNIJiInaD8aTwYEmbDgIkB2J0=; b=YisIo+oxS1zx243NKJGWDXyc54TcOCIIwzU6op4UHuD27i9KGQ/4ILaP0ZqC2Lo4ev 9hQU2L2Vbr+1MFA1XhH5eRxmAOO7mAyDnDAgKu7ntBC4qKZRxgObzRVrm+LreZb2dKku KxuZ+vE4wyneNnibOSl4XYTEAsYXSC+lBZBySoDsB3UxZzip0Utrp7sOmKQWzBMN6UOz wpah1CvOxbpHKXA9S6Uo+FP0tBG3q6oWQ5zK7xUtH1cmofFWfi45EKiabi8+thj6l4JV WtoUmhrAI/jzbjZXc963J6I3vyNd2s14YrnNoCe3nTQzcqUpNNL1kAdBWt2ItdWjX1AB seIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774497948; x=1775102748; 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=WE2REszyzNwmTq7UK1gNIJiInaD8aTwYEmbDgIkB2J0=; b=EW1g8icXTzAa+t0ogVRPiTU6fIX+oUerbP9IbdMpcnLvuUR+pk0jYYlU94eM6YtnUX 21fD/gKqChCHiw5C/rRyVTEUZa6VVAX4CRYUi2EVhCd5DuvehZv47GiyDDm9KgRZzCsc SqbIeCWBZ7t1uVKl4y9zzBTyDGfGGz/JCwrbpvTIo3fmxEu2IJaNHaxCLIAOlc0Wzu1s VlQE3ZkmW9AZ/yifxz5P3dq+7cHVVkPoZrWSVI16yJxVuy4Uf6XdQG1jqlbaAzGYFlCu Opa3tCdkMgZRuZLXofpGV/EZRl8VBgWGQY95/uU6MksqFrLnjLJ3wNX1HIOc9tR4IpK5 ql9A== X-Forwarded-Encrypted: i=1; AJvYcCVSs56JkxApHbuTnWDgtBRICxTpxunKaS9eNDy8eNLVjNlhdYAjTRKagXMfBCpyDBqDC9lWgonjOByJ/naM@postgresql.org X-Gm-Message-State: AOJu0Yz3WqnfU76HI2Cbn9Bilo+1SDlzqCmmKmpr9I57M8sH0XRyYx7L vY9DRNrsW8Xif/6xNLAock2bHKehDGqrKPYa3b04/6S2cXUgl56gRN6XdD5xPPMKoGMB0E8P+dW eWHSxO8PH2Z5H8DKrfUInA23B5JmOfgVIyOhkoUyE X-Gm-Gg: ATEYQzzNSfrl37q+V1dC8/2aBiMKxkiCK7bGKKil7EeSDUECDPz7n3k+j3XHU4/Il5N giLd4Pi4quNUrGRxqrX7IQEcb7Kuc2SksG5BV7c+iWapxp0mlWcJz0crTymWtSuh9w9/tyJbjZf TgdbSBxSM/E5j9mhTozlqADrZ1vr6ACBOPCUM3wcRuqrMvd+nXNRmvzJNLcnl7nYgVhe7c7/90f AznMpwhY+iO1fUC68i5ES7iqJrjRYLDI+g/NtlluCsGxmHFXvb52TWpOe+uX6N4Qjyr5YqRvBf2 h0c6hDNO X-Received: by 2002:a05:6402:8d0:b0:65f:76c8:b92f with SMTP id 4fb4d7f45d1cf-66adc26ff67mr16762a12.0.1774497947169; Wed, 25 Mar 2026 21:05:47 -0700 (PDT) MIME-Version: 1.0 References: <6ec95d6e.15a854.19d22f55f00.Coremail.18663776784@163.com> In-Reply-To: <6ec95d6e.15a854.19d22f55f00.Coremail.18663776784@163.com> From: Robert Pang Date: Wed, 25 Mar 2026 21:05:34 -0700 X-Gm-Features: AQROBzA81weuA1VgO0je6kQHF6eKG1Hq37qpCz4UB-AZgChl8mgfKk3-CPXL_K0 Message-ID: Subject: Re: [PATCH] Fix premature timeout in pg_promote() caused by signal interruptions To: getiancheng_2012 <18663776784@163.com> Cc: Michael Paquier , pgsql-hackers Content-Type: multipart/alternative; boundary="000000000000ccd3a4064de57f2a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ccd3a4064de57f2a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Michael and Tiancheng On Tue, Mar 24, 2026 at 8:06=E2=80=AFPM getiancheng_2012 <18663776784@163.c= om> wrote: > ---- Replied Message ---- > From Michael Paquier > Date 3/25/2026 10:28 > To Robert Pang > Cc pgsql-hackers > > Subject Re: [PATCH] Fix premature timeout in pg_promote() caused by > signal interruptions > > On Wed, Mar 11, 2026 at 09:44:07AM -0700, Robert Pang wrote: > > The current implementation of pg_promote() calculates a fixed number > of loop iterations based on the timeout value, assuming each loop > waits exactly 100 ms for the backend latch. However, if the backend > receives an unrelated signal (e.g., from > client_connection_check_interval), it wakes up early. These repeated, > unrelated wakeups cause the loop counter to deplete much faster than > intended, leading to a premature timeout. > > > It is true that we can do better here, and your proposal about having > a more precise timeout calculation looks like a sensible improvement > for this case. > > No objections regarding your patch. I would like to apply it on HEAD, > if there are no objections. > -- > Michael > > > Hi all, > > Overall LGTM. Just a small comment: > > "+ end_time =3D GetCurrentTimestamp() + wait_seconds * 1000000L;" > > I think we can use TimestampTzPlusSeconds(GetCurrentTimestamp(), wait_sec= onds). > > > Best regards > > Tiancheng Ge > > Thank you for reviewing this patch. The use of TimestampTzPlusSeconds() will be good. Best regards Robert Pang --000000000000ccd3a4064de57f2a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Michael and=C2=A0Tiancheng

On Tue, Mar 24, 2026 at 8:06=E2=80=AFPM getiancheng_2012 <18663776784@163.com> wrote:
---- Replied Message ----
F= romMichae= l Paquier<michael@paquier.xyz>
Date3/25/2026 10:28
ToRobert Pang<robertpang@google.com>
Ccpgsql-hackers<pgsql-hackers@postgresql.org>
SubjectRe: [PA= TCH] Fix premature timeout in pg_promote() caused by signal interruptions
On Wed, Mar 11, 2026 at 09:44:07AM -0700=
, Robert Pang wrote:
The current implementation of pg_promot= e() calculates a fixed number
of loop iterations based on the timeout v= alue, assuming each loop
waits exactly 100 ms for the backend latch. Ho= wever, if the backend
receives an unrelated signal (e.g., from
clie= nt_connection_check_interval), it wakes up early. These repeated,
unrel= ated wakeups cause the loop counter to deplete much faster than
intende= d, leading to a premature timeout.

It is true that we c= an do better here, and your proposal about having
a more precise timeout= calculation looks like a sensible improvement
for this case.

No = objections regarding your patch.=C2=A0 I would like to apply it on HEAD,if there are no objections.
--
Michael

=
Hi all,
Overall LGTM. Just a small comment:
"=
+  end_time =3D GetCurrentTimestamp() + wait_seconds * 1000000L;"
I think we can use TimestampTzPlusSeconds(GetCurrentTimestamp(), wait=
_seconds).

Best regards
Tiancheng Ge
=

Thank you for revi= ewing this patch. The use of=C2=A0TimestampTzPlusSeconds() will be good.

Best regards
Robert Pang
--000000000000ccd3a4064de57f2a--