Re: Conflicting updates of command progress - Mailing list pgsql-hackers

From Antonin Houska
Subject Re: Conflicting updates of command progress
Date
Msg-id 17871.1745404955@localhost
Whole thread Raw
In response to Re: Conflicting updates of command progress  (Fujii Masao <masao.fujii@oss.nttdata.com>)
List pgsql-hackers
Fujii Masao <masao.fujii@oss.nttdata.com> wrote:

> On 2025/04/15 2:13, Sami Imseih wrote:
> >> While working on [1] I realized that some field of pg_stat_progress_cluste has
> >> weird value.
>
> I ran into the same issue while working on [2], and eventually had to
> withdraw that patch because of it.

Have you considered reporting the progress of each command separately?

I think that can be implemented by moving the progress related fields from
PgBackendStatus into a new structure and by teaching the backend to insert a
new instance of that structure into a shared hash table (dshash.c) whenever a
command that needs progress reporting is being started.

pgstat.c uses such a hash table for various statistics objects, however it's
probably not a good idea to adjust this infrastructure by simply adding a new
object kind (e.g. PGSTAT_KIND_COMMAND). I think that pgstat.c is designed for
frequent updates of backend-local statistics and less frequent flushes
(e.g. at command completion) to the shared memory. That's not suitable for
progress reporting.

> [2] https://commitfest.postgresql.org/patch/5282/

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



pgsql-hackers by date:

Previous
From: Antonin Houska
Date:
Subject: Re: Conflicting updates of command progress
Next
From: Nisha Moond
Date:
Subject: Re: Fix slot synchronization with two_phase decoding enabled