Re: Use array as object (src/fe_utils/parallel_slot.c) - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Use array as object (src/fe_utils/parallel_slot.c)
Date
Msg-id YwLKrbwSy7FKjbK0@paquier.xyz
Whole thread Raw
In response to Re: Use array as object (src/fe_utils/parallel_slot.c)  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: Use array as object (src/fe_utils/parallel_slot.c)
Re: Use array as object (src/fe_utils/parallel_slot.c)
List pgsql-hackers
On Fri, Aug 19, 2022 at 02:22:32PM -0500, Justin Pryzby wrote:
> If you trace the history back to a17923204, you'll see a comment about the
> "zeroth slot", which makes it clear that the first slot it what's intended.
>
> I agree that it would be clearer if this were written as slots[0].connection.

Based on the way the code is written on HEAD, this would be the
correct assumption.  Now, calling PQgetCancel() would return NULL for
a connection that we actually ignore in the code a couple of lines
above when it has PGINVALID_SOCKET.  So it seems to me that the
suggestion of using "cancelconn", which would be the first valid
connection, rather than always the first connection, which may be
using an invalid socket, is correct, so as we always have our hands
on a way to cancel a command.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: Perform streaming logical transactions by background workers and parallel apply
Next
From: Michael Paquier
Date:
Subject: Re: Fix a comment in WalSnd structure