Re: Process local hint bit cache

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Process local hint bit cache
Date: 2011-04-04 14:25:54
Message-ID: BANLkTi=RjTvPcO_3P+YfB6v7wyZohpbVBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 3, 2011 at 6:40 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> On Sat, Apr 2, 2011 at 8:37 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
>>> On Thu, Mar 31, 2011 at 5:38 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>>>> working on exanding the cache to # xid > 1.
>>
>>> patch attached.  this is essentially my original idea except it's
>>> injected directly in to tqual.c as a kind of a expansion of the 'last
>>> seen' concept.  Because the cache loops are inlined and very tight (4
>>> int compares), it's actually cheaper than jumping out of line into
>>> clog to test this_int = that_int;
>>
>> This seems like a mess.  Why is the criterion for caching commit states
>> different from whether the hint bit can be set?  And why are you
>
> The hint bits are always set.  The page is flagged dirty if and only
> if you have to dip below the process local cache to get it.  The
> rationale for this is simple: it caps your downside because unlike
> hint bit removal or BM_UNTIDY, you only have to dip into clog and pay
> the i/o once per page -- so that your downside is limited to pre-cache
> behavior (minus the overhead of maintaining the cache).

I might have missed part of the thrust of your question. In the
patch, the commit status is only stored if the LSN for the xid is
known safe (instead of checking it just before setting the bit as
SetHintBits does). This is indeed different, and it was done so as to
avoid having to a. repeatedly check XLogNeedsFlush or b. cache the xid
LSN as transam.c does. Perhaps this is weak sauce, so I think the
first thing to do is have another go at doing it at the transam level.
Stay tuned...

merlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-04-04 14:52:01 time table for beta1
Previous Message Kevin Grittner 2011-04-04 12:07:00 Re: GUC assign hooks (was Re: wal_buffers = -1 and SIGHUP)