Re: Resetting PGPROC atomics in ProcessInit()

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Resetting PGPROC atomics in ProcessInit()
Date: 2018-11-04 01:00:11
Message-ID: CA+TgmobCtQKa=T52tqsTEQhbd_JLx2woqM3g_G_8ObyxCc7-pA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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. Apart from this
issue, it's not free.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu Kommi 2018-11-04 01:07:24 Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query
Previous Message Michael Paquier 2018-11-04 00:28:37 Re: CF app feature request