Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5bvU-0004gj-1t for pgsql-jdbc@arkaria.postgresql.org; Wed, 13 Feb 2013 12:59:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U5bvT-0000HA-HJ for pgsql-jdbc@arkaria.postgresql.org; Wed, 13 Feb 2013 12:59:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5bvS-0000H2-Ux for pgsql-jdbc@postgresql.org; Wed, 13 Feb 2013 12:59:03 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5bvP-0002r9-68 for pgsql-jdbc@postgresql.org; Wed, 13 Feb 2013 12:59:02 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id A896C28F01; Wed, 13 Feb 2013 04:58:55 -0800 (PST) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id A4875185ED; Wed, 13 Feb 2013 04:58:55 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id DE1441219C7; Wed, 13 Feb 2013 05:01:51 -0800 (PST) X-Virus-Scanned: amavisd-new at zcs-prod-ext-mta-1.vmware.com Received: from zcs-prod-ext-mta-1.vmware.com ([127.0.0.1]) by localhost (zcs-prod-ext-mta-1.vmware.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MU3ZDiFks-z6; Wed, 13 Feb 2013 05:01:51 -0800 (PST) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id B45B81219C2; Wed, 13 Feb 2013 05:01:51 -0800 (PST) Received: from [192.168.1.90] (unknown [10.113.62.14]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Wed, 13 Feb 2013 05:01:50 -0800 (PST) Message-ID: <511B8E0D.6010103@vmware.com> Date: Wed, 13 Feb 2013 14:58:53 +0200 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Bryan Varner CC: "pgsql-jdbc@postgresql.org" Subject: Re: PostgreSQL XAResource & GlassFish 3.1.2.2 References: <511A2C7F.1040104@vmware.com> <511A675B.3020207@polarislabs.com> <511A8BAC.7080400@vmware.com> , <511A8FC5.5040107@polarislabs.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -6.9 (------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org 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