Re: Proposal for CSN based snapshots

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(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 17:58:55
Message-ID: 1409075935.2335.358.camel@jeff-desktop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2014-08-26 at 13:45 +0300, Heikki Linnakangas wrote:
> 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..

Aren't those the same ideas that have been proposed for eliminating hint
bits?

If this patch makes taking snapshots much faster, then perhaps it's
enough incentive to follow through on one of those ideas. I am certainly
open to removing hint bits (which was probably clear from earlier
discussions) if there are significant wins elsewhere and the penalty is
not too great.

To continue the discussion on this patch, let's assume that we make
TransactionIdGetCommitLSN sufficiently fast. If that's the case, can't
we make HeapTupleSatisfiesMVCC look more like:

LsnMin = TransactionIdGetCommitLSN(xmin);
if (!COMMITLSN_IS_COMMITTED(LsnMin))
LsnMin = BIG_LSN;

LsnMin = TransactionIdGetCommitLSN(xmin);
if (!COMMITLSN_IS_COMMITTED(LsnMin))
LsnMin = BIG_LSN;

return (snapshot->snapshotlsn >= LsnMin &&
snapshot->snapshotlsn < LsnMax);

There would need to be some handling for locked tuples, or tuples
related to the current transaction, of course. But I still think it
would turn out simpler; perhaps by enough to save a few cycles.

Regards,
Jeff Davis

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2014-08-26 18:25:57 Re: Proposal for CSN based snapshots
Previous Message Magnus Hagander 2014-08-26 16:53:21 Re: Switch pg_basebackup to use -X stream instead of -X fetch by default?