Re: Resetting PGPROC atomics in ProcessInit()

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Resetting PGPROC atomics in ProcessInit()
Date: 2018-11-08 11:08:25
Message-ID: CAA4eK1Lqu-v8Cw2KV0pem8+3b+yLPoC4chF6ACczSkxWhdjt-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Nov 4, 2018 at 6:30 AM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Sat, Oct 27, 2018 at 6:41 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > I just noticed, while working on a patch adding things to PGPROC, that
> > the group clearning patches for the proc array and clog reset atomics in
> > InitProcess().
> >
> > I'm not a big fan of that, because it means that it's not safe to look
> > at the atomics of backends that aren't currently in use. Is there any
> > reason to not instead initialize them in InitProcGlobal() and just
> > assert in InitProcess() that they're 0? If they're not, we'd be in deep
> > trouble anyway, no?
>
> I think you are correct. I think it would be better in general for
> InitProcess() to Assert() rather than reinitializing.
>

Okay, changed the code as per Andres's and your suggestion. Do you
think the attached change makes sense? I think we should backpatch
this.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
fix_atomic_init_group_clear_v1.patch application/octet-stream 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-11-08 11:16:49 Re: A typo in partprune.c
Previous Message Fabien COELHO 2018-11-08 10:54:27 Re: fix psql \conninfo & \connect when using hostaddr