Re: auto-sizing wal_buffers - Mailing list pgsql-hackers

From Robert Haas
Subject Re: auto-sizing wal_buffers
Date
Msg-id AANLkTikpeVE-XMZL4L4Mi4zUd7S-D1JckO97_wjp8t3M@mail.gmail.com
Whole thread Raw
In response to Re: auto-sizing wal_buffers  (Greg Smith <greg@2ndquadrant.com>)
Responses Re: auto-sizing wal_buffers  (Jaime Casanova <jaime@2ndquadrant.com>)
Re: auto-sizing wal_buffers  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sat, Jan 15, 2011 at 11:52 AM, Greg Smith <greg@2ndquadrant.com> wrote:
> Where I was expecting that setting to be "4" instead for 32kB.  So there's
> probably some minor bug left in where I inserted this into the
> initialization sequence.

So I started taking a look at this patch tonight with an eye to
committing it, but ended up having to whack it around fairly hard to
fix the problem described above: the problem is, I believe, that the
initialization code in question doesn't run in every backend.  My
first thought was "gee, it's a bad idea for us to be manipulating the
value of the GUC variable directly, I should use an assign_hook".
But of course that turns out to be a bad idea, because there's no
guarantee that wal_buffers will be initialized after shared_buffers.
So I put it back the way you had it, and jiggered things so that the
copy of the value that's actually used for memory allocation gets
stored in XLogCtl.  That made it possible to define a show_hook that
DTRT, but that wasn't entirely straightforward either: the show_hook
has to deliver the finished string, not just a replacement integer for
guc.c to format.  So I exposed the relevant formatting logic from
guc.c as a separate function (duplicating that code didn't seem
smart), and now it all seems to work.  See attached, which also
includes some other rewriting of code and docs that I hope constitute
improvements.

Barring screams of agony^W^W^Whelpful suggestions for how to code this
more neatly, I'll go ahead and commit this.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: WIP: RangeTypes
Next
From: Jaime Casanova
Date:
Subject: Re: auto-sizing wal_buffers