db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: how can I force a rollback of an XA transaction
Date Tue, 06 Dec 2011 14:26:53 GMT
"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