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

From Justin Pryzby
Subject Re: Use array as object (src/fe_utils/parallel_slot.c)
Date
Msg-id 20220819192232.GW26426@telsasoft.com
Whole thread Raw
In response to Re: Use array as object (src/fe_utils/parallel_slot.c)  (Ranier Vilela <ranier.vf@gmail.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 03:52:36PM -0300, Ranier Vilela wrote:
> Em qui., 11 de ago. de 2022 às 09:52, Ranier Vilela <ranier.vf@gmail.com> escreveu:
> 
> > Hi,
> >
> > One other case suspicious, which I think deserves a conference.
> > At function wait_on_slots (src/fe_utils/parallel_slot.c)
> > The variable "slots" are array, but at function call SetCancelConn,
> > "slots" are used as an object, which at the very least would be suspicious.
>
> The commit
> https://github.com/postgres/postgres/commit/f71519e545a34ece0a27c8bb1a2b6e197d323163
> Introduced the affected function.

It's true that the function was added there, but SetCancelConn() was called the
same way before that: SetCancelConn(slots->connection);

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.

-- 
Justin



pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Re: Use array as object (src/fe_utils/parallel_slot.c)
Next
From: Ranier Vilela
Date:
Subject: Re: Use array as object (src/fe_utils/parallel_slot.c)