Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p0m0m-000122-UK for pgsql-jdbc@arkaria.postgresql.org; Thu, 01 Dec 2022 16:02:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p0m0l-0003X8-NQ for pgsql-jdbc@arkaria.postgresql.org; Thu, 01 Dec 2022 16:02:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p0m0l-0003Wy-Er for pgsql-jdbc@lists.postgresql.org; Thu, 01 Dec 2022 16:02:07 +0000 Received: from mail-vs1-xe2d.google.com ([2607:f8b0:4864:20::e2d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p0m0e-0004zc-S3 for pgsql-jdbc@lists.postgresql.org; Thu, 01 Dec 2022 16:02:06 +0000 Received: by mail-vs1-xe2d.google.com with SMTP id t10so1828213vsa.5 for ; Thu, 01 Dec 2022 08:02:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=jv6lHx1JhcUSMRoAUCtgu3l/9OPIPH814o4vteF0fbA=; b=OU0yk5yL2N5JdQY0wzNt7XhaN/HGzdo7d6gr8Sd6HfG25Zx2WqJBV12mGuG+1+qTfN eTPmRngys9ytE/rteaw2dN1TwZjOnGFxHWRLoAzxCoLvQnZCFqA/QaEhRIhgTBg1kBPV DjVWtr3ufMbRx5LhS3+yFzWIFgu7rLZ5sV6QpFb/zT4RKsMZZWlYiFAljW5xtD8T0t5c jnmsdGPWn0KDWnOsFegj8T34Y+UCsQa7zzL79O79X7gHWMjeJK+OL/J5kRw0IRzGm8rD obUaN5+R6QkHdkfjQcXUk4Vvg2pJ+NkOHleUtskH59Z+xWhWe/FCcWTLfbO2IU/2hoKL xmSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jv6lHx1JhcUSMRoAUCtgu3l/9OPIPH814o4vteF0fbA=; b=tJzPqzzuexFN9KyDdiuhxCAxoqnyY+vlC20ClEyqjoyJZgXvXHCsCSBDeQkwXcOLvp rvzpO9yBjKFPo5KyxtY+AucE1K6S1UrILDo3GR4DFQpfngU4Z1V5y6/+yB0F8MmpuFwt w2al61syQFuW0o4zeJbsMrNH/z/AyJ5j3bx2TLO5ooZypGTgGI3ZJOzBloT4f95adv9x URKqh9qchzQMo/pcG5gpjwie4TgBdvSD5UyinNI0Ds+OEfCuf3QjL0qI0TMMwQcdIeY1 v42c1XENFvVGeZVnd8AlvKO9jKCrwNzeBmO9N45Epp36U4cJOu6lzuNeB1yYQCN0IyMA cXTw== X-Gm-Message-State: ANoB5pnkkTbKk4yLcOd7U7UoiFON7lwMU8xuHYlva37u6qVpfXkYzX4y 5SoDUBeqsu39OWwabsOi4Mal24rl6IgOjrKneUw= X-Google-Smtp-Source: AA0mqf4+GkiB+7Xb19KOyZEd9CAA3GqOR6AW/EWTffnJQC8PuMxlaIQ0GtJxUHRzhAhIb/j56JJoSk15virpYXPSing= X-Received: by 2002:a05:6102:11e5:b0:3aa:2fea:86f4 with SMTP id e5-20020a05610211e500b003aa2fea86f4mr27762466vsg.54.1669910519545; Thu, 01 Dec 2022 08:01:59 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dave Cramer Date: Thu, 1 Dec 2022 11:01:43 -0500 Message-ID: Subject: Re: Would preparing internally during XAResource.end(xid, TMSUCCESS) works? To: Andy Fan Cc: pgsql-jdbc@lists.postgresql.org Content-Type: multipart/alternative; boundary="00000000000053068205eec657d3" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000053068205eec657d3 Content-Type: text/plain; charset="UTF-8" Hi Andy, Sorry I'm not much help here. Were you able to figure this out? Dave Cramer On Sat, 26 Nov 2022 at 07:03, Andy Fan wrote: > Hi: > > One of our customers is coming from Oracle and they use XAResource like > this. > > xaResource1.start(xid, ..); > xaResource1.getConnection.doSomeDML(); > xaResource1.end(xid, TMSUCCESS); > > xaResource2.prepare(xid); > > This works in Oracle but doesn't work in PostgreSQL's JDBC, since we have > to use the same XAResource instance to prepare the xid. > > I know why we have to 'prepare transaction xxx' in the same connection for > PostgreSQL kernel. For now my question is: can we do the 'prepare > transaction 'xxx'' during XAResource.end(xid, TMSUCCESS); and later in > XAResource2.prepare(xid), we can double check if it is prepared already, > if so we can just return XA_OK. the benefit of this is that the user > doesn't > have to prepare in the same connection. > > Asking customers not to do this is not an option in my case, > and I'm not asking our community to do so, I'm just asking what > would be wrong if we do so. > > Any feedback is welcome, Thanks! > > > -- > Best Regards > Andy Fan > --00000000000053068205eec657d3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi=C2=A0Andy,

Sorry I&= #39;m not much help here.

Were you able to figure = this out?

Dave Cramer


On Sat, 26 Nov 2022 at 07:03, Andy Fan <zhihui.fan1213@gmail.com> wrote:
Hi:

On= e of our customers is coming from Oracle and they use XAResource like
th= is.

xaResource1.start(xid, ..);
xaResource1.getConnection.doSomeD= ML();
xaResource1.end(xid, TMSUCCESS);

xaResource2.prepare(xid);<= br>
This works in Oracle but doesn't work in PostgreSQL's JDBC, = since we have
to use the same XAResource instance to prepare the xid.
I know why we have to 'prepare transaction xxx' in the same co= nnection for
PostgreSQL kernel. For now my question is: =C2=A0can we do = the 'prepare
transaction 'xxx'' during XAResource.end(xi= d, TMSUCCESS); and later in
XAResource2.prepare(xid), we can double chec= k if it is prepared already,
if so we can just return XA_OK. the benefit= of this is that the user doesn't
have to prepare in the same= connection.

Asking=C2=A0customers not to do this is not an option i= n my case,=C2=A0
and I'm not asking our community to do so, I= 'm just asking what
would be wrong if we do so.
Any feedback is welcome,=C2=A0 Thanks!

--
Best Regards
Andy Fan
--00000000000053068205eec657d3--