XA distributed transactions

Hi - I can’t find anything in the docs about support for XA Transactions

I want to do a distributed transaction between consuming a message from JMS/MQ, performing CRUD database work in CockroachDB, and publishing message to different JMS/MQ.

Ideally using Naryana as the transaction manager “TM”, and CockroachDB and MQ as resource managers “RM”, in the XA protocol.

Does CockroachDB support XA transactions as an RM with an external coordinating TM?

Could I also use Cockroach as the TM instead of Naryana?

Today it is working with both JMS/MQ as separate RM coordinated by Naryana TM, but I am wondering about adding DB work with CockroachDB into the mix.

Many thanks,
TB.

Dear @anestors,
thanks for your interest in CockroachDB.
At this time CockroachDB does not support XA transactions or interoperability with external transaction managers. Possible future support for this feature is tracked here: https://github.com/cockroachdb/cockroach/issues/22329. Please comment on this github issue if you want to explain your use case further.

Neither can you use CockroachDB as TM for an external database. This is because CockroachDB lacks the suitable callbacks upon transaction commit/rollack to inform the external database whether to commit or rollback its own transaction. Ideally XA compatibility would be the best approach.

Thanks for the update, I’ll keep eye out for issue 22329 then.

Another customer asked me about this a while ago. Since I’ve been neck deep in the transaction model recently, I figured I’d implement this today since it seemed pretty tractable to provide Postgres-level support (i.e. allow CockroachDB to act as an XAResource in a distributed transaction).

The (working though still alpha) PR is here: https://github.com/cockroachdb/cockroach/pull/22359

1 Like