Re: BufferSync() performance - Mailing list pgsql-general

From Tom Lane
Subject Re: BufferSync() performance
Date
Msg-id 10376.1236285536@sss.pgh.pa.us
Whole thread Raw
In response to BufferSync() performance  (Guido Ostkamp <postgresql@ostkamp.fastmail.fm>)
List pgsql-general
Guido Ostkamp <postgresql@ostkamp.fastmail.fm> writes:
> Would this work or is there a special reason why the original check was
> done with lock held?

This will fail, very nastily, on multiple-CPU machines with weak memory
ordering guarantees.  You can't assume you are seeing an up-to-date
value of the flag bit if you don't take the spinlock first.

There are places where we can get away with such things because a
slightly stale answer is okay, but not in BufferSync().  Failing to
include a dirty page in the checkpoint is fatal.

            regards, tom lane

pgsql-general by date:

Previous
From: Richard Greenwood
Date:
Subject: Re: not quite a cross tab query...
Next
From: Greg Smith
Date:
Subject: Re: BufferSync() performance