From: Kevin Grittner <kgrittn@ymail.com>
To: Ludovic POLLET <ludovic.pollet@kurmi-software.com>
To: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: TR: [BUGS] BUG #8842: lo_open/fastpath transaction inconsistency
Date: Mon, 5 May 2014 06:54:57 -0700 (PDT)
Message-ID: <1399298097.47090.YahooMailNeo@web122305.mail.ne1.yahoo.com> (raw)
In-Reply-To: <dc0d8729da3744cfaf5b1d4ef36a566f@AMSPR06MB166.eurprd06.prod.outlook.com>
References: <20140115124935.30128.15593@wrigleys.postgresql.org>
<20140416175501.GG7443@momjian.us>
<dc0d8729da3744cfaf5b1d4ef36a566f@AMSPR06MB166.eurprd06.prod.outlook.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
Ludovic POLLET <ludovic.pollet@kurmi-software.com> wrote:
> We are facing a bug where our application cannot read a Lob
> because of concurrent removal. However, we are using the
> serializable isolation level and a correct transaction scope.
> We're using the latest JDBC driver snapshot (and hibernate but
> that does not really matter).
>
> The problematic use case is basically a thread that read the LOB
> while another thread replace it with a new one and release the
> old one. In this case, the reader will get a "large object xxx
> does not exist".
>
> From what I understand, it is due to the opening of the large
> object that is always done in read/write mode and thus behave as
> a read commited one (as written in the doc).
>
> This behaviour is at least very surprising especially when
> working in SERIALIZABLE concurrency level.
>
> The attached patch implements the following changes:
> - Opening the lob in read mode until a write function is called.
> In such a case, the LOB will be reopened in read/write mode. It
> totally solves my problem since our application does not modify
> Lob, but creates new ones indeed.
> - Deferring the first lo_open until a Blob function is really
> called (hibernate seems to be creating blob even if it does not
> even read them...)
>
> What do you think about these behaviors ?
As one of the developers of the implementation of serializable
transactions used by PostgreSQL, I remember that we needed to
exclude large objects from the transaction serialization because it
basically did not follow transactional semantics in any other
regard. The only workaround I can think to suggest is to only
insert and delete large objects -- never update them, and rely on
the serialization of modifications to the OID columns which
*reference* the large objects. Always add the large object before
setting a reference to it, and always eliminate references to a
large object before deleting it. A crash at the wrong time could
leave a large object which is unreferenced, so you might want to
look at the vacuumlo executable:
http://www.postgresql.org/docs/current/static/vacuumlo.html
Unfortunately, I don't know how that approach interacts with
Hibernate or its use of the JDBC driver.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: kgrittn@ymail.com, ludovic.pollet@kurmi-software.com
Subject: Re: TR: [BUGS] BUG #8842: lo_open/fastpath transaction inconsistency
In-Reply-To: <1399298097.47090.YahooMailNeo@web122305.mail.ne1.yahoo.com>
References: <20140115124935.30128.15593@wrigleys.postgresql.org> <20140416175501.GG7443@momjian.us> <dc0d8729da3744cfaf5b1d4ef36a566f@AMSPR06MB166.eurprd06.prod.outlook.com> <1399298097.47090.YahooMailNeo@web122305.mail.ne1.yahoo.com>
* 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