Isolation in Distributed (Global) Transactions Using JTA

As you know, isolation and atomicity are two different properties. Atomicity is an all-or-nothing property, or the transaction completes successfully, or fails at all. The atomicity is definitely supported by the JTA and the standard XA Open XA standard on which the JTA is based.

My question is: Does JTA support isolation? I only mean the case when we use EJB and JDBC, without frameworks (like Spring) or transaction managers other than JTA.

In other words, let's look at the case where we have several threads, and suppose that one of them performs a global transaction that accesses and changes in several databases. Other threads perform modifications in the databases, but each thread performs a modification on only one database and performs it inside a transaction.

Will we have any concurrency problems like dirty / repeatable / phantom read inside a global transaction?

AFAIK there is no way to specify the isolation level in the JTA.

+5
source share
1 answer

Isolation is a black sheep of the ACID family. This, strictly speaking, is not the property of a transaction manager. It is fully controlled by the resource manager, i.e. the database. All database transactions operate at a specific isolation level. The difference in XA transactions (JTA) is how this level is selected.

For the most part, it is not possible to achieve control over the choice of transaction isolation level that you have with regular transactions, although some resource managers may allow the SQL settings of transaction isolation commands as the first statement in the XA transaction branch. Another used model is sometimes custom flags for XAResource.start, an approach chosen, for example, by the oracle. For database engines that do not support any of them, transaction XA has a default isolation level that is configured globally for the database server.

Note that even for "serializable" transactions, JTAs or otherwise, you will still have headaches. Read Peter Bailey's excellent ACIDRain paper, and then find a corner to cry quietly.

http://www.bailis.org/papers/acidrain-sigmod2017.pdf

+2
source

Source: https://habr.com/ru/post/1267331/


All Articles