pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Bryan Varner <bvarner@polarislabs.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Cc: Kevin Grittner <kgrittn@ymail.com>
Cc: Florent Guillaume <fg@nuxeo.com>
Subject: Re: Working toward a JTA 1.0.1 Compliant XADataSource
Date: Sat, 16 Feb 2013 22:03:07 +0200
Message-ID: <511FE5FB.6000503@vmware.com> (raw)
In-Reply-To: <A2B35D2698B0C74F9B8333525E67ED0135FF12E8@plindyexch02.polarislabs.lan>
References: <A2B35D2698B0C74F9B8333525E67ED0135FF12E8@plindyexch02.polarislabs.lan>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

On 16.02.2013 09:16, Bryan Viarner wrote:
> For our application and middleware stack we've not had any luck making minor adjustments to improve the issues we've been having. My early panic about serialized methods did help to eliminate one class of errors in our test environment (once we were finally able to duplicate the issue), but culminated in exposing the lack of interleaving or shareable XAResources for 2pc operations with the GlassFish transaction manager as the ultimate culprit for our issues. It seems that when GlassFish gets busy (and your resource pool gets busy) it starts expecting some aspects of interleaving -- in the form of commit(xid1, false) after start(xid2, NOFLAGS) has been issued to an XAResource.

Sorry to hear that. I'd be interested to have an isolated, stand-alone 
test application that reproduces the problem, so that I could also play 
with it.

> As has been discussed on this list earlier in the week an implementation that truly implements JTA 1.0.1, or at least supports interleaving will bring a new set of trade-offs. Such an implementation would also make more complex JEE deployments atop PostgreSQL possible (and more reliable, as in our case) for a wider set of containers and transaction managers.

Frankly, I don't think this is worth the trouble, or worth complicating 
the driver for. It would be nice to be fully compliant, just so we could 
say that we are, but in practice, meh.

The PostgreSQL driver is not alone with the limitations. I believe 
Oracle has similar limitations, as does MySQL, and DB2. Which is why all 
application servers I've bumped into this far have options to work 
around them. I'm very surprised if Glassfish doesn't. In practice, a 
transaction manager that insists on working support for transaction 
interleaving and suspend/resume, is pretty useless.

For example, in JBoss the option is called "track-connection-by-tx". 
Since JBoss 5, the default is "true", so you don't need to remember to 
set it manually anymore. I'm guessing that the JBoss developers decided 
that it's better to set it by default, because in practice most 
connector implementations require it to be set.

On Atomikos, the setting is called "com.atomikos.icatch.threaded_2pc", 
and they also seem to have switched the default to false (ie. the right 
option for PostgreSQL") in version 3.7.

IMHO it was a serious mistake from the JTA spec authors to require those 
extra features. They are not required for robust two-phase commit, and 
are difficult to implement in many JDBC drivers, including PostgreSQL's.

> We love PostgreSQL. It's done very well for us in the past and we'd like to give back by making it a better product for everyone to use. This looks like a pretty good place to start doing that.

I think the best action here would be to expand the FAQ with specific 
information on how to set up the data source on various app servers 
(http://jdbc.postgresql.org/documentation/faq.html). And if Glassfish 
doesn't yet provide a suitable work-around option, petition them to 
implement one.

> On behalf of the development team I've been working with on this the last few days, I'd like to invite any interested party to take a peek at what we're doing on github.
> https://github.com/polarislabs/pgjdbc/tree/POLARIS_XA

There seems to be some unrelated refactoring in this branch, moving 
files around, so it's a bit hard to see what the real changes are.

One random thought just occurred to me: while I don't think this is 
worth the complexity in the PostgreSQL driver, would it be possible to 
implement this as a generic wrapper that could be used with any 
XADataSource implementation? The concept of implementing the transaction 
interleaving and suspend/resume by adding yet another layer of pooling 
seems pretty universal. It could then be used with any application 
server which doesn't already provide a work-around option, and with any 
JDBC implementation that has these limitations.

- Heikki


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



view thread (14+ messages)  latest in thread

Message-ID: <511FE5FB.6000503@vmware.com>
Permalink:  ../511FE5FB.6000503@vmware.com/
Also on:    postgresql.org/message-id/511FE5FB.6000503@vmware.com

 · 

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 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: hlinnakangas@vmware.com, bvarner@polarislabs.com, kgrittn@ymail.com, fg@nuxeo.com
  Subject: Re: Working toward a JTA 1.0.1 Compliant XADataSource
  In-Reply-To: <511FE5FB.6000503@vmware.com>
  References: <A2B35D2698B0C74F9B8333525E67ED0135FF12E8@plindyexch02.polarislabs.lan> <511FE5FB.6000503@vmware.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