Details
-
Bug
-
Resolution: Done
-
Critical
-
5.1.0.CR3
-
None
Description
In 5.1.0, the DummyXid was modified to use UUIDs to generate full branch and transaction identifiers. The most and least significant longs of each UUID was used to populate a part of a 64-byte array (the rest of the array being set to 0).
This poses a number of problems.
1. Generating 2 UUIDs for each XID is expensive
2. Most of the 64-byte array is set to 0 and wasted
3. XID.hashcode() is implemented by performing Arrays.hashcode on each of the (mostly-empty) 64-bit arrays
This makes using the DummyTransactionManager (and consequently, the BatchModeTransactionManager) extremely efficient - if XA compliant.
This JIRA proposes to change this such that:
1. Each transaction manager creates a single UUID as a transaction manager ID
2. Each XID created uses an atomic long for transaction and branch ID
3. Combining most and least significant long of the transaction manager ID with the long counter can provide both transaction and branch identifiers.
4. Hashcode should be calculated on the above 3 longs ONLY, not the full array, and should be cached.