Re: REPACK (CONCURRENTLY) decoding worker is canceled by lock_timeout

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: REPACK (CONCURRENTLY) decoding worker is canceled by lock_timeout
Date: 2026-09-10 06:21:27
Message-ID: 902950F0-E94A-4DFF-93EE-8B10469F51A1@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Sep 10, 2026, at 11:21, shihao zhong <zhong950419(at)gmail(dot)com> wrote:
>
> Hi Alvaro,
>
> > I would prefer to have a way to transmit the effective values from the
> > leader backend to the worker
>
> Done in v2, through the DSM segment the worker already attaches to.
>
> Only lock_timeout and transaction_timeout are passed. A bgworker never
> arms statement_timeout or idle_in_transaction_session_timeout. v1 have
> because it aligns with the autovacuum worker.
>
> One behavior change from v1. v1 turned the timeouts off, so REPACK always
> got through. v2 uses the caller's values instead, so if the caller has a
> lock_timeout of its own, the command can still be cancelled.
>
> The difference is that it is now cancelled by a value the
> caller sees in SHOW and can override with SET, rather than by one coming
> from the owner role that the caller cannot reach at all.
>
> I did consider SerializeGUCState, but that seems too much.
>
> Applies cleanly to master and REL_19_STABLE.
>
> Regards,
> Shihao
> <v2-0001-Pass-the-backend-s-timeout-settings-to-the-REPACK.patch>

Auto-vacuum explicitly overrides all four settable session timeouts (statement_timeout, transaction_timeout, lock_timeout, and idle_in_transaction_session_timeout) to zero, while this worker only handles the latter two. I understand that statement_timeout and idle_in_transaction_session_timeout are probably never armed by this worker, so functionally they may not need special handling.

My concern is that the inconsistency might lead to confusion to future readers. Does it make sense to either remove those two from auto-vacuum worker or set them to repack worker as well?

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Nidzwetzki 2026-09-10 06:34:11 Re: Add pg_nodiscard decorations to Bitmapset functions
Previous Message Amit Langote 2026-09-10 06:20:32 Re: Revert RI fast-path batching from REL_19_STABLE