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>
Subject: Re: PostgreSQL XAResource & GlassFish 3.1.2.2
Date: Wed, 13 Feb 2013 14:58:53 +0200
Message-ID: <511B8E0D.6010103@vmware.com> (raw)
In-Reply-To: <A2B35D2698B0C74F9B8333525E67ED0135FABC78@plindyexch02.polarislabs.lan>
References: <A2B35D2698B0C74F9B8333525E67ED0135F89007@plindyexch02.polarislabs.lan>
	<511A2C7F.1040104@vmware.com>
	<511A675B.3020207@polarislabs.com>
	<511A8BAC.7080400@vmware.com>
	<CAF-4BpMPm3v1sVh=G2W3frMDb3MTJcuqxx4Uc2ZLPKtpM4Ws9Q@mail.gmail.com>
	<CADK3HHLzykmBHGnfb62TmZ-8qYzNEeo=6qQR77pEq-yxoLScLg@mail.gmail.com>
	<CADK3HHK_FtmUTCp9i2k4HjPt0xW9GnO3aKF0P=62oY8LyvGWSg@mail.gmail.com>
	<511A8FC5.5040107@polarislabs.com>
	<A2B35D2698B0C74F9B8333525E67ED0135FABC78@plindyexch02.polarislabs.lan>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

On 13.02.2013 04:28, Bryan Varner wrote:
> So, in our testing, this has eliminated one source of error. We do see -some- improvement.
>
> However, I'm -very- confused about why the XAResource implementation for postgres has so many condition checks, why it's tracking what xid was being serviced by the resource (these are global). It seems like the XAResource implementation isn't trusting the global transaction manager to actually track xids to resources.

That's one reason. Bugs in transaction managers are not unheard of. 
Getting useful error messages instead of than strange undefined behavior 
if you call the methods in a wrong sequence is useful in those 
scenarios. It's also highly useful for debugging purposes, if you're 
developing a transaction manager.

Another reason is that because the implementation doesn't support 
transaction interleaving and suspend/resume, it checks that the 
transaction manager doesn't try to do that. If it does, you get a 
meaningful error, "Transaction interleaving not implemented". That's a 
clue to the user to configure the transaction manager to not do that.

> Is this due to the overly simplistic isSameRM method, where it's not actually comparing if the resources is the same resource rather than the same rmid (pointer to an XAResource)?

I didn't fully understand that sentence, but no, it's not related to the 
fact that we have one XAResource instance per connection.

> I'm not an XA expert, but I've been doing some comparison / contrasting to other open source implementations, and it seems like other implementations are merely tracking some simple state (are we in a global tx or not?) but none of them are enforcing the restrictions the PG resource is regarding currentxid.

I guess it depends on the underlying DBMS. Many drivers just pass on the 
start/end calls to the backend, and the backend handles tracking the 
state. Also, some drivers are simply not as strict on sanity-checking 
the incoming calls, and will fail silently if the transaction manager 
does something goofy.

- 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 (24+ messages)  latest in thread

Message-ID: <511B8E0D.6010103@vmware.com>
Permalink:  ../511B8E0D.6010103@vmware.com/
Also on:    postgresql.org/message-id/511B8E0D.6010103@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
  Subject: Re: PostgreSQL XAResource & GlassFish 3.1.2.2
  In-Reply-To: <511B8E0D.6010103@vmware.com>
  References: <A2B35D2698B0C74F9B8333525E67ED0135F89007@plindyexch02.polarislabs.lan> <511A2C7F.1040104@vmware.com> <511A675B.3020207@polarislabs.com> <511A8BAC.7080400@vmware.com> <CAF-4BpMPm3v1sVh=G2W3frMDb3MTJcuqxx4Uc2ZLPKtpM4Ws9Q@mail.gmail.com> <CADK3HHLzykmBHGnfb62TmZ-8qYzNEeo=6qQR77pEq-yxoLScLg@mail.gmail.com> <CADK3HHK_FtmUTCp9i2k4HjPt0xW9GnO3aKF0P=62oY8LyvGWSg@mail.gmail.com> <511A8FC5.5040107@polarislabs.com> <A2B35D2698B0C74F9B8333525E67ED0135FABC78@plindyexch02.polarislabs.lan> <511B8E0D.6010103@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