Re: pgsql XA with weblogic 8.1?

From: Jan de Visser <jdevisser(at)digitalfairway(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: pgsql XA with weblogic 8.1?
Date: 2005-12-07 13:50:11
Message-ID: 200512070850.12250.jdevisser@digitalfairway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Well, it seems that the list doesn't like attachments. So here again with my
log in-line...

On Tuesday 29 November 2005 00:50, Kris Jurka wrote:
> On Mon, 28 Nov 2005, Jan de Visser wrote:
> > Well, that wasn't it. I debugged a bit, and it turns out that WL sends a
> > start(xid,TMJOIN) when committing entity EJBs. Don't ask me why (I'm not
> > an XA expert by any stretch of the imagination). What I did is took the
> > pragmatic approach, and allow a TMJOIN if the connection is in
> > STATE_ENDED and if the xid is the same as the current xid. This seems to
> > work.
>
> What's the order of calls made?
>
> start(xid, TMNOFLAGS)
> end(xid, TMSUCCESS)
> start(xid, TMJOIN)
> prepare(xid)
> commit(xid, false)
>
> or does the start call only happen once, with TMJOIN instead of TMNOFLAGS.
> It's tough to get an idea of what calls are actually being made and on
> which connections. Any chance you could send us a log trace using
> Oliver's new logging code in 8.2dev with loglevel=2?
>
> Kris Jurka

I hacked BaseDataSource to allow for a LogLevel attribute, and PGXAConnection
to print the flags passed to start, and got the attached.

So it seems to be the case that the tx is started with TMNOFLAGS, ended, and
restarted with TMJOIN in the ejbStore phase (The 'Creating' message is
actually in ejbCreate()), which confirms my theory.

So my question again: Would it be OK to allow TMJOIN on an ended but
non-committed tx with the same Xid? Like so:

// Check implementation deficiency preconditions
if (flags == TMRESUME)
throw new PGXAException(GT.tr("suspend/resume and join not implemented"),
XAException.XAER_RMERR);
if ( ( flags == TMJOIN ) && ( ( state != STATE_ENDED ) ||
!xid.equals( currentXid ) ) ) {
throw new PGXAException(GT.tr("Transaction interleaving not implemented"),
XAException.XAER_RMERR);
}
if ( ( state == STATE_ENDED ) && ( !xid.equals( currentXid ) ||
( flags != TMJOIN ) ) ) {
throw new PGXAException(GT.tr("Transaction interleaving not implemented"),
XAException.XAER_RMERR);
}

As I mentioned before, this works for me.

JdV!!

Log:

08:47:41.442 (1) XAResource 1d12d43: starting transaction xid =
BEA1-000426CF2CA2CC69504A-6466632E636F7265 with flags TMNOFLAGS
08:47:41.444 (1) simple execute,
handler=org(dot)postgresql(dot)jdbc2(dot)AbstractJdbc2Statement$StatementResultHandler(at)17b285e,
maxRows=0, fetchSize=0, flags=1
08:47:41.445 (1) FE=> Bind(stmt=S_1,portal=null)
08:47:41.445 (1) FE=> Execute(portal=null,limit=0)
08:47:41.445 (1) FE=> Parse(stmt=null,query="SELECT id FROM
tableSerializedXML WHERE enttype=$1 AND id=$2",oids={1043,1043})
08:47:41.445 (1) FE=> Bind(stmt=null,portal=null,$1=<controlpaneldef>,
$2=<eoss-controlpanel>)
08:47:41.446 (1) FE=> Describe(portal=null)
08:47:41.446 (1) FE=> Execute(portal=null,limit=0)
08:47:41.446 (1) FE=> Sync
08:47:41.447 (1) <=BE BindComplete [null]
08:47:41.447 (1) <=BE CommandStatus(BEGIN)
08:47:41.447 (1) <=BE ParseComplete [null]
08:47:41.447 (1) <=BE BindComplete [null]
08:47:41.447 (1) <=BE RowDescription(1)
08:47:41.447 (1) <=BE CommandStatus(SELECT)
08:47:41.448 (1) <=BE ReadyForQuery(T)
[07 084741.449]:LOW:9597-ExecuteThrea:XMLEntity_9v:Type controlpaneldef, ID
eos
Creating
08:47:41.455 (1) XAResource 1d12d43: ending transaction xid =
BEA1-000426CF2CA2CC69504A-6466632E636F7265
[07 084741.457]:DET:9597-ExecuteThrea:XMLEntity_9v:Type controlpaneldef, ID
eos
ejbStore Type controlpaneldef, ID eoss-controlpanel
[07 084741.458]:LOW:9597-ExecuteThrea:XMLEntity_9v:Type controlpaneldef, ID
eos
Storing
08:47:41.586 (1) XAResource 1d12d43: starting transaction xid =
BEA1-000426CF2CA2CC69504A-6466632E636F7265 with flags TMJOIN
08:47:41.589 (1) simple execute,
handler=org(dot)postgresql(dot)jdbc2(dot)AbstractJdbc2Connection$TransactionCommandHandler(at)40bc88,
maxRows=0, fetchSize=0, flags=22
08:47:41.590 (1) FE=> Parse(stmt=S_3,query="ROLLBACK",oids={})
08:47:41.590 (1) FE=> Bind(stmt=S_3,portal=null)
08:47:41.590 (1) FE=> Execute(portal=null,limit=1)
08:47:41.591 (1) FE=> Sync
08:47:41.591 (1) <=BE ParseComplete [S_3]
08:47:41.592 (1) <=BE BindComplete [null]
08:47:41.592 (1) <=BE CommandStatus(ROLLBACK)
08:47:41.592 (1) <=BE ReadyForQuery(I)
SQLException: SQLState() vendor code(-3)
java.sql.SQLException: XA error: XAER_RMERR : A resource manager error has
occured in the transaction branch start() failed on resource 'dfc.core':
XAER_RMERR : A resource manager error has occured in the transaction branch
org.postgresql.xa.PGXAException: suspend/resume and join not implemented
at org.postgresql.xa.PGXAConnection.start(PGXAConnection.java:118)
at
weblogic.jdbc.wrapper.VendorXAResource.start(VendorXAResource.java:50)
at weblogic.jdbc.jta.DataSource.start(DataSource.java:629)
at
weblogic.transaction.internal.XAServerResourceInfo.start(XAServerResourceInfo.java:1140)
at
weblogic.transaction.internal.XAServerResourceInfo.xaStart(XAServerResourceInfo.java:1072)
at
weblogic.transaction.internal.XAServerResourceInfo.enlist(XAServerResourceInfo.java:255)
at
weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:463)
at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1392)
at
weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1334)
at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:396)
at weblogic.jdbc.jta.DataSource.connect(DataSource.java:354)
at
weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:305)
at
dfc.util.database.J2EEConnectionFactory.createConnection(J2EEConnectionFactory.java:57)

--
--------------------------------------------------------------
Jan de Visser                     jdevisser(at)digitalfairway(dot)com

                Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message torino 2005-12-07 16:07:06 来年2月トリノに一緒に行きません?
Previous Message Tea Yu 2005-12-07 02:51:18 Re: JDBC executeUpdate returns 0 for table partitioning rule insertion