Re: Proposal for CSN based snapshots

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Greg Stark <stark(at)mit(dot)edu>, Robert Haas <robertmhaas(at)gmail(dot)com>, "Andres Freund" <andres(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>, Ants Aasma <ants(at)cybertec(dot)at>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Markus Wanner <markus(at)bluegap(dot)ch>
Subject: Re: Proposal for CSN based snapshots
Date: 2014-08-26 10:45:25
Message-ID: 53FC6545.7000501@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/26/2014 12:03 PM, Jeff Davis wrote:
> On Fri, 2014-06-13 at 13:24 +0300, Heikki Linnakangas wrote:
>> Attached is a new patch. It now keeps the current pg_clog unchanged, but
>> adds a new pg_csnlog besides it. pg_csnlog is more similar to
>> pg_subtrans than pg_clog: it's not WAL-logged, is reset at startup, and
>> segments older than GlobalXmin can be truncated.
>
> It appears that this patch weakens the idea of hint bits. Even if
> HEAP_XMIN_COMMITTED is set, it still needs to find out if it's in the
> snapshot.
>
> That's fast if the xid is less than snap->xmin, but otherwise it needs
> to do a fetch from the csnlog, which is exactly what the hint bits are
> designed to avoid. And we can't get around this, because the whole point
> of this patch is to remove the xip array from the snapshot.

Yeah. This patch in the current state is likely much much slower than
unpatched master, except in extreme cases where you have thousands of
connections and short transactions so that without the patch, you spend
most of the time acquiring snapshots.

My current thinking is that access to the csnlog will need to be made
faster. Currently, it's just another SLRU, but I'm sure we can do better
than that. Or add a backend-private cache on top of it; that might
already alleviate it enough..

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2014-08-26 11:17:10 Re: replication commands and log_statements
Previous Message Erik Rijkers 2014-08-26 10:42:40 Re: Final Patch for GROUPING SETS - unrecognized node type: 347