Re: system views for walsender activity

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: system views for walsender activity
Date: 2011-01-13 16:08:58
Message-ID: AANLkTikV3sqYt0P=zg8ov9ZpHUqbMf1Tou28_iZvw=yD@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 12, 2011 at 03:03, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Jan 11, 2011 at 7:24 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>>> No, do this at top
>>>
>>> if (walsnd->state == state)
>>>  return;
>>>
>>> Keep spinlocks when actually setting it.
>
> I think this is safe...
>
>> Aha. Thanks for the pointers, pfa a new version.
>
> ...but I think you also need to take the spinlock when reading the value.

Even when it can only ever be set by one process (the owning
walsender), and the variable is atomic (as it should be, since it's a
single enum/int)?

Anyway, it should be as simple as copying it out to a local variable
when it's already in the spinlock and then use that, right?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-01-13 16:28:19 Re: SSI patch version 8
Previous Message Tom Lane 2011-01-13 15:41:28 Re: kill -KILL: What happens?