Re: [PATCHES] Hint Bits and Write I/O - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: [PATCHES] Hint Bits and Write I/O
Date
Msg-id 1213828865.9468.177.camel@ebony.site
Whole thread Raw
In response to Hint Bits and Write I/O  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
On Wed, 2008-06-18 at 14:53 +0100, Simon Riggs wrote:

> There is one minor strangeness in the patch, which is the change of
> initdb's command order when "vacuuming database template1". With the
> previous ordering of ANALYZE; VACUUM FULL; VACUUM; the flexible hint bit
> setting of the ANALYZE on a freshly bootstrapped database caused a
> *consistent* error during the VACUUM FULL which follows it. That took,
> (cough, splutter), a little while to resolve. I've added that as a test
> to the vacuum regression tests and not found another error (yet?). An
> interesting mystery though. :-)

Ah! Now I understand.

The ANALYZE was setting hint bits, yet not dirtying the buffer. When the
VACUUM reads the buffer it sees the hint bits set, so doesn't set the
buffer dirty. Yet if the buffer is replaced the hints are lost, yet the
VACUUM now relies upon their presence - wham!

So, for this to work VACUUM correctly must dirty any buffer it touches
that has hint_count > 0, even if no hints were set by the VACUUM. VACUUM
will then act the same, no matter whether another session has recently
touched the buffer. Conceivably, this might mean that VACUUM dirties
*more* buffers than it did before, but at least it will write them also.

New version on its way.

--
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Training, Services and Support


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: regex cache
Next
From: Alvaro Herrera
Date:
Subject: ecpg generated files ignorable?