Re: Lockless StrategyGetBuffer() clock sweep

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Lockless StrategyGetBuffer() clock sweep
Date: 2014-12-23 21:42:41
Message-ID: CA+TgmoYEWEb+-p3Ru2Go4w2n1tyRPiBoKu_HdADw14Boi6c-Mw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 23, 2014 at 3:30 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> On 2014-12-10 21:52:17 -0500, Robert Haas wrote:
>> Maybe you could store the pgprocno instead of the PROC *.
>
> That's a good idea. Here's a patch implementing that and other things.

Thanks. Cool.

> Changes:
> * The handling of wraparound is slight changed. There's a separate patch
> for the case where nextVictimBuffer is above NBuffers. That allows a)
> to avoid the somewhat expensive modulo operation in the common case b)
> always consistent results for StrategySyncStart()
> * StrategySyncStart() doesn't have a situation in which it can return
> inaccurate information anymore. That could actually trigger an
> assertion bgwriter.
> * There was a bug because the local victim variable was signed instead
> of unsigned.
> * Clock sweep ticks are moved into a separate routine.
>
> Comments?

You need to spell-check your commit message. My spell-checker
complains about acquiration, aleviated, aleviates, and clocksweep.
The first is not a word at all; perhaps you meant acquisition. The
next two, I believe, need a double-l rather than a single-l.
"acquiration" also appears in the text of the patch, along with
"wether" (should be "whether"). And the last one should be two words.

I don't think I have anything to say about the substance of the patch.
If fetch-and-add is faster than a spinlock cycle, then it is. And
it's good to be fast.

--
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 Andres Freund 2014-12-23 21:51:40 Re: Lockless StrategyGetBuffer() clock sweep
Previous Message Mark Kirkwood 2014-12-23 21:13:53 Re: mysql with postgres