Using ignite, can you set a priority on OPTIMISTIC SERIALIZABLE transactions, so one will take precedence over the other? In other words, if I have 2 optimistic serializable transactions A and B, and I know that A is more important than B, if A and B clash with each other, can I ensure that A succeeds and B fails?
The ignite docs say the following:
In Ignite, each transaction is assigned a comparable version called XidVersion. Upon transaction commit, each entry that is written in the transaction is assigned a new comparable version called EntryVersion. An OPTIMISTIC SERIALIZABLE transaction with version XidVersionA fails with a TransactionOptimisticException if:
There is an ongoing PESSIMISTIC or non-serializable OPTIMISTIC transaction holding a lock on an entry of the SERIALIZABLE transaction.
There is another ongoing OPTIMISTIC SERIALIZABLE transaction with version XidVersionB such that XidVersionB > XidVersionA and this transaction holds a lock on an entry of the SERIALIZABLE transaction.
So presumably what I need to do is set XidVersion on transaction A to be higher than XidVersion on transaction B. However I can't find any way to set the XidVersion on a transaction.
Ignite doesn't support setting transaction priorities. XidVersion is built using the natural order of a change. I.e. depending on a timeframe, the counters increases in the order
field, it also depends on the topology and other internal things.
From the docs:
TX1 [txId=GridCacheVersion [topVer=74949328, time=1463469328421, order=1463469326211, nodeOrder=1], nodeId=ad68354d-07b8-4be5-85bb-f5f2362fbb88, threadId=73]
TX2 [txId=GridCacheVersion [topVer=74949328, time=1463469328421, order=1463469326210, nodeOrder=1], nodeId=ad68354d-07b8-4be5-85bb-f5f2362fbb88, threadId=74]