Re: Allow progress tracking of sub-commands

From: Antonin Houska <ah(at)cybertec(dot)at>
To: Manu <manuelreyesbravo(at)gmail(dot)com>
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-30 16:10:30
Message-ID: 105259.1796055030@chrudos
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Manu <manuelreyesbravo(at)gmail(dot)com> wrote:

> The dummy command works: with v06-0001 alone, case 2 keeps the
> COPY's row. But with 0002 applied as well it is still lost, the
> same as on v05 and master. Tested on master 9ebc9a458c3.
>
> > v06 fixes this too (hopefully it doesn't break the previous fixes).
>
> The script from my last mail gives 1, 1 and 1 rows in
> pg_stat_progress_copy with v06-0001 alone, but 1, 0 and 0 with
> 0001 and 0002, as before.
>
> With two file_fdw scans in the trigger's query,
> fileBeginForeignScan() turns pgstat_track_progress off, so neither
> inner COPY is pushed. But fileEndForeignScan() turns it back on
> before EndCopyFrom(), so the first inner COPY's
> pgstat_progress_end_command() runs, finds no parent and ends the
> outer COPY. Resuming after EndCopyFrom() would avoid that,

I've fixed it this way, thanks.

> but since 0001 now keeps the outer row by itself here, maybe 0002 can rely
> on the dummy command too.

Disabling the reporting in file_fdw (if the number of nodes is greater than
one) seems cleaner. If file_fdw relied on the fact that the 2nd node will be
treated as dummy, the 1st one would still appear in the pg_stat_progress_copy
view, and it wouldn't receive updates.

--
Antonin Houska
Web: https://www.cybertec-postgresql.com

Attachment Content-Type Size
v07-0001-Allow-progress-tracking-of-sub-commands.patch application/mbox 50.0 KB
v07-0002-Do-not-report-progress-of-two-or-more-COPY-commands-.patch application/mbox 6.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2026-11-30 16:14:54 Re: Why clearing the VM doesn't require registering vm buffer in wal record
Previous Message Andrew Dunstan 2026-11-30 15:33:31 Re: -Wformat-nonliteral