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

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(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-12 12:51:57
Message-ID: CAGRkXqS5B3oe305LxByJt3Hh5-fOUU_dRCsR6w9TuyCPXDVz6Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Alvaro, Chao,

Attached is v3. The code is the same as v2, with two additions.

1. The comment in RepackWorkerMain() now says why only lock_timeout and
transaction_timeout are passed. lock_timeout is armed by any lock wait,
and transaction_timeout by StartTransaction(). Both can fire in the
worker: the wait for older transactions in the snapshot builder is a
lock wait, and the worker's transaction spans the whole command.
statement_timeout and idle_in_transaction_session_timeout are only
armed by the command loop in PostgresMain(), which a background worker
never runs. I hope that answers Chao's question without touching
autovacuum.

2. A lock_timeout on the table owner role
does not reach the worker, and one set in the REPACK session does.
It fails on unpatched master and passes with 0001.

I expect this to be common in production, since a database- or
role-level lock_timeout is a normal setting. As REPACK (CONCURRENTLY)
is new in PG19, I suggest adding this to the open items and fixing it
before release.

Thanks,
Shihao

Attachment Content-Type Size
v3-0001-Pass-the-backend-s-timeout-settings-to-the-REPACK.patch application/octet-stream 3.7 KB
v3-0002-Add-isolation-test-for-timeouts-in-the-REPACK-dec.patch application/octet-stream 4.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message ChenhuiMo 2026-09-12 13:12:03 Re: [PATCH] Speed up repeat() for larger counts
Previous Message shihao zhong 2026-09-12 12:43:28 Re: Add a permission check to pg_stat_get_backend_subxact()