db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: XA transactions and state information
Date Wed, 03 Aug 2005 15:50:00 GMT
Mamta Satoor wrote:

> Just to be sure, so it is correct for local connection to pick up the
> global transaction's isolation level in the example scenario below?

>> Within the global
>> transaction, I change the isolation level to RS and then exit the global
>> transaction so the connection is now attached to the local transaction.
>> The isolation level at this point is set to RS rather than UR. This

No, the local connection is not picking up the global transaction's
isolation level. It is reflecting the state of the Connection object.

Isolation level and the other states affected are states of the
Connection object. So the application has stated through the
setTransactionIsolation call that its *Connection* is at RS level. Thus
any subsequent transaction that it *starts* will be at RS level.

This difference comes when the application using this Connection joins
an *existing* global transaction that is at a *different* isolation
level (say RR) to the Connection.  Changing the isolation level of the
transaction to match the Connection (RS) seems wrong and in Derby would
force a commit, which is definitely not the desired behaviour as that
would end the global transaction. So getTransactionIsolation has to
return RR as it would be misleading (and incorrect?) to return RS. But
the Connection object is still at RS, so when the new *local*
transaction is started it will be at RS. I also believe that
setIsolationLevel within a global transaction will throw an exception if
the transaction has performed some work.

A similar but simpler issue exists with auto commit mode, again a state
of the Connection. But in this case, when the Connection object is
attached to a global transaction the auto commit mode must be false by
definition of the JBDC spec. But on reverting to a local transaction the
state of auto-commit reverts to the state that the Connection object had
before attaching the global transaction. This revert behaviour is
defined by the last paragraph of section 12.4 of the JDBC 3.0 spec.

Then the model of defined auto-commit revert behaviour was followed for
the other Connection state, such as isolation level. I think when Derby
was closed source at IBM we worked these issues with the JDBC EG through
the IBM rep.

Dan.



Mime
View raw message