This is an automated email from the ASF dual-hosted git repository. av pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push: new 6f5e27e2e89 IGNITE-20506 CacheAtomicityMode#TRANSACTIONAL_SNAPSHOT removal (#10964) 6f5e27e2e89 is described below commit 6f5e27e2e898a170837181f4d3af4f8847b052c1 Author: Anton Vinogradov <a...@apache.org> AuthorDate: Thu Oct 5 13:51:59 2023 +0300 IGNITE-20506 CacheAtomicityMode#TRANSACTIONAL_SNAPSHOT removal (#10964) --- docs/_docs/SQL/sql-transactions.adoc | 87 ---------- docs/_docs/code-snippets/dotnet/SqlTransactions.cs | 102 ----------- .../apache/ignite/snippets/SqlTransactions.java | 33 ---- docs/_docs/code-snippets/xml/mvcc.xml | 46 ----- docs/_docs/configuring-caches/atomicity-modes.adoc | 8 - docs/_docs/sql-reference/ddl.adoc | 2 +- docs/_docs/sql-reference/transactions.adoc | 69 -------- docs/_docs/transactions/mvcc.adoc | 193 --------------------- .../apache/ignite/cache/CacheAtomicityMode.java | 47 +---- .../cache/CacheAffinitySharedManager.java | 7 +- .../processors/cache/CacheGroupContext.java | 3 +- .../processors/cache/ClusterCachesInfo.java | 8 +- .../processors/cache/GridCacheContext.java | 10 +- .../processors/cache/GridCacheMapEntry.java | 45 +---- .../processors/cache/GridCacheProcessor.java | 21 +-- .../processors/cache/GridLocalConfigManager.java | 11 -- .../cache/ValidationOnNodeJoinUtils.java | 59 ------- .../processors/cache/mvcc/MvccProcessor.java | 24 --- .../processors/cache/mvcc/MvccProcessorImpl.java | 75 +------- .../internal/processors/cache/mvcc/MvccUtils.java | 15 -- .../GridCacheDatabaseSharedManager.java | 12 +- .../internal/IgniteClientReconnectCacheTest.java | 2 +- .../cache/AbstractDataTypesCoverageTest.java | 2 +- .../cache/IgniteOutOfMemoryPropagationTest.java | 2 +- .../IgniteCacheMultiClientsStartTest.java | 2 +- .../distributed/IgniteCacheTxIteratorSelfTest.java | 2 +- .../CacheObjectTransformationEvolutionTest.java | 2 +- .../transform/CacheObjectTransformationTest.java | 2 +- .../processors/query/h2/IgniteH2Indexing.java | 3 +- .../internal/processors/query/h2/QueryParser.java | 72 +------- .../query/h2/sql/GridSqlQueryParser.java | 2 +- .../index/DynamicEnableIndexingBasicSelfTest.java | 2 +- .../DynamicEnableIndexingConcurrentSelfTest.java | 2 +- .../internal/processors/query/LazyOnDmlTest.java | 2 +- .../query/WrongQueryEntityFieldTypeTest.java | 2 +- .../Cache/Configuration/CacheAtomicityMode.cs | 33 +--- .../config/mvcc/benchmark-mvcc-messages.sh | 97 ----------- .../config/mvcc/benchmark-mvcc-processor.sh | 94 ---------- .../mvcc/benchmark-mvcc-updates-contention.sh | 95 ---------- .../config/mvcc/benchmark-thin-native.properties | 123 ------------- .../benchmark-jdbc-thin-inmemory-mvcc.properties | 104 ----------- .../jdbc/mvcc/MvccUpdateContentionBenchmark.java | 12 -- 42 files changed, 36 insertions(+), 1498 deletions(-) diff --git a/docs/_docs/SQL/sql-transactions.adoc b/docs/_docs/SQL/sql-transactions.adoc deleted file mode 100644 index 5e850c227f8..00000000000 --- a/docs/_docs/SQL/sql-transactions.adoc +++ /dev/null @@ -1,87 +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. -= SQL Transactions -:javaSourceFile: {javaCodeDir}/SqlTransactions.java - -CAUTION: `TRANSACTIONAL_SNAPSHOT` is deprecated since 2.12 and will be removed in the next releases. - -== Overview -SQL Transactions are supported for caches that use the `TRANSACTIONAL_SNAPSHOT` atomicity mode. The `TRANSACTIONAL_SNAPSHOT` mode is the implementation of multiversion concurrency control (MVCC) for Ignite caches. For more information about MVCC and current limitations, visit the link:transactions/mvcc[Multiversion Concurrency Control] page. - -See the link:sql-reference/transactions[Transactions] page for the transaction syntax supported by Ignite. - -== Enabling MVCC -To enable MVCC for a cache, use the `TRANSACTIONAL_SNAPSHOT` atomicity mode in the cache configuration. If you create a table with the `CREATE TABLE` command, specify the atomicity mode as a parameter in the `WITH` part of the command: - -[tabs] --- -tab:SQL[] -[source,sql] ----- -CREATE TABLE Person WITH "ATOMICITY=TRANSACTIONAL_SNAPSHOT" ----- -tab:XML[] -[source,xml] ----- -<bean class="org.apache.ignite.configuration.IgniteConfiguration"> - <property name="cacheConfiguration"> - <bean class="org.apache.ignite.configuration.CacheConfiguration"> - - <property name="name" value="myCache"/> - - <property name="atomicityMode" value="TRANSACTIONAL_SNAPSHOT"/> - - </bean> - </property> -</bean> ----- - -tab:Java[] -[source,java] ----- -include::{javaSourceFile}[tag=enable,indent=0] ----- - -tab:C#/.NET[] -[source,csharp] ----- -include::code-snippets/dotnet/SqlTransactions.cs[tag=mvcc,indent=0] ----- -tab:C++[unsupported] --- - - - -== Limitations - -=== Cross-Cache Transactions - -The `TRANSACTIONAL_SNAPSHOT` mode is enabled per cache and does not permit caches with different atomicity modes within one transaction. Thus, if you want to cover multiple tables in one SQL transaction, all tables must be created with the `TRANSACTIONAL_SNAPSHOT` mode. - -=== Nested Transactions - -Ignite supports three modes of handling nested SQL transactions that can be enabled via a JDBC/ODBC connection parameter. - -[source,sql] ----- -jdbc:ignite:thin://127.0.0.1/?nestedTransactionsMode=COMMIT ----- - - -When a nested transaction occurs within another transaction, the system behavior depends on the `nestedTransactionsMode` parameter: - -- `ERROR` — When the nested transaction is encountered, an error is thrown and the enclosing transaction is rolled back. This is the default behavior. -- `COMMIT` — The enclosing transaction is committed; the nested transaction starts and is committed when its COMMIT statement is encountered. The rest of the statements in the enclosing transaction are executed as implicit transactions. -- `IGNORE` — DO NOT USE THIS MODE. The beginning of the nested transaction is ignored, statements within the nested transaction will be executed as part of the enclosing transaction, and all changes will be committed with the commit of the nested transaction. The subsequent statements of the enclosing transaction will be executed as implicit transactions. diff --git a/docs/_docs/code-snippets/dotnet/SqlTransactions.cs b/docs/_docs/code-snippets/dotnet/SqlTransactions.cs deleted file mode 100644 index 917e02dfd13..00000000000 --- a/docs/_docs/code-snippets/dotnet/SqlTransactions.cs +++ /dev/null @@ -1,102 +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. - */ -using System; -using Apache.Ignite.Core; -using Apache.Ignite.Core.Cache; -using Apache.Ignite.Core.Cache.Configuration; -using Apache.Ignite.Core.Discovery.Tcp; -using Apache.Ignite.Core.Discovery.Tcp.Static; - -namespace dotnet_helloworld -{ - public class SqlTransactions - { - public static void EnablingMvcc() - { - var ignite = Ignition.Start( - new IgniteConfiguration - { - DiscoverySpi = new TcpDiscoverySpi - { - LocalPort = 48500, - LocalPortRange = 20, - IpFinder = new TcpDiscoveryStaticIpFinder - { - Endpoints = new[] - { - "127.0.0.1:48500..48520" - } - } - } - }); - - // tag::mvcc[] - var cacheCfg = new CacheConfiguration - { - Name = "myCache", - AtomicityMode = CacheAtomicityMode.TransactionalSnapshot - }; - // end::mvcc[] - ignite.CreateCache<long, long>(cacheCfg); - Console.Write(typeof(Person)); - } - - public static void ConcurrentUpdates() - { - var cfg = new IgniteConfiguration - { - CacheConfiguration = new[] - { - new CacheConfiguration - { - Name = "mvccCache", - AtomicityMode = CacheAtomicityMode.TransactionalSnapshot - }, - } - }; - var ignite = Ignition.Start(cfg); - var cache = ignite.GetCache<int, string>("mvccCache"); - - // tag::mvccConcurrentUpdates[] - for (var i = 1; i <= 5; i++) - { - using (var tx = ignite.GetTransactions().TxStart()) - { - Console.WriteLine($"attempt #{i}, value: {cache.Get(1)}"); - try - { - cache.Put(1, "new value"); - tx.Commit(); - Console.WriteLine($"attempt #{i} succeeded"); - break; - } - catch (CacheException) - { - if (!tx.IsRollbackOnly) - { - // Transaction was not marked as "rollback only", - // so it's not a concurrent update issue. - // Process the exception here. - break; - } - } - } - } - // end::mvccConcurrentUpdates[] - } - } -} diff --git a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/SqlTransactions.java b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/SqlTransactions.java deleted file mode 100644 index 0bd3895b7f1..00000000000 --- a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/SqlTransactions.java +++ /dev/null @@ -1,33 +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.snippets; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; - -public class SqlTransactions { - - void enableMVCC() { - //tag::enable[] - CacheConfiguration cacheCfg = new CacheConfiguration<>(); - cacheCfg.setName("myCache"); - - cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - - //end::enable[] - } -} diff --git a/docs/_docs/code-snippets/xml/mvcc.xml b/docs/_docs/code-snippets/xml/mvcc.xml deleted file mode 100644 index 2213bffdcf9..00000000000 --- a/docs/_docs/code-snippets/xml/mvcc.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> - <!-- tag::ignite-config[] --> - <bean class="org.apache.ignite.configuration.IgniteConfiguration"> - - <property name="cacheConfiguration"> - <bean class="org.apache.ignite.configuration.CacheConfiguration"> - <property name="name" value="myCache"/> - <property name="atomicityMode" value="TRANSACTIONAL_SNAPSHOT"/> - </bean> - </property> - - <!-- tag::discovery[] --> - <property name="discoverySpi"> - <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> - <property name="ipFinder"> - <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> - <property name="addresses"> - <list> - <value>127.0.0.1:47500..47509</value> - </list> - </property> - </bean> - </property> - </bean> - </property> - <!-- end::discovery[] --> - </bean> - <!-- end::ignite-config[] --> -</beans> diff --git a/docs/_docs/configuring-caches/atomicity-modes.adoc b/docs/_docs/configuring-caches/atomicity-modes.adoc index 4c75657f9df..9751c1b8621 100644 --- a/docs/_docs/configuring-caches/atomicity-modes.adoc +++ b/docs/_docs/configuring-caches/atomicity-modes.adoc @@ -47,14 +47,6 @@ For more information about transactions, see link:key-value-api/transactions[Per [discrete] === Performance Considerations The `TRANSACTIONAL` mode adds a performance cost to cache operations and should be enabled only if you need transactions. -==== - -| TRANSACTIONAL_SNAPSHOT - -a| An experimental mode that implements multiversion concurrency control (MVCC) and supports both key-value transactions and SQL transactions. See link:transactions/mvcc[Multiversion Concurrency Control] for details about and limitations of this mode. - -CAUTION: `TRANSACTIONAL_SNAPSHOT` is deprecated since 2.12 and will be removed in the next releases. - |=== diff --git a/docs/_docs/sql-reference/ddl.adoc b/docs/_docs/sql-reference/ddl.adoc index 7111b951d9d..3f997738288 100644 --- a/docs/_docs/sql-reference/ddl.adoc +++ b/docs/_docs/sql-reference/ddl.adoc @@ -52,7 +52,7 @@ Parameters: ** `TEMPLATE=<cache's template name>` - case-sensitive name of a link:configuring-caches/configuration-overview#cache-templates[cache template]. A template is an instance of the `CacheConfiguration` class registered by calling `Ignite.addCacheConfiguration()`. Use predefined `TEMPLATE=PARTITIONED` or `TEMPLATE=REPLICATED` templates to create the cache with the corresponding replication mode. The rest of the parameters will be those that are defined in the `CacheConfiguration` object. By [...] ** `BACKUPS=<number of backups>` - sets the number of link:configuring-caches/configuring-backups[partition backups]. If neither this nor the `TEMPLATE` parameter is set, then the cache is created with `0` backup copies. -** `ATOMICITY=<ATOMIC | TRANSACTIONAL | TRANSACTIONAL_SNAPSHOT>` - sets link:key-value-api/transactions[atomicity mode] for the underlying cache. If neither this nor the `TEMPLATE` parameter is set, then the cache is created with the `ATOMIC` mode enabled. If `TRANSACTIONAL_SNAPSHOT` is specified, the table will link:transactions/mvcc[support transactions]. +** `ATOMICITY=<ATOMIC | TRANSACTIONAL>` - sets link:key-value-api/transactions[atomicity mode] for the underlying cache. If neither this nor the `TEMPLATE` parameter is set, then the cache is created with the `ATOMIC` mode enabled. ** `WRITE_SYNCHRONIZATION_MODE=<PRIMARY_SYNC | FULL_SYNC | FULL_ASYNC>` - sets the write synchronization mode for the underlying cache. If neither this nor the `TEMPLATE` parameter is set, then the cache is created with `FULL_SYNC` mode enabled. ** `CACHE_GROUP=<group name>` - specifies the link:configuring-caches/cache-groups[group name] the underlying cache belongs to. diff --git a/docs/_docs/sql-reference/transactions.adoc b/docs/_docs/sql-reference/transactions.adoc deleted file mode 100644 index 100bf25302e..00000000000 --- a/docs/_docs/sql-reference/transactions.adoc +++ /dev/null @@ -1,69 +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. -= Transactions - -IMPORTANT: Support for link:transactions/mvcc[SQL transactions] is currently in the beta stage. For production use, consider key-value transactions. - -Ignite supports the following statements that allow users to start, commit, or rollback a transaction. - -[source,sql] ----- -BEGIN [TRANSACTION] - -COMMIT [TRANSACTION] - -ROLLBACK [TRANSACTION] ----- - -- The `BEGIN` statement begins a new transaction. -- `COMMIT` commits the current transaction. -- `ROLLBACK` rolls back the current transaction. - -NOTE: DDL statements are not supported inside transactions. - -== Description - -The `BEGIN`, `COMMIT` and `ROLLBACK` commands allow you to manage SQL Transactions. A transaction is a sequence of SQL operations that starts with the `BEGIN` statement and ends with the `COMMIT` statement. Either all of the operations in a transaction succeed or they all fail. - -The `ROLLBACK [TRANSACTION]` statement undoes all updates made since the last time a `COMMIT` or `ROLLBACK` command was issued. - -== Example -Add a person and update the city population by 1 in a single transaction and commit it. - -[source,sql] ----- -BEGIN; - -INSERT INTO Person (id, name, city_id) VALUES (1, 'John Doe', 3); - -UPDATE City SET population = population + 1 WHERE id = 3; - -COMMIT; ----- - - -Add a person, update the city population and then roll back changes instead of committing them. - -[source,sql] ----- -BEGIN; - -INSERT INTO Person (id, name, city_id) VALUES (1, 'John Doe', 3); - -UPDATE City SET population = population + 1 WHERE id = 3; - -ROLLBACK; ----- - diff --git a/docs/_docs/transactions/mvcc.adoc b/docs/_docs/transactions/mvcc.adoc deleted file mode 100644 index 929539a3b3d..00000000000 --- a/docs/_docs/transactions/mvcc.adoc +++ /dev/null @@ -1,193 +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. -= Multiversion Concurrency Control - -CAUTION: `TRANSACTIONAL_SNAPSHOT` is deprecated since 2.12 and will be removed in the next releases. - -== Overview - -Caches with the `TRANSACTIONAL_SNAPSHOT` atomicity mode support SQL transactions as well as link:key-value-api/transactions[key-value transactions] and enable multiversion concurrency control (MVCC) for both types of transactions. - - -== Multiversion Concurrency Control - - -Multiversion Concurrency Control (MVCC) is a method of controlling the consistency of data accessed by multiple users concurrently. MVCC implements the https://en.wikipedia.org/wiki/Snapshot_isolation[snapshot isolation] guarantee which ensures that each transaction always sees a consistent snapshot of data. - -Each transaction obtains a consistent snapshot of data when it starts and can only view and modify data in this snapshot. -When the transaction updates an entry, Ignite verifies that the entry has not been updated by other transactions and creates a new version of the entry. -The new version becomes visible to other transactions only when and if this transaction commits successfully. -If the entry has been updated, the current transaction fails with an exception (see the <<Concurrent Updates>> section for the information on how to handle update conflicts). - -//// -*TODO* Artem - we should explain what a physical vs logical snapshot is. I don't know. -//// - -The snapshots are not physical snapshots but logical snapshots that are generated by the MVCC-coordinator: a cluster node that coordinates transactional activity in the cluster. The coordinator keeps track of all active transactions and is notified when each transaction finishes. All operations with an MVCC-enabled cache request a snapshot of data from the coordinator. - -== Enabling MVCC -To enable MVCC for a cache, use the `TRANSACTIONAL_SNAPSHOT` atomicity mode in the cache configuration. If you create a table with the `CREATE TABLE` command, specify the atomicity mode as a parameter in the `WITH` part of the command: - - -[tabs] --- -tab:XML[] - -[source, xml] ----- -include::code-snippets/xml/mvcc.xml[tags=ignite-config;!discovery, indent=0] ----- - -tab:SQL[] -[source,sql] ----- -CREATE TABLE Person WITH "ATOMICITY=TRANSACTIONAL_SNAPSHOT" ----- --- - -NOTE: The `TRANSACTIONAL_SNAPSHOT` mode only supports the default concurrency mode (`PESSIMISTIC`) and default isolation level (`REPEATABLE_READ`). See link:key-value-api/transactions#concurrency-modes-and-isolation-levels[Concurrency modes and isolation levels] for details. - - -== Concurrent Updates - -If an entry is read and then updated within a single transaction, it is possible that another transaction could be processed in between the two operations and update the entry first. In this case, an exception is thrown when the first transaction attempts to update the entry and the transaction is marked as "rollback only". You have to retry the transaction. - -This is how to tell that an update conflict has occurred: - -* When Java transaction API is used, a `CacheException` is thrown with the message `Cannot serialize transaction due to write conflict (transaction is marked for rollback)` and the `Transaction.rollbackOnly` flag is set to `true`. -* When SQL transactions are executed through the JDBC or ODBC driver, the `SQLSTATE:40001` error code is returned. - -[tabs] --- - -tab:Ignite Java[] -[source,java] ----- -for(int i = 1; i <=5 ; i++) { - try (Transaction tx = Ignition.ignite().transactions().txStart()) { - System.out.println("attempt #" + i + ", value: " + cache.get(1)); - try { - cache.put(1, "new value"); - tx.commit(); - System.out.println("attempt #" + i + " succeeded"); - break; - } catch (CacheException e) { - if (!tx.isRollbackOnly()) { - // Transaction was not marked as "rollback only", - // so it's not a concurrent update issue. - // Process the exception here. - break; - } - } - } -} ----- -tab:JDBC[] -[source,java] ----- -Class.forName("org.apache.ignite.IgniteJdbcThinDriver"); - -// Open JDBC connection. -Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1"); - -PreparedStatement updateStmt = null; -PreparedStatement selectStmt = null; - -try { - // starting a transaction - conn.setAutoCommit(false); - - selectStmt = conn.prepareStatement("select name from Person where id = 1"); - selectStmt.setInt(1, 1); - ResultSet rs = selectStmt.executeQuery(); - - if (rs.next()) - System.out.println("name = " + rs.getString("name")); - - updateStmt = conn.prepareStatement("update Person set name = ? where id = ? "); - - updateStmt.setString(1, "New Name"); - updateStmt.setInt(2, 1); - updateStmt.executeUpdate(); - - // committing the transaction - conn.commit(); -} catch (SQLException e) { - if ("40001".equals(e.getSQLState())) { - // retry the transaction - } else { - // process the exception - } -} finally { - if (updateStmt != null) updateStmt.close(); - if (selectStmt != null) selectStmt.close(); -} ----- - -tab:C#/.NET[] -[source,csharp] ----- -include::code-snippets/dotnet/SqlTransactions.cs[tag=mvccConcurrentUpdates,indent=0] ----- - - -tab:C++[] -[source,cpp] ----- -include::code-snippets/cpp/src/concurrent_updates.cpp[tag=concurrent-updates,indent=0] ----- - --- - - - -== Limitations - -=== Cross-Cache Transactions -The `TRANSACTIONAL_SNAPSHOT` mode is enabled per cache and does not permit caches with different atomicity modes within the same transaction. As a consequence, if you want to cover multiple tables in one SQL transaction, all tables must be created with the `TRANSACTIONAL_SNAPSHOT` mode. - -=== Nested Transactions -Ignite supports three modes of handling nested SQL transactions. They can be enabled via a JDBC/ODBC connection parameter. - - -[source, shell] ----- -jdbc:ignite:thin://127.0.0.1/?nestedTransactionsMode=COMMIT ----- - -When a nested transaction occurs within another transaction, the `nestedTransactionsMode` parameter dictates the system behavior: - -- `ERROR` — When the nested transaction is encountered, an error is thrown and the enclosing transaction is rolled back. This is the default behavior. -- `COMMIT` — The enclosing transaction is committed; the nested transaction starts and is committed when its COMMIT statement is encountered. The rest of the statements in the enclosing transaction are executed as implicit transactions. -- `IGNORE` — DO NOT USE THIS MODE. The beginning of the nested transaction is ignored, statements within the nested transaction will be executed as part of the enclosing transaction, and all changes will be committed with the commit of the nested transaction. The subsequent statements of the enclosing transaction will be executed as implicit transactions. - - -=== Continuous Queries -If you use link:key-value-api/continuous-queries[Continuous Queries] with an MVCC-enabled cache, there are several limitations that you should be aware of: - -* When an update event is received, subsequent reads of the updated key may return the old value for a period of time before the MVCC-coordinator learns of the update. This is because the update event is sent from the node where the key is updated, as soon as it is updated. In such a case, the MVCC-coordinator may not be immediately aware of that update, and therefore, subsequent reads may return outdated information during that period of time. -* There is a limit on the number of keys per node a single transaction can update when continuous queries are used. The updated values are kept in memory, and if there are too many updates, the node might not have enough RAM to keep all the objects. To avoid OutOfMemory errors, each transaction is allowed to update at most 20,000 keys (the default value) on a single node. If this value is exceeded, the transaction will throw an exception and will be rolled back. This number can be change [...] - -=== Other Limitations -The following features are not supported for the MVCC-enabled caches. These limitations may be addressed in future releases. - -* link:configuring-caches/near-cache[Near Caches] -* link:configuring-caches/expiry-policies[Expiry Policies] -* link:events/listening-to-events[Events] -* link:{javadoc_base_url}/org/apache/ignite/cache/CacheInterceptor.html[Cache Interceptors] -* link:persistence/external-storage[External Storage] -* link:configuring-caches/on-heap-caching[On-Heap Caching] -* link:{javadoc_base_url}/org/apache/ignite/IgniteCache.html#lock-K-[Explicit Locks] -* The link:{javadoc_base_url}/org/apache/ignite/IgniteCache.html#localEvict-java.util.Collection-[localEvict()] and link:{javadoc_base_url}/org/apache/ignite/IgniteCache.html#localPeek-K-org.apache.ignite.cache.CachePeekMode...-[localPeek()] methods 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 f8b5ff2a75d..f83dcdd6d95 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 @@ -35,13 +35,6 @@ public enum CacheAtomicityMode { /** * Enables fully {@code ACID}-compliant transactional cache behavior for the key-value API. * <p> - * <b>Note!</b> In this mode, transactional consistency is guaranteed for key-value API operations only. - * To enable ACID capabilities for SQL transactions, use the {@code TRANSACTIONAL_SNAPSHOT} mode. - * <p> - * <b>Note!</b> This atomicity mode is not compatible with the other modes within the same transaction. - * if a transaction is executed over multiple caches, all caches must have the same atomicity mode, - * either {@code TRANSACTIONAL_SNAPSHOT} or {@code TRANSACTIONAL}. - * <p> * See {@link Transaction} for more information about transactions. */ TRANSACTIONAL, @@ -96,35 +89,7 @@ public enum CacheAtomicityMode { * * @see IgniteCache#withNoRetries() */ - ATOMIC, - - /** - * <b>This is an experimental feature. Transactional SQL is currently in a beta status.</b> - * <p> - * Specifies fully {@code ACID}-compliant transactional cache behavior for both key-value API and SQL transactions. - * <p> - * This atomicity mode enables multiversion concurrency control (MVCC) for the cache. In MVCC-enabled caches, - * when a transaction updates a row, it creates a new version of that row instead of overwriting it. - * Other users continue to see the old version of the row until the transaction is committed. - * In this way, readers and writers do not conflict with each other and always work with a consistent dataset. - * The old version of data is cleaned up when it's no longer accessed by anyone. - * <p> - * With this mode enabled, one node is elected as an MVCC coordinator. This node tracks all in-flight transactions - * and queries executed in the cluster. Each transaction or query executed over the cache with - * {@code TRANSACTIONAL_SNAPSHOT} mode works with a current snapshot of data generated for this transaction or query - * by the coordinator. This snapshot ensures that the transaction works with a consistent database state - * during its execution period. - * <p> - * <b>Note!</b> This atomicity mode is not compatible with the other modes within the same transaction. - * If a transaction is executed over multiple caches, all caches must have the same atomicity mode, - * either {@code TRANSACTIONAL_SNAPSHOT} or {@code TRANSACTIONAL}. - * <p> - * See {@link Transaction} for more information about transactions. - * - * @deprecated Use {@link #TRANSACTIONAL} or {@link #ATOMIC} instead. Please, be aware this API will be removed in the next releases. - */ - @Deprecated - TRANSACTIONAL_SNAPSHOT; + ATOMIC; /** Enumerated values. */ private static final CacheAtomicityMode[] VALS = values(); @@ -138,14 +103,4 @@ public enum CacheAtomicityMode { @Nullable public static CacheAtomicityMode fromOrdinal(int ord) { return ord >= 0 && ord < VALS.length ? VALS[ord] : null; } - - /** - * TRANSACTIONAL_SNAPSHOT free values. - * To be removed on <a href="https://issues.apache.org/jira/browse/IGNITE-13871">MVCC removal</a> finish. - * - * @return Values. - */ - public static CacheAtomicityMode[] _values() { - return new CacheAtomicityMode[] {TRANSACTIONAL, ATOMIC}; - } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java index 2dd1885b41a..ca76782b125 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java @@ -79,6 +79,7 @@ import org.apache.ignite.lang.IgniteInClosure; import org.apache.ignite.lang.IgniteUuid; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.jetbrains.annotations.Nullable; + import static org.apache.ignite.cache.CacheRebalanceMode.NONE; import static org.apache.ignite.events.EventType.EVT_NODE_FAILED; import static org.apache.ignite.events.EventType.EVT_NODE_JOINED; @@ -875,9 +876,6 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap IgniteInternalFuture<?> res = cachesRegistry.update(exchActions); - for (ExchangeActions.CacheActionData d: exchActions.cacheStartRequests()) - cctx.coordinators().validateCacheConfiguration(d.descriptor().cacheConfiguration()); - // Affinity did not change for existing caches. onCustomMessageNoAffinityChange(fut, exchActions); @@ -1365,9 +1363,6 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap ) throws IgniteCheckedException { IgniteInternalFuture<?> res = cachesRegistry.addUnregistered(descs); - for (DynamicCacheDescriptor d: descs) - cctx.coordinators().validateCacheConfiguration(d.cacheConfiguration()); - if (fut.context().mergeExchanges()) return res; 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 99bed931a28..6132385e8e7 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 @@ -75,7 +75,6 @@ import org.apache.ignite.plugin.CacheTopologyValidatorProvider; import org.jetbrains.annotations.Nullable; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheRebalanceMode.NONE; import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_PART_MISSED; @@ -265,7 +264,7 @@ public class CacheGroupContext { storeCacheId = affNode && dataRegion.config().getPageEvictionMode() != DataPageEvictionMode.DISABLED; - mvccEnabled = ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT; + mvccEnabled = false; log = ctx.kernalContext().log(getClass()); 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 3109bc5c21c..086443b7732 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 @@ -86,7 +86,7 @@ import org.apache.ignite.spi.discovery.DiscoveryDataBag; import org.apache.ignite.spi.systemview.view.CacheGroupView; import org.apache.ignite.spi.systemview.view.CacheView; import org.jetbrains.annotations.Nullable; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; + import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.events.EventType.EVT_NODE_JOINED; import static org.apache.ignite.internal.GridComponent.DiscoveryDataExchangeType.CACHE_PROC; @@ -2551,9 +2551,9 @@ public class ClusterCachesInfo { CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "cacheMode", "Cache mode", cfg.getCacheMode(), startCfg.getCacheMode(), true); - if (cfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT || startCfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) - CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "atomicityMode", "Atomicity mode", - attr1.atomicityMode(), attr2.atomicityMode(), true); +// https://issues.apache.org/jira/browse/IGNITE-12622 +// 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); 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 6136c24ce72..3462e0b3bbe 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 @@ -119,7 +119,6 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_DISABLE_TRIGGERING 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; @@ -851,14 +850,7 @@ public class GridCacheContext<K, V> implements Externalizable { public boolean transactional() { CacheConfiguration cfg = config(); - return cfg.getAtomicityMode() == TRANSACTIONAL || cfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT; - } - - /** - * @return {@code True} if transactional snapshot. - */ - public boolean transactionalSnapshot() { - return config().getAtomicityMode() == TRANSACTIONAL_SNAPSHOT; + return cfg.getAtomicityMode() == TRANSACTIONAL; } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index cf7815a465b..cb2de2968e2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -1259,9 +1259,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme counters.accumulateSizeDelta(cctx.cacheId(), partition(), -1); } - if (cctx.group().logDataRecords()) - logPtr = logMvccUpdate(tx, null, 0, 0L, mvccVer); - update(null, 0, 0, newVer, true); recordNodeId(affNodeId, topVer); @@ -3897,7 +3894,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme long expireTime, long updCntr ) throws IgniteCheckedException { - assert cctx.transactional() && !cctx.transactionalSnapshot(); + assert cctx.transactional(); if (tx.local()) { // For remote tx we log all updates in batch: GridDistributedTxRemoteAdapter.commitIfLocked() GridCacheOperation op; @@ -3922,43 +3919,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme return null; } - /** - * @param tx Transaction. - * @param val Value. - * @param expireTime Expire time (or 0 if not applicable). * - * @param updCntr Update counter. - * @param mvccVer Mvcc version. - * @throws IgniteCheckedException In case of log failure. - */ - protected WALPointer logMvccUpdate(IgniteInternalTx tx, CacheObject val, long expireTime, long updCntr, - MvccSnapshot mvccVer) - throws IgniteCheckedException { - assert mvccVer != null; - assert cctx.transactionalSnapshot(); - - if (tx.local()) { // For remote tx we log all updates in batch: GridDistributedTxRemoteAdapter.commitIfLocked() - GridCacheOperation op; - if (val == null) - op = DELETE; - else - op = this.val == null ? GridCacheOperation.CREATE : UPDATE; - - return cctx.group().wal().log(new MvccDataRecord(new MvccDataEntry( - cctx.cacheId(), - key, - val, - op, - tx.nearXidVersion(), - tx.writeVersion(), - expireTime, - key.partition(), - updCntr, - mvccVer))); - } - else - return null; - } - /** * Removes value from offheap. * @@ -4844,9 +4804,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme counters.accumulateSizeDelta(cctx.cacheId(), entry.partition(), -1); } - if (cctx.group().logDataRecords()) - entry.logMvccUpdate(tx, null, 0, 0, mvccVer); - entry.update(null, 0, 0, newVer, true); entry.recordNodeId(affNodeId, topVer); 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 a147215f440..e223f45e6ec 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 @@ -208,7 +208,6 @@ 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_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; @@ -655,8 +654,6 @@ public class GridCacheProcessor extends GridProcessorAdapter { */ void initialize(CacheConfiguration cfg, CacheObjectContext cacheObjCtx) throws IgniteCheckedException { CU.initializeConfigDefaults(log, cfg, cacheObjCtx); - - ctx.coordinators().preProcessCacheConfiguration(cfg); } /** @@ -1247,9 +1244,6 @@ public class GridCacheProcessor extends GridProcessorAdapter { pluginMgr.validate(); - if (!recoveryMode && cfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT && grp.affinityNode()) - sharedCtx.coordinators().ensureStarted(); - sharedCtx.jta().registerCache(cfg); // Skip suggestions for internal caches. @@ -1336,8 +1330,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { case REPLICATED: { if (nearEnabled) { switch (cfg.getAtomicityMode()) { - case TRANSACTIONAL: - case TRANSACTIONAL_SNAPSHOT: { + case TRANSACTIONAL: { cache = new GridNearTransactionalCache(cacheCtx); break; @@ -1355,8 +1348,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { } else { switch (cfg.getAtomicityMode()) { - case TRANSACTIONAL: - case TRANSACTIONAL_SNAPSHOT: { + case TRANSACTIONAL: { cache = cacheCtx.affinityNode() ? new GridDhtColocatedCache(cacheCtx) : new GridDhtColocatedCache(cacheCtx, new GridNoStorageCacheMap()); @@ -1449,8 +1441,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { GridDhtCacheAdapter dht = null; switch (cfg.getAtomicityMode()) { - case TRANSACTIONAL: - case TRANSACTIONAL_SNAPSHOT: { + case TRANSACTIONAL: { assert cache instanceof GridNearTransactionalCache; GridNearTransactionalCache near = (GridNearTransactionalCache)cache; @@ -1684,9 +1675,6 @@ public class GridCacheProcessor extends GridProcessorAdapter { IgniteInternalFuture<?> res = sharedCtx.affinity().initCachesOnLocalJoin( locJoinCtx.cacheGroupDescriptors(), locJoinCtx.cacheDescriptors()); - for (DynamicCacheDescriptor d: locJoinCtx.cacheDescriptors().values()) - ctx.coordinators().validateCacheConfiguration(d.cacheConfiguration()); - List<StartCacheInfo> startCacheInfos = locJoinCtx.caches().stream() .map(cacheInfo -> new StartCacheInfo(cacheInfo.get1(), cacheInfo.get2(), exchTopVer, false)) .collect(toList()); @@ -2087,9 +2075,6 @@ public class GridCacheProcessor extends GridProcessorAdapter { dht.context().finishRecovery(cacheStartVer, updatedDescriptor); } - if (cacheContext.config().getAtomicityMode() == TRANSACTIONAL_SNAPSHOT && groupContext.affinityNode()) - sharedCtx.coordinators().ensureStarted(); - onKernalStart(cacheContext.cache()); if (log.isInfoEnabled()) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java index 846d7128a99..6593a31c5c7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java @@ -69,7 +69,6 @@ import org.apache.ignite.marshaller.MarshallerUtils; import org.jetbrains.annotations.Nullable; import static java.nio.file.Files.newDirectoryStream; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.internal.processors.cache.GridCacheUtils.UTILITY_CACHE_NAME; import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.CACHE_DATA_FILENAME; import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.CACHE_DIR_PREFIX; @@ -802,17 +801,7 @@ public class GridLocalConfigManager { 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() + "]"); - } - boolean staticCfgVal = cfg.isEncryptionEnabled(); - boolean storedVal = cfgFromStore.isEncryptionEnabled(); if (storedVal != staticCfgVal) { diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java index 841a4b77e14..eb49d0da34d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java @@ -27,9 +27,6 @@ import java.util.function.BiFunction; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.cache.configuration.FactoryBuilder; -import javax.cache.expiry.EternalExpiryPolicy; -import javax.cache.expiry.ExpiryPolicy; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.cache.CacheRebalanceMode; @@ -38,7 +35,6 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; import org.apache.ignite.cache.store.CacheStore; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.DataPageEvictionMode; import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.DeploymentMode; @@ -51,7 +47,6 @@ import org.apache.ignite.internal.IgniteFeatures; import org.apache.ignite.internal.IgniteNodeAttributes; import org.apache.ignite.internal.binary.BinaryMarshaller; import org.apache.ignite.internal.cluster.DetachedClusterNode; -import org.apache.ignite.internal.processors.cache.persistence.DataRegion; import org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor; import org.apache.ignite.internal.processors.query.QuerySchemaPatch; import org.apache.ignite.internal.processors.query.QueryUtils; @@ -67,16 +62,12 @@ import org.apache.ignite.plugin.security.SecurityException; import org.apache.ignite.spi.IgniteNodeValidationResult; import org.apache.ignite.spi.discovery.DiscoveryDataBag; import org.apache.ignite.spi.encryption.EncryptionSpi; -import org.apache.ignite.spi.indexing.IndexingSpi; -import org.apache.ignite.spi.indexing.noop.NoopIndexingSpi; import org.jetbrains.annotations.Nullable; import static org.apache.ignite.IgniteSystemProperties.IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; -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.CacheRebalanceMode.NONE; import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC; import static org.apache.ignite.configuration.DeploymentMode.ISOLATED; @@ -310,54 +301,6 @@ public class ValidationOnNodeJoinUtils { CacheConfiguration.MAX_PARTITIONS_COUNT + " partitions [actual=" + cc.getAffinity().partitions() + ", affFunction=" + cc.getAffinity() + ", cacheName=" + cc.getName() + ']'); - if (cc.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) { - apply(assertParam, cc.getNearConfiguration() == null, - "near cache cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode"); - - apply(assertParam, !cc.isReadThrough(), - "readThrough cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode"); - - apply(assertParam, !cc.isWriteThrough(), - "writeThrough cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode"); - - apply(assertParam, !cc.isWriteBehindEnabled(), - "writeBehindEnabled cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode"); - - apply(assertParam, cc.getRebalanceMode() != NONE, - "Rebalance mode NONE cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode"); - - ExpiryPolicy expPlc = null; - - if (cc.getExpiryPolicyFactory() instanceof FactoryBuilder.SingletonFactory) - expPlc = (ExpiryPolicy)cc.getExpiryPolicyFactory().create(); - - if (!(expPlc instanceof EternalExpiryPolicy)) { - apply(assertParam, cc.getExpiryPolicyFactory() == null, - "expiry policy cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode"); - } - - apply(assertParam, cc.getInterceptor() == null, - "interceptor cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode"); - - // Disable in-memory evictions for mvcc cache. TODO IGNITE-10738 - String memPlcName = cc.getDataRegionName(); - DataRegion dataRegion = ctx.cache().context().database().dataRegion(memPlcName); - - if (dataRegion != null && !dataRegion.config().isPersistenceEnabled() && - dataRegion.config().getPageEvictionMode() != DataPageEvictionMode.DISABLED) { - throw new IgniteCheckedException("Data pages evictions cannot be used with TRANSACTIONAL_SNAPSHOT " + - "cache atomicity mode for in-memory regions. Please, either disable evictions or enable " + - "persistence for data regions with TRANSACTIONAL_SNAPSHOT caches. [cacheName=" + cc.getName() + - ", dataRegionName=" + memPlcName + ", pageEvictionMode=" + - dataRegion.config().getPageEvictionMode() + ']'); - } - - IndexingSpi idxSpi = ctx.config().getIndexingSpi(); - - apply(assertParam, idxSpi == null || idxSpi instanceof NoopIndexingSpi, - "Custom IndexingSpi cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode"); - } - // This method can be called when memory recovery is in progress, // which means that the GridDiscovery manager is not started, and therefore localNode is also not initialized. ClusterNode locNode = ctx.discovery().localNode() != null ? ctx.discovery().localNode() : @@ -403,8 +346,6 @@ public class ValidationOnNodeJoinUtils { } } - ctx.coordinators().validateCacheConfiguration(cc); - if (cc.getAtomicityMode() == ATOMIC) apply(assertParam, cc.getTransactionManagerLookupClassName() == null, "transaction manager can not be used with ATOMIC cache"); 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 010d86b7adb..bfb50e66f54 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 @@ -18,9 +18,7 @@ package org.apache.ignite.internal.processors.cache.mvcc; import java.util.Optional; -import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteLogger; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.events.DiscoveryEvent; import org.apache.ignite.internal.IgniteDiagnosticPrepareContext; import org.apache.ignite.internal.IgniteInternalFuture; @@ -194,28 +192,6 @@ public interface MvccProcessor extends GridProcessor { */ void ackTxRollback(MvccVersion updateVer); - /** - * 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; - /** * Cache stop callback. * @param cctx Cache context. 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 7c6e9deadf5..644d03b755a 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 @@ -35,10 +35,8 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteLogger; 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; @@ -58,7 +56,6 @@ import org.apache.ignite.internal.managers.eventstorage.DiscoveryEventListener; import org.apache.ignite.internal.processors.GridProcessorAdapter; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch; -import org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.GridCacheEntryEx; import org.apache.ignite.internal.processors.cache.KeyCacheObject; @@ -109,7 +106,6 @@ 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_NODE_FAILED; import static org.apache.ignite.events.EventType.EVT_NODE_JOINED; import static org.apache.ignite.events.EventType.EVT_NODE_LEFT; @@ -210,7 +206,7 @@ public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProce /** */ private final GridFutureAdapter<Void> initFut = new GridFutureAdapter<>(); - /** Flag whether at least one cache with {@code CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT} mode is registered. */ + /** Flag whether at least one mvcc cache is registered. */ private volatile boolean mvccEnabled; /** Flag whether all nodes in cluster support MVCC. */ @@ -252,7 +248,7 @@ public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProce customLsnr = new CustomEventListener<DynamicCacheChangeBatch>() { @Override public void onCustomEvent(AffinityTopologyVersion topVer, ClusterNode snd, DynamicCacheChangeBatch msg) { - checkMvccCacheStarted(msg); + // No-op. } }; } @@ -266,28 +262,6 @@ public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProce ctx.discovery().setCustomEventListener(DynamicCacheChangeBatch.class, customLsnr); } - /** {@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) { - if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) { - if (!mvccSupported) - throw new IgniteException("Cannot start MVCC transactional cache. " + - "MVCC is unsupported by the cluster."); - - mvccEnabled = true; - } - } - /** {@inheritDoc} */ @Nullable @Override public IgniteNodeValidationResult validateNode(ClusterNode node) { if (mvccEnabled && node.version().compareToIgnoreTimestamp(MVCC_SUPPORTED_SINCE) < 0) { @@ -300,23 +274,6 @@ public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProce return null; } - /** {@inheritDoc} */ - @Override public void ensureStarted() throws IgniteCheckedException { - if (!ctx.clientNode()) { - assert mvccEnabled && mvccSupported; - - synchronized (mux) { - if (txLog == null) - txLog = new TxLog(ctx, ctx.cache().context().database()); - } - - startVacuumWorkers(); - - if (log.isInfoEnabled()) - log.info("Mvcc processor started."); - } - } - /** {@inheritDoc} */ @Override public void onCacheStop(final GridCacheContext cctx) { // No-op. @@ -365,15 +322,7 @@ public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProce /** {@inheritDoc} */ @Override public void afterBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr, GridCacheDatabaseSharedManager.RestoreBinaryState restoreState) throws IgniteCheckedException { - - boolean hasMvccCaches = ctx.cache().persistentCaches().stream() - .anyMatch(c -> c.cacheConfiguration().getAtomicityMode() == TRANSACTIONAL_SNAPSHOT); - - if (hasMvccCaches) { - txLog = new TxLog(ctx, mgr); - - mvccEnabled = true; - } + // No-op. } /** @@ -1028,24 +977,6 @@ public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProce return node.version().compareToIgnoreTimestamp(MVCC_SUPPORTED_SINCE) >= 0; } - /** */ - private void checkMvccCacheStarted(DynamicCacheChangeBatch cacheMsg) { - if (!mvccEnabled) { - for (DynamicCacheChangeRequest req : cacheMsg.requests()) { - CacheConfiguration ccfg = req.startCacheConfiguration(); - - if (ccfg == null) - continue; - - if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) { - assert mvccSupported; - - mvccEnabled = true; - } - } - } - } - /** */ private MvccSnapshotResponse assignTxSnapshot(long futId, UUID nearId, boolean client) { assert initFut.isDone() && curCrd.local(); 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 c9e75da2654..4efa99ba45e 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,8 +18,6 @@ package org.apache.ignite.internal.processors.cache.mvcc; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteException; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.TransactionConfiguration; import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException; @@ -780,19 +778,6 @@ public class MvccUtils { return snapshot; } - /** - * Throws atomicity modes compatibility validation exception. - * - * @param ccfg1 Config 1. - * @param ccfg2 Config 2. - */ - public static void throwAtomicityModesMismatchException(CacheConfiguration ccfg1, CacheConfiguration ccfg2) { - throw new IgniteException("Caches with transactional_snapshot atomicity mode cannot participate in the same" + - " transaction with caches having another atomicity mode. [cacheName=" + ccfg1.getName() + - ", cacheMode=" + ccfg1.getAtomicityMode() + ", anotherCacheName=" + ccfg2.getName() + - " anotherCacheMode=" + ccfg2.getAtomicityMode() + ']'); - } - /** */ private static MvccVersion mvccVersion(long crd, long cntr, int opCntr) { return new MvccVersionImpl(crd, cntr, opCntr); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java index d6f8246daae..6cd08378b24 100755 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java @@ -173,7 +173,6 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_PDS_WAL_REBALANCE_ import static org.apache.ignite.IgniteSystemProperties.IGNITE_PREFER_WAL_REBALANCE; import static org.apache.ignite.IgniteSystemProperties.getBoolean; import static org.apache.ignite.IgniteSystemProperties.getInteger; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.internal.cluster.DistributedConfigurationUtils.makeUpdateListener; import static org.apache.ignite.internal.cluster.DistributedConfigurationUtils.setDefaultValue; import static org.apache.ignite.internal.pagemem.PageIdUtils.partId; @@ -699,11 +698,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan if (dataRegionMap.isEmpty()) return; - boolean hasMvccCache = false; - for (CacheGroupDescriptor grpDesc : cctx.cache().cacheGroupDescriptors().values()) { - hasMvccCache |= grpDesc.config().getAtomicityMode() == TRANSACTIONAL_SNAPSHOT; - String regionName = grpDesc.config().getDataRegionName(); DataRegion region = regionName != null ? dataRegionMap.get(regionName) : dfltDataRegion; @@ -729,20 +724,17 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan cctx.kernalContext().encryption().onCacheGroupStop(grpDesc.groupId()); } - if (!hasMvccCache && dataRegionMap.containsKey(TxLog.TX_LOG_CACHE_NAME)) { + if (dataRegionMap.containsKey(TxLog.TX_LOG_CACHE_NAME)) { PageMemory memory = dataRegionMap.get(TxLog.TX_LOG_CACHE_NAME).pageMemory(); if (memory instanceof PageMemoryEx) ((PageMemoryEx)memory).invalidate(TxLog.TX_LOG_CACHE_ID, PageIdAllocator.INDEX_PARTITION); } - final boolean hasMvccCache0 = hasMvccCache; - storeMgr.cleanupPageStoreIfMatch( new Predicate<Integer>() { @Override public boolean test(Integer grpId) { - return MetaStorage.METASTORAGE_CACHE_ID != grpId && - (TxLog.TX_LOG_CACHE_ID != grpId || !hasMvccCache0); + return MetaStorage.METASTORAGE_CACHE_ID != grpId; } }, true); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java index cb991c845bd..f9ec97b27d6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java @@ -835,7 +835,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac int cnt = 0; - for (CacheAtomicityMode atomicityMode : CacheAtomicityMode._values()) { + for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) { for (CacheWriteSynchronizationMode syncMode : CacheWriteSynchronizationMode.values()) { CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/AbstractDataTypesCoverageTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/AbstractDataTypesCoverageTest.java index 2a1ef49aeb7..742b01e9ef8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/AbstractDataTypesCoverageTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/AbstractDataTypesCoverageTest.java @@ -166,7 +166,7 @@ public abstract class AbstractDataTypesCoverageTest extends GridCommonAbstractTe Object[] paramLine = null; - for (CacheAtomicityMode atomicityMode : CacheAtomicityMode._values()) { + for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) { paramLine = Arrays.copyOf(baseParamLine, baseParamLine.length); paramLine[1] = atomicityMode; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOutOfMemoryPropagationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOutOfMemoryPropagationTest.java index bb7499c36b4..9d48b210783 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOutOfMemoryPropagationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOutOfMemoryPropagationTest.java @@ -83,7 +83,7 @@ public class IgniteOutOfMemoryPropagationTest extends GridCommonAbstractTest { /** */ private void testOOMPropagation(boolean useStreamer) throws Exception { - for (CacheAtomicityMode atomicityMode : CacheAtomicityMode._values()) { + for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) { for (CacheMode cacheMode : CacheMode.values()) { for (CacheWriteSynchronizationMode writeSyncMode : CacheWriteSynchronizationMode.values()) { for (int backupsCnt = 0; backupsCnt <= 1; backupsCnt++) { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMultiClientsStartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMultiClientsStartTest.java index 8839bfb2855..44a72b466d0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMultiClientsStartTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMultiClientsStartTest.java @@ -75,7 +75,7 @@ public class IgniteCacheMultiClientsStartTest extends GridCommonAbstractTest { CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setCacheMode(PARTITIONED); - ccfg.setAtomicityMode(CacheAtomicityMode._values()[i % CacheAtomicityMode._values().length]); + ccfg.setAtomicityMode(CacheAtomicityMode.values()[i % CacheAtomicityMode.values().length]); ccfg.setWriteSynchronizationMode(PRIMARY_SYNC); ccfg.setBackups(1); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxIteratorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxIteratorSelfTest.java index 576ccf35d00..0cb5f1c374f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxIteratorSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheTxIteratorSelfTest.java @@ -105,7 +105,7 @@ public class IgniteCacheTxIteratorSelfTest extends GridCommonAbstractTest { try { for (CacheMode mode : CacheMode.values()) { - for (CacheAtomicityMode atomMode : CacheAtomicityMode._values()) { + for (CacheAtomicityMode atomMode : CacheAtomicityMode.values()) { if (mode == CacheMode.PARTITIONED) { // Near cache makes sense only for partitioned cache. checkTxCache(CacheMode.PARTITIONED, atomMode, true, false); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transform/CacheObjectTransformationEvolutionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transform/CacheObjectTransformationEvolutionTest.java index 1e976c6dc1e..83bba815fca 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transform/CacheObjectTransformationEvolutionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transform/CacheObjectTransformationEvolutionTest.java @@ -47,7 +47,7 @@ public class CacheObjectTransformationEvolutionTest extends AbstractCacheObjectT public static Collection<?> parameters() { List<Object[]> res = new ArrayList<>(); - for (CacheAtomicityMode mode : CacheAtomicityMode._values()) + for (CacheAtomicityMode mode : CacheAtomicityMode.values()) res.add(new Object[] {mode}); return res; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transform/CacheObjectTransformationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transform/CacheObjectTransformationTest.java index 2d3516598e4..b912e9f1f9b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transform/CacheObjectTransformationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transform/CacheObjectTransformationTest.java @@ -45,7 +45,7 @@ public class CacheObjectTransformationTest extends AbstractCacheObjectTransforma public static Collection<?> parameters() { List<Object[]> res = new ArrayList<>(); - for (CacheAtomicityMode mode : CacheAtomicityMode._values()) + for (CacheAtomicityMode mode : CacheAtomicityMode.values()) res.add(new Object[] {mode}); return res; 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 bbb088cc091..e9ddd2e0434 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 @@ -1119,8 +1119,7 @@ public class IgniteH2Indexing implements GridQueryIndexing { try (TraceSurroundings ignored = MTC.support(ctx.tracing().create(SQL_DML_QRY_EXECUTE, MTC.span()))) { if (!updateInTxAllowed && ctx.cache().context().tm().inUserTx()) { throw new IgniteSQLException("DML statements are not allowed inside a transaction over " + - "cache(s) with TRANSACTIONAL atomicity mode (change atomicity mode to " + - "TRANSACTIONAL_SNAPSHOT or disable this error message with system property " + + "cache(s) with TRANSACTIONAL atomicity mode (disable this error message with system property " + "\"-DIGNITE_ALLOW_DML_INSIDE_TRANSACTION=true\")"); } diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java index e53ea65b477..e99dea72298 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java @@ -22,18 +22,14 @@ import java.sql.SQLException; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.function.Predicate; import java.util.regex.Pattern; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.failure.FailureContext; import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.GridCacheContextInfo; -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.jdbc.JdbcParameterMeta; @@ -48,14 +44,12 @@ import org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder; import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table; import org.apache.ignite.internal.processors.query.h2.opt.QueryContext; import org.apache.ignite.internal.processors.query.h2.sql.GridSqlAlias; -import org.apache.ignite.internal.processors.query.h2.sql.GridSqlAst; import org.apache.ignite.internal.processors.query.h2.sql.GridSqlInsert; import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuery; import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser; import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter; import org.apache.ignite.internal.processors.query.h2.sql.GridSqlSelect; 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.tracing.MTC; import org.apache.ignite.internal.processors.tracing.MTC.TraceSurroundings; import org.apache.ignite.internal.sql.SqlParseException; @@ -68,6 +62,7 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.h2.api.ErrorCode; import org.h2.command.Prepared; import org.jetbrains.annotations.Nullable; + import static org.apache.ignite.failure.FailureType.CRITICAL_ERROR; import static org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter.keyColumn; import static org.apache.ignite.internal.processors.tracing.SpanTags.SQL_PARSER_CACHE_HIT; @@ -461,7 +456,7 @@ public class QueryParser { GridSqlQuery selectStmt = (GridSqlQuery)parser.parse(prepared); List<Integer> cacheIds = parser.cacheIds(); - Integer mvccCacheId = mvccCacheIdForSelect(parser.objectsMap()); + Integer mvccCacheId = null; // Calculate if query is in fact can be executed locally. boolean loc = qry.isLocal(); @@ -619,48 +614,6 @@ public class QueryParser { IgniteQueryErrorCode.UNSUPPORTED_OPERATION); } - /** - * Get ID of the first MVCC cache for SELECT. - * - * @param objMap Object map. - * @return ID of the first MVCC cache or {@code null} if no MVCC caches involved. - */ - private Integer mvccCacheIdForSelect(Map<Object, Object> objMap) { - Boolean mvccEnabled = null; - Integer mvccCacheId = null; - GridCacheContextInfo cctx = null; - - for (Object o : objMap.values()) { - if (o instanceof GridSqlAlias) - o = GridSqlAlias.unwrap((GridSqlAst)o); - if (o instanceof GridSqlTable && ((GridSqlTable)o).dataTable() != null) { - GridSqlTable tbl = (GridSqlTable)o; - - if (tbl.dataTable() != null) { - GridCacheContextInfo curCctx = tbl.dataTable().cacheInfo(); - - assert curCctx != null; - - boolean curMvccEnabled = - curCctx.config().getAtomicityMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - - if (mvccEnabled == null) { - mvccEnabled = curMvccEnabled; - - if (mvccEnabled) - mvccCacheId = curCctx.cacheId(); - - cctx = curCctx; - } - else if (mvccEnabled != curMvccEnabled) - MvccUtils.throwAtomicityModesMismatchException(cctx.config(), curCctx.config()); - } - } - } - - return mvccCacheId; - } - /** * Prepare DML statement. * @@ -685,23 +638,6 @@ public class QueryParser { for (GridH2Table h2tbl : tbls) H2Utils.checkAndStartNotStartedCache(idx.kernalContext(), h2tbl.cacheInfo()); - // Check MVCC mode. - GridCacheContextInfo ctx = null; - boolean mvccEnabled = false; - - for (GridH2Table h2tbl : tbls) { - GridCacheContextInfo curCtx = h2tbl.cacheInfo(); - boolean curMvccEnabled = curCtx.config().getAtomicityMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - - if (ctx == null) { - ctx = curCtx; - - mvccEnabled = curMvccEnabled; - } - else if (curMvccEnabled != mvccEnabled) - MvccUtils.throwAtomicityModesMismatchException(ctx.config(), curCtx.config()); - } - // Get streamer info. GridH2Table streamTbl = null; @@ -718,7 +654,7 @@ public class QueryParser { plan = UpdatePlanBuilder.planForStatement( planKey, stmt, - mvccEnabled, + false, idx, log, forceFillAbsentPKsWithDefaults @@ -733,7 +669,7 @@ public class QueryParser { return new QueryParserResultDml( stmt, - mvccEnabled, + false, streamTbl, plan ); 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 99765a5395f..6df5a2949c4 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 @@ -1569,7 +1569,7 @@ public class GridSqlQueryParser { res.atomicityMode(CacheAtomicityMode.valueOf(val.toUpperCase())); } catch (IllegalArgumentException e) { - String validVals = Arrays.stream(CacheAtomicityMode._values()) + String validVals = Arrays.stream(CacheAtomicityMode.values()) .map(Enum::name) .collect(Collectors.joining(", ")); diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicEnableIndexingBasicSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicEnableIndexingBasicSelfTest.java index 13f7b8b3c9e..d863759e1d6 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicEnableIndexingBasicSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicEnableIndexingBasicSelfTest.java @@ -48,7 +48,7 @@ public class DynamicEnableIndexingBasicSelfTest extends DynamicEnableIndexingAbs CacheMode[] cacheModes = new CacheMode[] {CacheMode.PARTITIONED, CacheMode.REPLICATED}; - CacheAtomicityMode[] atomicityModes = CacheAtomicityMode._values(); + CacheAtomicityMode[] atomicityModes = CacheAtomicityMode.values(); List<Object[]> res = new ArrayList<>(); diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicEnableIndexingConcurrentSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicEnableIndexingConcurrentSelfTest.java index 4fef8834e8e..0078f404a0c 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicEnableIndexingConcurrentSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicEnableIndexingConcurrentSelfTest.java @@ -78,7 +78,7 @@ public class DynamicEnableIndexingConcurrentSelfTest extends DynamicEnableIndexi public static Iterable<Object[]> params() { CacheMode[] cacheModes = new CacheMode[] {CacheMode.PARTITIONED, CacheMode.REPLICATED}; - CacheAtomicityMode[] atomicityModes = CacheAtomicityMode._values(); + CacheAtomicityMode[] atomicityModes = CacheAtomicityMode.values(); List<Object[]> res = new ArrayList<>(); for (CacheMode cacheMode : cacheModes) { diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/LazyOnDmlTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/LazyOnDmlTest.java index a648c312f53..0690cb3c0d0 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/LazyOnDmlTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/LazyOnDmlTest.java @@ -75,7 +75,7 @@ public class LazyOnDmlTest extends AbstractIndexingCommonTest { Object[] paramTemplate = new Object[2]; - for (CacheAtomicityMode atomicityMode : CacheAtomicityMode._values()) { + for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) { paramTemplate = Arrays.copyOf(paramTemplate, paramTemplate.length); paramTemplate[0] = atomicityMode; diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/WrongQueryEntityFieldTypeTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/WrongQueryEntityFieldTypeTest.java index 4b2192b4bd1..cb0c32cddac 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/WrongQueryEntityFieldTypeTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/WrongQueryEntityFieldTypeTest.java @@ -87,7 +87,7 @@ public class WrongQueryEntityFieldTypeTest extends GridCommonAbstractTest { Collection<Object[]> params = new ArrayList<>(); - for (CacheAtomicityMode cacheMode : CacheAtomicityMode._values()) { + for (CacheAtomicityMode cacheMode : CacheAtomicityMode.values()) { for (int backups = 0; backups < 4; backups++) { for (int gridCnt = 1; gridCnt < 4; gridCnt++) { params.add(new Object[] {cacheMode, backups, person, "field", String.class, gridCnt}); diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicityMode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicityMode.cs index b60feb75ec5..16ee7c6bf83 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicityMode.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheAtomicityMode.cs @@ -27,13 +27,6 @@ namespace Apache.Ignite.Core.Cache.Configuration { /// <summary> /// Specifies fully ACID-compliant transactional cache behavior. - /// <para /> - /// <b>Note!</b> In this mode, transactional consistency is guaranteed for key-value API operations only. - /// To enable ACID capabilities for SQL transactions, use TRANSACTIONAL_SNAPSHOT mode. - /// <para /> - /// <b>Note!</b> This atomicity mode is not compatible with the other atomicity modes within the same transaction. - /// If a transaction is executed over multiple caches, all caches must have the same atomicity mode, - /// either TRANSACTIONAL_SNAPSHOT or TRANSACTIONAL. /// </summary> Transactional, @@ -57,30 +50,6 @@ namespace Apache.Ignite.Core.Cache.Configuration /// Also note that all data modifications in <see cref="Atomic"/> mode are guaranteed to be atomic /// and consistent with writes to the underlying persistent store, if one is configured. /// </summary> - Atomic, - - /// <summary> - /// This is an experimental feature. Transactional SQL is currently in a beta status. - /// <para/> - /// Specifies fully ACID-compliant transactional cache behavior for both key-value API and SQL transactions. - /// <para/> - /// This atomicity mode enables multiversion concurrency control (MVCC) for the cache. In MVCC-enabled caches, - /// when a transaction updates a row, it creates a new version of that row instead of overwriting it. - /// Other users continue to see the old version of the row until the transaction is committed. - /// In this way, readers and writers do not conflict with each other and always work with a consistent dataset. - /// The old version of data is cleaned up when it's no longer accessed by anyone. - /// <para /> - /// With this mode enabled, one node is elected as an MVCC coordinator. This node tracks all in-flight transactions - /// and queries executed in the cluster. Each transaction or query executed over the cache with - /// TRANSACTIONAL_SNAPSHOT mode works with a current snapshot of data generated for this transaction or query - /// by the coordinator. This snapshot ensures that the transaction works with a consistent database state - /// during its execution period. - /// <para /> - /// <b>Note!</b> This atomicity mode is not compatible with the other atomicity modes within the same transaction. - /// If a transaction is executed over multiple caches, all caches must have the same atomicity mode, - /// either TRANSACTIONAL_SNAPSHOT or TRANSACTIONAL. - /// </summary> - [IgniteExperimental] - TransactionalSnapshot + Atomic } } diff --git a/modules/yardstick/config/mvcc/benchmark-mvcc-messages.sh b/modules/yardstick/config/mvcc/benchmark-mvcc-messages.sh deleted file mode 100644 index 47f546d01eb..00000000000 --- a/modules/yardstick/config/mvcc/benchmark-mvcc-messages.sh +++ /dev/null @@ -1,97 +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. -# - -# -# Configuration to measure increased messages load with mvcc turned on. -# - -now0=`date +'%H%M%S'` - -# JVM options. -JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" - -# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses. -JVM_OPTS=${JVM_OPTS}" \ --Xms8g \ --Xmx8g \ --Xloggc:./gc${now0}.log \ --XX:+PrintGCDetails \ --verbose:gc \ --XX:+UseParNewGC \ --XX:+UseConcMarkSweepGC \ --XX:+PrintGCDateStamps \ -" - -#Ignite version -ver="RELEASE-" - -# List of default probes. -# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux). -BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe - -# Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick - -# Flag which indicates to restart the servers before every benchmark execution. -RESTART_SERVERS=true - -# Probe point writer class name. -# BENCHMARK_WRITER= - -# The benchmark is designed to run with 1 client node (driver itself) and many (4 for instance) server nodes. -SERVER_HOSTS=localhost,localhost,localhost,localhost -DRIVER_HOSTS=localhost - -# Remote username. -# REMOTE_USER= - -# Number of nodes, used to wait for the specified number of nodes to start. -nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`)) - -# Warmup. -w=30 - -# Duration. -d=300 - -# Threads count. -t=1 - -# Sync mode. -sm=FULL_SYNC - -# Parameters that should be the same across all the benchmarks launches. -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" - -# 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 --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, --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 --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 --atomic-mode TRANSACTIONAL, \ -${commonParams} -dn NativeSqlUpdateRangeBenchmark -ds ${ver}sql-update-batch-1000-backup-2-mvcc-on -b 2 --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT, \ -" diff --git a/modules/yardstick/config/mvcc/benchmark-mvcc-processor.sh b/modules/yardstick/config/mvcc/benchmark-mvcc-processor.sh deleted file mode 100644 index 25525a4f4ac..00000000000 --- a/modules/yardstick/config/mvcc/benchmark-mvcc-processor.sh +++ /dev/null @@ -1,94 +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. -# - -# -# Configuration to compare mvcc on/off. This benchmark creates load on mvcc processor. -# - -now0=`date +'%H%M%S'` - -# JVM options. -JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" - -# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses. -JVM_OPTS=${JVM_OPTS}" \ --Xms8g \ --Xmx8g \ --Xloggc:./gc${now0}.log \ --XX:+PrintGCDetails \ --verbose:gc \ --XX:+UseParNewGC \ --XX:+UseConcMarkSweepGC \ --XX:+PrintGCDateStamps \ -" - -#Ignite version -ver="RELEASE-" - -# List of default probes. -# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux). -BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe - -# Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick - -# Flag which indicates to restart the servers before every benchmark execution. -RESTART_SERVERS=true - -# Probe point writer class name. -# BENCHMARK_WRITER= - -# The benchmark is designed to run with 4 client nodes (drivers) and 1 server node. -SERVER_HOSTS=localhost -DRIVER_HOSTS=localhost,localhost,localhost,localhost - -# Remote username. -# REMOTE_USER= - -# Number of nodes, used to wait for the specified number of nodes to start. -nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`)) - -# Warmup. -w=30 - -# Duration. -d=300 - -# Threads count. -t=16 - -# Sync mode. -sm=FULL_SYNC - -# Parameters that should be the same across all the benchmarks launches. -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" - -# 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 --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 --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 --atomic-mode TRANSACTIONAL, \ -${commonParams} -dn MvccProcessorBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-on -b 0 --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT \ -" diff --git a/modules/yardstick/config/mvcc/benchmark-mvcc-updates-contention.sh b/modules/yardstick/config/mvcc/benchmark-mvcc-updates-contention.sh deleted file mode 100644 index 39f74247457..00000000000 --- a/modules/yardstick/config/mvcc/benchmark-mvcc-updates-contention.sh +++ /dev/null @@ -1,95 +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. -# - -# -# Configuration to measure performance of concurrent sql updates with contention. -# Update keys are shared among the threads/hosts. -# -now0=`date +'%H%M%S'` - -# JVM options. -JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" - -# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses. -JVM_OPTS=${JVM_OPTS}" \ --Xms8g \ --Xmx8g \ --Xloggc:./gc${now0}.log \ --XX:+PrintGCDetails \ --verbose:gc \ --XX:+UseParNewGC \ --XX:+UseConcMarkSweepGC \ --XX:+PrintGCDateStamps \ -" - -#Ignite version -ver="RELEASE-" - -# List of default probes. -# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux). -BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe - -# Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick - -# Flag which indicates to restart the servers before every benchmark execution. -RESTART_SERVERS=true - -# Probe point writer class name. -# BENCHMARK_WRITER= - -# The benchmark is designed to run with 4 client node (drivers) and several (2 for instance) server nodes -SERVER_HOSTS=localhost,localhost -DRIVER_HOSTS=localhost,localhost,localhost,localhost - -# Remote username. -# REMOTE_USER= - -# Number of nodes, used to wait for the specified number of nodes to start. -nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`)) - -# Warmup. -w=30 - -# Duration. -d=300 - -# Threads count. -t=16 - -# Sync mode. -sm=FULL_SYNC - -# Parameters that should be the same across all the benchmarks launches. -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 --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 --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 --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 --atomic-mode TRANSACTIONAL, \ -${commonParams} -dn MvccUpdateContentionBenchmark -ds ${ver}sql-update-batch-1000-backup-0-mvcc-on -b 0 --sqlRange 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT \ -" diff --git a/modules/yardstick/config/mvcc/benchmark-thin-native.properties b/modules/yardstick/config/mvcc/benchmark-thin-native.properties deleted file mode 100644 index 7281f21f3d0..00000000000 --- a/modules/yardstick/config/mvcc/benchmark-thin-native.properties +++ /dev/null @@ -1,123 +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. -# - -# -# Configuration to measure mvcc impact on jdbc operations. -# - -now0=`date +'%H%M%S'` - -# JVM options. -JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" - -# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses. -JVM_OPTS=${JVM_OPTS}" \ --Xms8g \ --Xmx8g \ --Xloggc:./gc${now0}.log \ --XX:+PrintGCDetails \ --verbose:gc \ --XX:+UseParNewGC \ --XX:+UseConcMarkSweepGC \ --XX:+PrintGCDateStamps \ -" - -#Ignite version -ver="RELEASE-" - -# List of default probes. -# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux). -BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe - -# Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick - -# Flag which indicates to restart the servers before every benchmark execution. -RESTART_SERVERS=true - -# Probe point writer class name. -# BENCHMARK_WRITER= - -# The benchmark is applicable only for 2 servers (the second server is started in client mode) and 1 driver. -SERVER_HOSTS=localhost,localhost -DRIVER_HOSTS=localhost - -# Remote username. -# REMOTE_USER= - -# Number of nodes, used to wait for the specified number of nodes to start. -nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`)) - -# Backups count. -b=1 - -# Warmup. -w=30 - -# Duration. -d=300 - -# Threads count. -t=4 - -# Sync mode. -sm=FULL_SYNC - -# Parameters that should be the same across all the benchmarks launches. -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" - -# 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 --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 --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 --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 --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 --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 --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 --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 --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 --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 --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 --atomic-mode TRANSACTIONAL, \ -${commonParams} -dn NativeJavaApiPutRemoveBenchmark -ds ${ver}sql-update-batch-1-native-sql-mvcc-on --atomic-mode TRANSACTIONAL_SNAPSHOT \ -" diff --git a/modules/yardstick/config/upload/benchmark-jdbc-thin-inmemory-mvcc.properties b/modules/yardstick/config/upload/benchmark-jdbc-thin-inmemory-mvcc.properties deleted file mode 100644 index dad8ed7e4da..00000000000 --- a/modules/yardstick/config/upload/benchmark-jdbc-thin-inmemory-mvcc.properties +++ /dev/null @@ -1,104 +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. -# - -# -# Benchmarks for data upload in inmemory mode (persistence disabled) with and without mvcc. -# - -now0=`date +'%H%M%S'` - -# JVM options. -JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" - -# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses. -JVM_OPTS=${JVM_OPTS}" \ --Xms8g \ --Xmx8g \ --Xloggc:./gc${now0}.log \ --XX:+PrintGCDetails \ --verbose:gc \ --XX:+UseParNewGC \ --XX:+UseConcMarkSweepGC \ --XX:+PrintGCDateStamps \ -" - -#Ignite version -ver="RELEASE-" - -# List of default probes. -# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux). -BENCHMARK_DEFAULT_PROBES=TotalTimeProbe - -# Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick - -# Flag which indicates to restart the servers before every benchmark execution. -RESTART_SERVERS=true - -# Probe point writer class name. -# BENCHMARK_WRITER= - -# The benchmark is applicable only for 2 servers (the second server is started in client mode) and 1 driver. -SERVER_HOSTS=localhost,localhost -DRIVER_HOSTS=localhost - -# Remote username. -# REMOTE_USER= - -# Number of nodes, used to wait for the specified number of nodes to start. -nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`)) - -# Backups count. -b=1 - -# Warmup. -w=0 - -# Threads count. -t=1 - -# Sync mode. -sm=FULL_SYNC - -# Parameters that should be the same across all the benchmarks launches. -commonParams="\ --cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} \ - --warmup ${w} --operations 1 \ - -jdbc jdbc:ignite:thin://auto.find/ \ - --threads ${t} --syncMode ${sm} -sn IgniteNode \ - --upload-rows 1000000 -cl \ - --clientNodesAfterId 0 \ -" - -# 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 --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 --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 --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 --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 --atomic-mode TRANSACTIONAL, \ -${commonParams} -dn BatchedInsertBenchmark -ds ${ver}upload-batched-insert-mvcc-on --upload-jdbc-batch-size 1000 --atomic-mode TRANSACTIONAL_SNAPSHOT \ -" 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 91128c043f2..fd50e86a3ab 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,7 +20,6 @@ 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; @@ -31,13 +30,6 @@ import static org.yardstickframework.BenchmarkUtils.println; * Designed to be ran in many threads on many hosts. */ public class MvccUpdateContentionBenchmark extends AbstractDistributedMvccBenchmark { - /** Expected expception message in mvcc on mode on update fail. */ - private static final String MVCC_EXC_MSG = "Cannot serialize transaction due to write conflict"; - - /** Expected exception message in mvcc off mode on update fail. */ - private static final String NO_MVCC_EXC_MSG_PREFIX = - "Failed to UPDATE some keys because they had been modified concurrently"; - /** Counter of failed updates. */ private final AtomicLong failsCnt = new AtomicLong(); @@ -53,10 +45,6 @@ public class MvccUpdateContentionBenchmark extends AbstractDistributedMvccBenchm execute(new SqlFieldsQuery(UPDATE_QRY).setArgs(start, end)); } catch (IgniteSQLException exc) { - if ((args.atomicMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT && !exc.getMessage().startsWith(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(); } catch (Exception e) {