Re: Proposal for CSN based snapshots

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Greg Stark <stark(at)mit(dot)edu>, Andres Freund <andres(at)2ndquadrant(dot)com>, Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>, Markus Wanner <markus(at)bluegap(dot)ch>, Ants Aasma <ants(at)cybertec(dot)at>, Bruce Momjian <bruce(at)momjian(dot)us>, obartunov <obartunov(at)postgrespro(dot)ru>, Teodor Sigaev <teodor(at)postgrespro(dot)ru>
Subject: Re: Proposal for CSN based snapshots
Date: 2016-08-10 14:30:57
Message-ID: 79213506-4c9c-7e7a-44c6-ae94484c1159@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/10/2016 05:09 PM, Tom Lane wrote:
> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
>> Imagine that you have a stream of normal, synchronous, commits. They get
>> assigned LSNs: 1, 2, 3, 4. They become visible to other transactions in
>> that order.
>
>> The way I described this scheme in the first emails on this thread, was
>> to use the current WAL insertion position as the snapshot. That's not
>> correct, though: you have to use the current WAL *flush* position as the
>> snapshot. Otherwise you would see the results of a transaction that
>> hasn't been flushed to disk yet, i.e. which might still get lost, if you
>> pull the power plug before the flush happens. So you have to use the
>> last flush position as the snapshot.
>
> Uh, what? That's not the semantics we have today, and I don't see why
> it's necessary or a good idea. Once the commit is in the WAL stream,
> any action taken on the basis of seeing the commit must be later in
> the WAL stream. So what's the problem?

I was talking about synchronous commits in the above. A synchronous
commit is not made visible to other transactions, until the commit WAL
record is flushed to disk.

You could argue that that doesn't need to be so, because indeed any
action taken on the basis of seeing the commit must be later in the WAL
stream. But that's what asynchronous commits are for. For synchronous
commits, we have a higher standard.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Satoshi Nagayasu 2016-08-10 14:37:36 Re: Wait events monitoring future development
Previous Message Bruce Momjian 2016-08-10 14:21:01 Re: Wait events monitoring future development