agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix timeout overflow in WAIT FOR LSN
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix timeout overflow in WAIT FOR LSN
@ 2026-09-14 11:49  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexander Korotkov @ 2026-09-14 11:49 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix timeout overflow in WAIT FOR LSN

Commit 447aae13b03 accepted TIMEOUT values up to INT64_MAX
milliseconds, but computing the deadline multiplies by 1000, which
caused an int64 overflow. And the command reported a timeout at once
instead of waiting.

Parse the value as an int instead, which simplifies the code and is
consistent with other timeout values such as the statement_timeout GUC.

The specified values are now rounded to the nearest millisecond, so a
positive timeout below half a millisecond becomes zero and waits
indefinitely.

Backpatch to v19, where the TIMEOUT option was introduced.

Reported-by: ChangAo Chen <cca5507@qq.com>
Author: ChangAo Chen <cca5507@qq.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/tencent_86B83240785807077600A1778566B5C12908@qq.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6c44473c2deed07b4cca3c202dd48b1e8e002ec9

Modified Files
--------------
doc/src/sgml/ref/wait_for.sgml          | 18 +++++++++++++-----
src/backend/access/transam/xlogwait.c   |  2 +-
src/backend/commands/repack_worker.c    |  4 ++--
src/backend/commands/wait.c             | 32 +++++++-------------------------
src/include/access/xlogwait.h           |  2 +-
src/test/recovery/t/049_wait_for_lsn.pl | 14 ++++++++++++++
6 files changed, 38 insertions(+), 34 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix timeout overflow in WAIT FOR LSN
@ 2026-09-14 11:50  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexander Korotkov @ 2026-09-14 11:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix timeout overflow in WAIT FOR LSN

Commit 447aae13b03 accepted TIMEOUT values up to INT64_MAX
milliseconds, but computing the deadline multiplies by 1000, which
caused an int64 overflow. And the command reported a timeout at once
instead of waiting.

Parse the value as an int instead, which simplifies the code and is
consistent with other timeout values such as the statement_timeout GUC.

The specified values are now rounded to the nearest millisecond, so a
positive timeout below half a millisecond becomes zero and waits
indefinitely.

Backpatch to v19, where the TIMEOUT option was introduced.

Reported-by: ChangAo Chen <cca5507@qq.com>
Author: ChangAo Chen <cca5507@qq.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/tencent_86B83240785807077600A1778566B5C12908@qq.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f260c03bccb709b61a0ddfdcc214134402150c0f

Modified Files
--------------
doc/src/sgml/ref/wait_for.sgml          | 18 +++++++++++++-----
src/backend/access/transam/xlogwait.c   |  2 +-
src/backend/commands/repack_worker.c    |  4 ++--
src/backend/commands/wait.c             | 32 +++++++-------------------------
src/include/access/xlogwait.h           |  2 +-
src/test/recovery/t/049_wait_for_lsn.pl | 14 ++++++++++++++
6 files changed, 38 insertions(+), 34 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-09-14 11:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 11:49 pgsql: Fix timeout overflow in WAIT FOR LSN Alexander Korotkov <akorotkov@postgresql.org>
2026-09-14 11:50 pgsql: Fix timeout overflow in WAIT FOR LSN Alexander Korotkov <akorotkov@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox