Re: [LIXA-general] LIXA XTA with transactions spanning threads
LIXA, LIbre XA, is a free and open source XA transaction manager
Brought to you by:
tiian
|
From: <lix...@li...> - 2020-10-08 10:58:28
|
Thinking about the question, there are some additional caveats to take into consideration.
Supposing you are using XTA for C, not XTA for Java, there are two different types of XA resources: "native" and "acquired".
Acquired resources, like for example MySQL (or MariaDB) and PostgreSQL, do not provide a real XA standard interface, but some hooks to implement an "XA like" behaviour.For both xta_postgresql_xa_resource_t and xta_mysql_xa_resource_t, the reasoning of my previous message applies.
Native resources, like for example Oracle Database, provide a real XA standard interface and don't require a specific "class" for every implementation: a single one named xta_native_xa_resource_t is sufficient.At this point the question: can I pass the reference of xta_native_xa_resource_t from one thread to another is constrained by the underlying XA implementation of the software vendor. It's not necessarily guarantee it works, but there's a "but": the XA standard provides a technique named "suspend/resume" that's XTA implements by mean of xta_transaction_suspend and xta_transaction_resume. It works even for different processes, not only for different threads, as in example example_xta_macc01.c
To make a long story short:
- for "acquired" XA resources it should work without further complexity
- for "native" XA resources, in the event it does not work due to the software vendor implementation, you should be able to get the result with the "suspend/resume" mechanism.
Kind RegardsCh.F.
---
Il mercoledì 7 ottobre 2020, 08:09:54 CEST, lixa-general--- via Lixa-general <lix...@li...> ha scritto:
Dear Rowland,it's exactly as you described.Just pay attention that with XTA, a single thread at a time can manage a transaction: the methods/functions that manage the references are re-entrant, but not thread safe. In other terms, if two threads must deal with the same references, it's your responsibility to synchronize them and avoid that two threads use the same references in parallel.
Kind RegardsCh.F.
---
Il mercoledì 7 ottobre 2020, 05:02:42 CEST, lix...@li... <lix...@li...> ha scritto:
I have been working to integrate LIXA into a transaction monitor for the Pony programming language. My original plan was to use the TX interface, but I believe that this interface is limited to calling tx_open() and tx_close() on the same thread. This requirement would greatly reduce the flexibility and power of my transaction monitor, and would not take much advantage of the Pony actor model.
I think that if I instead use the XTA interface, I will no longer face this limitation, and as long as I pass transaction manager and transaction references around in a safe manner, I will be able to support as many threads as needed.
Please confirm if my understanding is correct.
LIXA looks like a really nice piece of work. I am really looking forward to digging more deeply into it.
--
Rowland E. SmithP: (862) 260-4163M: (201) 396-3842
_______________________________________________
Lixa-general mailing list
Lix...@li...
https://lists.sourceforge.net/lists/listinfo/lixa-general
_______________________________________________
Lixa-general mailing list
Lix...@li...
https://lists.sourceforge.net/lists/listinfo/lixa-general
|