db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bergquist, Brett" <BBergqu...@canoga.com>
Subject RE: how can I force a rollback of an XA transaction
Date Tue, 06 Dec 2011 14:49:47 GMT
I will give this a try and that is exactly what I was just trying to write.  This is the second
time in about 5 years that this has happened :(  I need to get away from using XA but the
application server was bitching without it.

Thank you for your help on this.  It would have taken me much longer to come up with this


-----Original Message-----
From: Knut Anders Hatlen [mailto:knut.hatlen@oracle.com] 
Sent: Tuesday, December 06, 2011 9:27 AM
To: derby-dev@db.apache.org
Subject: Re: how can I force a rollback of an XA transaction

"Bergquist, Brett" <BBergquist@canoga.com> writes:

> The JVM that derby was running in crashed with a SEGV.  There
> application server also went down.  When I brought both up, the
> database shows two XA transactions in the PREPARE state (looking at
> syscs_diag.transaction_table) but the application server has no
> reference to these transactions to force a rollback.  Files in the
> database “log” directory are being created, with 3862 being the
> current count.  
> I need a way to get this to be cleaned up.  It would be best if this
> could be done with the database online as I don’t have days to wait
> for the database to come up.

Hi Brett,

If your application server doesn't manage to recover the transactions,
you could try to run the XA recovery procedure manually. Something like
this (untested) code:

XAConnection xac = ...; // get connection from the XADataSource
XAResource xar = xac.getXAResource();

for (Xid xid : xar.recover(XAResource.TMSTARTRSCAN)) {
    // or commit:
    // xar.commit(xid, false);

Hope this helps,

Knut Anders

View raw message