Transactional does not throw the right exception if tx service is down during tx finish

Details

Fixed an issue where the Transactional.run method could throw the wrong exception if the transaction service was unavailable when it was finishing a transaction.

Rank:

1|hzzuof:

Description

I have a program that is using Transactional.run(TxRunnable). If the transaction service is down when CDAP is trying to finish the transaction, the method ends up throwing a RuntimeException instead of a TransactionFailureException.

This is happening when AbstractTransactionContext checks if it can commit, but gets an exception from the txclient. It then tries to abort the current transaction which causes another exception from the txclient, which is the one that the user program sees.