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

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: REPACK (CONCURRENTLY) decoding worker is canceled by lock_timeout
Date: 2026-09-08 07:31:01
Message-ID: ap-4gDuPgFoudT-m@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-Sep-06, shihao zhong wrote:

> The worker waits for the first REPACK's XID in the snapshot builder.
> It runs in its own session as the table owner, so the database-level
> lock_timeout applies to it, and SET lock_timeout = 0 in the REPACK
> session does not reach it.
>
> The attached patch turns the settable timeouts off in the worker, as
> autovacuum does. statement_timeout and cancel on the REPACK session
> still stop the whole command.

Hmm, but there's no practical effect here, right? If it doesn't die
because of this particular timeout, it will fail due to some other
timeout. We just don't have an implementation that allows to run two
concurrent REPACK CONCURRENTLY. Will you later suggest to turn off
statement_timeout during REPACK?

> Separately, the wait itself means REPACK (CONCURRENTLY) runs are
> serialized. A PROC_IN_SAFE_IC-like flag could let the worker skip
> other REPACK transactions; I can look into that if there is interest.

Antonin Houska has a patch which would probably benefit from your
review. https://postgr.es/m/108776.1784105248@localhost

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Hay dos momentos en la vida de un hombre en los que no debería
especular: cuando puede permitírselo y cuando no puede" (Mark Twain)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2026-09-08 07:37:23 Re: Assert failure in try_nestloop_path()
Previous Message Michael Paquier 2026-09-08 07:30:09 Re: docs: Fixes for August 2026 minor release notes (v14-v17)