Re: Use array as object (src/fe_utils/parallel_slot.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Use array as object (src/fe_utils/parallel_slot.c)
Date: 2022-08-19 19:30:19
Message-ID: CAEudQArGP+1wTS6YpC9Pm3hJ4hzx0rszfvOHf0rHYE6FY8hChQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em sex., 19 de ago. de 2022 às 16:22, Justin Pryzby <pryzby(at)telsasoft(dot)com>
escreveu:

> 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(dot)vf(at)gmail(dot)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.
>
Thank you Justin, for the research.

>
> I agree that it would be clearer if this were written as
> slots[0].connection.
>
But I still think that the new variable introduced, "cancelconn", became
the real argument.

regards,
Ranier Vilela

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2022-08-19 20:08:29 use ARM intrinsics in pg_lfind32() where available
Previous Message Justin Pryzby 2022-08-19 19:22:32 Re: Use array as object (src/fe_utils/parallel_slot.c)