pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: andres@anarazel.de
Cc: michael@paquier.xyz
Cc: thomas.munro@gmail.com
Cc: tomas.vondra@2ndquadrant.com
Cc: a.zakirov@postgrespro.ru
Cc: ah@cybertec.at
Cc: magnus@hagander.net
Cc: robertmhaas@gmail.com
Cc: tgl@sss.pgh.pa.us
Cc: pgsql-hackers@postgresql.org
Subject: Re: shared-memory based stats collector
Date: Fri, 27 Mar 2020 12:34:02 -0300
Message-ID: <20200327153402.GA1045@alvherre.pgsql> (raw)
In-Reply-To: <20200327.163115.1814716981588442968.horikyota.ntt@gmail.com>

On 2020-Mar-27, Kyotaro Horiguchi wrote:

> +/*
> + * XLogArchiveWakeupEnd - Set up archiver wakeup stuff
> + */
> +void
> +XLogArchiveWakeupStart(void)
> +{
> +	Latch *old_latch PG_USED_FOR_ASSERTS_ONLY;
> +
> +	SpinLockAcquire(&XLogCtl->info_lck);
> +	old_latch = XLogCtl->archiverWakeupLatch;
> +	XLogCtl->archiverWakeupLatch = MyLatch;
> +	SpinLockRelease(&XLogCtl->info_lck);
> +	Assert (old_latch == NULL);
> +}

Comment is wrong about the function name; OTOH I don't think the
old_latch assigment in the fourth line won't work well in non-assert
builds.  But why do you need those shenanigans?  Surely
"Assert(XLogCtl->archiverWakeupLatch == NULL)" in the locked region
before assigning MyLatch should be sufficient and acceptable?

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (238+ messages)  latest in thread

Message-ID: <20200327153402.GA1045@alvherre.pgsql>
Permalink:  ../20200327153402.GA1045@alvherre.pgsql/
Also on:    postgresql.org/message-id/20200327153402.GA1045@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, horikyota.ntt@gmail.com, andres@anarazel.de, michael@paquier.xyz, thomas.munro@gmail.com, tomas.vondra@2ndquadrant.com, a.zakirov@postgrespro.ru, ah@cybertec.at, magnus@hagander.net, robertmhaas@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: shared-memory based stats collector
  In-Reply-To: <20200327153402.GA1045@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox