pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedRename PqMsg_Progress to PqMsg_ParallelWorkerProgress
12+ messages / 5 participants
[nested] [flat]
* Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-09 21:57 Sami Imseih <samimseih.pg@gmail.com>
0 siblings, 2 replies; 12+ messages in thread
From: Sami Imseih @ 2026-09-09 21:57 UTC (permalink / raw)
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; aleksander@timescale.com
While looking at this, I realized that "PqMsg_Progress" is the name of the
'P' message that was added for parallel index progress reporting.
I missed [1] at the time, but if there is still a chance to rename it to
"PqMsg_ParallelWorkerProgress", that seems better,
"PqMsg_Progress" does not really describe what it is, whereas
"PqMsg_ParallelWorkerProgress" makes it explicit that this is a
parallel-worker-to-leader message. It also matches other places in the code
that deal with parallel workers, such as "IsParallelWorker", so it is easier
to find when looking through parallel-worker code.
[1] https://www.postgresql.org/message-id/ZpboPlg1v38vJhsD%40nathan
--
Sami Imseih
Amazon Web Services (AWS)
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-09 22:35 Tom Lane <tgl@sss.pgh.pa.us>
parent: Sami Imseih <samimseih.pg@gmail.com>
1 sibling, 1 reply; 12+ messages in thread
From: Tom Lane @ 2026-09-09 22:35 UTC (permalink / raw)
To: Sami Imseih <samimseih.pg@gmail.com>; +Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>; Nathan Bossart <nathandbossart@gmail.com>; aleksander@timescale.com
Sami Imseih <samimseih.pg@gmail.com> writes:
> While looking at this, I realized that "PqMsg_Progress" is the name of the
> 'P' message that was added for parallel index progress reporting.
> I missed [1] at the time, but if there is still a chance to rename it to
> "PqMsg_ParallelWorkerProgress", that seems better,
> "PqMsg_Progress" does not really describe what it is, whereas
> "PqMsg_ParallelWorkerProgress" makes it explicit that this is a
> parallel-worker-to-leader message. It also matches other places in the code
> that deal with parallel workers, such as "IsParallelWorker", so it is easier
> to find when looking through parallel-worker code.
Yeah, "PqMsg_Progress" seems unduly generic. I don't think we should
rename it in the back branches, but doing so in master looks like
it'd be a small-footprint change.
regards, tom lane
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-10 04:39 Kirill Reshke <reshkekirill@gmail.com>
parent: Sami Imseih <samimseih.pg@gmail.com>
1 sibling, 1 reply; 12+ messages in thread
From: Kirill Reshke @ 2026-09-10 04:39 UTC (permalink / raw)
To: Sami Imseih <samimseih.pg@gmail.com>; +Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>; Nathan Bossart <nathandbossart@gmail.com>; aleksander@timescale.com
On Thu, 10 Sept 2026 at 02:57, Sami Imseih <samimseih.pg@gmail.com> wrote:
>
> While looking at this, I realized that "PqMsg_Progress" is the name of the
> 'P' message that was added for parallel index progress reporting.
>
> I missed [1] at the time, but if there is still a chance to rename it to
> "PqMsg_ParallelWorkerProgress", that seems better,
> "PqMsg_Progress" does not really describe what it is, whereas
> "PqMsg_ParallelWorkerProgress" makes it explicit that this is a
> parallel-worker-to-leader message. It also matches other places in the code
> that deal with parallel workers, such as "IsParallelWorker", so it is easier
> to find when looking through parallel-worker code.
>
> [1] https://www.postgresql.org/message-id/ZpboPlg1v38vJhsD%40nathan
>
> --
> Sami Imseih
> Amazon Web Services (AWS)
>
Well, that's kind of bikeshedding for me to start with. But if we do,
maybe a better option will be to describe what this exactly does, not
who sends it. Like PgMsg_StatProgressReport or something. Does it
sound?
--
Best regards,
Kirill Reshke
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-10 13:20 Antonin Houska <ah@cybertec.at>
parent: Kirill Reshke <reshkekirill@gmail.com>
0 siblings, 1 reply; 12+ messages in thread
From: Antonin Houska @ 2026-09-10 13:20 UTC (permalink / raw)
To: Kirill Reshke <reshkekirill@gmail.com>; +Cc: Sami Imseih <samimseih.pg@gmail.com>; Postgres hackers <pgsql-hackers@lists.postgresql.org>; Nathan Bossart <nathandbossart@gmail.com>; aleksander@timescale.com
Kirill Reshke <reshkekirill@gmail.com> wrote:
> On Thu, 10 Sept 2026 at 02:57, Sami Imseih <samimseih.pg@gmail.com> wrote:
> >
> > While looking at this, I realized that "PqMsg_Progress" is the name of the
> > 'P' message that was added for parallel index progress reporting.
> >
> > I missed [1] at the time, but if there is still a chance to rename it to
> > "PqMsg_ParallelWorkerProgress", that seems better,
> > "PqMsg_Progress" does not really describe what it is, whereas
> > "PqMsg_ParallelWorkerProgress" makes it explicit that this is a
> > parallel-worker-to-leader message. It also matches other places in the code
> > that deal with parallel workers, such as "IsParallelWorker", so it is easier
> > to find when looking through parallel-worker code.
> >
> > [1] https://www.postgresql.org/message-id/ZpboPlg1v38vJhsD%40nathan
> >
> > --
> > Sami Imseih
> > Amazon Web Services (AWS)
> >
>
> Well, that's kind of bikeshedding for me to start with. But if we do,
> maybe a better option will be to describe what this exactly does, not
> who sends it. Like PgMsg_StatProgressReport or something. Does it
> sound?
My objection to PqMsg_ParallelWorkerProgress is that other kinds of workers
might use it too, so PqMsg_WorkerProgress would make more sense. Anyway, your
suggestion sounds good to me as well because the existing message types do not
(except for PqMsg_BackendKeyData) use the name to indicate the sender.
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-10 14:30 Nathan Bossart <nathandbossart@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 12+ messages in thread
From: Nathan Bossart @ 2026-09-10 14:30 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Sami Imseih <samimseih.pg@gmail.com>; Postgres hackers <pgsql-hackers@lists.postgresql.org>; aleksander@timescale.com
On Wed, Sep 09, 2026 at 06:35:55PM -0400, Tom Lane wrote:
> Sami Imseih <samimseih.pg@gmail.com> writes:
>> While looking at this, I realized that "PqMsg_Progress" is the name of the
>> 'P' message that was added for parallel index progress reporting.
>
>> I missed [1] at the time, but if there is still a chance to rename it to
>> "PqMsg_ParallelWorkerProgress", that seems better,
>> "PqMsg_Progress" does not really describe what it is, whereas
>> "PqMsg_ParallelWorkerProgress" makes it explicit that this is a
>> parallel-worker-to-leader message. It also matches other places in the code
>> that deal with parallel workers, such as "IsParallelWorker", so it is easier
>> to find when looking through parallel-worker code.
>
> Yeah, "PqMsg_Progress" seems unduly generic. I don't think we should
> rename it in the back branches, but doing so in master looks like
> it'd be a small-footprint change.
All of the options I've seen listed in this thread so far involve changing
the part after the PqMsg_ prefix, but given we now have PqReplMsg_ and
PqBackupMsg_, I'm thinking it'd be better to give parallel worker messages
their own prefix. That seems to act as a sort of class or namespace for
the message. Maybe something like PqParallelMsg_Progress would work here.
--
nathan
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-10 14:32 Nathan Bossart <nathandbossart@gmail.com>
parent: Antonin Houska <ah@cybertec.at>
0 siblings, 0 replies; 12+ messages in thread
From: Nathan Bossart @ 2026-09-10 14:32 UTC (permalink / raw)
To: Antonin Houska <ah@cybertec.at>; +Cc: Kirill Reshke <reshkekirill@gmail.com>; Sami Imseih <samimseih.pg@gmail.com>; Postgres hackers <pgsql-hackers@lists.postgresql.org>; aleksander@timescale.com
On Thu, Sep 10, 2026 at 03:20:12PM +0200, Antonin Houska wrote:
> Kirill Reshke <reshkekirill@gmail.com> wrote:
>> Well, that's kind of bikeshedding for me to start with. But if we do,
>> maybe a better option will be to describe what this exactly does, not
>> who sends it. Like PgMsg_StatProgressReport or something. Does it
>> sound?
>
> My objection to PqMsg_ParallelWorkerProgress is that other kinds of workers
> might use it too, so PqMsg_WorkerProgress would make more sense. Anyway, your
> suggestion sounds good to me as well because the existing message types do not
> (except for PqMsg_BackendKeyData) use the name to indicate the sender.
I don't think we need to worry too much about other kinds of workers in
this case. The message is already listed under a comment that says it's
for parallel workers. Presumably we'd add new macros for things that other
types of workers send.
--
nathan
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-10 17:09 Sami Imseih <samimseih.pg@gmail.com>
parent: Nathan Bossart <nathandbossart@gmail.com>
0 siblings, 1 reply; 12+ messages in thread
From: Sami Imseih @ 2026-09-10 17:09 UTC (permalink / raw)
To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Postgres hackers <pgsql-hackers@lists.postgresql.org>; aleksander@timescale.com
Hi,
Thanks for the feedback!
On Thu, Sep 10, 2026 at 9:30 AM Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> On Wed, Sep 09, 2026 at 06:35:55PM -0400, Tom Lane wrote:
> > Sami Imseih <samimseih.pg@gmail.com> writes:
> >> While looking at this, I realized that "PqMsg_Progress" is the name of the
> >> 'P' message that was added for parallel index progress reporting.
> >
> >> I missed [1] at the time, but if there is still a chance to rename it to
> >> "PqMsg_ParallelWorkerProgress", that seems better,
> >> "PqMsg_Progress" does not really describe what it is, whereas
> >> "PqMsg_ParallelWorkerProgress" makes it explicit that this is a
> >> parallel-worker-to-leader message. It also matches other places in the code
> >> that deal with parallel workers, such as "IsParallelWorker", so it is easier
> >> to find when looking through parallel-worker code.
> >
> > Yeah, "PqMsg_Progress" seems unduly generic. I don't think we should
> > rename it in the back branches, but doing so in master looks like
> > it'd be a small-footprint change.
>
> All of the options I've seen listed in this thread so far involve changing
> the part after the PqMsg_ prefix, but given we now have PqReplMsg_ and
> PqBackupMsg_, I'm thinking it'd be better to give parallel worker messages
> their own prefix. That seems to act as a sort of class or namespace for
> the message. Maybe something like PqParallelMsg_Progress would work here.
I think PqParallelMsg_Progress makes sense. The attached does this.
--
Sami Imseih
Amazon Web Services (AWS)
Attachments:
v1-0001-Rename-PqMsg_Progress-to-PqParallelMsg_Progress.patch (application/octet-stream, 2.8K) download
From 0d140656b96c7ce42c54dc7a02876acadc482297 Mon Sep 17 00:00:00 2001
From: Sami Imseih <samimseih.pg@gmail.com>
Date: Thu, 10 Sep 2026 01:33:39 +0000
Subject: [PATCH v1 1/1] Rename PqMsg_Progress to PqParallelMsg_Progress
a99cc6c6b4 introduced PqMsg_Progress as the macro for protocol
character P. That character is used by parallel workers to send
messages to their leader, but the name is generic and does not reflect
that purpose. Rename the macro to PqParallelMsg_Progress instead.
The new name also introduces a PqParallelMsg_ prefix that can be reused
for future parallel-worker message types.
This is cosmetic, so no backpatch.
---
src/backend/access/transam/parallel.c | 2 +-
src/backend/utils/activity/backend_progress.c | 8 ++++----
src/include/libpq/protocol.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c
index 17fcd246b0c..e1806a9a28a 100644
--- a/src/backend/access/transam/parallel.c
+++ b/src/backend/access/transam/parallel.c
@@ -1218,7 +1218,7 @@ ProcessParallelMessage(ParallelContext *pcxt, int i, StringInfo msg)
break;
}
- case PqMsg_Progress:
+ case PqParallelMsg_Progress:
{
/*
* Only incremental progress reporting is currently supported.
diff --git a/src/backend/utils/activity/backend_progress.c b/src/backend/utils/activity/backend_progress.c
index 6d2049105ab..dee05b1abb1 100644
--- a/src/backend/utils/activity/backend_progress.c
+++ b/src/backend/utils/activity/backend_progress.c
@@ -92,15 +92,15 @@ void
pgstat_progress_parallel_incr_param(int index, int64 incr)
{
/*
- * Parallel workers notify a leader through a PqMsg_Progress message to
- * update progress, passing the progress index and incremented value.
- * Leaders can just call pgstat_progress_incr_param directly.
+ * Parallel workers notify a leader through a PqParallelMsg_Progress
+ * message to update progress, passing the progress index and incremented
+ * value. Leaders can just call pgstat_progress_incr_param directly.
*/
if (IsParallelWorker())
{
static StringInfoData progress_message;
- pq_beginmessage(&progress_message, PqMsg_Progress);
+ pq_beginmessage(&progress_message, PqParallelMsg_Progress);
pq_sendint32(&progress_message, index);
pq_sendint64(&progress_message, incr);
pq_endmessage(&progress_message);
diff --git a/src/include/libpq/protocol.h b/src/include/libpq/protocol.h
index eae8f0e7238..e333c2ae646 100644
--- a/src/include/libpq/protocol.h
+++ b/src/include/libpq/protocol.h
@@ -67,7 +67,7 @@
/* These are the codes sent by parallel workers to leader processes. */
-#define PqMsg_Progress 'P'
+#define PqParallelMsg_Progress 'P'
/* Replication codes sent by the primary (wrapped in CopyData messages). */
--
2.50.1
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-10 17:14 Tom Lane <tgl@sss.pgh.pa.us>
parent: Sami Imseih <samimseih.pg@gmail.com>
0 siblings, 1 reply; 12+ messages in thread
From: Tom Lane @ 2026-09-10 17:14 UTC (permalink / raw)
To: Sami Imseih <samimseih.pg@gmail.com>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Postgres hackers <pgsql-hackers@lists.postgresql.org>; aleksander@timescale.com
Sami Imseih <samimseih.pg@gmail.com> writes:
> On Thu, Sep 10, 2026 at 9:30 AM Nathan Bossart <nathandbossart@gmail.com> wrote:
>> All of the options I've seen listed in this thread so far involve changing
>> the part after the PqMsg_ prefix, but given we now have PqReplMsg_ and
>> PqBackupMsg_, I'm thinking it'd be better to give parallel worker messages
>> their own prefix. That seems to act as a sort of class or namespace for
>> the message. Maybe something like PqParallelMsg_Progress would work here.
> I think PqParallelMsg_Progress makes sense. The attached does this.
+1
regards, tom lane
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-10 18:21 Nathan Bossart <nathandbossart@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 12+ messages in thread
From: Nathan Bossart @ 2026-09-10 18:21 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Sami Imseih <samimseih.pg@gmail.com>; Postgres hackers <pgsql-hackers@lists.postgresql.org>; aleksander@timescale.com
On Thu, Sep 10, 2026 at 01:14:55PM -0400, Tom Lane wrote:
> Sami Imseih <samimseih.pg@gmail.com> writes:
>> On Thu, Sep 10, 2026 at 9:30 AM Nathan Bossart <nathandbossart@gmail.com> wrote:
>>> All of the options I've seen listed in this thread so far involve changing
>>> the part after the PqMsg_ prefix, but given we now have PqReplMsg_ and
>>> PqBackupMsg_, I'm thinking it'd be better to give parallel worker messages
>>> their own prefix. That seems to act as a sort of class or namespace for
>>> the message. Maybe something like PqParallelMsg_Progress would work here.
>
>> I think PqParallelMsg_Progress makes sense. The attached does this.
>
> +1
As I'm writing the commit message for this, I'm remembering why I
originally went with "PqMsg" for this one. Parallel workers reuse a bunch
of "regular" message types for roughly the same purpose as non-parallel
uses, so (with this commit applied) a function like
ProcessParallelMessage() would handle a bunch of "PqMsg" message types and
one "PqParallelMsg" type. I think the obvious way to resolve that
inconsistency is to duplicate those macros and give them the parallel
prefix, but I'm not sure that's a worthwhile endeavor. Those characters
have roughly the same meaning for parallel workers/leaders as they do
elsewhere, so there's no real gain in code readability. I'm content to
commit Sami's patch and let it be, but if folks would rather I straighten
things out further, I can do so.
--
nathan
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-10 19:40 Sami Imseih <samimseih.pg@gmail.com>
parent: Nathan Bossart <nathandbossart@gmail.com>
0 siblings, 1 reply; 12+ messages in thread
From: Sami Imseih @ 2026-09-10 19:40 UTC (permalink / raw)
To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Postgres hackers <pgsql-hackers@lists.postgresql.org>; aleksander@timescale.com
> I think the obvious way to resolve that
> inconsistency is to duplicate those macros and give them the parallel
> prefix, but I'm not sure that's a worthwhile endeavor. Those characters
> have roughly the same meaning for parallel workers/leaders as they do
> elsewhere, so there's no real gain in code readability.
IMO, this is not necessary. I can't think of a good reason.
--
Sami
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-10 19:50 Tom Lane <tgl@sss.pgh.pa.us>
parent: Sami Imseih <samimseih.pg@gmail.com>
0 siblings, 1 reply; 12+ messages in thread
From: Tom Lane @ 2026-09-10 19:50 UTC (permalink / raw)
To: Sami Imseih <samimseih.pg@gmail.com>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Postgres hackers <pgsql-hackers@lists.postgresql.org>; aleksander@timescale.com
Sami Imseih <samimseih.pg@gmail.com> writes:
>> I think the obvious way to resolve that
>> inconsistency is to duplicate those macros and give them the parallel
>> prefix, but I'm not sure that's a worthwhile endeavor. Those characters
>> have roughly the same meaning for parallel workers/leaders as they do
>> elsewhere, so there's no real gain in code readability.
> IMO, this is not necessary. I can't think of a good reason.
Agreed. I think the main problem with the way things stand is that
it looks like PqMsg_Progress might apply for regular clients, which
it doesn't.
Possibly it'd be appropriate to adjust the comments in protocol.h
to make things clearer. I think this might be enough:
-/* These are the codes sent by parallel workers to leader processes. */
+/* Additional codes sent by parallel workers to leader processes. */
regards, tom lane
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress
@ 2026-09-10 20:12 Nathan Bossart <nathandbossart@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 12+ messages in thread
From: Nathan Bossart @ 2026-09-10 20:12 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Sami Imseih <samimseih.pg@gmail.com>; Postgres hackers <pgsql-hackers@lists.postgresql.org>; aleksander@timescale.com
On Thu, Sep 10, 2026 at 03:50:20PM -0400, Tom Lane wrote:
> Sami Imseih <samimseih.pg@gmail.com> writes:
>>> I think the obvious way to resolve that
>>> inconsistency is to duplicate those macros and give them the parallel
>>> prefix, but I'm not sure that's a worthwhile endeavor. Those characters
>>> have roughly the same meaning for parallel workers/leaders as they do
>>> elsewhere, so there's no real gain in code readability.
>
>> IMO, this is not necessary. I can't think of a good reason.
>
> Agreed. I think the main problem with the way things stand is that
> it looks like PqMsg_Progress might apply for regular clients, which
> it doesn't.
>
> Possibly it'd be appropriate to adjust the comments in protocol.h
> to make things clearer. I think this might be enough:
>
> -/* These are the codes sent by parallel workers to leader processes. */
> +/* Additional codes sent by parallel workers to leader processes. */
Committed with that comment adjustment, thanks.
--
nathan
^ permalink raw reply [nested|flat] 12+ messages in thread
end of thread, other threads:[~2026-09-10 20:12 UTC | newest]
Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09 21:57 Rename PqMsg_Progress to PqMsg_ParallelWorkerProgress Sami Imseih <samimseih.pg@gmail.com>
2026-09-09 22:35 ` Tom Lane <tgl@sss.pgh.pa.us>
2026-09-10 14:30 ` Nathan Bossart <nathandbossart@gmail.com>
2026-09-10 17:09 ` Sami Imseih <samimseih.pg@gmail.com>
2026-09-10 17:14 ` Tom Lane <tgl@sss.pgh.pa.us>
2026-09-10 18:21 ` Nathan Bossart <nathandbossart@gmail.com>
2026-09-10 19:40 ` Sami Imseih <samimseih.pg@gmail.com>
2026-09-10 19:50 ` Tom Lane <tgl@sss.pgh.pa.us>
2026-09-10 20:12 ` Nathan Bossart <nathandbossart@gmail.com>
2026-09-10 04:39 ` Kirill Reshke <reshkekirill@gmail.com>
2026-09-10 13:20 ` Antonin Houska <ah@cybertec.at>
2026-09-10 14:32 ` Nathan Bossart <nathandbossart@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox