Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UGat7-0008St-Na for pgsql-jdbc@arkaria.postgresql.org; Fri, 15 Mar 2013 20:06:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UGat7-0006sl-7D for pgsql-jdbc@arkaria.postgresql.org; Fri, 15 Mar 2013 20:06:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UGat6-0006sY-Ar for pgsql-jdbc@postgresql.org; Fri, 15 Mar 2013 20:06:00 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UGat0-0003Hy-5g for pgsql-jdbc@postgresql.org; Fri, 15 Mar 2013 20:05:58 +0000 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 220D428268; Fri, 15 Mar 2013 13:05:51 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 1FDBE4013A; Fri, 15 Mar 2013 13:05:51 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id 75246C1523; Fri, 15 Mar 2013 13:05:49 -0700 (PDT) X-Virus-Scanned: amavisd-new at zcs-prod-ext-mta-2.vmware.com Received: from zcs-prod-ext-mta-2.vmware.com ([127.0.0.1]) by localhost (zcs-prod-ext-mta-2.vmware.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Eb0IRiyUTo3j; Fri, 15 Mar 2013 13:05:49 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id 4D212C1521; Fri, 15 Mar 2013 13:05:49 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA; Fri, 15 Mar 2013 13:05:48 -0700 (PDT) Message-ID: <51437F1C.7080000@vmware.com> Date: Fri, 15 Mar 2013 22:05:48 +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: Re: [pgjdbc] XADataSource support for resource sharing & interleaving. (#47) References: <51436708.9080801@vmware.com> <51436D0A.4030903@polarislabs.com> In-Reply-To: <51436D0A.4030903@polarislabs.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -9.3 (---------) 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 15.03.2013 20:48, Bryan Varner wrote: >> If we must have this anyway, I think we should try to implement it as a >> generic wrapper that could be used with any XADataSource implementation. > > I think you mean DataSource implementation. So long as the underlying > RDBMS supports prepared transactions, there's no reason a wrapper > couldn't handle -all- of the XA bits. Yeah, but there is no standardized way to work with the underlying RDBM's prepared transactions, other than XADataSource. PostgreSQL uses PREPARE TRANSACTION, other RDBMs have something else. I was thinking of a wrapper that calls the native XADataSource implementation, which doesn't need to support suspend/resume and interleaving, and presents a fully-compliant XADataSource implementation to the outside, using the technique you used. > I'm not opposed to pulling it out into a wrapper, but what you're > describing in doing so is a new F/OSS project to accomplish that goal. > There will be some overlap with other existing projects. DBCP provides a > pooling data source wrapper for drivers which don't provide it. Yeah, possibly. Or it could still be included in the org.postgresql driver. I guess it depends on the details, on what exactly the wrapper will look like. > Hibernate has a system for providing dialect-specific SQL, which we'll > need to handle prepare() commit() rollback() recover() of 2pc operations > on a per-dialect basis. I didn't understand that part. What does Hibernate have to do with this? >> Sure, that would >> be slow, so you'd definitely still want to configure the TM to not do >> that, but at least it would work. > > We evaluated what it would take to get pgjdbc to work with GlassFish's > TM as is. There are cases in our application where it does SUSPEND. What > you are proposing will not fix the missing support for SUSPEND / JOIN. Did you evaluate what it would take to add the option to Glassfish? > Honestly, I don't understand why all these drivers did such a half-baked > job of implementing the spec, or why you're so vocally defending a > half-implementation when it took two people bouncing ideas, code, and > testing a week to get it workable, and a few additional weeks to > stabilize it. The JTA specification is crap. It imposes requirements on the drivers that have nothing to do with the real goal of the spec: supporting two-phase commit. It's silly that drivers have to be complicated to support those things. If you look at the javadocs for XADataSource, it says for getXAConnection(): > Attempts to establish a *physical* database connection that can be used in a distributed transaction. (emphasis mine). It's pretty clear what the intention of the authors is. "physical" is a vague term, but you'd expect that typically to be a single TCP connection, wouldn't you? It's not expected that the driver needs a multiplexing layer, mapping a single XAConnection to multiple physical connections. Now, maybe it works fine with the multiplexing layer, but even if that's the way to meet the letter of the JTA spec, I don't think it's in the spirit of the spec that you'd have to do that. > I think it's completely unreasonable to expect the reference > implementation of a container that follows specifications to provide a > workaround for non-compliant drivers which incorrectly implement a > well-documented interface. Doesn't hurt to ask... They do have xa-driver-does-not-support-non-tx-operations and oracle-xa-recovery-workaround options, which are similar workarounds. Regarding the patch itself: Does it work correctly if you prepare a PreparedStatement in one transaction, suspend, and try to use the prepared statement in another transaction? I'm not sure what "correctly" is here, I don't think the JTA spec says anything explicit about that scenario (it's crap, after all ;-)), but I'd expect that to work. It's a bit worrying that you can exceed your connection pool size with this. In the worst case, a single logical connection can use an arbitrary number of physical connections. That makes it more difficult to set max_connections, so that you don't run out of slots. To an admin, it's pretty surprising to see 50 connections from a host, when you've configured the max connection pool size to 40. - Heikki -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc