You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Andrew Mashenkov (JIRA)" <ji...@apache.org> on 2019/04/03 11:09:03 UTC

[jira] [Assigned] (IGNITE-11439) MVCC: Error in transaction mode validation.

     [ https://issues.apache.org/jira/browse/IGNITE-11439?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Mashenkov reassigned IGNITE-11439:
-----------------------------------------

    Assignee: Andrew Mashenkov

> MVCC: Error in transaction mode validation.
> -------------------------------------------
>
>                 Key: IGNITE-11439
>                 URL: https://issues.apache.org/jira/browse/IGNITE-11439
>             Project: Ignite
>          Issue Type: Bug
>          Components: mvcc
>            Reporter: Roman Kondakov
>            Assignee: Andrew Mashenkov
>            Priority: Blocker
>             Fix For: 2.8
>
>         Attachments: Reproducer
>
>
> Currently MVCC transaction mode is validated within {{MvccUtils#tx()}} method. If this method is called during execution of {{OPTIMISTIC}} transaction over non-mvcc cache it can cause {{UnsupportedTxModeException}} in the case when at least one mvcc cache is also started in the cluster. This happens due to improper use of {{MvccUtils#mvccEnabled}} method which returns {{true}} if at least one mvcc cache is started. This is a global {{mvccEnabled}} flag, but not a per-cache one.
> A very common pattern of using the combination of these two methods is completely wrong:
> {code:java}
> if (MvccUtils.mvccEnabled(kernalCtx))  <- global check of enabled mvcc
>     tx = MvccUtils#tx(kernalCtx)   <- an attempt to get a transaction with wrong assumption of enabled mvcc. Exception is thrown here.
> {code}
> We need to revise mvcc transaction mode validation and using these methods in the project. All possible scenarios should be covered by tests.
> See reproducer in attachment. Error stacktrace is below:
> {noformat}
> class org.apache.ignite.internal.processors.cache.mvcc.MvccUtils$UnsupportedTxModeException: Only pessimistic transactions are supported when MVCC is enabled.
> 	at org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.tx(MvccUtils.java:717)
> 	at org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.tx(MvccUtils.java:696)
> 	at org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.query(GridReduceQueryExecutor.java:488)
> 	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$3.iterator(IgniteH2Indexing.java:1102)
> 	at org.apache.ignite.internal.processors.cache.QueryCursorImpl.iter(QueryCursorImpl.java:102)
> 	at org.apache.ignite.internal.processors.cache.query.RegisteredQueryCursor.iter(RegisteredQueryCursor.java:64)
> 	at org.apache.ignite.internal.processors.cache.QueryCursorImpl.getAll(QueryCursorImpl.java:121)
> 	at org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSqlTxModesTest.testConsequentMvccNonMvccOperations(CacheMvccSqlTxModesTest.java:64)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> 	at org.apache.ignite.testframework.junits.GridAbstractTest$7.run(GridAbstractTest.java:2049)
> 	at java.lang.Thread.run(Thread.java:748)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)