Re: Add a test for index_rebuild_count of REPACK (CONCURRENTLY)

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Manuel Reyes Bravo <manuelreyesbravo(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Adam Lee <adam8157(at)gmail(dot)com>
Subject: Re: Add a test for index_rebuild_count of REPACK (CONCURRENTLY)
Date: 2026-09-17 14:55:44
Message-ID: aqv9k36EbP9tw16Z@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

On 2026-Sep-16, Manuel Reyes Bravo wrote:

> I would like to work on the framework for v20, if nobody else is.

Sounds good.

> Some facts that make it look tractable:
>
> - Every write to st_progress_param goes through backend_progress.c
> (pgstat_progress_update_param, _incr_param, _parallel_incr_param,
> _update_multi_param, plus start/end_command). There are 163 calls in
> 23 files, and none of them writes the array directly, so one hook
> there sees every update.

Yep.

> - There is precedent for the switch in the DEVELOPER_OPTIONS trace_*
> settings (trace_locks, trace_notify, trace_sort, ...).

I think those are all pretty archaic, so I wouldn't necessarily base a
design on them.

> Before writing anything, three questions, so that I build what you have
> in mind:
>
> 1. A runtime developer setting (say trace_progress, like trace_notify)
> or something compiled in only for debug builds (like LOCK_DEBUG
> around trace_locks)?

I think a compile option is enough. We'll want a buildfarm animal that
runs with that option set, but things set up in such a way that the
(limited amount of) debug code is compiled out for regular developer
builds, so that this doesn't cause "meson test" to be any slower.

> 2. Should tests read the lines from the server log in TAP tests, or
> from the client with client_min_messages in the regression suite?
> Counters such as blocks scanned vary between runs, so I assume a test
> would match phases and selected counters rather than every line.

No opinion on this. Maybe a good frame would be a TAP test that runs
REPACK/COPY/etc and then reads the debug output to see if the order of
phase switching is from A to B to C, and that block numbers in column
such-and-such are monotonically increasing within one phase, and that
they get back to 0 when changing to phase X, etc.

> 3. One line per call, or only when a value actually changes?

I think emitting a line when nothing has changed would be pointless
noise.

> The first users would be VACUUM and REPACK, including the two
> index_rebuild_count cases from this week.

Sure, as long as it's not restricted to only cover them.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-09-17 14:57:22 Re: pg_get_object_address reports a published relation as non-existent
Previous Message Sami Imseih 2026-09-17 14:53:05 Re: Reject WAIT FOR earlier in transaction-snapshot mode