Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZIi86-0003Yu-Ud for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Jul 2015 18:55:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZIi86-0006op-GC for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Jul 2015 18:55:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZIi84-0006nG-Cw for pgsql-hackers@postgresql.org; Fri, 24 Jul 2015 18:55:32 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZIi81-0005JG-4o for pgsql-hackers@postgresql.org; Fri, 24 Jul 2015 18:55:31 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id 86552860004; Fri, 24 Jul 2015 20:55:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p5DDC6CF7.dip0.t-ipconnect.de [93.220.108.247]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id E0A8F860003; Fri, 24 Jul 2015 20:55:20 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id 480A0100E4A; Fri, 24 Jul 2015 20:55:20 +0200 (CEST) Date: Fri, 24 Jul 2015 20:55:20 +0200 From: Andres Freund To: Robert Haas Cc: Simon Riggs , Alexander Korotkov , Heikki Linnakangas , Dilip Kumar , Jeff Davis , PostgreSQL-development , Alvaro Herrera , Greg Stark , Andres Freund , Rajeev rastogi , Markus Wanner , Ants Aasma , Bruce Momjian , obartunov , Teodor Sigaev Subject: Re: Proposal for CSN based snapshots Message-ID: <20150724185520.GG21169@awork2.anarazel.de> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -5.4 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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