pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>
Cc: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Greg Stark <stark@mit.edu>
Cc: Andres Freund <andres@2ndquadrant.com>
Cc: Rajeev rastogi <rajeev.rastogi@huawei.com>
Cc: Markus Wanner <markus@bluegap.ch>
Cc: Ants Aasma <ants@cybertec.at>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: obartunov <obartunov@postgrespro.ru>
Cc: Teodor Sigaev <teodor@postgrespro.ru>
Subject: Re: Proposal for CSN based snapshots
Date: Fri, 24 Jul 2015 20:55:20 +0200
Message-ID: <20150724185520.GG21169@awork2.anarazel.de> (raw)
In-Reply-To: <CA+Tgmob1DmDsvc7iyd0SY5j4SFdesDwoef36bxG1pE_s1JQXOQ@mail.gmail.com>
References: <CAM-w4HMG-YeTfWc3r_excej3Kd04q4zDDXR0hxShVbij211ABA@mail.gmail.com>
	<539AD153.9000004@vmware.com>
	<1409043789.2335.330.camel@jeff-desktop>
	<53FC6545.7000501@vmware.com>
	<1409116988.2335.463.camel@jeff-desktop>
	<53FD7D65.9040602@vmware.com>
	<53FD7DCC.5020005@vmware.com>
	<CAPpHfdsCUb4qBUHzfqNsUYALC_LEpHD9qB-ozvS_8esv1edCTw@mail.gmail.com>
	<CANP8+jLAe3Smtq3FF49DMvuxtfoRQcCPQn28GEKuwAb2J41XCA@mail.gmail.com>
	<CA+Tgmob1DmDsvc7iyd0SY5j4SFdesDwoef36bxG1pE_s1JQXOQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 2015-07-24 14:21:39 -0400, Robert Haas wrote:
> - Mixing synchronous_commit=on and synchronous_commit=off won't work
> as well, because if the LSN ordering of commit records matches the
> order in which transactions become visible, then an async-commit
> transaction can't become visible before a later sync-commit
> transaction.  I expect we might just decide we can live with this, but
> it's worth discussing in case people feel otherwise.

I'm not following this anymore. Even though a couple months back I
apparently did. Heikki's description of the problem was:

On 2014-05-30 17:59:23 +0300, Heikki Linnakangas wrote:
> One thorny issue came up in discussions with other hackers on this in PGCon:
> 
> When a transaction is committed asynchronously, it becomes visible to other
> backends before the commit WAL record is flushed. With CSN-based snapshots,
> the order that transactions become visible is always based on the LSNs of
> the WAL records. This is a problem when there is a mix of synchronous and
> asynchronous commits:
> 
> If transaction A commits synchronously with commit LSN 1, and transaction B
> commits asynchronously with commit LSN 2, B cannot become visible before A.
> And we cannot acknowledge B as committed to the client until it's visible to
> other transactions. That means that B will have to wait for A's commit
> record to be flushed to disk, before it can return, even though it was an
> asynchronous commit.


Afacs the xlog insertion order isn't changed relevantly by the patch?

Right now the order for sync commit = on is:

XactLogCommitRecord();
XLogFlush();
TransactionIdCommitTree();
ProcArrayEndTransaction();

and for sync commit = off it's:
XactLogCommitRecord();
TransactionIdAsyncCommitTree();
ProcArrayEndTransaction();

with the CSN patch it's:

sync on:
TransactionIdSetCommitting();
XactLogCommitRecord();
XLogFlush(XactLastRecEnd);
TransactionIdCommitTree();

sync off:
TransactionIdSetCommitting();
XactLogCommitRecord();
TransactionIdCommitTree();

How does this cause the above described problem? Yes, mixing sync/async
commits can give somewhat weird visibility semantics, but that's not
really new, is it?

Regards,

Andres


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (113+ messages)  latest in thread

Message-ID: <20150724185520.GG21169@awork2.anarazel.de>
Permalink:  ../20150724185520.GG21169@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20150724185520.GG21169@awork2.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andres@anarazel.de, robertmhaas@gmail.com, simon@2ndquadrant.com, a.korotkov@postgrespro.ru, hlinnakangas@vmware.com, dilipbalaut@gmail.com, pgsql@j-davis.com, alvherre@2ndquadrant.com, stark@mit.edu, andres@2ndquadrant.com, rajeev.rastogi@huawei.com, markus@bluegap.ch, ants@cybertec.at, bruce@momjian.us, obartunov@postgrespro.ru, teodor@postgrespro.ru
  Subject: Re: Proposal for CSN based snapshots
  In-Reply-To: <20150724185520.GG21169@awork2.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox