We now have working XA recovery!
I have merged Juha's work to trunk, and will very shortly be back merging the changes I have made back to the 1_0 branch.
I have had to make some changes to get it to work, in summary, the problems where:
We only want to handleAcks or handleReferences if the prepared tx has been loaded from the database.
We don't want to do this if the transaction had been created without restarting and recover had been called for it
Not releasing references
Not creating deliveries with correct delivery observer .
(This method was never getting executed since none of the tests were testing transactional acks. Otherwise it would have failed with a ClassCastException)
Not releasing memory references
Now we return a list of MessageChannelPair objects.
The main problem with the previous code was that there was an assumption that a message is only in one channel for a tx, which is incorrect.
hence a map doesn't work since the mapping gets overwritten when put happens again for the same message.
Also no - need for getChannels() method - this can be injected into the transaction repository
5) Missing tests.
The previous tests were only testing transacted sends, and not testing transacted acknowledgements or rollbacks
Also weren't testing single message in multiple channels
I have expanded the tests to include transacted acks in different situations and other cases like rollback.
I think we have it pretty much covered now.
6) The following queries:
were missing from the xxx-persistence-service.xml files in src/etc/server/default/deploy
Also some problems with rollback:
Also if there are some messages in a queue
then in a global tx, they are acked
then the server is restarted
then the queue is loaded (it won't load those messages)
then the tx is rolled back - this resets the state to C in the database, but does not put the refs back in the queue, so I've added a tx callback
that cancels the messages back in under these circumstances
Not looking up the correct channel when the channel represents a durable subscription.
There were also some intermittent failures in the test suite which were due to switching from using the old JBoss tx Mgr to JBoss TS JTA. The previous
tests were relying on resources in a tx being rolled back in a particular order which was an incorrect assumption. This has been remedied.