Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHD73-0000d4-FK for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Dec 2016 17:13:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cHD72-0002OT-U2 for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Dec 2016 17:13:04 +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_2) (envelope-from ) id 1cHD71-0002Np-MT for pgsql-hackers@postgresql.org; Wed, 14 Dec 2016 17:13:03 +0000 Received: from smtp02.citrix.com ([66.165.176.63]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cHD6t-0006zY-8U for pgsql-hackers@postgresql.org; Wed, 14 Dec 2016 17:13:01 +0000 X-IronPort-AV: E=Sophos;i="5.33,347,1477958400"; d="scan'208";a="403620477" From: Ian Jackson MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-ID: <22609.32147.935746.463570@mariner.uk.xensource.com> Date: Wed, 14 Dec 2016 17:12:51 +0000 To: Kevin Grittner CC: Robert Haas , Alvaro Herrera , Thomas Munro , , "pgsql-hackers@postgresql.org" Subject: Re: [OSSTEST PATCH 0/1] PostgreSQL db: Retry on constraint violation [and 2 more messages] [and 1 more messages] In-Reply-To: References: <1481307991-16971-1-git-send-email-ian.jackson@eu.citrix.com> <22606.47105.549023.301281@mariner.uk.xensource.com> <22607.56276.807567.924144@mariner.uk.xensource.com> <22608.6345.97849.783099@mariner.uk.xensource.com> <22608.14118.291149.821376@mariner.uk.xensource.com> <20161214140539.hotxjeoshju2m7zw@alvherre.pgsql> <22609.29020.794032.389420@mariner.uk.xensource.com> X-Mailer: VM 8.2.0b under 24.4.1 (i586-pc-linux-gnu) X-Pg-Spam-Score: -7.3 (-------) 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 Kevin Grittner writes ("Re: [HACKERS] [OSSTEST PATCH 0/1] PostgreSQL db: Retry on constraint violation [and 2 more messages] [and 1 more messages]"): > On Wed, Dec 14, 2016 at 10:20 AM, Ian Jackson wrote: > > > Let me try to summarise my understanding of what the developers think > > they can and intend to promise, about SERIALIZABLE transactions: > > > > There is a consistent serialisation of all transactions which > > successfully commit; or which do not attempt to make any changes. > > > > A "consistent serialisation" means that there is an order in which > > the same transactions might have been executed giving exactly the > > answers. This includes, if applicable, the same errors. (The > > database is free to generate synchronisation failure errors 40P01 and > > 40001 whenever it chooses.) > > I would alter that slightly to: > > There is a consistent serialization of all serializable > transactions which successfully commit. Here `serializable' means SERIALIZABLE ? > > A transaction which attempts to make any changes, and which does not > > commit (whether because the application never asks for COMMIT, or > > because of reported synchronisation failure) might see internally > > inconsistent data, or an internally-consistent view which is not > > compatible with any serialisation of other transactions. An > > application which needs a coherent view should not rely on any of the > > information from such a transaction. > > Even a read-only transaction can see a state that is not consistent > with business rules (as enforced in the software) given that some > particular later state is reached. > > For examples, please see this Wiki page. You might be particularly > interested in the examples in the "Read Only Transactions" section: > > https://wiki.postgresql.org/wiki/SSI Thanks. I read that part of the wiki page. But in that example, we are told that T1 will be aborted, not T3. Can it happen that a transaction which does not make any update attempts, will see "impossible" data, and that this is only detected at COMMIT ? Does that apply even to READ ONLY transactions ? > > Serialisation failures in subtransactions might cause the parent > > transaction to experience a serialisation failure too. > > There is currently at least one bug Right. I was trying to capture the intent, modulo bugs. > Once a serialization failure occurs the transaction is flagged as > "doomed" and will not, under any circumstances be allowed to > commit. If you find any exception to that, please report it as a > bug. Right. I think this prevents any exception-catching arrangements from suppressing the serialisation failure. Since AIUI it is not possible to run the outer COMMIT from within an exception trapping context. If it /is/ possible to run that outer COMMIT in a way which swallows the exception then this is not a practical problem but the wording ought to be changed to refer to the success of the COMMIT statement. Ian. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers