From: | Antonin Houska <ah(at)cybertec(dot)at> |
---|---|
To: | Sami Imseih <samimseih(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Conflicting updates of command progress |
Date: | 2025-04-23 10:26:12 |
Message-ID: | 17632.1745403972@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Sami Imseih <samimseih(at)gmail(dot)com> wrote:
> > While working on [1] I realized that some field of pg_stat_progress_cluste has
> > weird value.
>
> Is there a repro that you can share that shows the weird values? It sounds like
> the repro is on top of [1]. Is that right?
Yes.
> > AFAICS the current design does not consider that one progress-reporting
> > command can be called by another one.
>
> pgstat_progress_start_command should only be called once by the entry
> point for the
> command. In theory, we could end up in a situation where start_command
> is called multiple times during the same top-level command;
Not only in theory - it actually happens when CLUSTER is rebuilding indexes.
> > Not sure what the correct fix is. We can
> > either ignore update requests from the "nested" commands, or display the
>
> There is a pattern where we do
>
> ```
> if (progress)
> pgstat_progress_update_param
> ```
>
> cluster_rel can pass down a flag to index_build or others that update progress
> to not report progress. Therefore, only the top level command is
> updating progress.
> what do you think?
That's a possible approach. However, if the index build takes long time in the
CLUSTER case, the user will probably be interested in details about the index
build.
The other approach is that we report only on the index build, but in that case
the interesting row of pg_stat_progress_cluster would disappear
temporarily. That might also be confusing.
Ideally we should report on all the commands in progress, but that is not
trivial to implement.
> [1] https://commitfest.postgresql.org/patch/5117/
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
From | Date | Subject | |
---|---|---|---|
Next Message | Antonin Houska | 2025-04-23 10:42:35 | Re: Conflicting updates of command progress |
Previous Message | Andrey Borodin | 2025-04-23 09:46:40 | Re: [PATCH] dynahash: add memory allocation failure check |