Re: Lockless StrategyGetBuffer() clock sweep

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(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 20:30:52
Message-ID: 20141223203052.GC23613@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

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?

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0001-Lockless-StrategyGetBuffer-clock-sweep-hotpath.patch text/x-patch 15.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-12-23 21:00:21 Re: Commit timestamp abbreviations
Previous Message Peter Geoghegan 2014-12-23 19:55:59 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}