Re: Allow progress tracking of sub-commands

From: Manu <manuelreyesbravo(at)gmail(dot)com>
To: Antonin Houska <ah(at)cybertec(dot)at>
Cc: Alberto Piai <alberto(dot)piai(at)gmail(dot)com>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, alvherre(at)kurilemu(dot)de, pgsql-hackers(at)lists(dot)postgresql(dot)org, bharath(dot)rupireddyforpostgres(at)gmail(dot)com, mihailnikalayeu(at)gmail(dot)com, adam8157(at)gmail(dot)com
Subject: Re: Allow progress tracking of sub-commands
Date: 2026-11-26 17:35:39
Message-ID: 179571453997.3877155.15686094625091283399@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Antonin,

v04 fixes two of the four cases from my last mail. The two COPY
trigger cases are still there, and two related cases are now worse
than on master. All of this is on master 9ebc9a458c3 with v04-0001
and v04-0002, using the attached script. The session reads its own
progress row, so it gives the same output on every run.

> Should work in v04 [1].

It does. After the failed two-scan query the session reports progress
again, and the Assert in xact_callback() no longer fires. The cursor
case is fixed too, and so are the rows Adam and Alberto saw left
behind by CREATE INDEX CONCURRENTLY and REINDEX CONCURRENTLY.

> This should also work in v04.

Not for the two COPY trigger cases:

1. If a COPY fails inside a two-scan query run by its trigger, its
row stays after the error and through later commands. While the
next CREATE INDEX runs, pg_stat_progress_create_index has no row
for it, and the session still shows the failed COPY. On master the
row goes away with the error.

2. A two-scan query that succeeds inside a COPY trigger still removes
the outer COPY's row for the rest of that COPY. Master does the
same, so this one is not a regression.

The two related cases: if the two-scan query fails inside a
subtransaction and the error is caught, either in a PL/pgSQL
EXCEPTION block or with SAVEPOINT and ROLLBACK TO, the session stops
reporting progress altogether. A later COPY or CREATE INDEX in that
session has no row at all. On master both show up normally, and a
new session is fine with v04 too.

The parallel BRIN build still looks the way Adam described, which I
take it you already plan to drop.

Regards,
Manu

Attachment Content-Type Size
v04-cases.sh.txt text/plain 4.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Lamberson 2026-11-26 17:39:09 Re: Extensible sync handler registration (register_sync_handler)
Previous Message surya poondla 2026-11-26 17:35:38 Re: Parallel vacuum: check XID wraparound failsafe between indexes