Re: Latch for the WAL writer - further reducing idle wake-ups.

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Latch for the WAL writer - further reducing idle wake-ups.
Date: 2012-05-08 23:21:58
Message-ID: CAEYLb_XggnfVNWUYv6wvTM5K43YdwsqjN66H4vCUB7FHkQoo=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8 May 2012 22:35, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Now that I've actually read the patch, rather than just responding to
> your description of it, I find myself entirely unhappy with the proposed
> changes in the walwriter's sleep logic.  You have introduced race
> conditions (it is NOT okay to reset the latch somewhere below the top of
> the loop)

Yes, there is some checking of flags before the potential ResetLatch()
call, which may be acted on. The code there is almost identical to
that of the extant bgwriter code. I was under the impression that this
did not amount to a race, though it's rather late now, and I'm feeling
under the weather, so I have not taken steps to verify that I have it
right. Arguably, you'd want somebody's SetLatch call to be ignored if

> and degraded the walwriter's signal response time in normal
> non-hibernation state, to solve a problem not in evidence; to wit that
> backends spend too much time signaling the walwriter.  Given the
> location of the only existing SetLatch call for the purpose, I find that
> proposition more than a bit doubtful.

I do too. The elaborate logic to reduce that overhead was nothing more
than a vestige of the first version. I apologise for making such a
basic error.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-05-08 23:40:50 Re: Latch for the WAL writer - further reducing idle wake-ups.
Previous Message Tom Lane 2012-05-08 21:35:27 Re: Latch for the WAL writer - further reducing idle wake-ups.