Re: Resetting PGPROC atomics in ProcessInit()

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Resetting PGPROC atomics in ProcessInit()
Date: 2018-10-27 14:36:45
Message-ID: CAA4eK1JROSgyy2B2bTdzQTCjQqgD-WxEh8rnJ1fAeEfx1cZ0cg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 27, 2018 at 4:11 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> Hi,
>
> 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?
>

It seems the code written has followed a natural practice i.e PGPROC
members are initialized in InitProcess and ProcGlobal members (like
procArrayGroupFirst) are initialized in InitProcGlobal. For your use
case, can't you look at procArrayGroupFirst? If not, then I think we
can do what you are saying as I don't see a problem in initializing
them in InitProcGlobal.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-10-27 14:45:57 Re: BUG #15446: Crash on ALTER TABLE
Previous Message Tomas Vondra 2018-10-27 12:22:45 Re: Comment fix and question about dshash.c