[
https://issues.apache.org/jira/browse/IGNITE-11697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16813504#comment-16813504
]
Aleksey Plekhanov commented on IGNITE-11697:
--------------------------------------------
As implemented by ticket IGNITE-7481 the suspended transaction is resumed on
timeout to the {{timeout-worker}} thread.
Later this behavior was changed by ticket IGNITE-6827 and the transaction is
resumed to last used this transaction thread.
But both approaches are wrong.
In the first case - actual rollback is performed asynchronously by a system
pool thread, and if there more then one transaction is rolled back by timeout
simultaneously second and subsequent transactions wiil not be resumed and
rolled back correctly since {{timeout-worker}} thread already holds the
transaction.
In the second case - the transaction appears from the thin air in the user's
thread at some point in time.
I think we don't need to resume transaction on timeout at all, we need to use a
common way for all states. Transaction can be rolled back by any thread and
{{SUSPENDED}} is the valid previous state for {{MARKED_ROLLBACK}} state. I see
no problems here. The only problem is: suspend removes the transaction from the
transactionMap and rollback can't find the transaction in this map. We need to
change behavior for suspend/resume operations as originally was proposed in the
ticket IGNITE-7481 (don't remove the transaction from the transactionMap)
> Suspended optimistic transaction automatically resumes to last thread after a
> timeout.
> --------------------------------------------------------------------------------------
>
> Key: IGNITE-11697
> URL: https://issues.apache.org/jira/browse/IGNITE-11697
> Project: Ignite
> Issue Type: Bug
> Affects Versions: 2.7
> Reporter: Aleksey Plekhanov
> Priority: Major
> Labels: iep-34
>
> This leads to unpredictable results from a user's point of view.
> Reproducer:
>
> {code:java}
> public class IgniteTxSuspendAndTimeoutTest extends GridCommonAbstractTest {
> @Test
> public void testSuspendAndTimeout() throws Exception {
> Ignite ignite = startGrid(0);
> IgniteCache cache = ignite.createCache(new
> CacheConfiguration<>().setName("c").setAtomicityMode(TRANSACTIONAL));
> Transaction tx1 = ignite.transactions().txStart(OPTIMISTIC,
> TransactionIsolation.REPEATABLE_READ, 100, 0);
> cache.put(1, 1);
> tx1.suspend();
> assertNull(cache.get(1)); // Pass here.
> doSleep(200);
> assertNull(cache.get(1)); // Fail here. But we don't expect any
> explicitly running transaction at this point.
> }
> }
> {code}
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)