You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2018/09/17 10:08:30 UTC
[1/3] ignite git commit: IGNITE-9320: MVCC configuration: added new
CacheAtomicityMode.MVCC_SNAPSHOT. This closes #4660.
Repository: ignite
Updated Branches:
refs/heads/master f01825165 -> 2ab949349
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/platforms/cpp/odbc-test/config/queries-default.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/config/queries-default.xml b/modules/platforms/cpp/odbc-test/config/queries-default.xml
index 659ad14..996ef6e 100644
--- a/modules/platforms/cpp/odbc-test/config/queries-default.xml
+++ b/modules/platforms/cpp/odbc-test/config/queries-default.xml
@@ -40,103 +40,8 @@
<property name="cacheConfiguration">
<list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeSynchronizationMode" value="FULL_SYNC"/>
-
- <!-- Configure type metadata to enable queries. -->
- <property name="queryEntities">
- <list>
- <bean class="org.apache.ignite.cache.QueryEntity">
- <property name="keyType" value="java.lang.Long"/>
- <property name="valueType" value="TestType"/>
-
- <property name="fields">
- <map>
- <entry key="i8Field" value="java.lang.Byte"/>
- <entry key="i16Field" value="java.lang.Short"/>
- <entry key="i32Field" value="java.lang.Integer"/>
- <entry key="i64Field" value="java.lang.Long"/>
- <entry key="strField" value="java.lang.String"/>
- <entry key="floatField" value="java.lang.Float"/>
- <entry key="doubleField" value="java.lang.Double"/>
- <entry key="boolField" value="java.lang.Boolean"/>
- <entry key="guidField" value="java.util.UUID"/>
- <entry key="dateField" value="java.util.Date"/>
- <entry key="timeField" value="java.sql.Time"/>
- <entry key="timestampField" value="java.sql.Timestamp"/>
- <entry key="i8ArrayField" value="[B"/>
- </map>
- </property>
-
- <property name="keyFields">
- <list></list>
- </property>
-
- <property name="indexes">
- <list>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <constructor-arg value="i32Field"/>
- </bean>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <constructor-arg value="i64Field"/>
- </bean>
- </list>
- </property>
-
- <property name="fieldsPrecision">
- <map>
- <entry key="strField" value="60" />
- </map>
- </property>
- </bean>
- </list>
- </property>
- </bean>
-
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache2"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeSynchronizationMode" value="FULL_SYNC"/>
-
- <!-- Configure type metadata to enable queries. -->
- <property name="queryEntities">
- <list>
- <bean class="org.apache.ignite.cache.QueryEntity">
- <property name="keyType" value="java.lang.Long"/>
- <property name="valueType" value="ComplexType"/>
-
- <property name="keyFieldName" value="k"/>
- <property name="valueFieldName" value="v"/>
-
- <property name="fields">
- <map>
- <entry key="k" value="java.lang.Long"/>
- <entry key="v" value="ComplexType"/>
- <entry key="i32Field" value="java.lang.Integer"/>
- <entry key="objField" value="TestObject"/>
- <entry key="strField" value="java.lang.String"/>
- </map>
- </property>
-
- <property name="keyFields">
- <list></list>
- </property>
-
- <property name="indexes">
- <list>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <constructor-arg value="i32Field"/>
- </bean>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
+ <bean parent="test-type-template"/>
+ <bean parent="complex-type-template"/>
</list>
</property>
@@ -162,4 +67,103 @@
</bean>
</property>
</bean>
+
+ <bean id="test-type-template" abstract="true" class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache"/>
+ <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+ <!-- Configure type metadata to enable queries. -->
+ <property name="queryEntities">
+ <list>
+ <bean class="org.apache.ignite.cache.QueryEntity">
+ <property name="keyType" value="java.lang.Long"/>
+ <property name="valueType" value="TestType"/>
+
+
+ <property name="fields">
+ <map>
+ <entry key="i8Field" value="java.lang.Byte"/>
+ <entry key="i16Field" value="java.lang.Short"/>
+ <entry key="i32Field" value="java.lang.Integer"/>
+ <entry key="i64Field" value="java.lang.Long"/>
+ <entry key="strField" value="java.lang.String"/>
+ <entry key="floatField" value="java.lang.Float"/>
+ <entry key="doubleField" value="java.lang.Double"/>
+ <entry key="boolField" value="java.lang.Boolean"/>
+ <entry key="guidField" value="java.util.UUID"/>
+ <entry key="dateField" value="java.util.Date"/>
+ <entry key="timeField" value="java.sql.Time"/>
+ <entry key="timestampField" value="java.sql.Timestamp"/>
+ <entry key="i8ArrayField" value="[B"/>
+ </map>
+ </property>
+
+ <property name="keyFields">
+ <list></list>
+ </property>
+
+ <property name="indexes">
+ <list>
+ <bean class="org.apache.ignite.cache.QueryIndex">
+ <constructor-arg value="i32Field"/>
+ </bean>
+ <bean class="org.apache.ignite.cache.QueryIndex">
+ <constructor-arg value="i64Field"/>
+ </bean>
+ </list>
+ </property>
+
+ <property name="fieldsPrecision">
+ <map>
+ <entry key="strField" value="60" />
+ </map>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+
+ <bean id="complex-type-template" abstract="true" class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache2"/>
+ <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+ <!-- Configure type metadata to enable queries. -->
+ <property name="queryEntities">
+ <list>
+ <bean class="org.apache.ignite.cache.QueryEntity">
+ <property name="keyType" value="java.lang.Long"/>
+ <property name="valueType" value="ComplexType"/>
+
+ <property name="keyFieldName" value="k"/>
+ <property name="valueFieldName" value="v"/>
+
+ <property name="fields">
+ <map>
+ <entry key="k" value="java.lang.Long"/>
+ <entry key="v" value="ComplexType"/>
+ <entry key="i32Field" value="java.lang.Integer"/>
+ <entry key="objField" value="TestObject"/>
+ <entry key="strField" value="java.lang.String"/>
+ </map>
+ </property>
+
+ <property name="keyFields">
+ <list></list>
+ </property>
+
+ <property name="indexes">
+ <list>
+ <bean class="org.apache.ignite.cache.QueryIndex">
+ <constructor-arg value="i32Field"/>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/platforms/cpp/odbc-test/config/queries-transaction-32.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/config/queries-transaction-32.xml b/modules/platforms/cpp/odbc-test/config/queries-transaction-32.xml
index 94ddd3d..b5479c7 100644
--- a/modules/platforms/cpp/odbc-test/config/queries-transaction-32.xml
+++ b/modules/platforms/cpp/odbc-test/config/queries-transaction-32.xml
@@ -27,7 +27,16 @@
<import resource="queries-default.xml"/>
<bean parent="queries.cfg">
- <property name="mvccEnabled" value="true"/>
+ <property name="cacheConfiguration">
+ <list>
+ <bean parent="test-type-template">
+ <property name="atomicityMode" value="TRANSACTIONAL_SNAPSHOT"/>
+ </bean>
+ <bean parent="complex-type-template">
+ <property name="atomicityMode" value="TRANSACTIONAL_SNAPSHOT"/>
+ </bean>
+ </list>
+ </property>
<property name="memoryConfiguration">
<bean class="org.apache.ignite.configuration.MemoryConfiguration">
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/platforms/cpp/odbc-test/config/queries-transaction.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/config/queries-transaction.xml b/modules/platforms/cpp/odbc-test/config/queries-transaction.xml
index 7d74fc9..9d8c535 100644
--- a/modules/platforms/cpp/odbc-test/config/queries-transaction.xml
+++ b/modules/platforms/cpp/odbc-test/config/queries-transaction.xml
@@ -27,6 +27,15 @@
<import resource="queries-default.xml"/>
<bean parent="queries.cfg">
- <property name="mvccEnabled" value="true"/>
+ <property name="cacheConfiguration">
+ <list>
+ <bean parent="test-type-template">
+ <property name="atomicityMode" value="TRANSACTIONAL_SNAPSHOT"/>
+ </bean>
+ <bean parent="complex-type-template">
+ <property name="atomicityMode" value="TRANSACTIONAL_SNAPSHOT"/>
+ </bean>
+ </list>
+ </property>
</bean>
</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/yardstick/config/mvcc/benchmark-mvcc-messages.sh
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/mvcc/benchmark-mvcc-messages.sh b/modules/yardstick/config/mvcc/benchmark-mvcc-messages.sh
index 32068d3..47f546d 100644
--- a/modules/yardstick/config/mvcc/benchmark-mvcc-messages.sh
+++ b/modules/yardstick/config/mvcc/benchmark-mvcc-messages.sh
@@ -78,21 +78,20 @@ sm=FULL_SYNC
commonParams="-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -w ${w} -d ${d} \
-jdbc jdbc:ignite:thin://auto.find/ -t ${t} -sm ${sm} \
--clientNodesAfterId 100 \
- -sn IgniteNode -cl --range 1000000 \
- --atomic-mode TRANSACTIONAL"
+ -sn IgniteNode -cl --range 1000000"
# Run configuration which contains all benchmarks.
# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
CONFIGS="\
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-off -b 0 --sqlRange 1, \
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-on -b 0 --sqlRange 1 --mvcc, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-off -b 0 --sqlRange 1 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-on -b 0 --sqlRange 1 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-off -b 0 --sqlRange 1000, \
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-on -b 0 --sqlRange 1000 --mvcc, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-off -b 0 --sqlRange 1000, --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-on -b 0 --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-backup-2-mvcc-off -b 2 --sqlRange 1, \
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-backup-2-mvcc-on -b 2 --sqlRange 1 --mvcc, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-backup-2-mvcc-off -b 2 --sqlRange 1 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-backup-2-mvcc-on -b 2 --sqlRange 1 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-backup-2-mvcc-off -b 2 --sqlRange 1000, \
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-backup-2-mvcc-on -b 2 --sqlRange 1000 --mvcc, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-backup-2-mvcc-off -b 2 --sqlRange 1000 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-backup-2-mvcc-on -b 2 --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
"
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/yardstick/config/mvcc/benchmark-mvcc-processor.sh
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/mvcc/benchmark-mvcc-processor.sh b/modules/yardstick/config/mvcc/benchmark-mvcc-processor.sh
index db45199..25525a4 100644
--- a/modules/yardstick/config/mvcc/benchmark-mvcc-processor.sh
+++ b/modules/yardstick/config/mvcc/benchmark-mvcc-processor.sh
@@ -78,18 +78,17 @@ sm=FULL_SYNC
commonParams="-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -w ${w} -d ${d} \
-jdbc jdbc:ignite:thin://auto.find/ -t ${t} -sm ${sm} \
--clientNodesAfterId 100 \
- -sn IgniteNode -cl --range 1000000 \
- --atomic-mode TRANSACTIONAL"
+ -sn IgniteNode -cl --range 1000000"
# Run configuration which contains all benchmarks.
# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
CONFIGS="\
-${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-off -b 0 --sqlRange 1, \
-${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-on -b 0 --sqlRange 1 --mvcc, \
+${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-off -b 0 --sqlRange 1 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-on -b 0 --sqlRange 1 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-25-backup-0-mvcc-off -b 0 --sqlRange 25, \
-${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-25-backup-0-mvcc-on -b 0 --sqlRange 25 --mvcc, \
+${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-25-backup-0-mvcc-off -b 0 --sqlRange 25 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-25-backup-0-mvcc-on -b 0 --sqlRange 25 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-off -b 0 --sqlRange 1000, \
-${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-on -b 0 --sqlRange 1000 --mvcc \
+${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-off -b 0 --sqlRange 1000 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-on -b 0 --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT \
"
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/yardstick/config/mvcc/benchmark-mvcc-updates-contention.sh
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/mvcc/benchmark-mvcc-updates-contention.sh b/modules/yardstick/config/mvcc/benchmark-mvcc-updates-contention.sh
index 0a92bce..39f7424 100644
--- a/modules/yardstick/config/mvcc/benchmark-mvcc-updates-contention.sh
+++ b/modules/yardstick/config/mvcc/benchmark-mvcc-updates-contention.sh
@@ -79,18 +79,17 @@ commonParams="-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nod
-jdbc jdbc:ignite:thin://auto.find/ -t ${t} -sm ${sm} \
--clientNodesAfterId 100 \
-sn IgniteNode -cl \
- --range 1000000 --mvcc-contention-range 10000 \
- --atomic-mode TRANSACTIONAL"
+ --range 1000000 --mvcc-contention-range 10000"
# Run configuration which contains all benchmarks.
# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
CONFIGS="\
-${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-off -b 0 --sqlRange 1, \
-${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-on -b 0 --sqlRange 1 --mvcc, \
+${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-off -b 0 --sqlRange 1 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-1-backup-0-mvcc-on -b 0 --sqlRange 1 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-25-backup-0-mvcc-off -b 0 --sqlRange 25, \
-${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-25-backup-0-mvcc-on -b 0 --sqlRange 25 --mvcc, \
+${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-25-backup-0-mvcc-off -b 0 --sqlRange 25 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-25-backup-0-mvcc-on -b 0 --sqlRange 25 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-off -b 0 --sqlRange 1000, \
-${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-on -b 0 --sqlRange 1000 --mvcc \
+${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-off -b 0 --sqlRange 1000 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-on -b 0 --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT \
"
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/yardstick/config/mvcc/benchmark-thin-native.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/mvcc/benchmark-thin-native.properties b/modules/yardstick/config/mvcc/benchmark-thin-native.properties
index 3fae9a8..7281f21 100644
--- a/modules/yardstick/config/mvcc/benchmark-thin-native.properties
+++ b/modules/yardstick/config/mvcc/benchmark-thin-native.properties
@@ -81,44 +81,43 @@ sm=FULL_SYNC
commonParams="-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} \
-jdbc jdbc:ignite:thin://auto.find/ -t ${t} -sm ${sm} \
--clientNodesAfterId 0 \
- -sn IgniteNode -cl --range 1000000 \
- --atomic-mode TRANSACTIONAL"
+ -sn IgniteNode -cl --range 1000000"
# Run configuration which contains all benchmarks.
# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
CONFIGS="\
-${commonParams} -dn JdbcSqlInsertDeleteBenchmark -ds ${ver}sql-insert-delete-batch-1-jdbc-thin-mvcc-off, \
-${commonParams} -dn JdbcSqlInsertDeleteBenchmark -ds ${ver}sql-insert-delete-batch-1-jdbc-thin-mvcc-on --mvcc, \
+${commonParams} -dn JdbcSqlInsertDeleteBenchmark -ds ${ver}sql-insert-delete-batch-1-jdbc-thin-mvcc-off --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn JdbcSqlInsertDeleteBenchmark -ds ${ver}sql-insert-delete-batch-1-jdbc-thin-mvcc-on --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn JdbcSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1-jdbc-thin-mvcc-off --sqlRange 1, \
-${commonParams} -dn JdbcSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1-jdbc-thin-mvcc-on --sqlRange 1 --mvcc, \
+${commonParams} -dn JdbcSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1-jdbc-thin-mvcc-off --sqlRange 1 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn JdbcSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1-jdbc-thin-mvcc-on --sqlRange 1 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn JdbcSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1000-jdbc-thin-mvcc-off --sqlRange 1000, \
-${commonParams} -dn JdbcSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1000-jdbc-thin-mvcc-on --sqlRange 1000 --mvcc, \
+${commonParams} -dn JdbcSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1000-jdbc-thin-mvcc-off --sqlRange 1000 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn JdbcSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1000-jdbc-thin-mvcc-on --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn JdbcSqlUpdateBenchmark -ds ${ver}sql-update-batch-1-jdbc-thin-mvcc-off --sqlRange 1, \
-${commonParams} -dn JdbcSqlUpdateBenchmark -ds ${ver}sql-update-batch-1-jdbc-thin-mvcc-on --sqlRange 1 --mvcc, \
+${commonParams} -dn JdbcSqlUpdateBenchmark -ds ${ver}sql-update-batch-1-jdbc-thin-mvcc-off --sqlRange 1 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn JdbcSqlUpdateBenchmark -ds ${ver}sql-update-batch-1-jdbc-thin-mvcc-on --sqlRange 1 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn JdbcSqlUpdateBenchmark -ds ${ver}sql-update-batch-1000-jdbc-thin-mvcc-off --sqlRange 1000, \
-${commonParams} -dn JdbcSqlUpdateBenchmark -ds ${ver}sql-update-batch-1000-jdbc-thin-mvcc-on --sqlRange 1000 --mvcc, \
+${commonParams} -dn JdbcSqlUpdateBenchmark -ds ${ver}sql-update-batch-1000-jdbc-thin-mvcc-off --sqlRange 1000 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn JdbcSqlUpdateBenchmark -ds ${ver}sql-update-batch-1000-jdbc-thin-mvcc-on --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
\
-${commonParams} -dn NativeSqlInsertDeleteBenchmark -ds ${ver}sql-insert-delete-batch-1-native-sql-mvcc-off, \
-${commonParams} -dn NativeSqlInsertDeleteBenchmark -ds ${ver}sql-insert-delete-batch-1-native-sql-mvcc-on --mvcc, \
+${commonParams} -dn NativeSqlInsertDeleteBenchmark -ds ${ver}sql-insert-delete-batch-1-native-sql-mvcc-off --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeSqlInsertDeleteBenchmark -ds ${ver}sql-insert-delete-batch-1-native-sql-mvcc-on --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn NativeSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1-native-sql-mvcc-off --sqlRange 1, \
-${commonParams} -dn NativeSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1-native-sql-mvcc-on --sqlRange 1 --mvcc, \
+${commonParams} -dn NativeSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1-native-sql-mvcc-off --sqlRange 1 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1-native-sql-mvcc-on --sqlRange 1 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn NativeSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1000-native-sql-mvcc-off --sqlRange 1000, \
-${commonParams} -dn NativeSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1000-native-sql-mvcc-on --sqlRange 1000 --mvcc, \
+${commonParams} -dn NativeSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1000-native-sql-mvcc-off --sqlRange 1000 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeSqlQueryRangeBenchmark -ds ${ver}sql-select-batch-1000-native-sql-mvcc-on --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-native-sql-mvcc-off --sqlRange 1, \
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-native-sql-mvcc-on --sqlRange 1 --mvcc, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-native-sql-mvcc-off --sqlRange 1 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1-native-sql-mvcc-on --sqlRange 1 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-native-sql-mvcc-off --sqlRange 1000, \
-${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-native-sql-mvcc-on --sqlRange 1000 --mvcc, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-native-sql-mvcc-off --sqlRange 1000 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-native-sql-mvcc-on --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
\
-${commonParams} -dn NativeJavaApiPutRemoveBenchmark -ds ${ver}sql-update-batch-1-native-sql-mvcc-off, \
-${commonParams} -dn NativeJavaApiPutRemoveBenchmark -ds ${ver}sql-update-batch-1-native-sql-mvcc-on --mvcc \
+${commonParams} -dn NativeJavaApiPutRemoveBenchmark -ds ${ver}sql-update-batch-1-native-sql-mvcc-off --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeJavaApiPutRemoveBenchmark -ds ${ver}sql-update-batch-1-native-sql-mvcc-on --atomic-mode TRANSACTIONAL_SNAPSHOT \
"
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/yardstick/config/upload/benchmark-jdbc-thin-inmemory-mvcc.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/upload/benchmark-jdbc-thin-inmemory-mvcc.properties b/modules/yardstick/config/upload/benchmark-jdbc-thin-inmemory-mvcc.properties
index 6e55b9b..dad8ed7 100644
--- a/modules/yardstick/config/upload/benchmark-jdbc-thin-inmemory-mvcc.properties
+++ b/modules/yardstick/config/upload/benchmark-jdbc-thin-inmemory-mvcc.properties
@@ -82,24 +82,23 @@ commonParams="\
--threads ${t} --syncMode ${sm} -sn IgniteNode \
--upload-rows 1000000 -cl \
--clientNodesAfterId 0 \
- --atomic-mode TRANSACTIONAL \
"
# Run configuration which contains all benchmarks.
# Note that each benchmark is set to run only one time, warmup parameter is set to 0 due to custom warmup operation.
CONFIGS="\
-${commonParams} -dn NativePutBenchmark -ds ${ver}upload-native-put-mvcc-off, \
-${commonParams} -dn NativePutBenchmark -ds ${ver}upload-native-put-mvcc-on --mvcc, \
+${commonParams} -dn NativePutBenchmark -ds ${ver}upload-native-put-mvcc-off --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativePutBenchmark -ds ${ver}upload-native-put-mvcc-on --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn NativeStreamerBenchmark -ds ${ver}upload-native-streamer-mvcc-off --streamer-local-batch-size 1000, \
-${commonParams} -dn NativeStreamerBenchmark -ds ${ver}upload-native-streamer-mvcc-on --streamer-local-batch-size 1000 --mvcc, \
+${commonParams} -dn NativeStreamerBenchmark -ds ${ver}upload-native-streamer-mvcc-off --streamer-local-batch-size 1000 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn NativeStreamerBenchmark -ds ${ver}upload-native-streamer-mvcc-on --streamer-local-batch-size 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn CopyBenchmark -ds ${ver}upload-copy-mvcc-off, \
-${commonParams} -dn CopyBenchmark -ds ${ver}upload-copy-mvcc-on --mvcc, \
+${commonParams} -dn CopyBenchmark -ds ${ver}upload-copy-mvcc-off --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn CopyBenchmark -ds ${ver}upload-copy-mvcc-on --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn InsertBenchmark -ds ${ver}upload-insert-mvcc-off, \
-${commonParams} -dn InsertBenchmark -ds ${ver}upload-insert-mvcc-on --mvcc, \
+${commonParams} -dn InsertBenchmark -ds ${ver}upload-insert-mvcc-off --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn InsertBenchmark -ds ${ver}upload-insert-mvcc-on --atomic-mode TRANSACTIONAL_SNAPSHOT, \
\
-${commonParams} -dn BatchedInsertBenchmark -ds ${ver}upload-batched-insert-mvcc-off --upload-jdbc-batch-size 1000, \
-${commonParams} -dn BatchedInsertBenchmark -ds ${ver}upload-batched-insert-mvcc-on --upload-jdbc-batch-size 1000 --mvcc \
+${commonParams} -dn BatchedInsertBenchmark -ds ${ver}upload-batched-insert-mvcc-off --upload-jdbc-batch-size 1000 --atomic-mode TRANSACTIONAL, \
+${commonParams} -dn BatchedInsertBenchmark -ds ${ver}upload-batched-insert-mvcc-on --upload-jdbc-batch-size 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT \
"
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index bbe2ab3..3f4fddc 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -19,19 +19,16 @@ package org.apache.ignite.yardstick;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.ParametersDelegate;
-import java.util.Collections;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
-
-import java.util.ArrayList;
-import java.util.List;
import org.apache.ignite.yardstick.cache.IgniteStreamerBenchmark;
import org.apache.ignite.yardstick.upload.UploadBenchmarkArguments;
import org.jetbrains.annotations.Nullable;
@@ -269,17 +266,6 @@ public class IgniteBenchmarkArguments {
private int streamerBufSize = IgniteDataStreamer.DFLT_PER_NODE_BUFFER_SIZE;
/** */
- @Parameter(names = {"-mvcc", "--mvcc"}, description = "Enable MVCC for cache")
- private boolean mvcc;
-
- /**
- * @return {@code True} if need enable cache mvcc (see {@link CacheConfiguration#isMvccEnabled()}).
- */
- public boolean mvccEnabled() {
- return mvcc;
- }
-
- /** */
@Parameter(names = {"-sqlr", "--sqlRange"}, description = "Result set size")
@GridToStringInclude
private int sqlRange = 1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index a259cbf..0c61435 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -103,8 +103,6 @@ public class IgniteNode implements BenchmarkServer {
CacheConfiguration[] ccfgs = c.getCacheConfiguration();
- c.setMvccEnabled(args.mvccEnabled());
-
if (ccfgs != null) {
for (CacheConfiguration cc : ccfgs) {
// IgniteNode can not run in CLIENT_ONLY mode,
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/mvcc/MvccUpdateContentionBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/mvcc/MvccUpdateContentionBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/mvcc/MvccUpdateContentionBenchmark.java
index 09179db..77c8c50 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/mvcc/MvccUpdateContentionBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/mvcc/MvccUpdateContentionBenchmark.java
@@ -20,6 +20,7 @@ package org.apache.ignite.yardstick.jdbc.mvcc;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicLong;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
@@ -52,8 +53,8 @@ public class MvccUpdateContentionBenchmark extends AbstractDistributedMvccBenchm
execute(new SqlFieldsQuery(UPDATE_QRY).setArgs(start, end));
}
catch (IgniteSQLException exc) {
- if ((args.mvccEnabled() && !exc.getMessage().equals(MVCC_EXC_MSG)) ||
- (!args.mvccEnabled() && !exc.getMessage().startsWith(NO_MVCC_EXC_MSG_PREFIX)))
+ if ((args.atomicMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT && !exc.getMessage().equals(MVCC_EXC_MSG)) ||
+ (args.atomicMode() != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT && !exc.getMessage().startsWith(NO_MVCC_EXC_MSG_PREFIX)))
throw new RuntimeException("Exception with unexpected message is thrown.", exc);
failsCnt.incrementAndGet();
[2/3] ignite git commit: IGNITE-9320: MVCC configuration: added new
CacheAtomicityMode.MVCC_SNAPSHOT. This closes #4660.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
index 9510e63..143bd42 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
@@ -37,8 +37,9 @@ import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.binary.BinaryWriterExImpl;
import org.apache.ignite.internal.binary.GridBinaryMarshaller;
import org.apache.ignite.internal.processors.authentication.AuthorizationContext;
-import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
+import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx;
import org.apache.ignite.internal.processors.odbc.ClientListenerProtocolVersion;
import org.apache.ignite.internal.processors.odbc.ClientListenerRequest;
import org.apache.ignite.internal.processors.odbc.ClientListenerRequestHandler;
@@ -148,10 +149,8 @@ public class OdbcRequestHandler implements ClientListenerRequestHandler {
log = ctx.log(getClass());
- if (ctx.grid().configuration().isMvccEnabled())
- worker = new OdbcRequestHandlerWorker(ctx.igniteInstanceName(), log, this, ctx);
- else
- worker = null;
+ // TODO IGNITE-9484 Do not create worker if there is a possibility to unbind TX from threads.
+ worker = new OdbcRequestHandlerWorker(ctx.igniteInstanceName(), log, this, ctx);
}
/** {@inheritDoc} */
@@ -162,7 +161,7 @@ public class OdbcRequestHandler implements ClientListenerRequestHandler {
OdbcRequest req = (OdbcRequest)req0;
- if (worker == null)
+ if (!MvccUtils.mvccEnabled(ctx))
return doHandle(req);
else {
GridFutureAdapter<ClientListenerResponse> fut = worker.process(req);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractFeatureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractFeatureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractFeatureTest.java
index a667297..fe450d1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractFeatureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractFeatureTest.java
@@ -87,7 +87,7 @@ public abstract class CacheMvccAbstractFeatureTest extends CacheMvccAbstractTest
@Override protected void beforeTest() throws Exception {
CacheConfiguration<Integer, Person> ccfg = new CacheConfiguration<>(CACHE_NAME);
- ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
ccfg.setIndexedTypes(Integer.class, Person.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java
index c5137f6..a4962d1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java
@@ -71,7 +71,6 @@ import org.apache.ignite.internal.util.lang.GridInClosure3;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteBiTuple;
@@ -89,7 +88,7 @@ import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -162,10 +161,8 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setMvccEnabled(true);
-
if (disableScheduledVacuum)
- cfg.setMvccVacuumTimeInterval(Integer.MAX_VALUE);
+ cfg.setMvccVacuumFrequency(Integer.MAX_VALUE);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
@@ -1438,7 +1435,7 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest {
CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(cacheMode);
- ccfg.setAtomicityMode(TRANSACTIONAL);
+ ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
ccfg.setWriteSynchronizationMode(syncMode);
ccfg.setAffinity(new RendezvousAffinityFunction(false, parts));
@@ -1464,7 +1461,7 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest {
for (Ignite node : G.allGrids()) {
final MvccProcessorImpl crd = mvccProcessor(node);
- if (crd == null)
+ if (!crd.mvccEnabled())
continue;
crd.stopVacuumWorkers(); // to prevent new futures creation.
@@ -1576,9 +1573,11 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest {
if (!node.configuration().isClientMode()) {
MvccProcessorImpl crd = mvccProcessor(node);
- if (crd == null)
+ if (!crd.mvccEnabled() || GridTestUtils.getFieldValue(crd, "vacuumWorkers") == null)
continue;
+ assert GridTestUtils.getFieldValue(crd, "txLog") != null;
+
Throwable vacuumError = crd.vacuumError();
assertNull(X.getFullStackTrace(vacuumError), vacuumError);
@@ -1604,12 +1603,6 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest {
assertNotNull(crd);
- if (crd instanceof NoOpMvccProcessor) {
- assertFalse(MvccUtils.mvccEnabled(ctx));
-
- return null;
- }
-
return (MvccProcessorImpl)crd;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java
index 76a8604..5cabffc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java
@@ -33,7 +33,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
@@ -51,8 +51,6 @@ public class CacheMvccClusterRestartTest extends GridCommonAbstractTest {
cfg.setConsistentId(gridName);
- cfg.setMvccEnabled(true);
-
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
DataStorageConfiguration storageCfg = new DataStorageConfiguration();
@@ -170,7 +168,7 @@ public class CacheMvccClusterRestartTest extends GridCommonAbstractTest {
CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
- ccfg.setAtomicityMode(TRANSACTIONAL);
+ ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
ccfg.setBackups(2);
return ccfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java
index b0a2ec8..a10c6c7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java
@@ -18,30 +18,40 @@
package org.apache.ignite.internal.processors.cache.mvcc;
import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
import javax.cache.CacheException;
import javax.cache.configuration.Factory;
+import javax.cache.configuration.FactoryBuilder;
import javax.cache.expiry.CreatedExpiryPolicy;
import javax.cache.expiry.Duration;
import javax.cache.expiry.ExpiryPolicy;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheInterceptorAdapter;
+import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreReadFromBackupTest;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.configvariations.ConfigVariations;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
/**
*
*/
+@SuppressWarnings("unchecked")
public class CacheMvccConfigurationValidationTest extends GridCommonAbstractTest {
/** */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
@@ -50,8 +60,6 @@ public class CacheMvccConfigurationValidationTest extends GridCommonAbstractTest
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setMvccEnabled(true);
-
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
return cfg;
@@ -74,7 +82,7 @@ public class CacheMvccConfigurationValidationTest extends GridCommonAbstractTest
GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
- node.createCache(new CacheConfiguration("cache2").setGroupName("grp1").setAtomicityMode(TRANSACTIONAL));
+ node.createCache(new CacheConfiguration("cache2").setGroupName("grp1").setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
return null;
}
@@ -89,7 +97,7 @@ public class CacheMvccConfigurationValidationTest extends GridCommonAbstractTest
public void testMvccModeMismatchForGroup2() throws Exception {
final Ignite node = startGrid(0);
- node.createCache(new CacheConfiguration("cache1").setGroupName("grp1").setAtomicityMode(TRANSACTIONAL));
+ node.createCache(new CacheConfiguration("cache1").setGroupName("grp1").setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
@@ -99,7 +107,232 @@ public class CacheMvccConfigurationValidationTest extends GridCommonAbstractTest
}
}, CacheException.class, null);
- node.createCache(new CacheConfiguration("cache2").setGroupName("grp1").setAtomicityMode(TRANSACTIONAL));
+ node.createCache(new CacheConfiguration("cache2").setGroupName("grp1").setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccLocalCacheDisabled() throws Exception {
+ final Ignite node1 = startGrid(1);
+ final Ignite node2 = startGrid(2);
+
+ IgniteCache cache1 = node1.createCache(new CacheConfiguration("cache1")
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ cache1.put(1,1);
+ cache1.put(2,2);
+ cache1.put(2,2);
+
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ node1.createCache(new CacheConfiguration("cache2").setCacheMode(CacheMode.LOCAL)
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ return null;
+ }
+ }, CacheException.class, null);
+
+ IgniteCache cache3 = node2.createCache(new CacheConfiguration("cache3")
+ .setAtomicityMode(TRANSACTIONAL));
+
+ cache3.put(1, 1);
+ cache3.put(2, 2);
+ cache3.put(3, 3);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccExpiredPolicyCacheDisabled() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8640");
+
+ final Ignite node1 = startGrid(1);
+ final Ignite node2 = startGrid(2);
+
+ IgniteCache cache1 = node1.createCache(new CacheConfiguration("cache1")
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ cache1.put(1,1);
+ cache1.put(2,2);
+ cache1.put(2,2);
+
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ node1.createCache(new CacheConfiguration("cache2")
+ .setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MINUTES, 1)))
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ return null;
+ }
+ }, CacheException.class, null);
+
+ IgniteCache cache3 = node2.createCache(new CacheConfiguration("cache3")
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ cache3.put(1, 1);
+ cache3.put(2, 2);
+ cache3.put(3, 3);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccThirdPartyStoreCacheDisabled() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8640");
+
+ final Ignite node1 = startGrid(1);
+ final Ignite node2 = startGrid(2);
+
+ IgniteCache cache1 = node1.createCache(new CacheConfiguration("cache1")
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ cache1.put(1,1);
+ cache1.put(2,2);
+ cache1.put(2,2);
+
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ node1.createCache(new CacheConfiguration("cache2")
+ .setCacheStoreFactory(FactoryBuilder.factoryOf(CacheStoreReadFromBackupTest.TestStore.class))
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ return null;
+ }
+ }, CacheException.class, null);
+
+ IgniteCache cache3 = node2.createCache(new CacheConfiguration("cache3")
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ cache3.put(1, 1);
+ cache3.put(2, 2);
+ cache3.put(3, 3);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccInterceptorCacheDisabled() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-8640");
+
+ final Ignite node1 = startGrid(1);
+ final Ignite node2 = startGrid(2);
+
+ IgniteCache cache1 = node1.createCache(new CacheConfiguration("cache1")
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ cache1.put(1,1);
+ cache1.put(2,2);
+ cache1.put(2,2);
+
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ node1.createCache(new CacheConfiguration("cache2")
+ .setInterceptor(new ConfigVariations.NoopInterceptor())
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ return null;
+ }
+ }, CacheException.class, null);
+
+ IgniteCache cache3 = node2.createCache(new CacheConfiguration("cache3")
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT));
+
+ cache3.put(1, 1);
+ cache3.put(2, 2);
+ cache3.put(3, 3);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNodeRestartWithCacheModeChangedTxToMvcc() throws Exception {
+ cleanPersistenceDir();
+
+ //Enable persistence.
+ DataStorageConfiguration storageCfg = new DataStorageConfiguration();
+ DataRegionConfiguration regionCfg = new DataRegionConfiguration();
+ regionCfg.setPersistenceEnabled(true);
+ storageCfg.setDefaultDataRegionConfiguration(regionCfg);
+ IgniteConfiguration cfg = getConfiguration("testGrid");
+ cfg.setDataStorageConfiguration(storageCfg);
+ cfg.setConsistentId(cfg.getIgniteInstanceName());
+
+ Ignite node = startGrid(cfg);
+
+ node.cluster().active(true);
+
+ CacheConfiguration ccfg1 = new CacheConfiguration("test1").setAtomicityMode(TRANSACTIONAL);
+
+ IgniteCache cache = node.createCache(ccfg1);
+
+ cache.put(1, 1);
+ cache.put(1, 2);
+ cache.put(2, 2);
+
+ stopGrid(cfg.getIgniteInstanceName());
+
+ CacheConfiguration ccfg2 = new CacheConfiguration().setName(ccfg1.getName())
+ .setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+
+ IgniteConfiguration cfg2 = getConfiguration("testGrid")
+ .setConsistentId(cfg.getIgniteInstanceName())
+ .setCacheConfiguration(ccfg2)
+ .setDataStorageConfiguration(storageCfg);
+
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ startGrid(cfg2);
+
+ return null;
+ }
+ }, IgniteCheckedException.class, "Failed to start processor");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNodeRestartWithCacheModeChangedMvccToTx() throws Exception {
+ cleanPersistenceDir();
+
+ //Enable persistence.
+ DataStorageConfiguration storageCfg = new DataStorageConfiguration();
+ DataRegionConfiguration regionCfg = new DataRegionConfiguration();
+ regionCfg.setPersistenceEnabled(true);
+ storageCfg.setDefaultDataRegionConfiguration(regionCfg);
+ IgniteConfiguration cfg = getConfiguration("testGrid");
+ cfg.setDataStorageConfiguration(storageCfg);
+ cfg.setConsistentId(cfg.getIgniteInstanceName());
+
+ Ignite node = startGrid(cfg);
+
+ node.cluster().active(true);
+
+ CacheConfiguration ccfg1 = new CacheConfiguration("test1").setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
+
+ IgniteCache cache = node.createCache(ccfg1);
+
+ cache.put(1, 1);
+ cache.put(1, 2);
+ cache.put(2, 2);
+
+ stopGrid(cfg.getIgniteInstanceName());
+
+ CacheConfiguration ccfg2 = new CacheConfiguration().setName(ccfg1.getName())
+ .setAtomicityMode(TRANSACTIONAL);
+
+ IgniteConfiguration cfg2 = getConfiguration("testGrid")
+ .setConsistentId(cfg.getIgniteInstanceName())
+ .setCacheConfiguration(ccfg2)
+ .setDataStorageConfiguration(storageCfg);
+
+ GridTestUtils.assertThrows(log, new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ startGrid(cfg2);
+
+ return null;
+ }
+ }, IgniteCheckedException.class, "Failed to start processor");
}
/**
@@ -141,7 +374,7 @@ public class CacheMvccConfigurationValidationTest extends GridCommonAbstractTest
try (final Ignite node = startGrid(0)) {
final CacheConfiguration cfg = new TestConfiguration("cache");
- cfg.setAtomicityMode(TRANSACTIONAL);
+ cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
U.invoke(TestConfiguration.class, cfg, setterName, obj);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccOperationChecksTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccOperationChecksTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccOperationChecksTest.java
index dc2de9a..5aedf17 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccOperationChecksTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccOperationChecksTest.java
@@ -34,7 +34,7 @@ import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.testframework.GridTestUtils;
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
/**
@@ -158,7 +158,7 @@ public class CacheMvccOperationChecksTest extends CacheMvccAbstractTest {
final CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>("cache");
cfg.setCacheMode(cacheMode());
- cfg.setAtomicityMode(TRANSACTIONAL);
+ cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT);
try (IgniteCache<Integer, String> cache = node.createCache(cfg)) {
GridTestUtils.assertThrows(log, new Callable<Void>() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorLazyStartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorLazyStartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorLazyStartTest.java
new file mode 100644
index 0000000..064e7bb
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorLazyStartTest.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.mvcc;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+
+/**
+ * Tests for a lazy MVCC processor start.
+ */
+@SuppressWarnings("unchecked")
+public class CacheMvccProcessorLazyStartTest extends CacheMvccAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected CacheMode cacheMode() {
+ return CacheMode.PARTITIONED;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPreconfiguredCacheMvccNotStarted() throws Exception {
+ CacheConfiguration ccfg = cacheConfiguration(CacheMode.PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 0, 1);
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+
+ IgniteConfiguration cfg = getConfiguration();
+ cfg.setCacheConfiguration(ccfg);
+ IgniteConfiguration cfg2 = getConfiguration("node2");
+
+ IgniteEx node1 = startGrid(cfg);
+ IgniteEx node2 = startGrid(cfg2);
+
+ IgniteCache cache = node1.cache(ccfg.getName());
+
+ cache.put(1, 1);
+ cache.put(1, 2);
+
+ assertFalse(mvccEnabled(node1));
+ assertFalse(mvccEnabled(node2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPreconfiguredCacheMvccStarted() throws Exception {
+ CacheConfiguration ccfg = cacheConfiguration(CacheMode.PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 0, 1);
+
+ IgniteConfiguration cfg1 = getConfiguration();
+ cfg1.setCacheConfiguration(ccfg);
+ IgniteConfiguration cfg2 = getConfiguration("node2");
+
+ IgniteEx node1 = startGrid(cfg1);
+ IgniteEx node2 = startGrid(cfg2);
+
+ IgniteCache cache = node1.cache(ccfg.getName());
+
+ cache.put(1, 1);
+ cache.put(1, 2);
+
+ assertTrue(mvccEnabled(node1));
+ assertTrue(mvccEnabled(node2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccRestartedWithDynamicCache() throws Exception {
+ persistence = true;
+
+ IgniteEx node1 = startGrid(1);
+ IgniteEx node2 = startGrid(2);
+
+ assertFalse(mvccEnabled(node1));
+ assertFalse(mvccEnabled(node2));
+
+ node1.cluster().active(true);
+
+ assertFalse(mvccEnabled(node1));
+ assertFalse(mvccEnabled(node2));
+
+ CacheConfiguration ccfg = cacheConfiguration(CacheMode.PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 0, 1);
+
+ IgniteCache cache = node1.createCache(ccfg);
+
+ cache.put(1, 1);
+ cache.put(1, 2);
+
+ assertTrue(mvccEnabled(node1));
+ assertTrue(mvccEnabled(node2));
+
+ stopGrid(1);
+ stopGrid(2);
+
+ node1 = startGrid(1);
+ node2 = startGrid(2);
+
+ node1.cluster().active(true);
+
+ assertTrue(mvccEnabled(node1));
+ assertTrue(mvccEnabled(node2));
+
+ cache = node1.cache(ccfg.getName());
+
+ cache.put(1, 1);
+ cache.put(1, 2);
+
+ assertTrue(mvccEnabled(node1));
+ assertTrue(mvccEnabled(node2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMvccStartedWithDynamicCache() throws Exception {
+ IgniteEx node1 = startGrid(1);
+ IgniteEx node2 = startGrid(2);
+
+ assertFalse(mvccEnabled(node1));
+ assertFalse(mvccEnabled(node2));
+
+ CacheConfiguration ccfg = cacheConfiguration(CacheMode.PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 0, 1);
+
+ IgniteCache cache = node1.createCache(ccfg);
+
+ cache.put(1, 1);
+ cache.put(1, 2);
+
+ assertTrue(mvccEnabled(node1));
+ assertTrue(mvccEnabled(node2));
+
+ stopGrid(1);
+ stopGrid(2);
+
+ node1 = startGrid(1);
+ node2 = startGrid(2);
+
+ // Should not be started because we do not have persistence enabled
+ assertFalse(mvccEnabled(node1));
+ assertFalse(mvccEnabled(node2));
+
+ cache = node1.createCache(ccfg);
+
+ cache.put(1, 1);
+ cache.put(1, 2);
+
+ assertTrue(mvccEnabled(node1));
+ assertTrue(mvccEnabled(node2));
+ }
+
+ /**
+ * @param node Node.
+ * @return {@code True} if {@link MvccProcessor} is started.
+ */
+ private boolean mvccEnabled(IgniteEx node) {
+ return node.context().coordinators().mvccEnabled();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorTest.java
index 503460a..dc902fc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorTest.java
@@ -17,7 +17,9 @@
package org.apache.ignite.internal.processors.cache.mvcc;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxState;
@@ -58,6 +60,8 @@ public class CacheMvccProcessorTest extends CacheMvccAbstractTest {
grid.cluster().active(true);
+ grid.createCache(new CacheConfiguration<>("test").setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT));
+
MvccProcessorImpl mvccProcessor = mvccProcessor(grid);
assertEquals(TxState.NA, mvccProcessor.state(new MvccVersionImpl(1, 1, MvccUtils.MVCC_OP_COUNTER_NA)));
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccVacuumTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccVacuumTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccVacuumTest.java
index cba6d99..8c96b2e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccVacuumTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccVacuumTest.java
@@ -19,9 +19,10 @@ package org.apache.ignite.internal.processors.cache.mvcc;
import java.util.List;
import org.apache.ignite.Ignite;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.testframework.GridTestUtils;
@@ -43,6 +44,15 @@ public class CacheMvccVacuumTest extends CacheMvccAbstractTest {
Ignite node0 = startGrid(0);
Ignite node1 = startGrid(1);
+ node1.createCache(new CacheConfiguration<>("test1")
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
+
+ ensureNoVacuum(node0);
+ ensureNoVacuum(node1);
+
+ node1.createCache(new CacheConfiguration<>("test2")
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT));
+
ensureVacuum(node0);
ensureVacuum(node1);
@@ -71,6 +81,12 @@ public class CacheMvccVacuumTest extends CacheMvccAbstractTest {
node1.cluster().active(true);
+ ensureNoVacuum(node0);
+ ensureNoVacuum(node1);
+
+ node1.createCache(new CacheConfiguration<>("test2")
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT));
+
ensureVacuum(node0);
ensureVacuum(node1);
@@ -93,13 +109,24 @@ public class CacheMvccVacuumTest extends CacheMvccAbstractTest {
ensureNoVacuum(node0);
ensureNoVacuum(node1);
+
+ node0 = startGrid(0);
+ node1 = startGrid(1);
+
+ ensureNoVacuum(node0);
+ ensureNoVacuum(node1);
+
+ node1.cluster().active(true);
+
+ ensureVacuum(node0);
+ ensureVacuum(node1);
}
/**
* @throws Exception If failed.
*/
public void testVacuumNotStartedWithoutMvcc() throws Exception {
- IgniteConfiguration cfg = getConfiguration("grid1").setMvccEnabled(false);
+ IgniteConfiguration cfg = getConfiguration("grid1");
Ignite node = startGrid(cfg);
@@ -112,7 +139,7 @@ public class CacheMvccVacuumTest extends CacheMvccAbstractTest {
public void testVacuumNotStartedWithoutMvccPersistence() throws Exception {
persistence = true;
- IgniteConfiguration cfg = getConfiguration("grid1").setMvccEnabled(false);
+ IgniteConfiguration cfg = getConfiguration("grid1");
Ignite node = startGrid(cfg);
@@ -152,7 +179,6 @@ public class CacheMvccVacuumTest extends CacheMvccAbstractTest {
private void ensureNoVacuum(Ignite node) {
MvccProcessorImpl crd = mvccProcessor(node);
- if (crd != null)
- assertNull(GridTestUtils.<List<GridWorker>>getFieldValue(crd, "vacuumWorkers"));
+ assertNull(GridTestUtils.<List<GridWorker>>getFieldValue(crd, "vacuumWorkers"));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
index ccf1502..fac021e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/MemoryPolicyInitializationTest.java
@@ -75,7 +75,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
Collection<DataRegion> allMemPlcs = ignite.context().cache().context().database().dataRegions();
- assertEquals(2, allMemPlcs.size());
+ assertEquals(3, allMemPlcs.size());
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
}
@@ -91,7 +91,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
Collection<DataRegion> allMemPlcs = ignite.context().cache().context().database().dataRegions();
- assertEquals(3, allMemPlcs.size());
+ assertEquals(4, allMemPlcs.size());
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
@@ -112,7 +112,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
Collection<DataRegion> allMemPlcs = dbMgr.dataRegions();
- assertEquals(2, allMemPlcs.size());
+ assertEquals(3, allMemPlcs.size());
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
@@ -136,7 +136,7 @@ public class MemoryPolicyInitializationTest extends GridCommonAbstractTest {
Collection<DataRegion> allMemPlcs = dbMgr.dataRegions();
- assertEquals(3, allMemPlcs.size());
+ assertEquals(4, allMemPlcs.size());
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccSelfTest.java
index eaea6da..d7948bd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccSelfTest.java
@@ -17,10 +17,11 @@
package org.apache.ignite.internal.processors.datastreamer;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
/**
* Check DataStreamer with Mvcc enabled.
@@ -33,14 +34,17 @@ public class DataStreamProcessorMvccSelfTest extends DataStreamProcessorSelfTest
CacheConfiguration[] cacheConfigurations = igniteConfiguration.getCacheConfiguration();
assert cacheConfigurations == null || cacheConfigurations.length == 0
- || (cacheConfigurations.length == 1 && cacheConfigurations[0].getAtomicityMode() == TRANSACTIONAL);
-
- igniteConfiguration.setMvccEnabled(true);
+ || (cacheConfigurations.length == 1 && cacheConfigurations[0].getAtomicityMode() == TRANSACTIONAL_SNAPSHOT);
return igniteConfiguration;
}
/** {@inheritDoc} */
+ @Override protected CacheAtomicityMode getCacheAtomicityMode() {
+ return TRANSACTIONAL_SNAPSHOT;
+ }
+
+ /** {@inheritDoc} */
@Override public void testPartitioned() throws Exception {
// test uses batchedSorted StreamReceiver which depends on Cache.putAll, Cache.removeAll
fail("https://issues.apache.org/jira/browse/IGNITE-9451");
@@ -70,4 +74,9 @@ public class DataStreamProcessorMvccSelfTest extends DataStreamProcessorSelfTest
super.testUpdateStore();
}
+
+ /** {@inheritDoc} */
+ @Override public void testLocal() throws Exception {
+ // Do not check local caches with MVCC enabled.
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
index 7075973..536d73e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
@@ -34,6 +34,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.affinity.Affinity;
@@ -67,6 +68,7 @@ import org.jetbrains.annotations.Nullable;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.LOCAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -122,7 +124,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(mode);
- cc.setAtomicityMode(TRANSACTIONAL);
+ cc.setAtomicityMode(getCacheAtomicityMode());
if (nearEnabled) {
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
@@ -150,6 +152,13 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
}
/**
+ * @return Default cache atomicity mode.
+ */
+ protected CacheAtomicityMode getCacheAtomicityMode() {
+ return TRANSACTIONAL;
+ }
+
+ /**
* @return {@code True} if custom stream receiver should use keepBinary flag.
*/
protected boolean customKeepBinary() {
@@ -730,7 +739,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testFlush() throws Exception {
- mode = LOCAL;
+ // Local caches are not allowed with MVCC enabled.
+ mode = getCacheAtomicityMode() != TRANSACTIONAL_SNAPSHOT ? LOCAL : PARTITIONED;
useCache = true;
@@ -782,7 +792,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testTryFlush() throws Exception {
- mode = LOCAL;
+ // Local caches are not allowed with MVCC enabled.
+ mode = getCacheAtomicityMode() != TRANSACTIONAL_SNAPSHOT ? LOCAL : PARTITIONED;
useCache = true;
@@ -817,7 +828,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testFlushTimeout() throws Exception {
- mode = LOCAL;
+ // Local caches are not allowed with MVCC enabled.
+ mode = getCacheAtomicityMode() != TRANSACTIONAL_SNAPSHOT ? LOCAL : PARTITIONED;
useCache = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/testframework/configvariations/ConfigVariations.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/configvariations/ConfigVariations.java b/modules/core/src/test/java/org/apache/ignite/testframework/configvariations/ConfigVariations.java
index 8e7e554..ca22b56 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/configvariations/ConfigVariations.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/configvariations/ConfigVariations.java
@@ -92,7 +92,7 @@ public class ConfigVariations {
@SuppressWarnings("unchecked")
private static final ConfigParameter<CacheConfiguration>[][] BASIC_CACHE_SET = new ConfigParameter[][] {
Parameters.objectParameters("setCacheMode", CacheMode.REPLICATED, CacheMode.PARTITIONED),
- Parameters.enumParameters("setAtomicityMode", CacheAtomicityMode.class),
+ Parameters.objectParameters("setAtomicityMode", CacheAtomicityMode.ATOMIC, CacheAtomicityMode.TRANSACTIONAL),
// Set default parameters.
Parameters.objectParameters("setLoadPreviousValue", true),
asArray(SIMPLE_CACHE_STORE_PARAM),
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java
index f87b14d..8585ebe 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccIteratorWithCon
import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccLocalEntriesWithConcurrentTransactionTest;
import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccOperationChecksTest;
import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccPartitionedCoordinatorFailoverTest;
+import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccProcessorLazyStartTest;
import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccProcessorTest;
import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccReplicatedCoordinatorFailoverTest;
import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccScanQueryWithConcurrentTransactionTest;
@@ -61,6 +62,7 @@ public class IgniteCacheMvccTestSuite extends TestSuite {
suite.addTestSuite(CacheMvccClusterRestartTest.class);
suite.addTestSuite(CacheMvccPartitionedCoordinatorFailoverTest.class);
suite.addTestSuite(CacheMvccReplicatedCoordinatorFailoverTest.class);
+ suite.addTestSuite(CacheMvccProcessorLazyStartTest.class);
return suite;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index a795552..79c431f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -128,6 +128,7 @@ import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlStatement;
import org.apache.ignite.internal.processors.query.h2.sql.GridSqlTable;
import org.apache.ignite.internal.processors.query.h2.sys.SqlSystemTableEngine;
+import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemView;
import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewBaselineNodes;
import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewNodeAttributes;
import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemViewNodeMetrics;
@@ -136,7 +137,6 @@ import org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecut
import org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor;
import org.apache.ignite.internal.processors.query.h2.twostep.MapQueryLazyWorker;
import org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2QueryRequest;
-import org.apache.ignite.internal.processors.query.h2.sys.view.SqlSystemView;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorImpl;
@@ -209,7 +209,8 @@ import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryTy
import static org.apache.ignite.internal.processors.query.QueryUtils.KEY_FIELD_NAME;
import static org.apache.ignite.internal.processors.query.QueryUtils.VAL_FIELD_NAME;
import static org.apache.ignite.internal.processors.query.QueryUtils.VER_FIELD_NAME;
-import static org.apache.ignite.internal.processors.query.h2.PreparedStatementEx.INVOLVED_CACHES;
+import static org.apache.ignite.internal.processors.query.h2.PreparedStatementEx.MVCC_CACHE_ID;
+import static org.apache.ignite.internal.processors.query.h2.PreparedStatementEx.MVCC_STATE;
import static org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode.OFF;
import static org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode.distributedJoinMode;
import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.LOCAL;
@@ -1073,7 +1074,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
boolean startTx, int timeout, final GridQueryCancel cancel,
MvccQueryTracker mvccTracker) throws IgniteCheckedException {
- GridNearTxLocal tx = null; boolean mvccEnabled = mvccEnabled(kernalContext());
+ GridNearTxLocal tx = null;
+
+ boolean mvccEnabled = mvccEnabled(kernalContext());
assert mvccEnabled || mvccTracker == null;
@@ -1649,53 +1652,90 @@ public class IgniteH2Indexing implements GridQueryIndexing {
* @return MVCC query tracker or {@code null} if MVCC is disabled for involved caches.
*/
private MvccQueryTracker mvccTracker(PreparedStatement stmt, boolean startTx) throws IgniteCheckedException {
- List<GridCacheContext> caches;
+ boolean mvccEnabled;
+
+ GridCacheContext mvccCacheCtx = null;
+
try {
if (stmt.isWrapperFor(PreparedStatementEx.class)) {
PreparedStatementEx stmtEx = stmt.unwrap(PreparedStatementEx.class);
- caches = stmtEx.meta(INVOLVED_CACHES);
+ Boolean mvccState = stmtEx.meta(MVCC_STATE);
+
+ mvccEnabled = mvccState != null ? mvccState : checkMvcc(stmt);
+
+ if (mvccEnabled) {
+ Integer cacheId = stmtEx.meta(MVCC_CACHE_ID);
+
+ assert cacheId != null;
+
+ mvccCacheCtx = ctx.cache().context().cacheContext(cacheId);
- if (caches == null)
- stmtEx.putMeta(INVOLVED_CACHES, caches = parseInvolvedCaches(stmt));
+ assert mvccCacheCtx != null;
+ }
}
else
- caches = parseInvolvedCaches(stmt);
- } catch (SQLException e) {
+ mvccEnabled = checkMvcc(stmt);
+ }
+ catch (SQLException e) {
throw new IgniteSQLException(e);
}
- GridCacheContext firstCctx = null;
- boolean mvccEnabled = false;
+ assert !mvccEnabled || mvccCacheCtx != null;
- for (GridCacheContext cctx : caches) {
- if (firstCctx == null) {
- firstCctx = cctx;
- mvccEnabled = firstCctx.mvccEnabled();
- }
- else if (mvccEnabled != cctx.mvccEnabled())
- throw new IllegalStateException("Using caches with different mvcc settings in same query is forbidden.");
- }
-
- return mvccEnabled ? MvccUtils.mvccTracker(firstCctx, startTx) : null;
+ return mvccEnabled ? MvccUtils.mvccTracker(mvccCacheCtx, startTx) : null;
}
- /** */
- private static List<GridCacheContext> parseInvolvedCaches(PreparedStatement stmt) {
+ /**
+ * Checks if statement uses MVCC caches. If it does, additional metadata is added to statement.
+ *
+ * @param stmt Statement to check.
+ * @return {@code True} if there MVCC cache involved in statement.
+ * @throws SQLException If parser failed.
+ */
+ private static Boolean checkMvcc(PreparedStatement stmt) throws SQLException {
GridSqlQueryParser parser = new GridSqlQueryParser(false);
parser.parse(GridSqlQueryParser.prepared(stmt));
- List<GridCacheContext> involvedCaches = new ArrayList<>();
+ Boolean mvccEnabled = null;
+ Integer mvccCacheId = null;
+ GridCacheContext ctx0 = null;
for (Object o : parser.objectsMap().values()) {
if (o instanceof GridSqlAlias)
o = GridSqlAlias.unwrap((GridSqlAst) o);
- if (o instanceof GridSqlTable && ((GridSqlTable) o).dataTable() != null)
- involvedCaches.add(((GridSqlTable) o).dataTable().cache());
+ if (o instanceof GridSqlTable && ((GridSqlTable) o).dataTable() != null) {
+ GridCacheContext cctx = ((GridSqlTable) o).dataTable().cache();
+
+ if (mvccEnabled == null) {
+ mvccEnabled = cctx.mvccEnabled();
+ mvccCacheId = cctx.cacheId();
+ ctx0 = cctx;
+ }
+ else if (mvccEnabled != cctx.mvccEnabled())
+ MvccUtils.throwAtomicityModesMismatchException(ctx0, cctx);
+ }
}
- return involvedCaches;
+ if (mvccEnabled == null)
+ return false;
+
+ // Remember mvccEnabled flag to avoid further additional parsing if statement obtained from the statement cache.
+ if (stmt.isWrapperFor(PreparedStatementEx.class)) {
+ PreparedStatementEx stmtEx = stmt.unwrap(PreparedStatementEx.class);
+
+ if (mvccEnabled) {
+ assert mvccCacheId != null;
+
+ stmtEx.putMeta(MVCC_CACHE_ID, mvccCacheId);
+ stmtEx.putMeta(MVCC_STATE, Boolean.TRUE);
+ }
+ else
+ stmtEx.putMeta(MVCC_STATE, Boolean.FALSE);
+ }
+
+ return mvccEnabled;
}
/**
@@ -2596,6 +2636,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridCacheSharedContext sharedCtx = ctx.cache().context();
int expectedParallelism = 0;
+ GridCacheContext cctx0 = null;
boolean mvccEnabled = false;
@@ -2606,11 +2647,12 @@ public class IgniteH2Indexing implements GridQueryIndexing {
assert cctx != null;
- if (i == 0)
+ if (i == 0) {
mvccEnabled = cctx.mvccEnabled();
+ cctx0 = cctx;
+ }
else if (cctx.mvccEnabled() != mvccEnabled)
- throw new IllegalStateException("Using caches with different mvcc settings in same query is " +
- "forbidden.");
+ MvccUtils.throwAtomicityModesMismatchException(cctx0, cctx);
if (!cctx.isPartitioned())
continue;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/PreparedStatementEx.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/PreparedStatementEx.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/PreparedStatementEx.java
index d254971..50dd892 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/PreparedStatementEx.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/PreparedStatementEx.java
@@ -28,8 +28,11 @@ public interface PreparedStatementEx extends PreparedStatement {
/** */
static final AtomicInteger metaIdGenerator = new AtomicInteger();
- /** */
- static final int INVOLVED_CACHES = metaIdGenerator.getAndIncrement();
+ /** Flag if at least one MVCC cache is used in this statement. */
+ static final int MVCC_STATE = metaIdGenerator.getAndIncrement();
+
+ /** First mvcc cache id of the involved caches. */
+ static final int MVCC_CACHE_ID = metaIdGenerator.getAndIncrement();
/**
* @param id Metadata key.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
index 6c103f3..5e44f27 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
@@ -30,6 +30,7 @@ import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx;
@@ -126,7 +127,7 @@ public final class UpdatePlanBuilder {
if (cctx == null)
mvccEnabled = (cctx = (((GridSqlTable)o).dataTable()).cache()).mvccEnabled();
else if (((GridSqlTable)o).dataTable().cache().mvccEnabled() != mvccEnabled)
- throw new IllegalStateException("Using caches with different mvcc settings in same query is forbidden.");
+ MvccUtils.throwAtomicityModesMismatchException(cctx, ((GridSqlTable)o).dataTable().cache());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index 599d792..18c068a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -1492,6 +1492,8 @@ public class GridSqlQueryParser {
atomicityMode = CacheAtomicityMode.TRANSACTIONAL;
else if (CacheAtomicityMode.ATOMIC.name().equalsIgnoreCase(val))
atomicityMode = CacheAtomicityMode.ATOMIC;
+ else if (CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT.name().equalsIgnoreCase(val))
+ atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
else
throw new IgniteSQLException("Invalid value of \"" + PARAM_ATOMICITY + "\" parameter " +
"(should be either TRANSACTIONAL or ATOMIC): " + val, IgniteQueryErrorCode.PARSING);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsCommandsWithMvccEnabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsCommandsWithMvccEnabledSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsCommandsWithMvccEnabledSelfTest.java
index 55dd59a..8c6f407 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsCommandsWithMvccEnabledSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsCommandsWithMvccEnabledSelfTest.java
@@ -52,10 +52,10 @@ public class SqlTransactionsCommandsWithMvccEnabledSelfTest extends AbstractSche
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
- startGrid(commonConfiguration(0).setMvccEnabled(true));
+ startGrid(commonConfiguration(0));
super.execute(node(), "CREATE TABLE INTS(k int primary key, v int) WITH \"wrap_value=false,cache_name=ints," +
- "atomicity=transactional\"");
+ "atomicity=transactional_snapshot\"");
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsSelfTest.java
index 7081e34..d93bdab 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsSelfTest.java
@@ -35,7 +35,6 @@ import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
-import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
@@ -53,10 +52,10 @@ public class SqlTransactionsSelfTest extends AbstractSchemaSelfTest {
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
- startGrid(commonConfiguration(0).setMvccEnabled(true));
+ startGrid(commonConfiguration(0));
super.execute(node(), "CREATE TABLE INTS(k int primary key, v int) WITH \"wrap_value=false,cache_name=ints," +
- "atomicity=transactional\"");
+ "atomicity=transactional_snapshot\"");
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBulkLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBulkLoadTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBulkLoadTest.java
index d620e84..98bbdfc 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBulkLoadTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBulkLoadTest.java
@@ -57,7 +57,7 @@ public class CacheMvccBulkLoadTest extends CacheMvccAbstractTest {
"create table person(" +
" id int not null primary key," +
" name varchar not null" +
- ") with \"atomicity=transactional\""
+ ") with \"atomicity=transactional_snapshot\""
));
stmt = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1").createStatement();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccDmlSimpleTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccDmlSimpleTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccDmlSimpleTest.java
index bb5e753..7f141ca 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccDmlSimpleTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccDmlSimpleTest.java
@@ -49,7 +49,7 @@ public class CacheMvccDmlSimpleTest extends CacheMvccAbstractTest {
cache = startGrid(0).getOrCreateCache(
new CacheConfiguration<>("test")
- .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT)
.setSqlSchema("PUBLIC")
.setIndexedTypes(Integer.class, Integer.class)
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryAbstractTest.java
index 152dc7e..739aaf8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryAbstractTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryAbstractTest.java
@@ -17,6 +17,13 @@
package org.apache.ignite.internal.processors.cache.mvcc;
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
+import javax.cache.CacheException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.QueryEntity;
@@ -32,14 +39,6 @@ import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
-import javax.cache.CacheException;
-import java.sql.Connection;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
-
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.internal.processors.cache.index.AbstractSchemaSelfTest.connect;
import static org.apache.ignite.internal.processors.cache.index.AbstractSchemaSelfTest.execute;
@@ -73,10 +72,10 @@ public abstract class CacheMvccSelectForUpdateQueryAbstractTest extends CacheMvc
try (Connection c = connect(grid(0))) {
execute(c, "create table person (id int primary key, firstName varchar, lastName varchar) " +
- "with \"atomicity=transactional,cache_name=Person\"");
+ "with \"atomicity=transactional_snapshot,cache_name=Person\"");
execute(c, "create table person_seg (id int primary key, firstName varchar, lastName varchar) " +
- "with \"atomicity=transactional,cache_name=PersonSeg,template=segmented\"");
+ "with \"atomicity=transactional_snapshot,cache_name=PersonSeg,template=segmented\"");
try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC,
TransactionIsolation.REPEATABLE_READ)) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeTest.java
index 32709ff..fe1304a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeTest.java
@@ -444,7 +444,7 @@ public class CacheMvccSizeTest extends CacheMvccAbstractTest {
/** */
private static IgniteCache<?, ?> table(IgniteEx ignite) {
- assert ignite.cachex("person").configuration().getAtomicityMode() == CacheAtomicityMode.TRANSACTIONAL;
+ assert ignite.cachex("person").configuration().getAtomicityMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
assert ignite.cachex("person").configuration().getCacheMode() == CacheMode.REPLICATED;
return ignite.cache("person");
@@ -458,7 +458,7 @@ public class CacheMvccSizeTest extends CacheMvccAbstractTest {
"create table person(" +
" id int primary key," +
" name varchar" +
- ") with \"atomicity=transactional,template=replicated,cache_name=person\""));
+ ") with \"atomicity=transactional_snapshot,template=replicated,cache_name=person\""));
return table(ignite);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlConfigurationValidationTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlConfigurationValidationTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlConfigurationValidationTest.java
new file mode 100644
index 0000000..7e6c9e8
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlConfigurationValidationTest.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.mvcc;
+
+import java.util.concurrent.Callable;
+import javax.cache.CacheException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+/**
+ * Configuration validation for SQL configured caches.
+ */
+public class CacheMvccSqlConfigurationValidationTest extends CacheMvccAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected CacheMode cacheMode() {
+ return CacheMode.PARTITIONED;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheGroupAtomicityModeMismatch1() throws Exception {
+ Ignite node = startGrid();
+
+ node.getOrCreateCache(DEFAULT_CACHE_NAME)
+ .query(new SqlFieldsQuery("CREATE TABLE City (id int primary key, name varchar, population int) WITH " +
+ "\"atomicity=transactional_snapshot,cache_group=group1,template=partitioned,backups=3,cache_name=City\""))
+ .getAll();;
+
+ GridTestUtils.assertThrows(log, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ node.cache(DEFAULT_CACHE_NAME)
+ .query(new SqlFieldsQuery("CREATE TABLE Person (id int primary key, name varchar) WITH " +
+ "\"atomicity=transactional,cache_group=group1,template=partitioned,backups=3,cache_name=Person\""))
+ .getAll();
+
+ return null;
+ }
+ }, CacheException.class, "Atomicity mode mismatch for caches related to the same group");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheGroupAtomicityModeMismatch2() throws Exception {
+ Ignite node = startGrid();
+
+ node.getOrCreateCache(DEFAULT_CACHE_NAME)
+ .query(new SqlFieldsQuery("CREATE TABLE City (id int primary key, name varchar, population int) WITH " +
+ "\"atomicity=transactional,cache_group=group1,template=partitioned,backups=3,cache_name=City\""));
+
+ GridTestUtils.assertThrows(log, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ node.cache(DEFAULT_CACHE_NAME)
+ .query(new SqlFieldsQuery("CREATE TABLE Person (id int primary key, name varchar) WITH " +
+ "\"atomicity=transactional_snapshot,cache_group=group1,template=partitioned,backups=3,cache_name=Person\""))
+ .getAll();
+
+ return null;
+ }
+ }, CacheException.class, "Atomicity mode mismatch for caches related to the same group");
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTxDifferentMvccSettingsTransactional() throws Exception {
+ ccfg = defaultCacheConfiguration().setSqlSchema("PUBLIC");
+ Ignite node = startGrid();
+
+ IgniteCache cache = node.cache(DEFAULT_CACHE_NAME);
+
+ cache.query(new SqlFieldsQuery("CREATE TABLE Person (id int primary key, name varchar) WITH " +
+ "\"atomicity=transactional_snapshot,template=partitioned,backups=1\"")).getAll();
+
+ cache.query(new SqlFieldsQuery("CREATE TABLE City (id int primary key, name varchar, population int) WITH " +
+ "\"atomicity=transactional,template=partitioned,backups=3\"")).getAll();
+
+ GridTestUtils.assertThrows(log, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ try (Transaction tx = node.transactions().txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) {
+ cache.query(new SqlFieldsQuery("SELECT * FROM Person, City")).getAll();
+
+ tx.commit();
+ }
+
+ return null;
+ }
+ }, CacheException.class, "Caches with transactional_snapshot atomicity mode cannot participate in the same transaction");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java
index e683def..2aad2d4 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java
@@ -1624,7 +1624,7 @@ public abstract class CacheMvccSqlTxQueriesAbstractTest extends CacheMvccAbstrac
ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT)
.setIndexedTypes(Integer.class, Integer.class);
- startGrid(getConfiguration("grid").setMvccVacuumTimeInterval(Integer.MAX_VALUE));
+ startGrid(getConfiguration("grid").setMvccVacuumFrequency(Integer.MAX_VALUE));
Ignite client = startGrid(getConfiguration("client").setClientMode(true));
@@ -1696,7 +1696,7 @@ public abstract class CacheMvccSqlTxQueriesAbstractTest extends CacheMvccAbstrac
ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT)
.setIndexedTypes(Integer.class, Integer.class);
- Ignite node = startGrid(getConfiguration("grid").setMvccVacuumTimeInterval(100));
+ Ignite node = startGrid(getConfiguration("grid").setMvccVacuumFrequency(100));
node.cluster().active(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccStreamingInsertTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccStreamingInsertTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccStreamingInsertTest.java
index 7d2e335..b07a187 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccStreamingInsertTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccStreamingInsertTest.java
@@ -57,7 +57,7 @@ public class CacheMvccStreamingInsertTest extends CacheMvccAbstractTest {
"create table person(" +
" id int not null primary key," +
" name varchar not null" +
- ") with \"atomicity=transactional\""
+ ") with \"atomicity=transactional_snapshot\""
));
Properties props = new Properties();
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
index 1a6cb55..c5f1441 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java
@@ -113,7 +113,7 @@ public class GridIndexRebuildSelfTest extends DynamicIndexAbstractSelfTest {
IgniteEx srv = startServer();
execute(srv, "CREATE TABLE T(k int primary key, v int) WITH \"cache_name=T,wrap_value=false," +
- "atomicity=transactional\"");
+ "atomicity=transactional_snapshot\"");
execute(srv, "CREATE INDEX IDX ON T(v)");
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildWithMvccEnabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildWithMvccEnabledSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildWithMvccEnabledSelfTest.java
index 3d65db8..cf68546 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildWithMvccEnabledSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildWithMvccEnabledSelfTest.java
@@ -40,8 +40,7 @@ public class GridIndexRebuildWithMvccEnabledSelfTest extends GridIndexRebuildSel
/** {@inheritDoc} */
@Override protected IgniteConfiguration serverConfiguration(int idx, boolean filter) throws Exception {
return super.serverConfiguration(idx, filter)
- .setMvccVacuumTimeInterval(Integer.MAX_VALUE)
- .setMvccEnabled(true);
+ .setMvccVacuumFrequency(Integer.MAX_VALUE);
}
/** {@inheritDoc} */
@@ -49,7 +48,7 @@ public class GridIndexRebuildWithMvccEnabledSelfTest extends GridIndexRebuildSel
IgniteEx srv = startServer();
execute(srv, "CREATE TABLE T(k int primary key, v int) WITH \"cache_name=T,wrap_value=false," +
- "atomicity=transactional\"");
+ "atomicity=transactional_snapshot\"");
execute(srv, "CREATE INDEX IDX ON T(v)");
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccSqlTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccSqlTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccSqlTestSuite.java
index c8f7643..ec60596 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccSqlTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccSqlTestSuite.java
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccReplicatedSqlTx
import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccScanQueryWithConcurrentJdbcTransactionTest;
import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSizeTest;
import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSizeWithConcurrentJdbcTransactionTest;
+import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSqlConfigurationValidationTest;
import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccStreamingInsertTest;
import org.apache.ignite.internal.processors.query.h2.GridIndexRebuildWithMvccEnabledSelfTest;
@@ -52,6 +53,7 @@ public class IgniteCacheMvccSqlTestSuite extends TestSuite {
TestSuite suite = new TestSuite("IgniteCache SQL MVCC Test Suite");
// Simple tests.
+ suite.addTestSuite(CacheMvccSqlConfigurationValidationTest.class);
suite.addTestSuite(CacheMvccDmlSimpleTest.class);
suite.addTestSuite(SqlTransactionsCommandsWithMvccEnabledSelfTest.class);
suite.addTestSuite(CacheMvccSizeTest.class);
[3/3] ignite git commit: IGNITE-9320: MVCC configuration: added new
CacheAtomicityMode.MVCC_SNAPSHOT. This closes #4660.
Posted by vo...@apache.org.
IGNITE-9320: MVCC configuration: added new CacheAtomicityMode.MVCC_SNAPSHOT. This closes #4660.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2ab94934
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2ab94934
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2ab94934
Branch: refs/heads/master
Commit: 2ab949349050a5affc66f01d4f2f00b81776143c
Parents: f018251
Author: rkondakov <ko...@mail.ru>
Authored: Mon Sep 17 13:08:19 2018 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Sep 17 13:08:19 2018 +0300
----------------------------------------------------------------------
.../JdbcThinConnectionMvccEnabledSelfTest.java | 4 +-
...ThinTransactionsAbstractComplexSelfTest.java | 10 +-
.../jdbc/thin/JdbcThinTransactionsSelfTest.java | 6 +-
...ThinTransactionsWithMvccEnabledSelfTest.java | 6 +-
.../apache/ignite/cache/CacheAtomicityMode.java | 33 +-
.../configuration/IgniteConfiguration.java | 48 +--
.../apache/ignite/internal/IgniteKernal.java | 4 +-
.../ignite/internal/IgniteNodeAttributes.java | 3 -
.../discovery/GridDiscoveryManager.java | 18 +-
.../affinity/GridAffinityAssignmentCache.java | 5 +-
.../processors/cache/CacheGroupContext.java | 21 +-
.../processors/cache/ClusterCachesInfo.java | 20 +-
.../processors/cache/GridCacheContext.java | 10 +-
.../processors/cache/GridCacheProcessor.java | 70 +++--
.../mvcc/MvccPreviousCoordinatorQueries.java | 7 +-
.../processors/cache/mvcc/MvccProcessor.java | 44 ++-
.../cache/mvcc/MvccProcessorImpl.java | 309 ++++++++++++-------
.../processors/cache/mvcc/MvccUtils.java | 27 +-
.../cache/mvcc/NoOpMvccProcessor.java | 215 -------------
.../continuous/CacheContinuousQueryManager.java | 2 +-
.../odbc/jdbc/JdbcRequestHandler.java | 9 +-
.../odbc/odbc/OdbcRequestHandler.java | 11 +-
.../mvcc/CacheMvccAbstractFeatureTest.java | 2 +-
.../cache/mvcc/CacheMvccAbstractTest.java | 21 +-
.../cache/mvcc/CacheMvccClusterRestartTest.java | 6 +-
.../CacheMvccConfigurationValidationTest.java | 245 ++++++++++++++-
.../mvcc/CacheMvccOperationChecksTest.java | 4 +-
.../mvcc/CacheMvccProcessorLazyStartTest.java | 175 +++++++++++
.../cache/mvcc/CacheMvccProcessorTest.java | 4 +
.../cache/mvcc/CacheMvccVacuumTest.java | 36 ++-
.../MemoryPolicyInitializationTest.java | 8 +-
.../DataStreamProcessorMvccSelfTest.java | 17 +-
.../DataStreamProcessorSelfTest.java | 20 +-
.../configvariations/ConfigVariations.java | 2 +-
.../testsuites/IgniteCacheMvccTestSuite.java | 2 +
.../processors/query/h2/IgniteH2Indexing.java | 102 ++++--
.../query/h2/PreparedStatementEx.java | 7 +-
.../query/h2/dml/UpdatePlanBuilder.java | 3 +-
.../query/h2/sql/GridSqlQueryParser.java | 2 +
...sactionsCommandsWithMvccEnabledSelfTest.java | 4 +-
.../cache/index/SqlTransactionsSelfTest.java | 5 +-
.../cache/mvcc/CacheMvccBulkLoadTest.java | 2 +-
.../cache/mvcc/CacheMvccDmlSimpleTest.java | 2 +-
...cheMvccSelectForUpdateQueryAbstractTest.java | 19 +-
.../cache/mvcc/CacheMvccSizeTest.java | 4 +-
...CacheMvccSqlConfigurationValidationTest.java | 111 +++++++
.../mvcc/CacheMvccSqlTxQueriesAbstractTest.java | 4 +-
.../mvcc/CacheMvccStreamingInsertTest.java | 2 +-
.../query/h2/GridIndexRebuildSelfTest.java | 2 +-
...GridIndexRebuildWithMvccEnabledSelfTest.java | 5 +-
.../testsuites/IgniteCacheMvccSqlTestSuite.java | 2 +
.../cpp/odbc-test/config/queries-default.xml | 198 ++++++------
.../odbc-test/config/queries-transaction-32.xml | 11 +-
.../odbc-test/config/queries-transaction.xml | 11 +-
.../config/mvcc/benchmark-mvcc-messages.sh | 19 +-
.../config/mvcc/benchmark-mvcc-processor.sh | 15 +-
.../mvcc/benchmark-mvcc-updates-contention.sh | 15 +-
.../mvcc/benchmark-thin-native.properties | 47 ++-
...benchmark-jdbc-thin-inmemory-mvcc.properties | 21 +-
.../yardstick/IgniteBenchmarkArguments.java | 18 +-
.../org/apache/ignite/yardstick/IgniteNode.java | 2 -
.../mvcc/MvccUpdateContentionBenchmark.java | 5 +-
62 files changed, 1292 insertions(+), 770 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionMvccEnabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionMvccEnabledSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionMvccEnabledSelfTest.java
index 051d1d2..0196cb2 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionMvccEnabledSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionMvccEnabledSelfTest.java
@@ -23,6 +23,7 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Savepoint;
import java.util.concurrent.Callable;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.binary.BinaryMarshaller;
@@ -67,8 +68,6 @@ public class JdbcThinConnectionMvccEnabledSelfTest extends JdbcThinAbstractSelfT
cfg.setGridLogger(new GridStringLogger());
- cfg.setMvccEnabled(true);
-
return cfg;
}
@@ -81,6 +80,7 @@ public class JdbcThinConnectionMvccEnabledSelfTest extends JdbcThinAbstractSelfT
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setName(name);
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsAbstractComplexSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsAbstractComplexSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsAbstractComplexSelfTest.java
index 28c65a9..68ed36b 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsAbstractComplexSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsAbstractComplexSelfTest.java
@@ -116,15 +116,13 @@ public abstract class JdbcThinTransactionsAbstractComplexSelfTest extends JdbcTh
@Override protected IgniteConfiguration getConfiguration(String testIgniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(testIgniteInstanceName);
- cfg.setMvccEnabled(true);
-
CacheConfiguration<Integer, Person> ccfg = new CacheConfiguration<>("Person");
ccfg.setIndexedTypes(Integer.class, Person.class);
ccfg.getQueryEntities().iterator().next().setKeyFieldName("id");
- ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
ccfg.setCacheMode(CacheMode.PARTITIONED);
@@ -145,14 +143,14 @@ public abstract class JdbcThinTransactionsAbstractComplexSelfTest extends JdbcTh
execute("ALTER TABLE \"Person\".person add if not exists companyid int");
execute("CREATE TABLE City (id int primary key, name varchar, population int) WITH " +
- "\"atomicity=transactional,template=partitioned,backups=3,cache_name=City\"");
+ "\"atomicity=transactional_snapshot,template=partitioned,backups=3,cache_name=City\"");
execute("CREATE TABLE Company (id int, \"cityid\" int, name varchar, primary key (id, \"cityid\")) WITH " +
- "\"atomicity=transactional,template=partitioned,backups=1,wrap_value=false,affinity_key=cityid," +
+ "\"atomicity=transactional_snapshot,template=partitioned,backups=1,wrap_value=false,affinity_key=cityid," +
"cache_name=Company\"");
execute("CREATE TABLE Product (id int primary key, name varchar, companyid int) WITH " +
- "\"atomicity=transactional,template=partitioned,backups=2,cache_name=Product\"");
+ "\"atomicity=transactional_snapshot,template=partitioned,backups=2,cache_name=Product\"");
execute("CREATE INDEX IF NOT EXISTS prodidx ON Product(companyid)");
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java
index 1619996..a8fa47b 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java
@@ -26,6 +26,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -58,8 +59,6 @@ public class JdbcThinTransactionsSelfTest extends JdbcThinAbstractSelfTest {
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
- cfg.setMvccEnabled(true);
-
cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME));
TcpDiscoverySpi disco = new TcpDiscoverySpi();
@@ -84,6 +83,7 @@ public class JdbcThinTransactionsSelfTest extends JdbcThinAbstractSelfTest {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setName(name);
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
return cfg;
}
@@ -97,7 +97,7 @@ public class JdbcThinTransactionsSelfTest extends JdbcThinAbstractSelfTest {
try (Connection c = c(true, NestedTxMode.ERROR)) {
try (Statement s = c.createStatement()) {
s.execute("CREATE TABLE INTS (k int primary key, v int) WITH \"cache_name=ints,wrap_value=false," +
- "atomicity=transactional\"");
+ "atomicity=transactional_snapshot\"");
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsWithMvccEnabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsWithMvccEnabledSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsWithMvccEnabledSelfTest.java
index e3f7f14..e01a53d 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsWithMvccEnabledSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsWithMvccEnabledSelfTest.java
@@ -26,6 +26,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -58,8 +59,6 @@ public class JdbcThinTransactionsWithMvccEnabledSelfTest extends JdbcThinAbstrac
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
- cfg.setMvccEnabled(true);
-
cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME));
TcpDiscoverySpi disco = new TcpDiscoverySpi();
@@ -84,6 +83,7 @@ public class JdbcThinTransactionsWithMvccEnabledSelfTest extends JdbcThinAbstrac
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setName(name);
+ cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT);
return cfg;
}
@@ -97,7 +97,7 @@ public class JdbcThinTransactionsWithMvccEnabledSelfTest extends JdbcThinAbstrac
try (Connection c = c(true, NestedTxMode.ERROR)) {
try (Statement s = c.createStatement()) {
s.execute("CREATE TABLE INTS (k int primary key, v int) WITH \"cache_name=ints,wrap_value=false," +
- "atomicity=transactional\"");
+ "atomicity=transactional_snapshot\"");
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java
index 79a8e5f..1584286 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java
@@ -33,8 +33,12 @@ import org.jetbrains.annotations.Nullable;
*/
public enum CacheAtomicityMode {
/**
- * Specified fully {@code ACID}-compliant transactional cache behavior. See
+ * Specified fully {@code ACID}-compliant transactional cache behavior for key-value API. See
* {@link Transaction} for more information about transactions.
+ * <p>
+ * <b>Note:</b> this mode guaranties transactional behavior <b>only for key-value API</b> operations.
+ * For ACID SQL transactions use {@code CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT} mode.
+ * </p>
*/
TRANSACTIONAL,
@@ -88,7 +92,32 @@ public enum CacheAtomicityMode {
*
* @see IgniteCache#withNoRetries()
*/
- ATOMIC;
+ ATOMIC,
+
+ /**
+ * Specified fully {@code ACID}-compliant transactional cache behavior not only for key-value API,
+ * but also for SQL transactions.
+ * <p>
+ * This cache atomicity mode is implemented within multiversion concurrency control (MVCC) where database can
+ * contain multiple versions of each row to allow readers do not collide with writers.
+ * Each update in this mode generates a new version of a row and don't remove a previous one.
+ * Old versions are cleaned only when they are not visible to anyone.
+ * </p>
+ * <p>
+ * There is one node in cluster is elected as MVCC coordinator. This node tracks all in-flight transactions and
+ * queries in the cluster.
+ * Each transaction or query over the cache with {@code TRANSACTIONAL_SNAPSHOT} mode obtains current
+ * database snapshot from the coordinator. This snapshot allows transactions and queries to skip invisible
+ * updates made by concurrent transactions to always observe the same consistent database state.
+ * </p>
+ * <p>
+ * <b>Note!</b> This atomicity mode is not interoperable with the other atomicity modes in the same transaction.
+ * Caches participated in transaction should either be all {@code TRANSACTIONAL} or all
+ * {@code TRANSACTIONAL_SNAPSHOT}, but not the mixed ones.
+ * </p>
+ * See {@link Transaction} for more information about transactions.
+ */
+ TRANSACTIONAL_SNAPSHOT;
/** Enumerated values. */
private static final CacheAtomicityMode[] VALS = values();
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 3060caa..6a0c7cb 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -218,8 +218,7 @@ public class IgniteConfiguration {
public static final int DFLT_MVCC_VACUUM_THREAD_CNT = 2;
/** Default time interval between vacuum process runs (ms). */
- public static final int DFLT_MVCC_VACUUM_TIME_INTERVAL = 5000;
-
+ public static final int DFLT_MVCC_VACUUM_FREQUENCY = 5000;
/** Optional local Ignite instance name. */
private String igniteInstanceName;
@@ -494,14 +493,11 @@ public class IgniteConfiguration {
/** Client connector configuration. */
private ClientConnectorConfiguration cliConnCfg = ClientListenerProcessor.DFLT_CLI_CFG;
- /** Flag whether MVCC is enabled. */
- private boolean mvccEnabled;
-
/** Size of MVCC vacuum thread pool. */
private int mvccVacuumThreadCnt = DFLT_MVCC_VACUUM_THREAD_CNT;
/** Time interval between vacuum process runs (ms). */
- private int mvccVacuumTimeInterval = DFLT_MVCC_VACUUM_TIME_INTERVAL;
+ private int mvccVacuumFreq = DFLT_MVCC_VACUUM_FREQUENCY;
/** User authentication enabled. */
private boolean authEnabled;
@@ -595,9 +591,8 @@ public class IgniteConfiguration {
metricsLogFreq = cfg.getMetricsLogFrequency();
metricsUpdateFreq = cfg.getMetricsUpdateFrequency();
mgmtPoolSize = cfg.getManagementThreadPoolSize();
- mvccEnabled = cfg.isMvccEnabled();
- mvccVacuumThreadCnt = cfg.mvccVacuumThreadCnt;
- mvccVacuumTimeInterval = cfg.mvccVacuumTimeInterval;
+ mvccVacuumThreadCnt = cfg.getMvccVacuumThreadCount();
+ mvccVacuumFreq = cfg.getMvccVacuumFrequency();
netTimeout = cfg.getNetworkTimeout();
nodeId = cfg.getNodeId();
odbcCfg = cfg.getOdbcConfiguration();
@@ -3003,32 +2998,11 @@ public class IgniteConfiguration {
}
/**
- * Whether or not MVCC is enabled.
- *
- * @return {@code True} if MVCC is enabled.
- */
- public boolean isMvccEnabled() {
- return mvccEnabled;
- }
-
- /**
- * Sets MVCC enabled flag.
- *
- * @param mvccEnabled MVCC enabled flag.
- * @return {@code this} for chaining.
- */
- public IgniteConfiguration setMvccEnabled(boolean mvccEnabled) {
- this.mvccEnabled = mvccEnabled;
-
- return this;
- }
-
- /**
* Returns number of MVCC vacuum cleanup threads.
*
* @return Number of MVCC vacuum cleanup threads.
*/
- public int getMvccVacuumThreadCnt() {
+ public int getMvccVacuumThreadCount() {
return mvccVacuumThreadCnt;
}
@@ -3038,7 +3012,7 @@ public class IgniteConfiguration {
* @param mvccVacuumThreadCnt Number of MVCC vacuum cleanup threads.
* @return {@code this} for chaining.
*/
- public IgniteConfiguration setMvccVacuumThreadCnt(int mvccVacuumThreadCnt) {
+ public IgniteConfiguration setMvccVacuumThreadCount(int mvccVacuumThreadCnt) {
this.mvccVacuumThreadCnt = mvccVacuumThreadCnt;
return this;
@@ -3049,18 +3023,18 @@ public class IgniteConfiguration {
*
* @return Time interval between vacuum runs.
*/
- public int getMvccVacuumTimeInterval() {
- return mvccVacuumTimeInterval;
+ public int getMvccVacuumFrequency() {
+ return mvccVacuumFreq;
}
/**
* Sets time interval between vacuum runs.
*
- * @param mvccVacuumTimeInterval Time interval between vacuum runs.
+ * @param mvccVacuumFreq Time interval between vacuum runs.
* @return {@code this} for chaining.
*/
- public IgniteConfiguration setMvccVacuumTimeInterval(int mvccVacuumTimeInterval) {
- this.mvccVacuumTimeInterval = mvccVacuumTimeInterval;
+ public IgniteConfiguration setMvccVacuumFrequency(int mvccVacuumFreq) {
+ this.mvccVacuumFreq = mvccVacuumFreq;
return this;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 230c05c..d74b3aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -125,7 +125,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
-import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccProcessorImpl;
import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.persistence.filename.PdsConsistentIdProcessor;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
@@ -994,7 +994,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
// be able to start receiving messages once discovery completes.
try {
startProcessor(new PdsConsistentIdProcessor(ctx));
- startProcessor(MvccUtils.createProcessor(ctx));
+ startProcessor(new MvccProcessorImpl(ctx));
startProcessor(createComponent(DiscoveryNodeValidationProcessor.class, ctx));
startProcessor(new GridAffinityProcessor(ctx));
startProcessor(createComponent(GridSegmentationProcessor.class, ctx));
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index 539727d..5b764e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -202,9 +202,6 @@ public final class IgniteNodeAttributes {
/** Internal attribute name constant. */
public static final String ATTR_DYNAMIC_CACHE_START_ROLLBACK_SUPPORTED = ATTR_PREFIX + ".dynamic.cache.start.rollback.supported";
- /** Mvcc enabled flag. */
- public static final String ATTR_MVCC_ENABLED = ATTR_PREFIX + ".mvcc.enabled";
-
/**
* Enforces singleton.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 48e3318..b9af961 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -162,7 +162,6 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_LATE_AFFINITY
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_BINARY_STRING_SER_VER_2;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_DFLT_SUID;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MVCC_ENABLED;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_OFFHEAP_SIZE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PHY_RAM;
@@ -658,7 +657,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
updateClientNodes(node.id());
}
- ctx.coordinators().onDiscoveryEvent(type, topSnapshot, topVer);
+ ctx.coordinators().onDiscoveryEvent(type, topSnapshot, topVer, customMsg);
boolean locJoinEvt = type == EVT_NODE_JOINED && node.id().equals(locNode.id());
@@ -1222,8 +1221,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
Boolean locSrvcCompatibilityEnabled = locNode.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
Boolean locSecurityCompatibilityEnabled = locNode.attribute(ATTR_SECURITY_COMPATIBILITY_MODE);
- Boolean locMvccEnabled = locNode.attribute(ATTR_MVCC_ENABLED);
-
for (ClusterNode n : nodes) {
int rmtJvmMajVer = nodeJavaMajorVersion(n);
@@ -1321,17 +1318,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
", locNodeId=" + locNode.id() + ", rmtNode=" + U.toShortString(n) + "]");
}
- Boolean rmtMvccEnabled = n.attribute(ATTR_MVCC_ENABLED);
-
- if (!F.eq(locMvccEnabled, rmtMvccEnabled)) {
- throw new IgniteCheckedException("Remote node has MVCC mode different from local " +
- "[locId8=" + U.id8(locNode.id()) +
- ", locMvccMode=" + (Boolean.TRUE.equals(locMvccEnabled) ? "ENABLED" : "DISABLED") +
- ", rmtId8=" + U.id8(n.id()) +
- ", rmtMvccMode=" + (Boolean.TRUE.equals(rmtMvccEnabled) ? "ENABLED" : "DISABLED") +
- ", rmtAddrs=" + U.addressesAsString(n) + ", rmtNode=" + U.toShortString(n) + "]");
- }
-
if (n.version().compareToIgnoreTimestamp(SERVICE_PERMISSIONS_SINCE) >= 0
&& ctx.security().enabled() // Matters only if security enabled.
) {
@@ -2388,7 +2374,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
Collection<ClusterNode> topSnapshot) {
assert topSnapshot.contains(loc);
- MvccCoordinator mvccCrd = ctx.coordinators().coordinatorFromDiscoveryEvent();
+ MvccCoordinator mvccCrd = ctx.coordinators().assignedCoordinator();
HashSet<UUID> alives = U.newHashSet(topSnapshot.size());
HashMap<UUID, ClusterNode> nodeMap = U.newHashMap(topSnapshot.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
index cc2c17c..2290ce6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
@@ -203,7 +203,10 @@ public class GridAffinityAssignmentCache {
* @param affAssignment Affinity assignment for topology version.
*/
public void initialize(AffinityTopologyVersion topVer, List<List<ClusterNode>> affAssignment) {
- MvccCoordinator mvccCrd = ctx.cache().context().coordinators().currentCoordinator(topVer);
+ MvccCoordinator mvccCrd = null;
+
+ if (!locCache)
+ mvccCrd = ctx.cache().context().coordinators().currentCoordinator(topVer);
initialize(topVer, affAssignment, mvccCrd);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
index c100d16..b92280a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
@@ -30,7 +30,6 @@ import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataPageEvictionMode;
-import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.TopologyValidator;
import org.apache.ignite.events.CacheRebalancingEvent;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
@@ -42,7 +41,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffini
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopologyImpl;
-import org.apache.ignite.internal.processors.cache.distributed.dht.PartitionsEvictManager;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader;
import org.apache.ignite.internal.processors.cache.persistence.DataRegion;
import org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager;
@@ -61,7 +59,7 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.mxbean.CacheGroupMetricsMXBean;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.LOCAL;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
import static org.apache.ignite.cache.CacheRebalanceMode.NONE;
@@ -218,26 +216,13 @@ public class CacheGroupContext {
storeCacheId = affNode && dataRegion.config().getPageEvictionMode() != DataPageEvictionMode.DISABLED;
+ mvccEnabled = ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT;
+
log = ctx.kernalContext().log(getClass());
caches = new ArrayList<>();
mxBean = new CacheGroupMetricsMXBeanImpl(this);
-
- mvccEnabled = mvccEnabled(ctx.gridConfig(), ccfg, cacheType);
- }
-
- /**
- * @param cfg Ignite configuration.
- * @param ccfg Cache configuration.
- * @param cacheType Cache typr.
- * @return {@code True} if mvcc is enabled for given cache.
- */
- public static boolean mvccEnabled(IgniteConfiguration cfg, CacheConfiguration ccfg, CacheType cacheType) {
- return cfg.isMvccEnabled() &&
- cacheType == CacheType.USER &&
- ccfg.getCacheMode() != LOCAL &&
- ccfg.getAtomicityMode() == TRANSACTIONAL;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index 8eab9c0..572e33e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -69,6 +69,7 @@ import org.apache.ignite.plugin.PluginProvider;
import org.apache.ignite.spi.discovery.DiscoveryDataBag;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.LOCAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
@@ -147,7 +148,7 @@ class ClusterCachesInfo {
if (ccfg == null)
grpCfgs.put(info.cacheData().config().getGroupName(), info.cacheData().config());
else
- validateCacheGroupConfiguration(ccfg, info.cacheData().config(), info.cacheType());
+ validateCacheGroupConfiguration(ccfg, info.cacheData().config());
}
String conflictErr = processJoiningNode(joinDiscoData, ctx.localNodeId(), true);
@@ -220,7 +221,7 @@ class ClusterCachesInfo {
}
if (checkConsistency)
- validateStartCacheConfiguration(locCfg, cacheData.cacheType());
+ validateStartCacheConfiguration(locCfg);
}
}
@@ -1864,17 +1865,16 @@ class ClusterCachesInfo {
/**
* @param ccfg Cache configuration to start.
- * @param cacheType Cache type.
* @throws IgniteCheckedException If failed.
*/
- void validateStartCacheConfiguration(CacheConfiguration ccfg, CacheType cacheType) throws IgniteCheckedException {
+ void validateStartCacheConfiguration(CacheConfiguration ccfg) throws IgniteCheckedException {
if (ccfg.getGroupName() != null) {
CacheGroupDescriptor grpDesc = cacheGroupByName(ccfg.getGroupName());
if (grpDesc != null) {
assert ccfg.getGroupName().equals(grpDesc.groupName());
- validateCacheGroupConfiguration(grpDesc.config(), ccfg, cacheType);
+ validateCacheGroupConfiguration(grpDesc.config(), ccfg);
}
}
}
@@ -1882,10 +1882,9 @@ class ClusterCachesInfo {
/**
* @param cfg Existing configuration.
* @param startCfg Cache configuration to start.
- * @param cacheType Cache type.
* @throws IgniteCheckedException If validation failed.
*/
- private void validateCacheGroupConfiguration(CacheConfiguration cfg, CacheConfiguration startCfg, CacheType cacheType)
+ private void validateCacheGroupConfiguration(CacheConfiguration cfg, CacheConfiguration startCfg)
throws IgniteCheckedException {
GridCacheAttributes attr1 = new GridCacheAttributes(cfg);
GridCacheAttributes attr2 = new GridCacheAttributes(startCfg);
@@ -1893,10 +1892,9 @@ class ClusterCachesInfo {
CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "cacheMode", "Cache mode",
cfg.getCacheMode(), startCfg.getCacheMode(), true);
- CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "mvccEnabled", "MVCC mode",
- CacheGroupContext.mvccEnabled(ctx.config(), cfg, cacheType),
- CacheGroupContext.mvccEnabled(ctx.config(), startCfg, cacheType),
- true);
+ if (cfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT || startCfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT)
+ CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "atomicityMode", "Atomicity mode",
+ attr1.atomicityMode(), attr2.atomicityMode(), true);
CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "affinity", "Affinity function",
attr1.cacheAffinityClassName(), attr2.cacheAffinityClassName(), true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index ac9de7c..7d200eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -112,6 +112,7 @@ import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_READ_LOAD_BALANCING;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_STARTED;
@@ -817,7 +818,14 @@ public class GridCacheContext<K, V> implements Externalizable {
* @return {@code True} if transactional.
*/
public boolean transactional() {
- return cacheCfg.getAtomicityMode() == TRANSACTIONAL;
+ return cacheCfg.getAtomicityMode() == TRANSACTIONAL || cacheCfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT;
+ }
+
+ /**
+ * @return {@code True} if transactional snapshot.
+ */
+ public boolean transactionalSnapshot() {
+ return cacheCfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index e0a2420..f000da7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -35,7 +35,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Collectors;
-import javax.cache.expiry.EternalExpiryPolicy;
import javax.management.MBeanServer;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
@@ -165,7 +164,7 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_REMOVED_ENTR
import static org.apache.ignite.IgniteSystemProperties.IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK;
import static org.apache.ignite.IgniteSystemProperties.getBoolean;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.cache.CacheMode.LOCAL;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
@@ -278,6 +277,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
throws IgniteCheckedException {
CU.initializeConfigDefaults(log, cfg, cacheObjCtx);
+ ctx.coordinators().preProcessCacheConfiguration(cfg);
ctx.igfsHelper().preProcessCacheConfiguration(cfg);
}
@@ -525,6 +525,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
ctx.igfsHelper().validateCacheConfiguration(cc);
+ ctx.coordinators().validateCacheConfiguration(cc);
if (cc.getAtomicityMode() == ATOMIC)
assertParameter(cc.getTransactionManagerLookupClassName() == null,
@@ -543,24 +544,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
"other cache types [cacheName=" + cc.getName() + ", groupName=" + cc.getGroupName() +
", cacheType=" + cacheType + "]");
- if (cc.getAtomicityMode() == TRANSACTIONAL && c.isMvccEnabled()) {
- if (cc.getCacheStoreFactory() != null) {
- throw new IgniteCheckedException("Transactional cache may not have a third party cache store when " +
- "MVCC is enabled.");
- }
-
- if (cc.getExpiryPolicyFactory() != null && !(cc.getExpiryPolicyFactory().create() instanceof
- EternalExpiryPolicy)) {
- throw new IgniteCheckedException("Transactional cache may not have expiry policy when " +
- "MVCC is enabled.");
- }
-
- if (cc.getInterceptor() != null) {
- throw new IgniteCheckedException("Transactional cache may not have an interceptor when " +
- "MVCC is enabled.");
- }
- }
-
// Make sure we do not use sql schema for system views.
if (ctx.query().moduleEnabled()) {
String schema = QueryUtils.normalizeSchemaName(cc.getName(), cc.getSqlSchema());
@@ -827,14 +810,42 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (CU.isPersistenceEnabled(ctx.config()) && ctx.cache().context().pageStore() != null) {
Map<String, StoredCacheData> storedCaches = ctx.cache().context().pageStore().readCacheConfigurations();
- if (!F.isEmpty(storedCaches))
+ if (!F.isEmpty(storedCaches)) {
for (StoredCacheData storedCacheData : storedCaches.values()) {
String cacheName = storedCacheData.config().getName();
//Ignore stored caches if it already added by static config(static config has higher priority).
if (!caches.containsKey(cacheName))
addStoredCache(caches, storedCacheData, cacheName, cacheType(cacheName), false);
+ else {
+ CacheConfiguration cfg = caches.get(cacheName).cacheData().config();
+ CacheConfiguration cfgFromStore = storedCacheData.config();
+
+ validateCacheConfigurationOnRestore(cfg, cfgFromStore);
+ }
}
+ }
+ }
+ }
+
+ /**
+ * Validates cache configuration against stored cache configuration when persistence is enabled.
+ *
+ * @param cfg Configured cache configuration.
+ * @param cfgFromStore Stored cache configuration
+ * @throws IgniteCheckedException If validation failed.
+ */
+ private void validateCacheConfigurationOnRestore(CacheConfiguration cfg, CacheConfiguration cfgFromStore)
+ throws IgniteCheckedException {
+ assert cfg != null && cfgFromStore != null;
+
+ if ((cfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT ||
+ cfgFromStore.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT)
+ && cfg.getAtomicityMode() != cfgFromStore.getAtomicityMode()) {
+ throw new IgniteCheckedException("Cannot start cache. Statically configured atomicity mode differs from " +
+ "previously stored configuration. Please check your configuration: [cacheName=" + cfg.getName() +
+ ", configuredAtomicityMode=" + cfg.getAtomicityMode() +
+ ", storedAtomicityMode=" + cfgFromStore.getAtomicityMode() + "]");
}
}
@@ -1462,6 +1473,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
pluginMgr.validate();
+ if (cfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT)
+ sharedCtx.coordinators().ensureStarted();
+
sharedCtx.jta().registerCache(cfg);
// Skip suggestions for internal caches.
@@ -1532,7 +1546,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
switch (cfg.getCacheMode()) {
case LOCAL: {
switch (cfg.getAtomicityMode()) {
- case TRANSACTIONAL: {
+ case TRANSACTIONAL:
+ case TRANSACTIONAL_SNAPSHOT: {
cache = new GridLocalCache(cacheCtx);
break;
@@ -1554,7 +1569,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
case REPLICATED: {
if (nearEnabled) {
switch (cfg.getAtomicityMode()) {
- case TRANSACTIONAL: {
+ case TRANSACTIONAL:
+ case TRANSACTIONAL_SNAPSHOT: {
cache = new GridNearTransactionalCache(cacheCtx);
break;
@@ -1572,7 +1588,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
else {
switch (cfg.getAtomicityMode()) {
- case TRANSACTIONAL: {
+ case TRANSACTIONAL:
+ case TRANSACTIONAL_SNAPSHOT: {
cache = cacheCtx.affinityNode() ?
new GridDhtColocatedCache(cacheCtx) :
new GridDhtColocatedCache(cacheCtx, new GridNoStorageCacheMap());
@@ -1662,7 +1679,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
GridDhtCacheAdapter dht = null;
switch (cfg.getAtomicityMode()) {
- case TRANSACTIONAL: {
+ case TRANSACTIONAL:
+ case TRANSACTIONAL_SNAPSHOT: {
assert cache instanceof GridNearTransactionalCache;
GridNearTransactionalCache near = (GridNearTransactionalCache)cache;
@@ -3428,7 +3446,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
CacheConfiguration ccfg = req.startCacheConfiguration();
try {
- cachesInfo.validateStartCacheConfiguration(ccfg, req.cacheType());
+ cachesInfo.validateStartCacheConfiguration(ccfg);
}
catch (IgniteCheckedException e) {
fut.onDone(e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccPreviousCoordinatorQueries.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccPreviousCoordinatorQueries.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccPreviousCoordinatorQueries.java
index 024ef70..cd7560f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccPreviousCoordinatorQueries.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccPreviousCoordinatorQueries.java
@@ -24,7 +24,6 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.managers.discovery.DiscoCache;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
import org.apache.ignite.internal.util.GridLongList;
import org.apache.ignite.internal.util.typedef.F;
@@ -56,17 +55,17 @@ class MvccPreviousCoordinatorQueries {
/**
* @param nodeQueries Active queries map.
- * @param discoCache Discovery data.
+ * @param nodes Cluster nodes.
* @param mgr Discovery manager.
*/
- void init(Map<UUID, GridLongList> nodeQueries, DiscoCache discoCache, GridDiscoveryManager mgr) {
+ void init(Map<UUID, GridLongList> nodeQueries, Collection<ClusterNode> nodes, GridDiscoveryManager mgr) {
synchronized (this) {
assert !initDone;
assert waitNodes == null;
waitNodes = new HashSet<>();
- for (ClusterNode node : discoCache.allNodes()) {
+ for (ClusterNode node : nodes) {
if ((nodeQueries == null || !nodeQueries.containsKey(node.id())) &&
mgr.alive(node) &&
!F.contains(rcvd, node.id()))
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessor.java
index bce61a1..a09468f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessor.java
@@ -23,10 +23,12 @@ import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.discovery.DiscoCache;
+import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.processors.GridProcessor;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.ExchangeContext;
@@ -43,8 +45,10 @@ public interface MvccProcessor extends GridProcessor {
* @param evtType Event type.
* @param nodes Current nodes.
* @param topVer Topology version.
+ * @param customMsg Message
*/
- void onDiscoveryEvent(int evtType, Collection<ClusterNode> nodes, long topVer);
+ void onDiscoveryEvent(int evtType, Collection<ClusterNode> nodes, long topVer,
+ @Nullable DiscoveryCustomMessage customMsg);
/**
* Exchange start callback.
@@ -71,6 +75,11 @@ public interface MvccProcessor extends GridProcessor {
void processClientActiveQueries(UUID nodeId, @Nullable GridLongList activeQueries);
/**
+ * @return Mvcc coordinator received from discovery event.
+ */
+ @Nullable MvccCoordinator assignedCoordinator();
+
+ /**
* @return Coordinator.
*/
@Nullable MvccCoordinator currentCoordinator();
@@ -83,11 +92,6 @@ public interface MvccProcessor extends GridProcessor {
@Nullable MvccCoordinator currentCoordinator(AffinityTopologyVersion topVer);
/**
- * @return Mvcc coordinator received from discovery event.
- */
- @Nullable MvccCoordinator coordinatorFromDiscoveryEvent();
-
- /**
* @return Current coordinator node ID.
*/
UUID currentCoordinatorId();
@@ -247,4 +251,32 @@ public interface MvccProcessor extends GridProcessor {
* @param diagCtx Diagnostic request.
*/
void dumpDebugInfo(IgniteLogger log, @Nullable IgniteDiagnosticPrepareContext diagCtx);
+
+ /**
+ * @return {@code True} if at least one cache with
+ * {@code CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT} mode is registered.
+ */
+ boolean mvccEnabled();
+
+ /**
+ * Pre-processes cache configuration before start.
+ *
+ * @param ccfg Cache configuration to pre-process.
+ */
+ void preProcessCacheConfiguration(CacheConfiguration ccfg);
+
+ /**
+ * Validates cache configuration before start.
+ *
+ * @param ccfg Cache configuration to validate.
+ * @throws IgniteCheckedException If validation failed.
+ */
+ void validateCacheConfiguration(CacheConfiguration ccfg) throws IgniteCheckedException;
+
+ /**
+ * Starts MVCC processor (i.e. initialises data structures and vacuum) if it has not been started yet.
+ *
+ * @throws IgniteCheckedException If failed to initialize.
+ */
+ void ensureStarted() throws IgniteCheckedException;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java
index 220f0c0..d1e2dc5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccProcessorImpl.java
@@ -28,9 +28,13 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.expiry.EternalExpiryPolicy;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
@@ -40,15 +44,17 @@ import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.NodeStoppingException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.discovery.DiscoCache;
+import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
+import org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch;
+import org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest;
import org.apache.ignite.internal.processors.cache.ExchangeContext;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
@@ -92,13 +98,14 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.lang.IgniteProductVersion;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.IgniteNodeValidationResult;
-import org.apache.ignite.spi.discovery.DiscoveryDataBag;
import org.apache.ignite.thread.IgniteThread;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
import static org.apache.ignite.events.EventType.EVT_CLIENT_NODE_DISCONNECTED;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
@@ -127,7 +134,10 @@ import static org.apache.ignite.internal.processors.cache.persistence.CacheDataR
* MVCC processor.
*/
@SuppressWarnings("serial")
-class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, DatabaseLifecycleListener {
+public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, DatabaseLifecycleListener {
+ /** */
+ private static final IgniteProductVersion MVCC_SUPPORTED_SINCE = IgniteProductVersion.fromString("2.7.0");
+
/** */
private static final Waiter LOCAL_TRANSACTION_MARKER = new LocalTransactionMarker();
@@ -153,6 +163,9 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
private volatile MvccCoordinator curCrd;
/** */
+ private volatile MvccCoordinator assignedCrd;
+
+ /** */
private TxLog txLog;
/** */
@@ -170,9 +183,6 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
private volatile Throwable vacuumError;
/** */
- private MvccDiscoveryData discoData = new MvccDiscoveryData(null);
-
- /** */
private final GridAtomicLong futIdCntr = new GridAtomicLong(0);
/** */
@@ -208,6 +218,12 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
/** */
private final GridFutureAdapter<Void> initFut = new GridFutureAdapter<>();
+ /** Flag whether at least one cache with {@code CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT} mode is registered. */
+ private volatile boolean mvccEnabled;
+
+ /** Flag whether all nodes in cluster support MVCC. */
+ private volatile boolean mvccSupported = true;
+
/**
* @param ctx Context.
*/
@@ -219,8 +235,6 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
/** {@inheritDoc} */
@Override public void start() throws IgniteCheckedException {
- ctx.addNodeAttribute(IgniteNodeAttributes.ATTR_MVCC_ENABLED, Boolean.TRUE);
-
ctx.event().addLocalEventListener(new CacheCoordinatorNodeFailListener(),
EVT_NODE_FAILED, EVT_NODE_LEFT);
@@ -228,12 +242,57 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
}
/** {@inheritDoc} */
- @Nullable @Override public IgniteNodeValidationResult validateNode(ClusterNode node) {
- Boolean rmtEnabled = node.attribute(IgniteNodeAttributes.ATTR_MVCC_ENABLED);
+ @Override public boolean mvccEnabled() {
+ return mvccEnabled;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void preProcessCacheConfiguration(CacheConfiguration ccfg) {
+ if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) {
+ if (!mvccSupported)
+ throw new IgniteException("Cannot start MVCC transactional cache. " +
+ "MVCC is unsupported by the cluster.");
+
+ mvccEnabled = true;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void validateCacheConfiguration(CacheConfiguration ccfg) throws IgniteCheckedException {
+ if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) {
+ if (!mvccSupported)
+ throw new IgniteException("Cannot start MVCC transactional cache. " +
+ "MVCC is unsupported by the cluster.");
+
+ if (ccfg.getCacheStoreFactory() != null) {
+ throw new IgniteCheckedException("Transactional cache may not have a third party cache store when " +
+ "MVCC is enabled.");
+ }
+
+ if (ccfg.getExpiryPolicyFactory() != null && !(ccfg.getExpiryPolicyFactory().create() instanceof
+ EternalExpiryPolicy)) {
+ throw new IgniteCheckedException("Transactional cache may not have expiry policy when " +
+ "MVCC is enabled.");
+ }
+
+ if (ccfg.getInterceptor() != null) {
+ throw new IgniteCheckedException("Transactional cache may not have an interceptor when " +
+ "MVCC is enabled.");
+ }
+
+ if (ccfg.getCacheMode() == CacheMode.LOCAL)
+ throw new IgniteCheckedException("Local caches are not supported by MVCC engine. Use " +
+ "CacheAtomicityMode.TRANSACTIONAL for local caches.");
+
+ mvccEnabled = true;
+ }
+ }
- if (rmtEnabled == null) {
- String errMsg = "Failed to add node to topology because MVCC is enabled on cluster and " +
- "the node doesn't support MVCC or MVCC is disabled for the node [nodeId=" + node.id() + ']';
+ /** {@inheritDoc} */
+ @Nullable @Override public IgniteNodeValidationResult validateNode(ClusterNode node) {
+ if (mvccEnabled && node.version().compareToIgnoreTimestamp(MVCC_SUPPORTED_SINCE) < 0) {
+ String errMsg = "Failed to add node to topology. MVCC is enabled on the cluster, but " +
+ "the node doesn't support MVCC [nodeId=" + node.id() + ']';
return new IgniteNodeValidationResult(node.id(), errMsg, errMsg);
}
@@ -242,6 +301,19 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
}
/** {@inheritDoc} */
+ @Override public void ensureStarted() throws IgniteCheckedException {
+ if (!ctx.clientNode() && txLog == null) {
+ assert mvccEnabled && mvccSupported;
+
+ txLog = new TxLog(ctx, ctx.cache().context().database());
+
+ startVacuumWorkers();
+
+ log.info("Mvcc processor started.");
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public void beforeStop(IgniteCacheDatabaseSharedManager mgr) {
stopVacuumWorkers();
@@ -250,6 +322,7 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
/** {@inheritDoc} */
@Override public void onInitDataRegions(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
+ // We have to always init txLog data region.
DataStorageConfiguration dscfg = dataStorageConfiguration();
mgr.addDataRegion(
@@ -260,13 +333,7 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
/** {@inheritDoc} */
@Override public void afterInitialise(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
- if (!CU.isPersistenceEnabled(ctx.config())) {
- assert txLog == null;
-
- txLog = new TxLog(ctx, mgr);
-
- startVacuumWorkers();
- }
+ // No-op.
}
/** {@inheritDoc} */
@@ -281,87 +348,19 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
/** {@inheritDoc} */
@Override public void afterMemoryRestore(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
- assert CU.isPersistenceEnabled(ctx.config());
- assert txLog == null;
-
- txLog = new TxLog(ctx, mgr);
-
- startVacuumWorkers();
- }
-
- /** {@inheritDoc} */
- @Override public DiscoveryDataExchangeType discoveryDataType() {
- return DiscoveryDataExchangeType.CACHE_CRD_PROC;
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("ConstantConditions")
- @Override public void collectGridNodeData(DiscoveryDataBag dataBag) {
- Integer cmpId = discoveryDataType().ordinal();
-
- if (!dataBag.commonDataCollectedFor(cmpId))
- dataBag.addGridCommonData(cmpId, discoData);
- }
-
- /** {@inheritDoc} */
- @Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
- MvccDiscoveryData discoData0 = (MvccDiscoveryData)data.commonData();
-
- // Disco data might be null in case the first joined node is daemon.
- if (discoData0 != null) {
- discoData = discoData0;
-
- log.info("Received mvcc coordinator on node join: " + discoData.coordinator());
-
- assert discoData != null;
- }
+ // No-op.
}
/** {@inheritDoc} */
- @Override public void onDiscoveryEvent(int evtType, Collection<ClusterNode> nodes, long topVer) {
- if (evtType == EVT_NODE_METRICS_UPDATED || evtType == EVT_DISCOVERY_CUSTOM_EVT)
+ @Override public void onDiscoveryEvent(int evtType, Collection<ClusterNode> nodes, long topVer,
+ @Nullable DiscoveryCustomMessage customMsg) {
+ if (evtType == EVT_NODE_METRICS_UPDATED)
return;
- MvccCoordinator crd;
-
- if (evtType == EVT_NODE_SEGMENTED || evtType == EVT_CLIENT_NODE_DISCONNECTED)
- crd = null;
- else {
- crd = discoData.coordinator();
-
- if (crd == null ||
- ((evtType == EVT_NODE_FAILED || evtType == EVT_NODE_LEFT) && !F.nodeIds(nodes).contains(crd.nodeId()))) {
- ClusterNode crdNode = null;
-
- if (crdC != null) {
- crdNode = crdC.apply(nodes);
-
- if (log.isInfoEnabled())
- log.info("Assigned coordinator using test closure: " + crd);
- }
- else {
- // Expect nodes are sorted by order.
- for (ClusterNode node : nodes) {
- if (!node.isClient()) {
- crdNode = node;
-
- break;
- }
- }
- }
-
- crd = crdNode != null ? new MvccCoordinator(crdNode.id(), coordinatorVersion(topVer), new AffinityTopologyVersion(topVer, 0)) : null;
-
- if (crd != null) {
- if (log.isInfoEnabled())
- log.info("Assigned mvcc coordinator [crd=" + crd + ", crdNode=" + crdNode + ']');
- }
- else
- U.warn(log, "New mvcc coordinator was not assigned [topVer=" + topVer + ']');
- }
- }
-
- discoData = new MvccDiscoveryData(crd);
+ if (evtType == EVT_DISCOVERY_CUSTOM_EVT)
+ checkMvccCacheStarted(customMsg);
+ else
+ assignMvccCoordinator(evtType, nodes, topVer);
}
/** {@inheritDoc} */
@@ -384,8 +383,8 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
}
/** {@inheritDoc} */
- @Override public void onExchangeDone(boolean newCoord, DiscoCache discoCache, Map<UUID, GridLongList> activeQueries) {
- if (!newCoord)
+ @Override public void onExchangeDone(boolean newCrd, DiscoCache discoCache, Map<UUID, GridLongList> activeQueries) {
+ if (!newCrd)
return;
ctx.cache().context().tm().rollbackMvccTxOnCoordinatorChange();
@@ -406,7 +405,7 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
log.info("Initialize local node as mvcc coordinator [node=" + ctx.localNodeId() +
", crdVer=" + crdVer + ']');
- prevCrdQueries.init(activeQueries, discoCache, ctx.discovery());
+ prevCrdQueries.init(activeQueries, F.view(discoCache.allNodes(), this::supportsMvcc), ctx.discovery());
initFut.onDone();
}
@@ -435,8 +434,8 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
}
/** {@inheritDoc} */
- @Override @Nullable public MvccCoordinator coordinatorFromDiscoveryEvent() {
- return discoData != null ? discoData.coordinator() : null;
+ @Override @Nullable public MvccCoordinator assignedCoordinator() {
+ return assignedCrd;
}
/** {@inheritDoc} */
@@ -458,6 +457,8 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
/** {@inheritDoc} */
@Override public byte state(MvccVersion ver) throws IgniteCheckedException {
+ assert txLog != null && mvccEnabled;
+
return txLog.get(ver.coordinatorVersion(), ver.counter());
}
@@ -468,6 +469,8 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
/** {@inheritDoc} */
@Override public void updateState(MvccVersion ver, byte state, boolean primary) throws IgniteCheckedException {
+ assert txLog != null && mvccEnabled;
+
TxKey key = new TxKey(ver.coordinatorVersion(), ver.counter());
txLog.put(key, state, primary);
@@ -808,12 +811,104 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
return ctx.config().getDataStorageConfiguration();
}
+ /** */
+ private void assignMvccCoordinator(int evtType, Collection<ClusterNode> nodes, long topVer) {
+ checkMvccSupported(nodes);
+
+ MvccCoordinator crd;
+
+ if (evtType == EVT_NODE_SEGMENTED || evtType == EVT_CLIENT_NODE_DISCONNECTED)
+ crd = null;
+ else {
+ crd = assignedCrd;
+
+ if (crd == null ||
+ ((evtType == EVT_NODE_FAILED || evtType == EVT_NODE_LEFT) && !F.nodeIds(nodes).contains(crd.nodeId()))) {
+ ClusterNode crdNode = null;
+
+ if (crdC != null) {
+ crdNode = crdC.apply(nodes);
+
+ if (log.isInfoEnabled())
+ log.info("Assigned coordinator using test closure: " + crd);
+ }
+ else {
+ // Expect nodes are sorted by order.
+ for (ClusterNode node : nodes) {
+ if (!node.isClient() && supportsMvcc(node)) {
+ crdNode = node;
+
+ break;
+ }
+ }
+ }
+
+ crd = crdNode != null ? new MvccCoordinator(crdNode.id(), coordinatorVersion(crdNode),
+ new AffinityTopologyVersion(topVer, 0)) : null;
+
+ if (log.isInfoEnabled() && crd != null)
+ log.info("Assigned mvcc coordinator [crd=" + crd + ", crdNode=" + crdNode + ']');
+ else if (crd == null)
+ U.warn(log, "New mvcc coordinator was not assigned [topVer=" + topVer + ']');
+ }
+ }
+
+ assignedCrd = crd;
+ }
+
/**
- * @param topVer Topology version.
+ * @param crdNode Assigned coordinator node.
* @return Coordinator version.
*/
- private long coordinatorVersion(long topVer) {
- return topVer + ctx.discovery().gridStartTime();
+ private long coordinatorVersion(ClusterNode crdNode) {
+ return crdNode.order() + ctx.discovery().gridStartTime();
+ }
+
+ /** */
+ private void checkMvccSupported(Collection<ClusterNode> nodes) {
+ if (mvccEnabled) {
+ assert mvccSupported;
+
+ return;
+ }
+
+ boolean res = true, was = mvccSupported;
+
+ for (ClusterNode node : nodes) {
+ if (!supportsMvcc(node)) {
+ res = false;
+
+ break;
+ }
+ }
+
+ if (was != res)
+ mvccSupported = res;
+ }
+
+ /** */
+ private boolean supportsMvcc(ClusterNode node) {
+ return node.version().compareToIgnoreTimestamp(MVCC_SUPPORTED_SINCE) >= 0;
+ }
+
+ /** */
+ private void checkMvccCacheStarted(@Nullable DiscoveryCustomMessage customMsg) {
+ assert customMsg != null;
+
+ if (!mvccEnabled && customMsg instanceof DynamicCacheChangeBatch) {
+ for (DynamicCacheChangeRequest req : ((DynamicCacheChangeBatch)customMsg).requests()) {
+ CacheConfiguration ccfg = req.startCacheConfiguration();
+
+ if (ccfg == null)
+ continue;
+
+ if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) {
+ assert mvccSupported;
+
+ mvccEnabled = true;
+ }
+ }
+ }
}
/**
@@ -952,11 +1047,11 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
cleanupQueue = new LinkedBlockingQueue<>();
- vacuumWorkers = new ArrayList<>(ctx.config().getMvccVacuumThreadCnt() + 1);
+ vacuumWorkers = new ArrayList<>(ctx.config().getMvccVacuumThreadCount() + 1);
vacuumWorkers.add(new VacuumScheduler(ctx, log, this));
- for (int i = 0; i < ctx.config().getMvccVacuumThreadCnt(); i++) {
+ for (int i = 0; i < ctx.config().getMvccVacuumThreadCount(); i++) {
vacuumWorkers.add(new VacuumWorker(ctx, log, cleanupQueue));
}
@@ -1895,7 +1990,7 @@ class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, D
VacuumScheduler(GridKernalContext ctx, IgniteLogger log, MvccProcessorImpl prc) {
super(ctx.igniteInstanceName(), "vacuum-scheduler", log);
- this.interval = ctx.config().getMvccVacuumTimeInterval();
+ this.interval = ctx.config().getMvccVacuumFrequency();
this.prc = prc;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
index c75393e..0422459 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUtils.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache.mvcc;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
@@ -102,14 +102,6 @@ public class MvccUtils {
}
/**
- * @param ctx Kernal context.
- * @return Newly created Mvcc processor.
- */
- public static MvccProcessor createProcessor(GridKernalContext ctx) {
- return mvccEnabled(ctx) ? new MvccProcessorImpl(ctx) : new NoOpMvccProcessor(ctx);
- }
-
- /**
* @param cctx Cache context.
* @param mvccCrd Mvcc coordinator version.
* @param mvccCntr Mvcc counter.
@@ -720,10 +712,10 @@ public class MvccUtils {
/**
* @param ctx Grid kernal context.
- * @return Whether MVCC is enabled or not on {@link IgniteConfiguration}.
+ * @return Whether MVCC is enabled or not.
*/
public static boolean mvccEnabled(GridKernalContext ctx) {
- return ctx.config().isMvccEnabled();
+ return ctx.coordinators().mvccEnabled();
}
/**
@@ -794,6 +786,19 @@ public class MvccUtils {
return snapshot;
}
+ /**
+ * Throws atomicity modes compatibility validation exception.
+ *
+ * @param ctx1 Cache context.
+ * @param ctx2 Another cache context.
+ */
+ public static void throwAtomicityModesMismatchException(GridCacheContext ctx1, GridCacheContext ctx2) {
+ throw new IgniteException("Caches with transactional_snapshot atomicity mode cannot participate in the same" +
+ " transaction with caches having another atomicity mode. [cacheName=" + ctx1.name() +
+ ", cacheMode=" + ctx1.config().getAtomicityMode() +
+ ", anotherCacheName=" + ctx2.name() + " anotherCacheMode=" + ctx2.config().getAtomicityMode() + ']');
+ }
+
/** */
private static MvccVersion mvccVersion(long crd, long cntr, int opCntr) {
return new MvccVersionImpl(crd, cntr, opCntr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/NoOpMvccProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/NoOpMvccProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/NoOpMvccProcessor.java
deleted file mode 100644
index b9a5132..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/NoOpMvccProcessor.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.mvcc;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.managers.discovery.DiscoCache;
-import org.apache.ignite.internal.processors.GridProcessorAdapter;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.ExchangeContext;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
-import org.apache.ignite.internal.util.GridLongList;
-import org.jetbrains.annotations.Nullable;
-
-/**
- *
- */
-class NoOpMvccProcessor extends GridProcessorAdapter implements MvccProcessor {
- /**
- * @param ctx Kernal context.
- */
- protected NoOpMvccProcessor(GridKernalContext ctx) {
- super(ctx);
- }
-
- /** {@inheritDoc} */
- @Override public void onDiscoveryEvent(int evtType, Collection<ClusterNode> nodes, long topVer) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void onExchangeStart(MvccCoordinator mvccCrd, ExchangeContext exchCtx, ClusterNode exchCrd) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void onExchangeDone(boolean newCoord, DiscoCache discoCache,
- Map<UUID, GridLongList> activeQueries) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void processClientActiveQueries(UUID nodeId, @Nullable GridLongList activeQueries) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public MvccCoordinator currentCoordinator() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public MvccCoordinator currentCoordinator(AffinityTopologyVersion topVer) {
- return null;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public MvccCoordinator coordinatorFromDiscoveryEvent() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public UUID currentCoordinatorId() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void updateCoordinator(MvccCoordinator curCrd) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public byte state(long crdVer, long cntr) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public byte state(MvccVersion ver) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void updateState(MvccVersion ver, byte state) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void updateState(MvccVersion ver, byte state, boolean primary) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void registerLocalTransaction(long crd, long cntr) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public boolean hasLocalTransaction(long crd, long cntr) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public IgniteInternalFuture<Void> waitFor(GridCacheContext cctx,
- MvccVersion locked) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void addQueryTracker(MvccQueryTracker tracker) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void removeQueryTracker(Long id) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public MvccSnapshot tryRequestSnapshotLocal() {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public MvccSnapshot tryRequestSnapshotLocal(
- @Nullable IgniteInternalTx tx) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public IgniteInternalFuture<MvccSnapshot> requestSnapshotAsync() {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public IgniteInternalFuture<MvccSnapshot> requestSnapshotAsync(IgniteInternalTx tx) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void requestSnapshotAsync(MvccSnapshotResponseListener lsnr) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void requestSnapshotAsync(IgniteInternalTx tx, MvccSnapshotResponseListener lsnr) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public IgniteInternalFuture<Void> ackTxCommit(MvccSnapshot updateVer) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public IgniteInternalFuture<Void> ackTxCommit(MvccVersion updateVer, MvccSnapshot readSnapshot,
- long qryId) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void ackTxRollback(MvccVersion updateVer) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void ackTxRollback(MvccVersion updateVer, MvccSnapshot readSnapshot, long qryTrackerId) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void ackQueryDone(MvccSnapshot snapshot, long qryId) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public IgniteInternalFuture<Void> waitTxsFuture(UUID crdId, GridLongList txs) {
- throw processorException();
- }
-
- /** {@inheritDoc} */
- @Override public void dumpDebugInfo(IgniteLogger log, @Nullable IgniteDiagnosticPrepareContext diagCtx) {
- // No-op.
- }
-
- /**
- * @return No-op processor usage exception;
- */
- private IgniteException processorException() {
- return new IgniteException("Current Ignite configuration does not support MVCC functionality " +
- "(consider adding ignite-schedule module to classpath).");
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index 0470fad..ab60f47 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -497,7 +497,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
final boolean includeExpired) throws IgniteCheckedException
{
//TODO IGNITE-7953
- if (!cctx.atomic() && cctx.kernalContext().config().isMvccEnabled())
+ if (cctx.transactionalSnapshot())
throw new UnsupportedOperationException("Continuous queries are not supported for transactional caches " +
"when MVCC is enabled.");
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ab94934/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
index 7dda67f..97ce20a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
@@ -45,6 +45,7 @@ import org.apache.ignite.internal.processors.authentication.AuthorizationContext
import org.apache.ignite.internal.processors.bulkload.BulkLoadAckClientParameters;
import org.apache.ignite.internal.processors.bulkload.BulkLoadProcessor;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
+import org.apache.ignite.internal.processors.cache.mvcc.MvccUtils;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx;
import org.apache.ignite.internal.processors.odbc.ClientListenerProtocolVersion;
@@ -190,10 +191,8 @@ public class JdbcRequestHandler implements ClientListenerRequestHandler {
log = ctx.log(getClass());
- if (ctx.grid().configuration().isMvccEnabled())
- worker = new JdbcRequestHandlerWorker(ctx.igniteInstanceName(), log, this, ctx);
- else
- worker = null;
+ // TODO IGNITE-9484 Do not create worker if there is a possibility to unbind TX from threads.
+ worker = new JdbcRequestHandlerWorker(ctx.igniteInstanceName(), log, this, ctx);
}
/** {@inheritDoc} */
@@ -204,7 +203,7 @@ public class JdbcRequestHandler implements ClientListenerRequestHandler {
JdbcRequest req = (JdbcRequest)req0;
- if (worker == null)
+ if (!MvccUtils.mvccEnabled(ctx))
return doHandle(req);
else {
GridFutureAdapter<ClientListenerResponse> fut = worker.process(req);