diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcVersionMismatchSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcVersionMismatchSelfTest.java deleted file mode 100644 index 8f749e929e555..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcVersionMismatchSelfTest.java +++ /dev/null @@ -1,172 +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.jdbc; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; -import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; -import org.apache.ignite.internal.processors.odbc.SqlStateCode; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Test; - -/** - * JDBC version mismatch test. - */ -public class JdbcVersionMismatchSelfTest extends GridCommonAbstractTest { - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - startGrid(); - - try (Connection conn = connect()) { - executeUpdate(conn, - "CREATE TABLE test (a INT PRIMARY KEY, b INT, c VARCHAR) WITH \"atomicity=TRANSACTIONAL_SNAPSHOT, cache_name=TEST\""); - - executeUpdate(conn, "INSERT INTO test VALUES (1, 1, 'test_1')"); - } - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testVersionMismatchJdbc() throws Exception { - try (Connection conn1 = connect(); Connection conn2 = connect()) { - conn1.setAutoCommit(false); - conn2.setAutoCommit(false); - - // Start first transaction and observe some values. - assertEquals(1, executeQuery(conn1, "SELECT * FROM test").size()); - - // Change values while first transaction is still in progress. - executeUpdate(conn2, "INSERT INTO test VALUES (2, 2, 'test_2')"); - executeUpdate(conn2, "COMMIT"); - assertEquals(2, executeQuery(conn2, "SELECT * FROM test").size()); - - // Force version mismatch. - try { - executeUpdate(conn1, "INSERT INTO test VALUES (2, 2, 'test_2')"); - - fail(); - } - catch (SQLException e) { - assertEquals(SqlStateCode.SERIALIZATION_FAILURE, e.getSQLState()); - assertEquals(IgniteQueryErrorCode.TRANSACTION_SERIALIZATION_ERROR, e.getErrorCode()); - - assertNotNull(e.getMessage()); - assertTrue(e.getMessage().contains("Cannot serialize transaction due to write conflict")); - } - - // Subsequent call should cause exception due to TX being rolled back. - try { - executeQuery(conn1, "SELECT * FROM test").size(); - - fail(); - } - catch (SQLException e) { - assertEquals(SqlStateCode.TRANSACTION_STATE_EXCEPTION, e.getSQLState()); - assertEquals(IgniteQueryErrorCode.TRANSACTION_COMPLETED, e.getErrorCode()); - - assertNotNull(e.getMessage()); - assertTrue(e.getMessage().contains("Transaction is already completed")); - } - - // Commit should fail. - try { - conn1.commit(); - - fail(); - } - catch (SQLException e) { - // Cannot pass proper error codes for now - assertEquals(SqlStateCode.INTERNAL_ERROR, e.getSQLState()); - assertEquals(IgniteQueryErrorCode.UNKNOWN, e.getErrorCode()); - - assertNotNull(e.getMessage()); - assertTrue(e.getMessage().contains("Failed to finish transaction because it has been rolled back")); - } - - // Rollback should work. - conn1.rollback(); - - // Subsequent calls should work fine. - assertEquals(2, executeQuery(conn2, "SELECT * FROM test").size()); - } - } - - /** - * Establish JDBC connection. - * - * @return Connection. - * @throws Exception If failed. - */ - private Connection connect() throws Exception { - return DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1:10800"); - } - - /** - * Execute update statement. - * - * @param conn Connection. - * @param sql SQL. - * @throws Exception If failed. - */ - private static void executeUpdate(Connection conn, String sql) throws Exception { - try (Statement stmt = conn.createStatement()) { - stmt.executeUpdate(sql); - } - } - - /** - * Execute query. - * - * @param conn Connection. - * @param sql SQL. - * @return Result. - * @throws Exception If failed. - */ - private static List> executeQuery(Connection conn, String sql) throws Exception { - List> rows = new ArrayList<>(); - - try (Statement stmt = conn.createStatement()) { - try (ResultSet rs = stmt.executeQuery(sql)) { - int colCnt = rs.getMetaData().getColumnCount(); - - while (rs.next()) { - List row = new ArrayList<>(colCnt); - - for (int i = 0; i < colCnt; i++) - row.add(rs.getObject(i + 1)); - - rows.add(row); - } - } - } - - return rows; - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java deleted file mode 100644 index 87229697da704..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverMvccTestSuite.java +++ /dev/null @@ -1,46 +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.jdbc.suite; - -import org.apache.ignite.jdbc.JdbcVersionMismatchSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinConnectionMvccEnabledSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsClientAutoCommitComplexSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsClientNoAutoCommitComplexSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsServerAutoCommitComplexSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsServerNoAutoCommitComplexSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsWithMvccEnabledSelfTest; -import org.apache.ignite.jdbc.thin.MvccJdbcTransactionFinishOnDeactivatedClusterSelfTest; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** */ -@RunWith(Suite.class) -@Suite.SuiteClasses({ - JdbcThinConnectionMvccEnabledSelfTest.class, - JdbcVersionMismatchSelfTest.class, - - // Transactions - JdbcThinTransactionsWithMvccEnabledSelfTest.class, - JdbcThinTransactionsClientAutoCommitComplexSelfTest.class, - JdbcThinTransactionsServerAutoCommitComplexSelfTest.class, - JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.class, - JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.class, - MvccJdbcTransactionFinishOnDeactivatedClusterSelfTest.class -}) -public class IgniteJdbcDriverMvccTestSuite { -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java index c53fa76a04f08..450db60030de1 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java @@ -39,7 +39,6 @@ import org.apache.ignite.jdbc.thin.JdbcThinComplexQuerySelfTest; import org.apache.ignite.jdbc.thin.JdbcThinConnectionAdditionalSecurityTest; import org.apache.ignite.jdbc.thin.JdbcThinConnectionMultipleAddressesTest; -import org.apache.ignite.jdbc.thin.JdbcThinConnectionMvccEnabledSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinConnectionPropertiesTest; import org.apache.ignite.jdbc.thin.JdbcThinConnectionSSLTest; import org.apache.ignite.jdbc.thin.JdbcThinConnectionSelfTest; @@ -65,7 +64,6 @@ import org.apache.ignite.jdbc.thin.JdbcThinMetadataPrimaryKeysSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinMetadataSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinMissingLongArrayResultsTest; -import org.apache.ignite.jdbc.thin.JdbcThinMultiStatementSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinNoDefaultSchemaTest; import org.apache.ignite.jdbc.thin.JdbcThinPreparedStatementLeakTest; import org.apache.ignite.jdbc.thin.JdbcThinPreparedStatementSelfTest; @@ -80,12 +78,6 @@ import org.apache.ignite.jdbc.thin.JdbcThinStreamingOrderedSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinStreamingResetStreamTest; import org.apache.ignite.jdbc.thin.JdbcThinTcpIoTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsClientAutoCommitComplexSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsClientNoAutoCommitComplexSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsLeaksMvccTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsServerAutoCommitComplexSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinTransactionsServerNoAutoCommitComplexSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinUpdateStatementSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinUpdateStatementSkipReducerOnUpdateSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinWalModeChangeSelfTest; @@ -150,7 +142,6 @@ // New thin JDBC JdbcThinConnectionSelfTest.class, - JdbcThinConnectionMvccEnabledSelfTest.class, JdbcThinConnectionMultipleAddressesTest.class, JdbcThinTcpIoTest.class, JdbcThinConnectionAdditionalSecurityTest.class, @@ -189,7 +180,6 @@ JdbcThinDynamicIndexTransactionalPartitionedNearSelfTest.class, JdbcThinDynamicIndexTransactionalPartitionedSelfTest.class, JdbcThinDynamicIndexTransactionalReplicatedSelfTest.class, - JdbcThinMultiStatementSelfTest.class, // New thin JDBC driver, DML tests JdbcThinBulkLoadSelfTest.class, @@ -206,13 +196,6 @@ JdbcThinComplexDmlDdlSkipReducerOnUpdateSelfTest.class, JdbcThinComplexDmlDdlCustomSchemaSelfTest.class, - // Transactions - JdbcThinTransactionsSelfTest.class, - JdbcThinTransactionsClientAutoCommitComplexSelfTest.class, - JdbcThinTransactionsServerAutoCommitComplexSelfTest.class, - JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.class, - JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.class, - JdbcThinLocalQueriesSelfTest.class, // Various commands. @@ -220,7 +203,6 @@ JdbcThinAuthenticateConnectionSelfTest.class, JdbcThinPreparedStatementLeakTest.class, - JdbcThinTransactionsLeaksMvccTest.class, JdbcThinSqlMergeTest.class, // Data types coverage. diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcThinDriverPartitionAwarenessTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcThinDriverPartitionAwarenessTestSuite.java index 485ab3aee2490..69722306e26d1 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcThinDriverPartitionAwarenessTestSuite.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcThinDriverPartitionAwarenessTestSuite.java @@ -21,7 +21,6 @@ import org.apache.ignite.jdbc.thin.JdbcThinConnectionSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinPartitionAwarenessReconnectionAndFailoverSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinPartitionAwarenessSelfTest; -import org.apache.ignite.jdbc.thin.JdbcThinPartitionAwarenessTransactionsSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinStatementSelfTest; import org.apache.ignite.jdbc.thin.JdbcThinTcpIoTest; import org.apache.ignite.testframework.GridTestUtils; @@ -38,7 +37,6 @@ JdbcThinTcpIoTest.class, JdbcThinStatementSelfTest.class, JdbcThinPartitionAwarenessSelfTest.class, - JdbcThinPartitionAwarenessTransactionsSelfTest.class, JdbcThinPartitionAwarenessReconnectionAndFailoverSelfTest.class, }) public class IgniteJdbcThinDriverPartitionAwarenessTestSuite { diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionMvccEnabledSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionMvccEnabledSelfTest.java deleted file mode 100644 index 76048c424baab..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionMvccEnabledSelfTest.java +++ /dev/null @@ -1,367 +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.jdbc.thin; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Savepoint; -import java.util.concurrent.Callable; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.binary.BinaryMarshaller; -import org.apache.ignite.internal.util.lang.RunnableX; -import org.apache.ignite.testframework.GridStringLogger; -import org.jetbrains.annotations.NotNull; -import org.junit.Test; - -import static java.sql.Connection.TRANSACTION_NONE; -import static java.sql.Connection.TRANSACTION_READ_COMMITTED; -import static java.sql.Connection.TRANSACTION_READ_UNCOMMITTED; -import static java.sql.Connection.TRANSACTION_REPEATABLE_READ; -import static java.sql.Connection.TRANSACTION_SERIALIZABLE; -import static org.apache.ignite.testframework.GridTestUtils.assertThrows; - -/** - * Connection test. - */ -@SuppressWarnings("ThrowableNotThrown") -public class JdbcThinConnectionMvccEnabledSelfTest extends JdbcThinAbstractSelfTest { - /** */ - private static final String URL = "jdbc:ignite:thin://127.0.0.1"; - - /** {@inheritDoc} */ - @SuppressWarnings({"deprecation", "unchecked"}) - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME).setNearConfiguration(null)); - - cfg.setMarshaller(new BinaryMarshaller()); - cfg.setGridLogger(new GridStringLogger()); - - return cfg; - } - - /** - * @param name Cache name. - * @return Cache configuration. - */ - private CacheConfiguration cacheConfiguration(@NotNull String name) { - CacheConfiguration cfg = defaultCacheConfiguration(); - - cfg.setName(name); - cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - startGridsMultiThreaded(2); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMetadataDefaults() throws Exception { - try (Connection conn = DriverManager.getConnection(URL)) { - DatabaseMetaData meta = conn.getMetaData(); - - assertEquals(TRANSACTION_REPEATABLE_READ, meta.getDefaultTransactionIsolation()); - assertTrue(meta.supportsTransactions()); - - assertFalse(meta.supportsTransactionIsolationLevel(TRANSACTION_NONE)); - assertFalse(meta.supportsTransactionIsolationLevel(TRANSACTION_READ_UNCOMMITTED)); - assertFalse(meta.supportsTransactionIsolationLevel(TRANSACTION_READ_COMMITTED)); - assertTrue(meta.supportsTransactionIsolationLevel(TRANSACTION_REPEATABLE_READ)); - assertFalse(meta.supportsTransactionIsolationLevel(TRANSACTION_SERIALIZABLE)); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testGetSetAutoCommit() throws Exception { - try (Connection conn = DriverManager.getConnection(URL)) { - assertTrue(conn.getMetaData().supportsTransactions()); - - assertTrue(conn.getAutoCommit()); - - conn.setAutoCommit(false); - - assertFalse(conn.getAutoCommit()); - - conn.setAutoCommit(true); - - assertTrue(conn.getAutoCommit()); - - conn.close(); - - // Exception when called on closed connection - checkConnectionClosed(new RunnableX() { - @Override public void runx() throws Exception { - conn.setAutoCommit(true); - } - }); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCommit() throws Exception { - try (Connection conn = DriverManager.getConnection(URL)) { - assertTrue(conn.getMetaData().supportsTransactions()); - - // Should not be called in auto-commit mode - assertThrows(log, - new Callable() { - @Override public Object call() throws Exception { - conn.commit(); - - return null; - } - }, - SQLException.class, - "Transaction cannot be committed explicitly in auto-commit mode" - ); - - conn.setAutoCommit(false); - - conn.commit(); - - conn.close(); - - // Exception when called on closed connection - checkConnectionClosed(new RunnableX() { - @Override public void runx() throws Exception { - conn.commit(); - } - }); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRollback() throws Exception { - try (Connection conn = DriverManager.getConnection(URL)) { - assertTrue(conn.getMetaData().supportsTransactions()); - - // Should not be called in auto-commit mode - assertThrows(log, - new Callable() { - @Override public Object call() throws Exception { - conn.rollback(); - - return null; - } - }, - SQLException.class, - "Transaction cannot be rolled back explicitly in auto-commit mode." - ); - - conn.setAutoCommit(false); - - conn.rollback(); - - conn.close(); - - // Exception when called on closed connection - checkConnectionClosed(new RunnableX() { - @Override public void runx() throws Exception { - conn.rollback(); - } - }); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSetSavepoint() throws Exception { - try (Connection conn = DriverManager.getConnection(URL)) { - assert !conn.getMetaData().supportsSavepoints(); - - // Disallowed in auto-commit mode - assertThrows(log, - new Callable() { - @Override public Object call() throws Exception { - conn.setSavepoint(); - - return null; - } - }, - SQLException.class, - "Savepoint cannot be set in auto-commit mode" - ); - - conn.setAutoCommit(false); - - // Unsupported - checkNotSupported(new RunnableX() { - @Override public void runx() throws Exception { - conn.setSavepoint(); - } - }); - - conn.close(); - - checkConnectionClosed(new RunnableX() { - @Override public void runx() throws Exception { - conn.setSavepoint(); - } - }); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSetSavepointName() throws Exception { - try (Connection conn = DriverManager.getConnection(URL)) { - assert !conn.getMetaData().supportsSavepoints(); - - // Invalid arg - assertThrows(log, - new Callable() { - @Override public Object call() throws Exception { - conn.setSavepoint(null); - - return null; - } - }, - SQLException.class, - "Savepoint name cannot be null" - ); - - final String name = "savepoint"; - - // Disallowed in auto-commit mode - assertThrows(log, - new Callable() { - @Override public Object call() throws Exception { - conn.setSavepoint(name); - - return null; - } - }, - SQLException.class, - "Savepoint cannot be set in auto-commit mode" - ); - - conn.setAutoCommit(false); - - // Unsupported - checkNotSupported(new RunnableX() { - @Override public void runx() throws Exception { - conn.setSavepoint(name); - } - }); - - conn.close(); - - checkConnectionClosed(new RunnableX() { - @Override public void runx() throws Exception { - conn.setSavepoint(name); - } - }); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRollbackSavePoint() throws Exception { - try (Connection conn = DriverManager.getConnection(URL)) { - assert !conn.getMetaData().supportsSavepoints(); - - // Invalid arg - assertThrows(log, - new Callable() { - @Override public Object call() throws Exception { - conn.rollback(null); - - return null; - } - }, - SQLException.class, - "Invalid savepoint" - ); - - final Savepoint savepoint = getFakeSavepoint(); - - // Disallowed in auto-commit mode - assertThrows(log, - new Callable() { - @Override public Object call() throws Exception { - conn.rollback(savepoint); - - return null; - } - }, - SQLException.class, - "Auto-commit mode" - ); - - conn.setAutoCommit(false); - - // Unsupported - checkNotSupported(new RunnableX() { - @Override public void runx() throws Exception { - conn.rollback(savepoint); - } - }); - - conn.close(); - - checkConnectionClosed(new RunnableX() { - @Override public void runx() throws Exception { - conn.rollback(savepoint); - } - }); - } - } - - /** - * @return Savepoint. - */ - private Savepoint getFakeSavepoint() { - return new Savepoint() { - @Override public int getSavepointId() throws SQLException { - return 100; - } - - @Override public String getSavepointName() { - return "savepoint"; - } - }; - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java index f40d34eb4d768..917ac650e28c1 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java @@ -1294,7 +1294,7 @@ public void testRollback() throws Exception { * @throws Exception if failed. */ @Test - public void testBeginFailsWhenMvccIsDisabled() throws Exception { + public void testBeginFails() throws Exception { try (Connection conn = DriverManager.getConnection(urlWithPartitionAwarenessProp)) { conn.createStatement().execute("BEGIN"); @@ -1309,7 +1309,7 @@ public void testBeginFailsWhenMvccIsDisabled() throws Exception { * @throws Exception if failed. */ @Test - public void testCommitIgnoredWhenMvccIsDisabled() throws Exception { + public void testCommitIgnored() throws Exception { try (Connection conn = DriverManager.getConnection(urlWithPartitionAwarenessProp)) { conn.setAutoCommit(false); conn.createStatement().execute("COMMIT"); @@ -1323,7 +1323,7 @@ public void testCommitIgnoredWhenMvccIsDisabled() throws Exception { * @throws Exception if failed. */ @Test - public void testRollbackIgnoredWhenMvccIsDisabled() throws Exception { + public void testRollbackIgnored() throws Exception { try (Connection conn = DriverManager.getConnection(urlWithPartitionAwarenessProp)) { conn.setAutoCommit(false); diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMultiStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMultiStatementSelfTest.java deleted file mode 100644 index b9b36a6dc83da..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMultiStatementSelfTest.java +++ /dev/null @@ -1,207 +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.jdbc.thin; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests for ddl queries that contain multiply sql statements, separated by ";". - */ -public class JdbcThinMultiStatementSelfTest extends GridCommonAbstractTest { - /** {@inheritDoc} */ - @Override public void beforeTestsStarted() throws Exception { - System.setProperty(IgniteSystemProperties.IGNITE_SQL_PARSER_DISABLE_H2_FALLBACK, "false"); - - startGrids(2); - } - - /** - * Setup tables. - */ - @Before - public void setupTables() throws Exception { - execute("DROP TABLE IF EXISTS TEST_TX; " + - "DROP TABLE IF EXISTS public.transactions; " + - "DROP TABLE IF EXISTS ONE;" + - "DROP TABLE IF EXISTS TWO;"); - - execute("CREATE TABLE TEST_TX " + - "(ID INT PRIMARY KEY, AGE INT, NAME VARCHAR) " + - "WITH \"atomicity=transactional_snapshot\";"); - - execute("INSERT INTO TEST_TX VALUES " + - "(1, 17, 'James'), " + - "(2, 43, 'Valery'), " + - "(3, 25, 'Michel'), " + - "(4, 19, 'Nick');"); - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - stopAllGrids(); - } - - /** - * Execute sql script using thin driver. - */ - private void execute(String sql) throws Exception { - try (Connection c = GridTestUtils.connect(grid(0), null)) { - try (Statement stmt = c.createStatement()) { - stmt.executeUpdate(sql); - } - - } - } - - /** - * Assert that script containing both h2 and non h2 (native) sql statements is handled correctly. - */ - @Test - public void testMixedCommands() throws Exception { - execute("CREATE TABLE public.transactions (pk INT, id INT, k VARCHAR, v VARCHAR, PRIMARY KEY (pk, id)); " + - "CREATE INDEX transactions_id_k_v ON public.transactions (id, k, v) INLINE_SIZE 150; " + - "INSERT INTO public.transactions VALUES (1,2,'some', 'word') ; " + - "CREATE INDEX transactions_k_v_id ON public.transactions (k, v, id) INLINE_SIZE 150; " + - "CREATE INDEX transactions_pk_id ON public.transactions (pk, id) INLINE_SIZE 20;"); - } - - /** - * Sanity test for scripts, containing empty statements are handled correctly. - */ - @Test - public void testEmptyStatements() throws Exception { - execute(";; ;;;;"); - execute(" ;; ;;;; "); - execute("CREATE TABLE ONE (id INT PRIMARY KEY, VAL VARCHAR);;" + - "CREATE INDEX T_IDX ON ONE(val)" + - ";;UPDATE ONE SET VAL = 'SOME';;; "); - execute("DROP INDEX T_IDX ;; ;;" + - "UPDATE ONE SET VAL = 'SOME'"); - } - - /** - * Check multi-statement containing both h2 and native parser statements (having "?" args) works well. - */ - @Test - public void testMultiStatementTxWithParams() throws Exception { - int leoAge = 28; - - String nickolas = "Nickolas"; - - int gabAge = 84; - String gabName = "Gab"; - - int delYounger = 19; - - String complexQuery = - "INSERT INTO TEST_TX VALUES (5, ?, 'Leo'); " + // 1 - ";;;;" + - "BEGIN ; " + - "UPDATE TEST_TX SET name = ? WHERE name = 'Nick' ;" + // 2 - "INSERT INTO TEST_TX VALUES (6, ?, ?); " + // 3, 4 - "DELETE FROM TEST_TX WHERE age < ?; " + // 5 - "COMMIT;"; - - try (Connection c = GridTestUtils.connect(grid(0), null)) { - try (PreparedStatement p = c.prepareStatement(complexQuery)) { - p.setInt(1, leoAge); - p.setString(2, nickolas); - p.setInt(3, gabAge); - p.setString(4, gabName); - p.setInt(5, delYounger); - - assertFalse("Expected, that first result is an update count.", p.execute()); - - assertTrue("Expected update count of the INSERT.", p.getUpdateCount() != -1); - assertTrue("More results are expected.", p.getMoreResults()); - - assertTrue("Expected update count of an empty statement.", p.getUpdateCount() != -1); - assertTrue("More results are expected.", p.getMoreResults()); - assertTrue("Expected update count of an empty statement.", p.getUpdateCount() != -1); - assertTrue("More results are expected.", p.getMoreResults()); - assertTrue("Expected update count of an empty statement.", p.getUpdateCount() != -1); - assertTrue("More results are expected.", p.getMoreResults()); - assertTrue("Expected update count of an empty statement.", p.getUpdateCount() != -1); - assertTrue("More results are expected.", p.getMoreResults()); - - assertTrue("Expected update count of the BEGIN", p.getUpdateCount() != -1); - assertTrue("More results are expected.", p.getMoreResults()); - assertTrue("Expected update count of the UPDATE", p.getUpdateCount() != -1); - assertTrue("More results are expected.", p.getMoreResults()); - assertTrue("Expected update count of the INSERT", p.getUpdateCount() != -1); - assertTrue("More results are expected.", p.getMoreResults()); - assertTrue("Expected update count of the DELETE", p.getUpdateCount() != -1); - assertTrue("More results are expected.", p.getMoreResults()); - assertTrue("Expected update count of the COMMIT", p.getUpdateCount() != -1); - - assertFalse("There should have been no results.", p.getMoreResults()); - assertFalse("There should have been no update results.", p.getUpdateCount() != -1); - } - - try (PreparedStatement sel = c.prepareStatement("SELECT * FROM TEST_TX ORDER BY ID;")) { - try (ResultSet pers = sel.executeQuery()) { - assertTrue(pers.next()); - assertEquals(43, age(pers)); - assertEquals("Valery", name(pers)); - - assertTrue(pers.next()); - assertEquals(25, age(pers)); - assertEquals("Michel", name(pers)); - - assertTrue(pers.next()); - assertEquals(19, age(pers)); - assertEquals("Nickolas", name(pers)); - - assertTrue(pers.next()); - assertEquals(28, age(pers)); - assertEquals("Leo", name(pers)); - - assertTrue(pers.next()); - assertEquals(84, age(pers)); - assertEquals("Gab", name(pers)); - - assertFalse(pers.next()); - } - } - } - } - - /** - * Extract person's name from result set. - */ - private static String name(ResultSet rs) throws SQLException { - return rs.getString("NAME"); - } - - /** - * Extract person's age from result set. - */ - private static int age(ResultSet rs) throws SQLException { - return rs.getInt("AGE"); - } - -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessReconnectionAndFailoverSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessReconnectionAndFailoverSelfTest.java index 1cc3969c40b6a..e01e2909be3fb 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessReconnectionAndFailoverSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessReconnectionAndFailoverSelfTest.java @@ -35,7 +35,6 @@ import java.util.logging.Logger; import org.apache.ignite.IgniteCache; import org.apache.ignite.Ignition; -import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.query.annotations.QuerySqlField; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.IgniteInterruptedCheckedException; @@ -552,60 +551,6 @@ public void testFailoverLimit() throws Exception { startGridsMultiThreaded(INITIAL_NODES_CNT); } - /** - * Check that there are no retries in case of transactional query. - * - * @throws Exception If failed. - */ - @SuppressWarnings({"unchecked", "ThrowableNotThrown"}) - @Test - public void testTransactionalQueryFailover() throws Exception { - try (Connection conn = DriverManager.getConnection(URL_WITH_ONE_PORT)) { - final String cacheName = UUID.randomUUID().toString().substring(0, 6); - - final String sql = "select 1 from \"" + cacheName + "\".Person"; - - CacheConfiguration cache = defaultCacheConfiguration().setName(cacheName). - setNearConfiguration(null).setIndexedTypes(Integer.class, Person.class). - setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - - ignite(0).createCache(cache); - - Statement stmt = conn.createStatement(); - - stmt.execute("BEGIN"); - - stmt.execute(sql); - - stopGrid(0); - - logHnd.records.clear(); - - GridTestUtils.assertThrows(null, - new Callable() { - @Override public Object call() throws Exception { - stmt.execute(sql); - - return null; - } - }, - SQLException.class, - "Failed to communicate with Ignite cluster." - ); - } - - assertEquals("Unexpected log records count.", 1, logHnd.records.size()); - - LogRecord record = logHnd.records.get(0); - - assertEquals("Unexpected log record text.", "Exception during sending an sql request.", - record.getMessage()); - - assertEquals("Unexpected log level", Level.FINE, record.getLevel()); - - startGrid(0); - } - /** * Check that there are no retries in following cases: *
    diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessTransactionsSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessTransactionsSelfTest.java deleted file mode 100644 index 47f1da18f423d..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessTransactionsSelfTest.java +++ /dev/null @@ -1,259 +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.jdbc.thin; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Collection; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.binary.BinaryMarshaller; -import org.apache.ignite.internal.processors.query.NestedTxMode; -import org.apache.ignite.internal.processors.query.running.QueryHistory; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.jetbrains.annotations.NotNull; -import org.junit.Test; - -/** - * Jdbc thin transactional partition awareness test. - */ -public class JdbcThinPartitionAwarenessTransactionsSelfTest extends JdbcThinAbstractSelfTest { - /** */ - private static final String URL = "jdbc:ignite:thin://127.0.0.1:10800..10802?partitionAwareness=true"; - - /** Nodes count. */ - private static final int NODES_CNT = 3; - - /** Query execution multiplier. */ - private static final int QUERY_EXECUTION_MULTIPLIER = 5; - - /** Connection. */ - private Connection conn; - - /** Statement. */ - private Statement stmt; - - /** {@inheritDoc} */ - @SuppressWarnings({"deprecation", "unchecked"}) - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - return super.getConfiguration(igniteInstanceName) - .setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME).setNearConfiguration(null)) - .setMarshaller(new BinaryMarshaller()); - } - - /** - * @param name Cache name. - * @return Cache configuration. - */ - private CacheConfiguration cacheConfiguration(@NotNull String name) { - return defaultCacheConfiguration() - .setName(name) - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - startGridsMultiThreaded(NODES_CNT); - - try (Connection c = prepareConnection(true, NestedTxMode.ERROR)) { - try (Statement stmt = c.createStatement()) { - stmt.execute("CREATE TABLE Person (id int primary key, firstName varchar, lastName varchar, age int) " + - "WITH \"cache_name=persons,wrap_value=true,atomicity=transactional_snapshot\""); - - stmt.executeUpdate("insert into Person (id, firstName, lastName, age) values (1, 'John1', 'Dow1', 1);" + - "insert into Person (id, firstName, lastName, age) values (2, 'John2', 'Dow2', 2);" + - "insert into Person (id, firstName, lastName, age) values (3, 'John3', 'Dow3', 3);"); - } - } - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - conn = DriverManager.getConnection(URL); - - stmt = conn.createStatement(); - - assert stmt != null; - assert !stmt.isClosed(); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - U.closeQuiet(stmt); - - conn.close(); - - assert stmt.isClosed(); - assert conn.isClosed(); - } - - /** - * @param autoCommit Auto commit mode. - * @param nestedTxMode Nested transactions mode. - * @return Connection. - * @throws SQLException if failed. - */ - private static Connection prepareConnection(boolean autoCommit, NestedTxMode nestedTxMode) throws SQLException { - Connection res = DriverManager.getConnection(URL + "&nestedTransactionsMode=" + nestedTxMode.name()); - - res.setAutoCommit(autoCommit); - - return res; - } - - /** - * Check that queries goes to the same node within transaction. - * - * @throws Exception If failed. - */ - @Test - public void testExecuteQueries() throws Exception { - stmt.execute("BEGIN"); - checkNodesUsage("select * from Person where _key = 1", 1, false); - stmt.execute("COMMIT"); - - stmt.execute("BEGIN"); - checkNodesUsage("select * from Person where _key = 1 or _key = 2", 2, false); - stmt.execute("COMMIT"); - - stmt.execute("BEGIN"); - checkNodesUsage("select * from Person where _key in (1, 2)", 2, false); - stmt.execute("COMMIT"); - } - - /** - * Check that dml queries(updates) goes to the same node within transaction. - * - * @throws Exception If failed. - */ - @Test - public void testUpdateQueries() throws Exception { - stmt.execute("BEGIN"); - checkNodesUsage("update Person set firstName = 'TestFirstName' where _key = 1", 1, - true); - stmt.execute("COMMIT"); - - stmt.execute("BEGIN"); - checkNodesUsage("update Person set firstName = 'TestFirstName' where _key = 1 or _key = 2", - 2, true); - stmt.execute("COMMIT"); - - stmt.execute("BEGIN"); - checkNodesUsage("update Person set firstName = 'TestFirstName' where _key in (1, 2)", - 2, true); - stmt.execute("COMMIT"); - } - - /** - * Check that dml queries(delete) goes to the same node within transaction. - * - * @throws Exception If failed. - */ - @Test - public void testDeleteQueries() throws Exception { - stmt.execute("BEGIN"); - checkNodesUsage("delete from Person where _key = 1000 or _key = 2000", 0, true); - stmt.execute("COMMIT"); - - stmt.execute("BEGIN"); - checkNodesUsage("delete from Person where _key in (1000, 2000)", 0, true); - stmt.execute("COMMIT"); - } - - /** - * Utility method that: - * 1. warms up an affinity cache; - * 2. resets query history; - * 3. executes given query multiple times; - * 4. checks query history metrics in order to verify that not more than expected nodes were used. - * - * @param sql Sql query, either prepared statement or sql query should be used. - * @param expRowsCnt Expected rows count within result. - * @param dml Flag that signals whether we execute dml or not. - * @throws Exception If failed. - */ - private void checkNodesUsage(String sql, int expRowsCnt, boolean dml) - throws Exception { - // Warm up an affinity cache. - if (dml) - stmt.executeUpdate(sql); - else - stmt.executeQuery(sql); - - // Reset query history. - for (int i = 0; i < NODES_CNT; i++) - grid(i).context().query().runningQueryManager().resetQueryHistoryMetrics(); - - // Execute query multiple times - for (int i = 0; i < NODES_CNT * QUERY_EXECUTION_MULTIPLIER; i++) { - ResultSet rs = null; - - int updatedRowsCnt = 0; - - if (dml) - updatedRowsCnt = stmt.executeUpdate(sql); - else - rs = stmt.executeQuery(sql); - - if (dml) { - assertEquals("Unexpected updated rows count: expected [" + expRowsCnt + "]," + - " got [" + updatedRowsCnt + "]", expRowsCnt, updatedRowsCnt); - } - else { - assert rs != null; - - int gotRowsCnt = 0; - - while (rs.next()) - gotRowsCnt++; - - assertEquals("Unexpected rows count: expected [" + expRowsCnt + "], got [" + gotRowsCnt + "]", - expRowsCnt, gotRowsCnt); - } - } - - // Check query history metrics in order to verify that not more than expected nodes were used. - int nonEmptyMetricsCntr = 0; - int qryExecutionsCntr = 0; - - for (int i = 0; i < NODES_CNT; i++) { - Collection metrics = grid(i).context().query().runningQueryManager() - .queryHistoryMetrics().values(); - - if (!metrics.isEmpty()) { - nonEmptyMetricsCntr++; - qryExecutionsCntr += new ArrayList<>(metrics).get(0).executions(); - } - } - - assertTrue("Unexpected amount of used nodes: expected [0 < nodesCnt <= 1" + - "], got [" + nonEmptyMetricsCntr + "]", - nonEmptyMetricsCntr == 1); - - assertEquals("Executions count doesn't match expeted value: expected [" + - NODES_CNT * QUERY_EXECUTION_MULTIPLIER + "], got [" + qryExecutionsCntr + "]", - NODES_CNT * QUERY_EXECUTION_MULTIPLIER, qryExecutionsCntr); - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsAbstractComplexSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsAbstractComplexSelfTest.java deleted file mode 100644 index 067ea3942b9b9..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsAbstractComplexSelfTest.java +++ /dev/null @@ -1,1063 +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.jdbc.thin; - -import java.sql.BatchUpdateException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.CountDownLatch; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cache.query.annotations.QuerySqlField; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.IgniteInterruptedCheckedException; -import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteInClosure; -import org.apache.ignite.testframework.GridTestUtils; -import org.junit.Test; - -/** - * Test to check various transactional scenarios. - */ -public abstract class JdbcThinTransactionsAbstractComplexSelfTest extends JdbcThinAbstractSelfTest { - /** Client node index. */ - static final int CLI_IDX = 1; - - /** - * Closure to perform ordinary delete after repeatable read. - */ - private final IgniteInClosure afterReadDel = new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where firstname = 'John'"); - } - }; - - /** - * Closure to perform fast delete after repeatable read. - */ - private final IgniteInClosure afterReadFastDel = new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where id = 1"); - } - }; - - /** - * Closure to perform ordinary update after repeatable read. - */ - private final IgniteInClosure afterReadUpdate = new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "UPDATE \"Person\".Person set firstname = 'Joe' where firstname = 'John'"); - } - }; - - /** - * Closure to perform ordinary delete and rollback after repeatable read. - */ - private final IgniteInClosure afterReadDelAndRollback = new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where firstname = 'John'"); - - rollback(conn); - } - }; - - /** - * Closure to perform fast delete after repeatable read. - */ - private final IgniteInClosure afterReadFastDelAndRollback = new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where id = 1"); - - rollback(conn); - } - }; - - /** - * Closure to perform ordinary update and rollback after repeatable read. - */ - private final IgniteInClosure afterReadUpdateAndRollback = new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "UPDATE \"Person\".Person set firstname = 'Joe' where firstname = 'John'"); - - rollback(conn); - } - }; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String testIgniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(testIgniteInstanceName); - - CacheConfiguration ccfg = new CacheConfiguration<>("Person"); - - ccfg.setIndexedTypes(Integer.class, Person.class); - - ccfg.getQueryEntities().iterator().next().setKeyFieldName("id"); - - ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - - ccfg.setCacheMode(CacheMode.PARTITIONED); - - cfg.setCacheConfiguration(ccfg); - - // Let the node with index 1 be client node. - cfg.setClientMode(F.eq(testIgniteInstanceName, getTestIgniteInstanceName(CLI_IDX))); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - execute("ALTER TABLE \"Person\".person add if not exists cityid int"); - - execute("ALTER TABLE \"Person\".person add if not exists companyid int"); - - execute("CREATE TABLE City (id int primary key, name varchar, population int) WITH " + - "\"atomicity=transactional_snapshot,template=partitioned,backups=3,cache_name=City\""); - - execute("CREATE TABLE Company (id int, \"cityid\" int, name varchar, primary key (id, \"cityid\")) WITH " + - "\"atomicity=transactional_snapshot,template=partitioned,backups=1,wrap_value=false,affinity_key=cityid," + - "cache_name=Company\""); - - execute("CREATE TABLE Product (id int primary key, name varchar, companyid int) WITH " + - "\"atomicity=transactional_snapshot,template=partitioned,backups=2,cache_name=Product\""); - - execute("CREATE INDEX IF NOT EXISTS prodidx ON Product(companyid)"); - - execute("CREATE INDEX IF NOT EXISTS persidx ON \"Person\".person(cityid)"); - - insertPerson(1, "John", "Smith", 1, 1); - insertPerson(2, "Mike", "Johns", 1, 2); - insertPerson(3, "Sam", "Jules", 2, 2); - insertPerson(4, "Alex", "Pope", 2, 3); - insertPerson(5, "Peter", "Williams", 2, 3); - - insertCity(1, "Los Angeles", 5000); - insertCity(2, "Seattle", 1500); - insertCity(3, "New York", 12000); - insertCity(4, "Cupertino", 400); - - insertCompany(1, "Microsoft", 2); - insertCompany(2, "Google", 3); - insertCompany(3, "Facebook", 1); - insertCompany(4, "Uber", 1); - insertCompany(5, "Apple", 4); - - insertProduct(1, "Search", 2); - insertProduct(2, "Windows", 1); - insertProduct(3, "Mac", 5); - - awaitPartitionMapExchange(); - } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - startGridsMultiThreaded(4); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - execute("DELETE FROM \"Person\".Person"); - - execute("DROP TABLE City"); - - execute("DROP TABLE Company"); - - execute("DROP TABLE Product"); - - super.afterTest(); - } - - /** - * - */ - @Test - public void testSingleDmlStatement() throws SQLException { - insertPerson(6, "John", "Doe", 2, 2); - - assertEquals(Collections.singletonList(l(6, "John", "Doe", 2, 2)), - execute("SELECT * FROM \"Person\".Person where id = 6")); - } - - /** - * - */ - @Test - public void testMultipleDmlStatements() throws SQLException { - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - insertPerson(conn, 6, "John", "Doe", 2, 2); - - // https://issues.apache.org/jira/browse/IGNITE-6938 - we can only see results of - // UPDATE of what we have not inserted ourselves. - execute(conn, "UPDATE \"Person\".person SET lastname = 'Jameson' where lastname = 'Jules'"); - - execute(conn, "DELETE FROM \"Person\".person where id = 5"); - } - }); - - assertEquals(l( - l(3, "Sam", "Jameson", 2, 2), - l(6, "John", "Doe", 2, 2) - ), execute("SELECT * FROM \"Person\".Person where id = 3 or id >= 5 order by id")); - } - - /** - * - */ - @Test - public void testBatchDmlStatements() throws SQLException { - doBatchedInsert(); - - assertEquals(l( - l(6, "John", "Doe", 2, 2), - l(7, "Mary", "Lee", 1, 3) - ), execute("SELECT * FROM \"Person\".Person where id > 5 order by id")); - } - - /** - * - */ - @Test - public void testBatchDmlStatementsIntermediateFailure() throws SQLException { - insertPerson(6, "John", "Doe", 2, 2); - - IgniteException e = (IgniteException)GridTestUtils.assertThrows(null, new Callable() { - @Override public Object call() throws Exception { - doBatchedInsert(); - - return null; - } - }, IgniteException.class, "Duplicate key during INSERT [key=KeyCacheObjectImpl " + - "[part=6, val=6, hasValBytes=true]]"); - - assertTrue(e.getCause() instanceof BatchUpdateException); - - assertEquals(IgniteQueryErrorCode.DUPLICATE_KEY, ((BatchUpdateException)e.getCause()).getErrorCode()); - - assertTrue(e.getCause().getMessage().contains("Duplicate key during INSERT [key=KeyCacheObjectImpl " + - "[part=6, val=6, hasValBytes=true]]")); - - // First we insert id 7, then 6. Still, 7 is not in the cache as long as the whole batch has failed inside tx. - assertEquals(Collections.emptyList(), execute("SELECT * FROM \"Person\".Person where id > 6 order by id")); - } - - /** - * - */ - private void doBatchedInsert() throws SQLException { - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - try { - try (PreparedStatement ps = conn.prepareStatement("INSERT INTO \"Person\".person " + - "(id, firstName, lastName, cityId, companyId) values (?, ?, ?, ?, ?)")) { - ps.setInt(1, 7); - - ps.setString(2, "Mary"); - - ps.setString(3, "Lee"); - - ps.setInt(4, 1); - - ps.setInt(5, 3); - - ps.addBatch(); - - ps.setInt(1, 6); - - ps.setString(2, "John"); - - ps.setString(3, "Doe"); - - ps.setInt(4, 2); - - ps.setInt(5, 2); - - ps.addBatch(); - - ps.executeBatch(); - } - } - catch (SQLException e) { - throw new IgniteException(e); - } - } - }); - } - - /** - * - */ - @Test - public void testInsertAndQueryMultipleCaches() throws SQLException { - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - insertCity(conn, 5, "St Petersburg", 6000); - - insertCompany(conn, 6, "VK", 5); - - insertPerson(conn, 6, "Peter", "Sergeev", 5, 6); - } - }); - - try (Connection c = connect("distributedJoins=true")) { - assertEquals(l(l(5, "St Petersburg", 6000, 6, 5, "VK", 6, "Peter", "Sergeev", 5, 6)), - execute(c, "SELECT * FROM City left join Company on City.id = Company.\"cityid\" " + - "left join \"Person\".Person p on City.id = p.cityid WHERE p.id = 6 or company.id = 6")); - } - } - - /** - * - */ - @Test - public void testColocatedJoinSelectAndInsertInTransaction() throws SQLException { - // We'd like to put some Google into cities with over 1K population which don't have it yet - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - List ids = flat(execute(conn, "SELECT distinct City.id from City left join Company c on " + - "City.id = c.\"cityid\" where population >= 1000 and c.name <> 'Google' order by City.id")); - - assertEqualsCollections(l(1, 2), ids); - - int i = 5; - - for (int l : ids) - insertCompany(conn, ++i, "Google", l); - } - }); - - assertEqualsCollections(l("Los Angeles", "Seattle", "New York"), flat(execute("SELECT City.name from City " + - "left join Company c on city.id = c.\"cityid\" WHERE c.name = 'Google' order by City.id"))); - } - - /** - * - */ - @Test - public void testDistributedJoinSelectAndInsertInTransaction() throws SQLException { - try (Connection c = connect("distributedJoins=true")) { - // We'd like to put some Google into cities with over 1K population which don't have it yet - executeInTransaction(c, new TransactionClosure() { - @Override public void apply(Connection conn) { - List res = flat(execute(conn, "SELECT p.id,p.name,c.id from Company c left join Product p on " + - "c.id = p.companyid left join City on city.id = c.\"cityid\" WHERE c.name <> 'Microsoft' " + - "and population < 1000")); - - assertEqualsCollections(l(3, "Mac", 5), res); - - insertProduct(conn, 4, (String)res.get(1), 1); - } - }); - } - - try (Connection c = connect("distributedJoins=true")) { - assertEqualsCollections(l("Windows", "Mac"), flat(execute(c, "SELECT p.name from Company c left join " + - "Product p on c.id = p.companyid WHERE c.name = 'Microsoft' order by p.id"))); - } - } - - /** - * - */ - @Test - public void testInsertFromExpression() throws SQLException { - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - execute(conn, "insert into city (id, name, population) values (? + 1, ?, ?)", - 8, "Moscow", 15000); - } - }); - } - - /** - * - */ - @Test - public void testAutoRollback() throws SQLException { - try (Connection c = connect()) { - begin(c); - - insertPerson(c, 6, "John", "Doe", 2, 2); - } - - // Connection has not hung on close and update has not been applied. - assertTrue(personCache().query(new SqlFieldsQuery("SELECT * FROM \"Person\".Person WHERE id = 6")) - .getAll().isEmpty()); - } - - /** - * - */ - @Test - public void testRepeatableReadWithConcurrentDelete() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where firstname = 'John'"); - } - }, null); - } - - /** - * - */ - @Test - public void testRepeatableReadWithConcurrentFastDelete() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where id = 1"); - } - }, null); - } - - /** - * - */ - @Test - public void testRepeatableReadWithConcurrentCacheRemove() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - personCache().remove(1); - } - }, null); - } - - /** - * - */ - @Test - public void testRepeatableReadAndDeleteWithConcurrentDelete() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where firstname = 'John'"); - } - }, afterReadDel); - } - - /** - * - */ - @Test - public void testRepeatableReadAndDeleteWithConcurrentFastDelete() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where id = 1"); - } - }, afterReadDel); - } - - /** - * - */ - @Test - public void testRepeatableReadAndDeleteWithConcurrentCacheRemove() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - personCache().remove(1); - } - }, afterReadDel); - } - - /** - * - */ - @Test - public void testRepeatableReadAndFastDeleteWithConcurrentDelete() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where firstname = 'John'"); - } - }, afterReadFastDel); - } - - /** - * - */ - @Test - public void testRepeatableReadAndFastDeleteWithConcurrentFastDelete() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where id = 1"); - } - }, afterReadFastDel); - } - - /** - * - */ - @Test - public void testRepeatableReadAndFastDeleteWithConcurrentCacheRemove() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - personCache().remove(1); - } - }, afterReadFastDel); - } - - /** - * - */ - @Test - public void testRepeatableReadAndDeleteWithConcurrentDeleteAndRollback() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where firstname = 'John'"); - } - }, afterReadDelAndRollback); - } - - /** - * - */ - @Test - public void testRepeatableReadAndDeleteWithConcurrentFastDeleteAndRollback() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where id = 1"); - } - }, afterReadDelAndRollback); - } - - /** - * - */ - @Test - public void testRepeatableReadAndDeleteWithConcurrentCacheRemoveAndRollback() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - personCache().remove(1); - } - }, afterReadDelAndRollback); - } - - /** - * - */ - @Test - public void testRepeatableReadAndFastDeleteWithConcurrentDeleteAndRollback() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where firstname = 'John'"); - } - }, afterReadFastDelAndRollback); - } - - /** - * - */ - @Test - public void testRepeatableReadAndFastDeleteWithConcurrentFastDeleteAndRollback() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "DELETE FROM \"Person\".Person where id = 1"); - } - }, afterReadFastDelAndRollback); - } - - /** - * - */ - @Test - public void testRepeatableReadAndFastDeleteWithConcurrentCacheRemoveAndRollback() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - personCache().remove(1); - } - }, afterReadFastDelAndRollback); - } - - /** - * - */ - @Test - public void testRepeatableReadWithConcurrentUpdate() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "UPDATE \"Person\".Person SET lastname = 'Fix' where firstname = 'John'"); - } - }, null); - } - - /** - * - */ - @Test - public void testRepeatableReadWithConcurrentCacheReplace() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - Person p = new Person(); - - p.id = 1; - p.firstName = "Luke"; - p.lastName = "Maxwell"; - - personCache().replace(1, p); - } - }, null); - } - - /** - * - */ - @Test - public void testRepeatableReadAndUpdateWithConcurrentUpdate() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "UPDATE \"Person\".Person SET lastname = 'Fix' where firstname = 'John'"); - } - }, afterReadUpdate); - } - - /** - * - */ - @Test - public void testRepeatableReadAndUpdateWithConcurrentCacheReplace() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - Person p = new Person(); - - p.id = 1; - p.firstName = "Luke"; - p.lastName = "Maxwell"; - - personCache().replace(1, p); - } - }, afterReadUpdate); - } - - /** - * - */ - @Test - public void testRepeatableReadAndUpdateWithConcurrentUpdateAndRollback() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - execute(conn, "UPDATE \"Person\".Person SET lastname = 'Fix' where firstname = 'John'"); - } - }, afterReadUpdateAndRollback); - } - - /** - * - */ - @Test - public void testRepeatableReadAndUpdateWithConcurrentCacheReplaceAndRollback() throws Exception { - doTestRepeatableRead(new IgniteInClosure() { - @Override public void apply(Connection conn) { - Person p = new Person(); - - p.id = 1; - p.firstName = "Luke"; - p.lastName = "Maxwell"; - - personCache().replace(1, p); - } - }, afterReadUpdateAndRollback); - } - - /** - * Perform repeatable reads and concurrent changes. - * @param concurrentWriteClo Updating closure. - * @param afterReadClo Closure making write changes that should also be made inside repeatable read transaction - * (must yield an exception). - * @throws Exception if failed. - */ - private void doTestRepeatableRead(final IgniteInClosure concurrentWriteClo, - final IgniteInClosure afterReadClo) throws Exception { - final CountDownLatch repeatableReadLatch = new CountDownLatch(1); - - final CountDownLatch initLatch = new CountDownLatch(1); - - final IgniteInternalFuture readFut = multithreadedAsync(new Callable() { - @Override public Object call() throws Exception { - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - List before = flat(execute(conn, "SELECT * from \"Person\".Person where id = 1")); - - assertEqualsCollections(l(1, "John", "Smith", 1, 1), before); - - initLatch.countDown(); - - try { - U.await(repeatableReadLatch); - } - catch (IgniteInterruptedCheckedException e) { - throw new IgniteException(e); - } - - List after = flat(execute(conn, "SELECT * from \"Person\".Person where id = 1")); - - assertEqualsCollections(before, after); - - if (afterReadClo != null) - afterReadClo.apply(conn); - } - }); - - return null; - } - }, 1); - - IgniteInternalFuture conModFut = multithreadedAsync(new Callable() { - @Override public Object call() throws Exception { - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - try { - U.await(initLatch); - } - catch (IgniteInterruptedCheckedException e) { - throw new IgniteException(e); - } - - concurrentWriteClo.apply(conn); - - repeatableReadLatch.countDown(); - } - }); - - return null; - } - }, 1); - - conModFut.get(); - - if (afterReadClo != null) { - IgniteCheckedException ex = (IgniteCheckedException)GridTestUtils.assertThrows(null, new Callable() { - @Override public Object call() throws Exception { - readFut.get(); - - return null; - } - }, IgniteCheckedException.class, "Cannot serialize transaction due to write conflict"); - - assertTrue(X.hasCause(ex, SQLException.class)); - - assertTrue(X.getCause(ex).getMessage().contains("Cannot serialize transaction due to write conflict")); - } - else - readFut.get(); - } - - /** - * Create a new connection, a new transaction and run given closure in its scope. - * @param clo Closure. - * @throws SQLException if failed. - */ - private void executeInTransaction(TransactionClosure clo) throws SQLException { - try (Connection conn = connect()) { - executeInTransaction(conn, clo); - } - } - - /** - * Create a new transaction and run given closure in its scope. - * @param conn Connection. - * @param clo Closure. - * @throws SQLException if failed. - */ - private void executeInTransaction(Connection conn, TransactionClosure clo) throws SQLException { - begin(conn); - - clo.apply(conn); - - commit(conn); - } - - /** - * @return Auto commit strategy for this test. - */ - abstract boolean autoCommit(); - - /** - * @param c Connection to begin a transaction on. - */ - private void begin(Connection c) { - if (autoCommit()) - execute(c, "BEGIN"); - } - - /** - * @param c Connection to begin a transaction on. - */ - private void commit(Connection c) throws SQLException { - if (autoCommit()) - execute(c, "COMMIT"); - else - c.commit(); - } - - /** - * @param c Connection to rollback a transaction on. - */ - private void rollback(Connection c) { - try { - if (autoCommit()) - execute(c, "ROLLBACK"); - else - c.rollback(); - } - catch (SQLException e) { - throw new IgniteException(e); - } - } - - /** - * @param sql Statement. - * @param args Arguments. - * @return Result set. - * @throws SQLException if failed. - */ - List> execute(String sql, Object... args) throws SQLException { - try (Connection c = connect()) { - c.setAutoCommit(true); - - return execute(c, sql, args); - } - } - - /** - * @param sql Statement. - * @param args Arguments. - * @return Result set. - * @throws RuntimeException if failed. - */ - @Override protected List> execute(Connection conn, String sql, Object... args) { - try { - return super.execute(conn, sql, args); - } - catch (SQLException e) { - throw new IgniteException(e); - } - } - - /** - * @return New connection to default node. - * @throws SQLException if failed. - */ - private Connection connect() throws SQLException { - return connect(null); - } - - /** - * @param params Connection parameters. - * @return New connection to default node. - * @throws SQLException if failed. - */ - private Connection connect(String params) throws SQLException { - Connection c = connect(node(), params); - - c.setAutoCommit(false); - - return c; - } - - /** - * @param node Node to connect to. - * @param params Connection parameters. - * @return Thin JDBC connection to specified node. - */ - @Override protected Connection connect(IgniteEx node, String params) { - try { - return super.connect(node, params); - } - catch (SQLException e) { - throw new AssertionError(e); - } - } - - /** - * @return Default node to fire queries from. - */ - private IgniteEx node() { - return grid(nodeIndex()); - } - - /** - * @return {@link Person} cache. - */ - private IgniteCache personCache() { - return node().cache("Person"); - } - - /** - * @return Node index to fire queries from. - */ - abstract int nodeIndex(); - - /** - * @param id New person's id. - * @param firstName First name. - * @param lastName Second name. - * @param cityId City id. - * @param companyId Company id. - * @throws SQLException if failed. - */ - private void insertPerson(final int id, final String firstName, final String lastName, final int cityId, - final int companyId) throws SQLException { - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - insertPerson(conn, id, firstName, lastName, cityId, companyId); - } - }); - } - - /** - * @param c Connection. - * @param id New person's id. - * @param firstName First name. - * @param lastName Second name. - * @param cityId City id. - * @param companyId Company id. - */ - private void insertPerson(Connection c, int id, String firstName, String lastName, int cityId, int companyId) { - execute(c, "INSERT INTO \"Person\".person (id, firstName, lastName, cityId, companyId) values (?, ?, ?, ?, ?)", - id, firstName, lastName, cityId, companyId); - } - - /** - * @param id New city's id. - * @param name City name. - * @param population Number of people. - * @throws SQLException if failed. - */ - private void insertCity(final int id, final String name, final int population) throws SQLException { - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - insertCity(conn, id, name, population); - } - }); - } - - /** - * @param c Connection. - * @param id New city's id. - * @param name City name. - * @param population Number of people. - */ - private void insertCity(Connection c, int id, String name, int population) { - execute(c, "INSERT INTO city (id, name, population) values (?, ?, ?)", id, name, population); - } - - /** - * @param id New company's id. - * @param name Company name. - * @param cityId City id. - * @throws SQLException if failed. - */ - private void insertCompany(final int id, final String name, final int cityId) throws SQLException { - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - insertCompany(conn, id, name, cityId); - } - }); - } - - /** - * @param c Connection. - * @param id New company's id. - * @param name Company name. - * @param cityId City id. - */ - private void insertCompany(Connection c, int id, String name, int cityId) { - execute(c, "INSERT INTO company (id, name, \"cityid\") values (?, ?, ?)", id, name, cityId); - } - - /** - * @param id New product's id. - * @param name Product name. - * @param companyId Company id.. - * @throws SQLException if failed. - */ - private void insertProduct(final int id, final String name, final int companyId) throws SQLException { - executeInTransaction(new TransactionClosure() { - @Override public void apply(Connection conn) { - insertProduct(conn, id, name, companyId); - } - }); - } - - /** - * @param c Connection. - * @param id New product's id. - * @param name Product name. - * @param companyId Company id.. - */ - private void insertProduct(Connection c, int id, String name, int companyId) { - execute(c, "INSERT INTO product (id, name, companyid) values (?, ?, ?)", id, name, companyId); - } - - /** - * Person class. - */ - private static final class Person { - /** */ - @QuerySqlField - public int id; - - /** */ - @QuerySqlField - public String firstName; - - /** */ - @QuerySqlField - public String lastName; - } - - /** - * Closure to be executed in scope of a transaction. - */ - private abstract static class TransactionClosure implements IgniteInClosure { - // No-op. - } - - /** - * @return List of given arguments. - */ - private static List l(Object... args) { - return F.asList(args); - } - - /** - * Flatten rows. - * @param rows Rows. - * @return Rows as a single list. - */ - private static List flat(Collection> rows) { - return new ArrayList<>(F.flatCollections((Collection>)rows)); - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsClientAutoCommitComplexSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsClientAutoCommitComplexSelfTest.java deleted file mode 100644 index d5b505a784a03..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsClientAutoCommitComplexSelfTest.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.jdbc.thin; - -/** - * - */ -public class JdbcThinTransactionsClientAutoCommitComplexSelfTest extends JdbcThinTransactionsAbstractComplexSelfTest { - /** {@inheritDoc} */ - @Override boolean autoCommit() { - return true; - } - - /** {@inheritDoc} */ - @Override int nodeIndex() { - return CLI_IDX; - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.java deleted file mode 100644 index 7fa69fdc468a3..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsClientNoAutoCommitComplexSelfTest.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.jdbc.thin; - -/** - * - */ -public class JdbcThinTransactionsClientNoAutoCommitComplexSelfTest extends JdbcThinTransactionsAbstractComplexSelfTest { - /** {@inheritDoc} */ - @Override boolean autoCommit() { - return false; - } - - /** {@inheritDoc} */ - @Override int nodeIndex() { - return CLI_IDX; - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsLeaksMvccTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsLeaksMvccTest.java deleted file mode 100644 index 8da619d3bece1..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsLeaksMvccTest.java +++ /dev/null @@ -1,151 +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.jdbc.thin; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Set; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.query.NestedTxMode; -import org.apache.ignite.internal.processors.query.h2.ConnectionManager; -import org.apache.ignite.internal.processors.query.h2.H2Connection; -import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.WithSystemProperty; -import org.junit.Test; - -import static org.apache.ignite.IgniteSystemProperties.IGNITE_MAX_COMPLETED_TX_COUNT; - -/** - * Tests to check leaks at the ConnectionManager#detachedConns map. - */ -public class JdbcThinTransactionsLeaksMvccTest extends JdbcThinAbstractSelfTest { - /** */ - private static final String URL = "jdbc:ignite:thin://127.0.0.1"; - - /** Keys count. */ - private static final int KEYS = 10; - - /** Iterations count. */ - private static final int ITERATIONS = 1_000; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - return super.getConfiguration(igniteInstanceName) - .setSystemWorkerBlockedTimeout(Long.MAX_VALUE); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - startGrids(3); - - try (Connection c = c(true, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - s.execute("CREATE TABLE TEST (k int primary key, v int) WITH \"atomicity=transactional_snapshot\""); - - for (int i = 0; i < KEYS; ++i) - s.execute("INSERT INTO TEST VALUES (" + i + ", " + i + ")"); - - } - } - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** - * @param autoCommit Auto commit mode. - * @param nestedTxMode Nested transactions mode. - * @return Connection. - * @throws SQLException if failed. - */ - private static Connection c(boolean autoCommit, NestedTxMode nestedTxMode) throws SQLException { - Connection res = DriverManager.getConnection(URL + "/?nestedTransactionsMode=" + nestedTxMode.name()); - - res.setAutoCommit(autoCommit); - - return res; - } - - /** - * - */ - @Test - @WithSystemProperty(key = IGNITE_MAX_COMPLETED_TX_COUNT, value = "1024") - public void testLeaks() { - runQueries(ITERATIONS); - - int prevUsedConns = usedConnectionCount(grid(0)); - - runQueries(ITERATIONS * 2); - - int curUsedConns = usedConnectionCount(grid(0)); - - assertTrue("Detached connection leaks: prevSize=" + prevUsedConns + ", curSize=" + curUsedConns, - curUsedConns < prevUsedConns * 2 + 1); - } - - /** - * @param iters Count of queries. - */ - private void runQueries(int iters) { - for (int i = 0; i < iters; ++i) { - try (Connection c = c(false, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - s.execute("BEGIN"); - - s.execute("SELECT * FROM TEST"); - - ResultSet rs = s.getResultSet(); - - int cnt = 0; - - while (rs.next()) - ++cnt; - - assertEquals(KEYS, cnt); - - c.commit(); - } - } - catch (SQLException e) { - throw new AssertionError(e); - } - } - } - - /** - * @param igx Node. - * @return Count of detached connections. - */ - private int usedConnectionCount(IgniteEx igx) { - ConnectionManager connMgr = ((IgniteH2Indexing)igx.context().query().getIndexing()).connections(); - - Set usedConns = GridTestUtils.getFieldValue(connMgr, "usedConns"); - - return usedConns.size(); - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java deleted file mode 100644 index 7100eb73ed8bd..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsSelfTest.java +++ /dev/null @@ -1,468 +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.jdbc.thin; - -import java.sql.BatchUpdateException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.binary.BinaryMarshaller; -import org.apache.ignite.internal.processors.query.NestedTxMode; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.GridStringLogger; -import org.apache.ignite.testframework.GridTestUtils; -import org.jetbrains.annotations.NotNull; -import org.junit.Test; - -/** - * Tests to check behavior with transactions on. - */ -public class JdbcThinTransactionsSelfTest extends JdbcThinAbstractSelfTest { - /** */ - private static final String URL = "jdbc:ignite:thin://127.0.0.1"; - - /** Logger. */ - private GridStringLogger log; - - /** {@inheritDoc} */ - @SuppressWarnings({"deprecation", "unchecked"}) - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME).setNearConfiguration(null)); - - cfg.setMarshaller(new BinaryMarshaller()); - - cfg.setGridLogger(log = new GridStringLogger()); - - return cfg; - } - - /** - * @param name Cache name. - * @return Cache configuration. - * @throws Exception In case of error. - */ - private CacheConfiguration cacheConfiguration(@NotNull String name) throws Exception { - CacheConfiguration cfg = defaultCacheConfiguration(); - - cfg.setName(name); - cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - startGrid(0); - - try (Connection c = c(true, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - s.execute("CREATE TABLE INTS (k int primary key, v int) WITH \"cache_name=ints,wrap_value=false," + - "atomicity=transactional_snapshot\""); - } - } - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** - * @param autoCommit Auto commit mode. - * @param nestedTxMode Nested transactions mode. - * @return Connection. - * @throws SQLException if failed. - */ - private static Connection c(boolean autoCommit, NestedTxMode nestedTxMode) throws SQLException { - Connection res = DriverManager.getConnection(URL + "/?nestedTransactionsMode=" + nestedTxMode.name()); - - res.setAutoCommit(autoCommit); - - return res; - } - - /** - * - */ - @Test - public void testTransactionsBeginCommitRollback() throws IgniteCheckedException { - final AtomicBoolean stop = new AtomicBoolean(); - - IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Runnable() { - @Override public void run() { - try { - try (Connection c = c(false, NestedTxMode.ERROR)) { - while (!stop.get()) { - try (Statement s = c.createStatement()) { - s.execute("BEGIN"); - - c.commit(); - - s.execute("BEGIN"); - - c.rollback(); - } - } - } - } - catch (SQLException e) { - throw new AssertionError(e); - } - } - }, 8, "jdbc-transactions"); - - U.sleep(5000); - - stop.set(true); - - fut.get(); - } - - /** - * - */ - @Test - public void testTransactionsBeginCommitRollbackAutocommit() throws IgniteCheckedException { - GridTestUtils.runMultiThreadedAsync(new Runnable() { - @Override public void run() { - try { - try (Connection c = c(true, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - s.execute("BEGIN"); - - s.execute("COMMIT"); - - s.execute("BEGIN"); - - s.execute("ROLLBACK"); - } - } - } - catch (SQLException e) { - throw new AssertionError(e); - } - } - }, 8, "jdbc-transactions").get(); - } - - /** - * - */ - @Test - public void testIgnoreNestedTxAutocommitOff() throws SQLException { - try (Connection c = c(false, NestedTxMode.IGNORE)) { - doNestedTxStart(c, false); - } - - assertTrue(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testCommitNestedTxAutocommitOff() throws SQLException { - try (Connection c = c(false, NestedTxMode.COMMIT)) { - doNestedTxStart(c, false); - } - - assertFalse(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testErrorNestedTxAutocommitOff() throws SQLException { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - try (Connection c = c(false, NestedTxMode.ERROR)) { - doNestedTxStart(c, false); - } - - throw new AssertionError(); - } - }, SQLException.class, "Transaction has already been started."); - } - - /** - * - */ - @Test - public void testIgnoreNestedTxAutocommitOn() throws SQLException { - try (Connection c = c(true, NestedTxMode.IGNORE)) { - doNestedTxStart(c, false); - } - - assertTrue(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testCommitNestedTxAutocommitOn() throws SQLException { - try (Connection c = c(true, NestedTxMode.COMMIT)) { - doNestedTxStart(c, false); - } - - assertFalse(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testErrorNestedTxAutocommitOn() throws SQLException { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - try (Connection c = c(true, NestedTxMode.ERROR)) { - doNestedTxStart(c, false); - } - - throw new AssertionError(); - } - }, SQLException.class, "Transaction has already been started."); - } - - /** - * - */ - @Test - public void testIgnoreNestedTxAutocommitOffBatched() throws SQLException { - try (Connection c = c(false, NestedTxMode.IGNORE)) { - doNestedTxStart(c, true); - } - - assertTrue(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testCommitNestedTxAutocommitOffBatched() throws SQLException { - try (Connection c = c(false, NestedTxMode.COMMIT)) { - doNestedTxStart(c, true); - } - - assertFalse(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testErrorNestedTxAutocommitOffBatched() throws SQLException { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - try (Connection c = c(false, NestedTxMode.ERROR)) { - doNestedTxStart(c, true); - } - - throw new AssertionError(); - } - }, BatchUpdateException.class, "Transaction has already been started."); - } - - /** - * - */ - @Test - public void testIgnoreNestedTxAutocommitOnBatched() throws SQLException { - try (Connection c = c(true, NestedTxMode.IGNORE)) { - doNestedTxStart(c, true); - } - - assertTrue(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testCommitNestedTxAutocommitOnBatched() throws SQLException { - try (Connection c = c(true, NestedTxMode.COMMIT)) { - doNestedTxStart(c, true); - } - - assertFalse(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testErrorNestedTxAutocommitOnBatched() throws SQLException { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - try (Connection c = c(true, NestedTxMode.ERROR)) { - doNestedTxStart(c, true); - } - - throw new AssertionError(); - } - }, BatchUpdateException.class, "Transaction has already been started."); - } - - /** - * Try to start nested transaction via batch as well as separate statements. - * @param conn Connection. - * @param batched Whether {@link Statement#executeBatch()} should be used. - * @throws SQLException if failed. - */ - private void doNestedTxStart(Connection conn, boolean batched) throws SQLException { - try (Statement s = conn.createStatement()) { - s.executeQuery("SELECT * FROM INTS"); - - if (batched) { - s.addBatch("BEGIN"); - - s.addBatch("BEGIN"); - - s.executeBatch(); - } - else { - s.execute("BEGIN"); - - s.execute("BEGIN"); - } - } - } - - /** - * @throws SQLException if failed. - */ - @Test - public void testAutoCommitSingle() throws SQLException { - doTestAutoCommit(false); - } - - /** - * @throws SQLException if failed. - */ - @Test - public void testAutoCommitBatched() throws SQLException { - doTestAutoCommit(true); - } - - /** - * @param batched Batch mode flag. - * @throws SQLException if failed. - */ - private void doTestAutoCommit(boolean batched) throws SQLException { - IgniteCache cache = grid(0).cache("ints"); - - try (Connection c = c(false, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - assertFalse(s.executeQuery("SELECT * from INTS").next()); - - if (batched) { - s.addBatch("INSERT INTO INTS(k, v) values(1, 1)"); - - s.executeBatch(); - } - else - s.execute("INSERT INTO INTS(k, v) values(1, 1)"); - - // We haven't committed anything yet - this check shows that autoCommit flag is in effect. - assertTrue(cache.query(new SqlFieldsQuery("SELECT * from INTS")).getAll().isEmpty()); - - // We should see own updates. - assertTrue(s.executeQuery("SELECT * from INTS").next()); - - c.commit(); - - c.setAutoCommit(true); - - assertEquals(1, cache.get(1)); - - assertTrue(s.executeQuery("SELECT * from INTS").next()); - } - } - } - - /** - * Test that exception in one of the statements does not kill connection worker altogether. - * @throws SQLException if failed. - */ - @Test - public void testExceptionHandling() throws SQLException { - try (Connection c = c(true, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - s.execute("INSERT INTO INTS(k, v) values(1, 1)"); - - assertEquals(1, grid(0).cache("ints").get(1)); - - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - s.execute("INSERT INTO INTS(x, y) values(1, 1)"); - - return null; - } - }, SQLException.class, "Failed to parse query"); - - s.execute("INSERT INTO INTS(k, v) values(2, 2)"); - - assertEquals(2, grid(0).cache("ints").get(2)); - } - } - } - - /** - * Test that exception in one of the statements does not kill connection worker altogether. - * @throws SQLException if failed. - */ - @Test - public void testParsingErrorHasNoSideEffect() throws SQLException { - try (Connection c = c(false, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - s.execute("INSERT INTO INTS(k, v) values(1, 1)"); - - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - s.execute("INSERT INTO INTS(k, v) values(1)"); - - return null; - } - }, SQLException.class, "Failed to parse query"); - - s.execute("INSERT INTO INTS(k, v) values(2, 2)"); - - c.commit(); - } - - assertEquals(1, grid(0).cache("ints").get(1)); - assertEquals(2, grid(0).cache("ints").get(2)); - } - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsServerAutoCommitComplexSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsServerAutoCommitComplexSelfTest.java deleted file mode 100644 index 3c473ab872d5f..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsServerAutoCommitComplexSelfTest.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.jdbc.thin; - -/** - * - */ -public class JdbcThinTransactionsServerAutoCommitComplexSelfTest extends JdbcThinTransactionsAbstractComplexSelfTest { - /** {@inheritDoc} */ - @Override boolean autoCommit() { - return true; - } - - /** {@inheritDoc} */ - @Override int nodeIndex() { - return 0; - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.java deleted file mode 100644 index 655d4c5c8f934..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsServerNoAutoCommitComplexSelfTest.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.jdbc.thin; - -/** - * - */ -public class JdbcThinTransactionsServerNoAutoCommitComplexSelfTest extends JdbcThinTransactionsAbstractComplexSelfTest { - /** {@inheritDoc} */ - @Override boolean autoCommit() { - return false; - } - - /** {@inheritDoc} */ - @Override int nodeIndex() { - return 0; - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsWithMvccEnabledSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsWithMvccEnabledSelfTest.java deleted file mode 100644 index 5521d85ebf64c..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinTransactionsWithMvccEnabledSelfTest.java +++ /dev/null @@ -1,439 +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.jdbc.thin; - -import java.sql.BatchUpdateException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.binary.BinaryMarshaller; -import org.apache.ignite.internal.processors.query.NestedTxMode; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.GridStringLogger; -import org.apache.ignite.testframework.GridTestUtils; -import org.jetbrains.annotations.NotNull; -import org.junit.Test; - -/** - * Tests to check behavior with transactions on. - */ -public class JdbcThinTransactionsWithMvccEnabledSelfTest extends JdbcThinAbstractSelfTest { - /** */ - private static final String URL = "jdbc:ignite:thin://127.0.0.1"; - - /** Logger. */ - private GridStringLogger log; - - /** {@inheritDoc} */ - @SuppressWarnings({"deprecation", "unchecked"}) - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME).setNearConfiguration(null)); - - cfg.setMarshaller(new BinaryMarshaller()); - - cfg.setGridLogger(log = new GridStringLogger()); - - return cfg; - } - - /** - * @param name Cache name. - * @return Cache configuration. - */ - private CacheConfiguration cacheConfiguration(@NotNull String name) { - CacheConfiguration cfg = defaultCacheConfiguration(); - - cfg.setName(name); - cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - startGrid(0); - - try (Connection c = c(true, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - s.execute("CREATE TABLE INTS (k int primary key, v int) WITH \"cache_name=ints,wrap_value=false," + - "atomicity=transactional_snapshot\""); - } - } - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** - * @param autoCommit Auto commit mode. - * @param nestedTxMode Nested transactions mode. - * @return Connection. - * @throws SQLException if failed. - */ - private static Connection c(boolean autoCommit, NestedTxMode nestedTxMode) throws SQLException { - Connection res = DriverManager.getConnection(URL + "/?nestedTransactionsMode=" + nestedTxMode.name()); - - res.setAutoCommit(autoCommit); - - return res; - } - - /** - * - */ - @Test - public void testTransactionsBeginCommitRollback() throws IgniteCheckedException { - final AtomicBoolean stop = new AtomicBoolean(); - - IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Runnable() { - @Override public void run() { - try { - try (Connection c = c(false, NestedTxMode.ERROR)) { - while (!stop.get()) { - try (Statement s = c.createStatement()) { - s.execute("BEGIN"); - - c.commit(); - - s.execute("BEGIN"); - - c.rollback(); - } - } - } - } - catch (SQLException e) { - throw new AssertionError(e); - } - } - }, 8, "jdbc-transactions"); - - U.sleep(5000); - - stop.set(true); - - fut.get(); - } - - /** - * - */ - @Test - public void testTransactionsBeginCommitRollbackAutocommit() throws IgniteCheckedException { - GridTestUtils.runMultiThreadedAsync(new Runnable() { - @Override public void run() { - try { - try (Connection c = c(true, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - s.execute("BEGIN"); - - s.execute("COMMIT"); - - s.execute("BEGIN"); - - s.execute("ROLLBACK"); - } - } - } - catch (SQLException e) { - throw new AssertionError(e); - } - } - }, 8, "jdbc-transactions").get(); - } - - /** - * - */ - @Test - public void testIgnoreNestedTxAutocommitOff() throws SQLException { - try (Connection c = c(false, NestedTxMode.IGNORE)) { - doNestedTxStart(c, false); - } - - assertTrue(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testCommitNestedTxAutocommitOff() throws SQLException { - try (Connection c = c(false, NestedTxMode.COMMIT)) { - doNestedTxStart(c, false); - } - - assertFalse(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testErrorNestedTxAutocommitOff() { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - try (Connection c = c(false, NestedTxMode.ERROR)) { - doNestedTxStart(c, false); - } - - throw new AssertionError(); - } - }, SQLException.class, "Transaction has already been started."); - } - - /** - * - */ - @Test - public void testIgnoreNestedTxAutocommitOn() throws SQLException { - try (Connection c = c(true, NestedTxMode.IGNORE)) { - doNestedTxStart(c, false); - } - - assertTrue(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testCommitNestedTxAutocommitOn() throws SQLException { - try (Connection c = c(true, NestedTxMode.COMMIT)) { - doNestedTxStart(c, false); - } - - assertFalse(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testErrorNestedTxAutocommitOn() { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - try (Connection c = c(true, NestedTxMode.ERROR)) { - doNestedTxStart(c, false); - } - - throw new AssertionError(); - } - }, SQLException.class, "Transaction has already been started."); - } - - /** - * - */ - @Test - public void testIgnoreNestedTxAutocommitOffBatched() throws SQLException { - try (Connection c = c(false, NestedTxMode.IGNORE)) { - doNestedTxStart(c, true); - } - - assertTrue(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testCommitNestedTxAutocommitOffBatched() throws SQLException { - try (Connection c = c(false, NestedTxMode.COMMIT)) { - doNestedTxStart(c, true); - } - - assertFalse(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testErrorNestedTxAutocommitOffBatched() { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - try (Connection c = c(false, NestedTxMode.ERROR)) { - doNestedTxStart(c, true); - } - - throw new AssertionError(); - } - }, BatchUpdateException.class, "Transaction has already been started."); - } - - /** - * - */ - @Test - public void testIgnoreNestedTxAutocommitOnBatched() throws SQLException { - try (Connection c = c(true, NestedTxMode.IGNORE)) { - doNestedTxStart(c, true); - } - - assertTrue(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testCommitNestedTxAutocommitOnBatched() throws SQLException { - try (Connection c = c(true, NestedTxMode.COMMIT)) { - doNestedTxStart(c, true); - } - - assertFalse(log.toString().contains("ignoring BEGIN command")); - } - - /** - * - */ - @Test - public void testErrorNestedTxAutocommitOnBatched() { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - try (Connection c = c(true, NestedTxMode.ERROR)) { - doNestedTxStart(c, true); - } - - throw new AssertionError(); - } - }, BatchUpdateException.class, "Transaction has already been started."); - } - - /** - * Try to start nested transaction via batch as well as separate statements. - * @param conn Connection. - * @param batched Whether {@link Statement#executeBatch()} should be used. - * @throws SQLException if failed. - */ - private void doNestedTxStart(Connection conn, boolean batched) throws SQLException { - try (Statement s = conn.createStatement()) { - s.executeQuery("SELECT * FROM INTS"); - - if (batched) { - s.addBatch("BEGIN"); - - s.addBatch("BEGIN"); - - s.executeBatch(); - } - else { - s.execute("BEGIN"); - - s.execute("BEGIN"); - } - } - } - - /** - * @throws SQLException if failed. - */ - @Test - public void testAutoCommitSingle() throws SQLException { - doTestAutoCommit(false); - } - - /** - * @throws SQLException if failed. - */ - @Test - public void testAutoCommitBatched() throws SQLException { - doTestAutoCommit(true); - } - - /** - * @param batched Batch mode flag. - * @throws SQLException if failed. - */ - private void doTestAutoCommit(boolean batched) throws SQLException { - IgniteCache cache = grid(0).cache("ints"); - - try (Connection c = c(false, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - assertFalse(s.executeQuery("SELECT * from INTS").next()); - - if (batched) { - s.addBatch("INSERT INTO INTS(k, v) values(1, 1)"); - - s.executeBatch(); - } - else - s.execute("INSERT INTO INTS(k, v) values(1, 1)"); - - // We haven't committed anything yet - this check shows that autoCommit flag is in effect. - assertTrue(cache.query(new SqlFieldsQuery("SELECT * from INTS")).getAll().isEmpty()); - - // We should see own updates. - assertTrue(s.executeQuery("SELECT * from INTS").next()); - - c.commit(); - - c.setAutoCommit(true); - - assertEquals(1, cache.get(1)); - - assertTrue(s.executeQuery("SELECT * from INTS").next()); - } - } - } - - /** - * Test that exception in one of the statements does not kill connection worker altogether. - * @throws SQLException if failed. - */ - @Test - public void testExceptionHandling() throws SQLException { - try (Connection c = c(true, NestedTxMode.ERROR)) { - try (Statement s = c.createStatement()) { - s.execute("INSERT INTO INTS(k, v) values(1, 1)"); - - assertEquals(1, grid(0).cache("ints").get(1)); - - GridTestUtils.assertThrows(null, new Callable() { - @Override public Void call() throws Exception { - s.execute("INSERT INTO INTS(x, y) values(1, 1)"); - - return null; - } - }, SQLException.class, "Failed to parse query"); - - s.execute("INSERT INTO INTS(k, v) values(2, 2)"); - - assertEquals(2, grid(0).cache("ints").get(2)); - } - } - } -} diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/MvccJdbcTransactionFinishOnDeactivatedClusterSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/MvccJdbcTransactionFinishOnDeactivatedClusterSelfTest.java deleted file mode 100644 index 98609a9478510..0000000000000 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/MvccJdbcTransactionFinishOnDeactivatedClusterSelfTest.java +++ /dev/null @@ -1,162 +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.jdbc.thin; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.Statement; -import java.util.Collections; -import java.util.concurrent.CountDownLatch; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.ConnectorConfiguration; -import org.apache.ignite.configuration.DataRegionConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.client.GridClient; -import org.apache.ignite.internal.client.GridClientClusterState; -import org.apache.ignite.internal.client.GridClientConfiguration; -import org.apache.ignite.internal.client.GridClientFactory; -import org.apache.ignite.internal.util.lang.GridAbsPredicate; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Test; - -import static org.apache.ignite.cluster.ClusterState.INACTIVE; - -/** */ -public class MvccJdbcTransactionFinishOnDeactivatedClusterSelfTest extends GridCommonAbstractTest { - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - cleanPersistenceDir(); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - return super.getConfiguration(igniteInstanceName) - .setConnectorConfiguration(new ConnectorConfiguration()) - .setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration( - new DataRegionConfiguration().setPersistenceEnabled(true)) - ); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTxCommitAfterDeactivation() throws Exception { - checkTxFinishAfterDeactivation(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTxRollbackAfterDeactivation() throws Exception { - checkTxFinishAfterDeactivation(false); - } - - /** */ - public void checkTxFinishAfterDeactivation(boolean commit) throws Exception { - IgniteEx node0 = startGrid(0); - - node0.cluster().state(ClusterState.ACTIVE); - - try (Connection conn = connect()) { - execute(conn, "CREATE TABLE t1(a INT, b VARCHAR, PRIMARY KEY(a)) WITH \"atomicity=TRANSACTIONAL_SNAPSHOT,backups=1\""); - } - - final CountDownLatch enlistedLatch = new CountDownLatch(1); - - assert node0.cluster().state().active(); - - IgniteInternalFuture txFinishedFut = GridTestUtils.runAsync(() -> { - executeTransaction(commit, enlistedLatch, () -> !node0.context().state().publicApiActiveState(true)); - - return null; - }); - - enlistedLatch.await(); - - deactivateThroughClient(); - - log.info(">>> Cluster deactivated ..."); - - try { - txFinishedFut.get(); - } - catch (Exception e) { - e.printStackTrace(); - - fail("Exception is not expected here"); - } - } - - /** */ - private void executeTransaction(boolean commit, CountDownLatch enlistedLatch, - GridAbsPredicate beforeCommitCondition) throws Exception { - try (Connection conn = connect()) { - execute(conn, "BEGIN"); - - execute(conn, "INSERT INTO t1 VALUES (1, '1')"); - - log.info(">>> Started transaction and enlisted entries"); - - enlistedLatch.countDown(); - - GridTestUtils.waitForCondition(beforeCommitCondition, 5_000); - - log.info(">>> Attempting to finish transaction"); - - execute(conn, commit ? "COMMIT" : "ROLLBACK"); - } - } - - /** */ - private static Connection connect() throws Exception { - return DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1"); - } - - /** */ - private static void execute(Connection conn, String sql) throws Exception { - try (Statement stmt = conn.createStatement()) { - stmt.executeUpdate(sql); - } - } - - /** */ - private void deactivateThroughClient() throws Exception { - GridClientConfiguration clientCfg = new GridClientConfiguration(); - - clientCfg.setServers(Collections.singletonList("127.0.0.1:11211")); - - try (GridClient client = GridClientFactory.start(clientCfg)) { - GridClientClusterState state = client.state(); - - log.info(">>> Try to deactivate ..."); - - state.state(INACTIVE, true); - } - } -} diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java index 5fb101aebcefd..b0682d54a364f 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java @@ -1628,10 +1628,6 @@ public final class IgniteSystemProperties { defaults = "" + DFLT_ALLOW_START_CACHES_IN_PARALLEL) public static final String IGNITE_ALLOW_START_CACHES_IN_PARALLEL = "IGNITE_ALLOW_START_CACHES_IN_PARALLEL"; - /** For test purposes only. Force Mvcc mode. */ - @SystemProperty("For test purposes only. Force Mvcc mode") - public static final String IGNITE_FORCE_MVCC_MODE_IN_TESTS = "IGNITE_FORCE_MVCC_MODE_IN_TESTS"; - /** * Allows to log additional information about all restored partitions after binary and logical recovery phases. * 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 f34fa5f71ce61..f8b5ff2a75d9e 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 @@ -138,4 +138,14 @@ 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 MVCC removal 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/CacheInvokeEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java index 44a51ecf181a4..cb79a55879244 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java @@ -96,27 +96,10 @@ public CacheInvokeEntry(KeyCacheObject keyObj, /** {@inheritDoc} */ @Override public void remove() { - if (!entry.isMvcc()) { - if (op == Operation.CREATE) - op = Operation.NONE; - else - op = Operation.REMOVE; - } - else { - if (op == Operation.CREATE) { - assert !hadVal; - - op = Operation.NONE; - } - else if (exists()) { - assert hadVal; - - op = Operation.REMOVE; - } - - if (hadVal && oldVal == null) - oldVal = val; - } + if (op == Operation.CREATE) + op = Operation.NONE; + else + op = Operation.REMOVE; val = null; valObj = null; @@ -127,13 +110,7 @@ else if (exists()) { if (val == null) throw new NullPointerException(); - if (!entry.isMvcc()) - this.oldVal = this.val; - else { - if (hadVal && oldVal == null) - this.oldVal = this.val; - } - + this.oldVal = this.val; this.val = val; op = hadVal ? Operation.UPDATE : Operation.CREATE; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java index 431ba34b01778..ba15b79bab17d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java @@ -77,11 +77,6 @@ public interface GridCacheEntryEx { */ public boolean isLocal(); - /** - * @return {@code True} if this is n entry from MVCC cache. - */ - public boolean isMvcc(); - /** * @return {@code False} if entry belongs to cache map, {@code true} if this entry was created in colocated * cache and node is not primary for this key. 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 f45f803136d74..70b4c5870e48d 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 @@ -107,6 +107,7 @@ import org.apache.ignite.thread.IgniteThread; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import static org.apache.ignite.IgniteSystemProperties.getLong; import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_EXPIRED; import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_LOCKED; @@ -336,11 +337,6 @@ protected void value(@Nullable CacheObject val) { return false; } - /** {@inheritDoc} */ - @Override public boolean isMvcc() { - return cctx.mvccEnabled(); - } - /** {@inheritDoc} */ @Override public boolean isNear() { return false; 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 fd81372fa474d..e23607f70658b 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 @@ -37,7 +37,6 @@ import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteLogger; -import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.DataRegionConfiguration; @@ -111,7 +110,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.events.EventType.EVT_NODE_FAILED; import static org.apache.ignite.events.EventType.EVT_NODE_JOINED; @@ -141,10 +139,6 @@ */ @SuppressWarnings("unchecked") public class MvccProcessorImpl extends GridProcessorAdapter implements MvccProcessor, DatabaseLifecycleListener { - /** */ - private static final boolean FORCE_MVCC = - IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, false); - /** */ private static final IgniteProductVersion MVCC_SUPPORTED_SINCE = IgniteProductVersion.fromString("2.7.0"); @@ -280,12 +274,6 @@ public MvccProcessorImpl(GridKernalContext ctx) { /** {@inheritDoc} */ @Override public void preProcessCacheConfiguration(CacheConfiguration ccfg) { - if (FORCE_MVCC && ccfg.getAtomicityMode() == TRANSACTIONAL && !CU.isSystemCache(ccfg.getName())) { - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - //noinspection unchecked - ccfg.setNearConfiguration(null); - } - if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) { if (!mvccSupported) throw new IgniteException("Cannot start MVCC transactional cache. " + diff --git a/modules/core/src/test/java/org/apache/ignite/cache/IgniteCacheEntryProcessorSequentialCallTest.java b/modules/core/src/test/java/org/apache/ignite/cache/IgniteCacheEntryProcessorSequentialCallTest.java index 33a37dcf28432..2a8b41b190a9b 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/IgniteCacheEntryProcessorSequentialCallTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/IgniteCacheEntryProcessorSequentialCallTest.java @@ -39,9 +39,6 @@ public class IgniteCacheEntryProcessorSequentialCallTest extends GridCommonAbstr /** */ private static final String CACHE = "cache"; - /** */ - private static final String MVCC_CACHE = "mvccCache"; - /** */ private String cacheName; @@ -68,10 +65,7 @@ public class IgniteCacheEntryProcessorSequentialCallTest extends GridCommonAbstr CacheConfiguration ccfg = cacheConfiguration(CACHE); - CacheConfiguration mvccCfg = cacheConfiguration(MVCC_CACHE) - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - - cfg.setCacheConfiguration(ccfg, mvccCfg); + cfg.setCacheConfiguration(ccfg); return cfg; } @@ -153,18 +147,6 @@ public void testPessimisticReadCommittedTxInvokeSequentialCall() throws Exceptio transactionInvokeSequentialCallOnNearNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.READ_COMMITTED); } - /** - * - */ - @Test - public void testMvccTxInvokeSequentialCall() throws Exception { - cacheName = MVCC_CACHE; - - transactionInvokeSequentialCallOnPrimaryNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); - - transactionInvokeSequentialCallOnNearNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); - } - /** * Test for sequential entry processor invoking not null value on primary cache. * In this test entry processor gets value from local node. diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java index 86f0ab376241d..1a45de8302003 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java @@ -20,12 +20,9 @@ import java.util.Random; import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -41,19 +38,6 @@ */ public class CacheStoreListenerRWThroughDisabledTransactionalCacheTest extends CacheStoreSessionListenerReadWriteThroughDisabledAbstractTest { - /** */ - @Before - public void beforeCacheStoreListenerRWThroughDisabledTransactionalCacheTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - return super.cacheConfiguration(igniteInstanceName); - } - /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java index 556fb40997d9e..defb387d4392b 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java @@ -31,10 +31,8 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.lifecycle.LifecycleAware; import org.apache.ignite.resources.IgniteInstanceResource; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -46,12 +44,6 @@ public class CacheStoreSessionListenerLifecycleSelfTest extends GridCommonAbstra /** */ private static final Queue evts = new ConcurrentLinkedDeque<>(); - /** */ - @Before - public void beforeCacheStoreSessionListenerLifecycleSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java index 8ce62e7701760..8cae78788d401 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java @@ -44,8 +44,6 @@ import org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore; import org.apache.ignite.resources.CacheStoreSessionResource; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import org.junit.Test; /** @@ -76,8 +74,6 @@ public class CacheStoreSessionListenerWriteBehindEnabledTest extends GridCacheAb /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - CacheConfiguration cacheCfg = super.cacheConfiguration(igniteInstanceName); cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(EmptyCacheStore.class)); @@ -96,12 +92,6 @@ public class CacheStoreSessionListenerWriteBehindEnabledTest extends GridCacheAb return cacheCfg; } - /** */ - @Before - public void beforeCacheStoreSessionListenerWriteBehindEnabledTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheTransactionalStoreReadFromBackupTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheTransactionalStoreReadFromBackupTest.java index 51ca1420907e9..4837936621f46 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheTransactionalStoreReadFromBackupTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheTransactionalStoreReadFromBackupTest.java @@ -18,7 +18,6 @@ package org.apache.ignite.cache.store; import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -26,13 +25,6 @@ * */ public class CacheTransactionalStoreReadFromBackupTest extends CacheStoreReadFromBackupTest { - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java index f26cc49cc9160..349418ddf2be8 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheLoadOnlyStoreAdapterSelfTest.java @@ -25,7 +25,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.util.typedef.T2; import org.apache.ignite.lang.IgniteBiTuple; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; import org.junit.Test; @@ -42,8 +41,6 @@ public class GridCacheLoadOnlyStoreAdapterSelfTest extends GridCommonAbstractTes /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - super.beforeTestsStarted(); startGrid(0); @@ -61,8 +58,6 @@ public class GridCacheLoadOnlyStoreAdapterSelfTest extends GridCommonAbstractTes */ @SuppressWarnings("unchecked") private CacheConfiguration cacheConfiguration() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - CacheConfiguration cfg = defaultCacheConfiguration(); assertNotNull(store); diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java index 015eab333530a..954319b7f5352 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreAbstractSelfTest.java @@ -40,7 +40,6 @@ import org.apache.ignite.internal.binary.BinaryMarshaller; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.marshaller.Marshaller; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -113,13 +112,6 @@ protected Connection getConnection() throws SQLException { }; } - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { Connection conn = getConnection(); @@ -157,8 +149,6 @@ protected Connection getConnection() throws SQLException { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCacheConfiguration(cacheConfiguration()); diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java index 22da3e6ad9580..c19d530a2fc80 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java @@ -32,20 +32,12 @@ import org.apache.ignite.cache.store.CacheStoreSessionListenerAbstractSelfTest; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.resources.CacheStoreSessionResource; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.h2.jdbcx.JdbcConnectionPool; -import org.junit.Before; /** * Tests for {@link CacheJdbcStoreSessionListener}. */ public class CacheJdbcStoreSessionListenerSelfTest extends CacheStoreSessionListenerAbstractSelfTest { - /** */ - @Before - public void beforeCacheJdbcStoreSessionListenerSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected Factory> storeFactory() { return new Factory>() { diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java index 96e1bd00f4caf..93de23c0e70bd 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java @@ -37,7 +37,6 @@ import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -58,13 +57,6 @@ public class GridCacheJdbcBlobStoreMultithreadedSelfTest extends GridCommonAbstr /** Number of transactions. */ private static final int TX_CNT = 1000; - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { startGridsMultiThreaded(GRID_CNT - 2); @@ -86,8 +78,6 @@ public class GridCacheJdbcBlobStoreMultithreadedSelfTest extends GridCommonAbstr /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration c = super.getConfiguration(igniteInstanceName); if (!c.isClientMode()) { diff --git a/modules/core/src/test/java/org/apache/ignite/failure/IoomFailureHandlerTest.java b/modules/core/src/test/java/org/apache/ignite/failure/IoomFailureHandlerTest.java index 1049ab5b15daf..c4a09f7b9fd6f 100644 --- a/modules/core/src/test/java/org/apache/ignite/failure/IoomFailureHandlerTest.java +++ b/modules/core/src/test/java/org/apache/ignite/failure/IoomFailureHandlerTest.java @@ -47,9 +47,6 @@ public class IoomFailureHandlerTest extends AbstractFailureHandlerTest { /** PDS enabled. */ private boolean pds; - /** MVCC enabled. */ - private boolean mvcc; - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); @@ -79,7 +76,7 @@ public class IoomFailureHandlerTest extends AbstractFailureHandlerTest { .setName(DEFAULT_CACHE_NAME) .setCacheMode(CacheMode.PARTITIONED) .setBackups(0) - .setAtomicityMode(mvcc ? CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT : CacheAtomicityMode.TRANSACTIONAL); + .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cfg.setCacheConfiguration(ccfg); @@ -105,7 +102,7 @@ public class IoomFailureHandlerTest extends AbstractFailureHandlerTest { */ @Test public void testIoomErrorNoStoreHandling() throws Exception { - testIoomErrorHandling(false, false); + testIoomErrorHandling(false); } /** @@ -113,31 +110,14 @@ public void testIoomErrorNoStoreHandling() throws Exception { */ @Test public void testIoomErrorPdsHandling() throws Exception { - testIoomErrorHandling(true, false); - } - - /** - * Test IgniteOutOfMemoryException handling with no store. - */ - @Test - public void testIoomErrorMvccNoStoreHandling() throws Exception { - testIoomErrorHandling(false, true); - } - - /** - * Test IgniteOutOfMemoryException handling with PDS. - */ - @Test - public void testIoomErrorMvccPdsHandling() throws Exception { - testIoomErrorHandling(true, true); + testIoomErrorHandling(true); } /** * Test IOOME handling. */ - private void testIoomErrorHandling(boolean pds, boolean mvcc) throws Exception { + private void testIoomErrorHandling(boolean pds) throws Exception { this.pds = pds; - this.mvcc = mvcc; IgniteEx ignite0 = startGrid(0); IgniteEx ignite1 = startGrid(1); @@ -163,12 +143,8 @@ private void testIoomErrorHandling(boolean pds, boolean mvcc) throws Exception { assertFalse(dummyFailureHandler(ignite0).failure()); - if (mvcc && pds) - assertFalse(dummyFailureHandler(ignite1).failure()); - else { - assertTrue(dummyFailureHandler(ignite1).failure()); - assertTrue(X.hasCause(dummyFailureHandler(ignite1).failureContext().error(), IgniteOutOfMemoryException.class)); - } + assertTrue(dummyFailureHandler(ignite1).failure()); + assertTrue(X.hasCause(dummyFailureHandler(ignite1).failureContext().error(), IgniteOutOfMemoryException.class)); } finally { stopGrid(1); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCacheHashMapPutAllWarningsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCacheHashMapPutAllWarningsTest.java index c64627a216ecb..72838fe62da06 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridCacheHashMapPutAllWarningsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridCacheHashMapPutAllWarningsTest.java @@ -31,7 +31,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.testframework.ListeningTestLogger; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -105,9 +104,6 @@ public void testHashMapPutAllExactMessage() throws Exception { */ @Test public void testHashMapPutAllExplicitOptimistic() throws Exception { - if (MvccFeatureChecker.forcedMvcc()) - return; - List messages = Collections.synchronizedList(new ArrayList<>()); testLog = new ListeningTestLogger(log()); 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 371bdb0a95edc..cb991c845bd59 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 @@ -69,7 +69,6 @@ import org.apache.ignite.spi.discovery.DiscoverySpi; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; @@ -818,19 +817,7 @@ else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) IgniteInClosure> putOp = new CI1>() { @Override public void apply(IgniteCache cache) { - while (true) { - try { - cache.put(1, 1); - - break; - } - catch (Exception e) { - if (e.getCause() instanceof IgniteClientDisconnectedException) - throw e; - else - MvccFeatureChecker.assertMvccWriteConflict(e); - } - } + cache.put(1, 1); } }; @@ -848,7 +835,7 @@ else if (evt.type() == EVT_CLIENT_NODE_RECONNECTED) int cnt = 0; - for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) { + for (CacheAtomicityMode atomicityMode : CacheAtomicityMode._values()) { for (CacheWriteSynchronizationMode syncMode : CacheWriteSynchronizationMode.values()) { CacheConfiguration ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); @@ -1416,16 +1403,7 @@ private void checkOperationInProgressFails(final IgniteEx client, assertNotEquals(id, client.localNode().id()); - while (true) { - try { - cache.put(1, 1); - - break; - } - catch (Exception e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } - } + cache.put(1, 1); GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/TransactionMetricsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/TransactionMetricsTest.java index d53c5a0e71e31..c655929f7bb71 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/TransactionMetricsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/TransactionMetricsTest.java @@ -31,7 +31,6 @@ import org.apache.ignite.mxbean.TransactionMetricsMxBean; import org.apache.ignite.spi.metric.IntMetric; import org.apache.ignite.spi.metric.LongMetric; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -51,8 +50,6 @@ public class TransactionMetricsTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String name) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.METRICS); - final IgniteConfiguration cfg = super.getConfiguration(name); cfg.setCommunicationSpi(new TestRecordingCommunicationSpi()); @@ -77,13 +74,6 @@ public class TransactionMetricsTest extends GridCommonAbstractTest { super.afterTest(); } - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.METRICS); - - super.beforeTestsStarted(); - } - /** * */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java index e72ab4a16df1c..9240872bb891a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java @@ -54,15 +54,12 @@ import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.ListeningTestLogger; import org.apache.ignite.testframework.LogListener; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.IgniteSystemProperties.IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; import static org.apache.ignite.testframework.GridTestUtils.runAsync; @@ -125,14 +122,6 @@ public void testDiagnosticMessages1() throws Exception { checkBasicDiagnosticInfo(CacheAtomicityMode.TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testDiagnosticMessagesMvcc1() throws Exception { - checkBasicDiagnosticInfo(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -143,16 +132,6 @@ public void testDiagnosticMessages2() throws Exception { checkBasicDiagnosticInfo(CacheAtomicityMode.TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testDiagnosticMessagesMvcc2() throws Exception { - connectionsPerNode = 5; - - checkBasicDiagnosticInfo(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -161,14 +140,6 @@ public void testLongRunning() throws Exception { checkLongRunning(TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testLongRunningMvcc() throws Exception { - checkLongRunning(TRANSACTIONAL_SNAPSHOT); - } - /** * @param atomicityMode Cache atomicity mode. * @throws Exception If failed. @@ -241,15 +212,6 @@ private CacheConfiguration cacheConfiguration(CacheAtomicityMode atomicityMode) .setNearConfiguration(null); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10637") // Support diagnostics message or disable test. - @Test - public void testSeveralLongRunningMvccTxs() throws Exception { - checkSeveralLongRunningTxs(TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -363,15 +325,6 @@ private int countTxKeysInASingleBlock(String log) { return cnt; } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10637") // Support diagnostic messages or disable test. - @Test - public void testLongRunningMvccTx() throws Exception { - checkLongRunningTx(TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -578,22 +531,6 @@ public void checkLongRunningTx(CacheAtomicityMode atomicityMode) throws Exceptio */ @Test public void testRemoteTx() throws Exception { - checkRemoteTx(TRANSACTIONAL); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRemoteMvccTx() throws Exception { - checkRemoteTx(TRANSACTIONAL_SNAPSHOT); - } - - /** - * @param atomicityMode Cache atomicity mode. - * @throws Exception If failed. - */ - public void checkRemoteTx(CacheAtomicityMode atomicityMode) throws Exception { int timeout = 3500; System.setProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, String.valueOf(timeout)); @@ -611,11 +548,9 @@ public void checkRemoteTx(CacheAtomicityMode atomicityMode) throws Exception { awaitPartitionMapExchange(); - CacheConfiguration ccfg = cacheConfiguration(atomicityMode).setBackups(1); + CacheConfiguration ccfg = cacheConfiguration(TRANSACTIONAL).setBackups(1); - if (atomicityMode != TRANSACTIONAL_SNAPSHOT || - MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) - ccfg.setNearConfiguration(new NearCacheConfiguration<>()); + ccfg.setNearConfiguration(new NearCacheConfiguration<>()); final Ignite node0 = ignite(0); final Ignite node1 = ignite(1); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/metric/IoStatisticsCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/metric/IoStatisticsCacheSelfTest.java index 9bf48f2cbfeb1..2352abf5adb38 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/metric/IoStatisticsCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/metric/IoStatisticsCacheSelfTest.java @@ -56,9 +56,6 @@ public class IoStatisticsCacheSelfTest extends GridCommonAbstractTest { /** */ protected static final String ATOMIC_CACHE_NAME = "ATOMIC_CACHE"; - /** */ - protected static final String MVCC_CACHE_NAME = "MVCC_CACHE"; - /** */ protected static final String TRANSACTIONAL_CACHE_NAME = "TRANSACTIONAL_CACHE"; @@ -73,7 +70,7 @@ public class IoStatisticsCacheSelfTest extends GridCommonAbstractTest { /** */ protected static final Set ALL_CACHE_GROUP_NAMES = Sets.newHashSet( - ATOMIC_CACHE_NAME, MVCC_CACHE_NAME, TRANSACTIONAL_CACHE_NAME, CACHE_GROUP_NAME); + ATOMIC_CACHE_NAME, TRANSACTIONAL_CACHE_NAME, CACHE_GROUP_NAME); /** */ protected static final int RECORD_COUNT = 100; @@ -98,10 +95,6 @@ protected boolean persist() { .setAtomicityMode(CacheAtomicityMode.ATOMIC) .setName(ATOMIC_CACHE_NAME); - final CacheConfiguration mvccCacheCfg = new CacheConfiguration() - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - .setName(MVCC_CACHE_NAME); - final CacheConfiguration transactionalCacheCfg = new CacheConfiguration() .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setName(TRANSACTIONAL_CACHE_NAME); @@ -126,8 +119,7 @@ protected boolean persist() { cfg.setDataStorageConfiguration(dsCfg); - cfg.setCacheConfiguration(transactionalCacheCfg, atomicCacheCfg, mvccCacheCfg, - atomic1CacheGrpCfg, atomic2CacheGrpCfg); + cfg.setCacheConfiguration(transactionalCacheCfg, atomicCacheCfg, atomic1CacheGrpCfg, atomic2CacheGrpCfg); return cfg; } @@ -168,14 +160,6 @@ public void testTransactonalCache() throws Exception { cacheTest(TRANSACTIONAL_CACHE_NAME, RECORD_COUNT, RECORD_COUNT * 3, RECORD_COUNT * 2); } - /** - * Test statistics for MVCC cache. - */ - @Test - public void testMvccCache() throws Exception { - cacheTest(MVCC_CACHE_NAME, RECORD_COUNT, RECORD_COUNT * 6, RECORD_COUNT * 3); - } - /** * Test statistics for ATOMIC cache. */ @@ -189,7 +173,7 @@ public void testAtomicCache() throws Exception { */ @Test public void testForThreeCaches() throws Exception { - prepareData(RECORD_COUNT, ATOMIC_CACHE_NAME, TRANSACTIONAL_CACHE_NAME, MVCC_CACHE_NAME); + prepareData(RECORD_COUNT, ATOMIC_CACHE_NAME, TRANSACTIONAL_CACHE_NAME); GridMetricManager mmgr = ignite.context().metric(); @@ -197,7 +181,7 @@ public void testForThreeCaches() throws Exception { assertEquals(ALL_CACHE_GROUP_NAMES, statisticCacheNames); - Stream.of(ATOMIC_CACHE_NAME, TRANSACTIONAL_CACHE_NAME, MVCC_CACHE_NAME).forEach((cacheName) -> { + Stream.of(ATOMIC_CACHE_NAME, TRANSACTIONAL_CACHE_NAME).forEach((cacheName) -> { long logicalReads = logicalReads(mmgr, CACHE_GROUP, cacheName); assertTrue(logicalReads > RECORD_COUNT); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/metric/JmxExporterSpiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/metric/JmxExporterSpiTest.java index 1145006a19865..c23221f5a436a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/metric/JmxExporterSpiTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/metric/JmxExporterSpiTest.java @@ -48,7 +48,6 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteJdbcThinDriver; -import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.Ignition; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; @@ -734,10 +733,6 @@ public void testTransactions() throws Exception { assertEquals(0L, txv.get("timeout")); assertTrue(((long)txv.get("startTime")) <= System.currentTimeMillis()); - //Only pessimistic transactions are supported when MVCC is enabled. - if (Objects.equals(System.getProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS), "true")) - return; - GridTestUtils.runMultiThreadedAsync(() -> { try (Transaction tx = ignite.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) { cache.put(cntr.incrementAndGet(), cntr.incrementAndGet()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java index d69c1c005fd3e..fce35b6ae41c9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java @@ -26,7 +26,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Properties; import java.util.Set; import java.util.concurrent.BrokenBarrierException; @@ -52,7 +51,6 @@ import org.apache.ignite.IgniteQueue; import org.apache.ignite.IgniteSemaphore; import org.apache.ignite.IgniteSet; -import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.Ignition; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; @@ -889,10 +887,6 @@ public void testTransactions() throws Exception { assertTrue(txv.startTime() <= System.currentTimeMillis()); assertEquals(String.valueOf(cacheId(cache1.getName())), txv.cacheIds()); - //Only pessimistic transactions are supported when MVCC is enabled. - if (Objects.equals(System.getProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS), "true")) - return; - GridTestUtils.runMultiThreadedAsync(() -> { try (Transaction tx = g.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) { cache1.put(cntr.incrementAndGet(), cntr.incrementAndGet()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java index f0639048d63df..1e8a6f4610c60 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java @@ -30,24 +30,16 @@ import org.apache.ignite.cache.store.CacheStoreAdapter; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Before; import org.junit.Test; /** * */ public class GridCacheTxLoadFromStoreOnLockSelfTest extends GridCommonAbstractTest { - /** */ - @Before - public void beforeGridCacheTxLoadFromStoreOnLockSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); 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 f1a5e448e91db..2a1ef49aeb768 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 static Collection parameters() { Object[] paramLine = null; - for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) { + for (CacheAtomicityMode atomicityMode : CacheAtomicityMode._values()) { paramLine = Arrays.copyOf(baseParamLine, baseParamLine.length); paramLine[1] = atomicityMode; @@ -184,14 +184,12 @@ public static Collection parameters() { assert paramLine != null; - if ((paramLine[1]) != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) { - for (Factory ttlFactory : TTL_FACTORIES) { - paramLine = Arrays.copyOf(baseParamLine, baseParamLine.length); + for (Factory ttlFactory : TTL_FACTORIES) { + paramLine = Arrays.copyOf(baseParamLine, baseParamLine.length); - paramLine[3] = ttlFactory; + paramLine[3] = ttlFactory; - params.add(paramLine); - } + params.add(paramLine); } for (int backups : new int[] {0, 1, 2}) { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java index 53b080d42a4ed..7c74b2570a0bd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java @@ -37,9 +37,7 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.resources.IgniteInstanceResource; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.IgniteSystemProperties.IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK; @@ -63,12 +61,6 @@ public class CacheClientStoreSelfTest extends GridCommonAbstractTest { /** */ private static volatile boolean loadedFromClient; - /** */ - @Before - public void beforeCacheClientStoreSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java index c429ef325c852..9fbd5dddb4418 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java @@ -32,9 +32,7 @@ import org.apache.ignite.lang.IgniteRunnable; import org.apache.ignite.resources.IgniteInstanceResource; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Before; import org.junit.Test; /** @@ -44,12 +42,6 @@ public class CacheConcurrentReadThroughTest extends GridCommonAbstractTest { /** */ private static final int SYS_THREADS = 16; - /** */ - @Before - public void beforeCacheConcurrentReadThroughTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java index 058e750882660..4f0124910f706 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java @@ -38,7 +38,6 @@ import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; @@ -154,26 +153,6 @@ public void testConnectionLeakOneBackupPessimisticReadCommittedLoadFromStore() t checkConnectionLeak(CacheAtomicityMode.TRANSACTIONAL, PESSIMISTIC, READ_COMMITTED); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testConnectionLeakOneBackupMvccPessimisticRepeatableRead() throws Exception { - checkConnectionLeak(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testConnectionLeakOneBackupMvccPessimisticRepeatableReadLoadFromStore() throws Exception { - isLoadFromStore = true; - - checkConnectionLeak(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, PESSIMISTIC, REPEATABLE_READ); - } - /** * @param atomicityMode Atomicity mode. * @param txConcurrency Transaction concurrency. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java index 0c1cf08cf8a34..e928a495bef92 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java @@ -28,13 +28,11 @@ import org.apache.ignite.internal.util.lang.GridAbsPredicate; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_REMOVED_ENTRIES_TTL; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -74,22 +72,11 @@ public void testDeferredDeleteQueue() throws Exception { testQueue(TRANSACTIONAL, false); - testQueue(TRANSACTIONAL_SNAPSHOT, false); - testQueue(ATOMIC, true); testQueue(TRANSACTIONAL, true); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testDeferredDeleteQueueMvcc() throws Exception { - testQueue(TRANSACTIONAL_SNAPSHOT, true); - } - /** * @param atomicityMode Cache atomicity mode. * @param nearCache {@code True} if need create near cache. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteSanitySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteSanitySelfTest.java index a9b8136444926..74ed77681bcd3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteSanitySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteSanitySelfTest.java @@ -23,11 +23,10 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Ignore; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -58,25 +57,6 @@ public void testDeferredDelete() throws Exception { testDeferredDelete(REPLICATED, TRANSACTIONAL, true, true); } - /** - * @throws Exception If fails. - */ - @Test - public void testDeferredDeleteMvcc() throws Exception { - testDeferredDelete(PARTITIONED, TRANSACTIONAL_SNAPSHOT, false, true); - testDeferredDelete(REPLICATED, TRANSACTIONAL_SNAPSHOT, false, true); - } - - /** - * @throws Exception If fails. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testDeferredDeleteMvccNear() throws Exception { - testDeferredDelete(PARTITIONED, TRANSACTIONAL_SNAPSHOT, true, false); - testDeferredDelete(REPLICATED, TRANSACTIONAL_SNAPSHOT, true, true); - } - /** * @param mode Mode. * @param atomicityMode Atomicity mode. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java index e613e4edf44da..22710b6fa9121 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java @@ -29,12 +29,10 @@ import org.apache.ignite.internal.binary.BinaryMarshaller; import org.apache.ignite.marshaller.Marshaller; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -79,18 +77,6 @@ public void testTx() throws Exception { enumOperations(ccfg); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTx() throws Exception { - Assume.assumeTrue("https://issues.apache.org/jira/browse/IGNITE-7187", singleNode()); - - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 1, TRANSACTIONAL_SNAPSHOT); - - enumOperations(ccfg); - } - /** * @param ccfg Cache configuration. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java index 7bcd7f7a6ce36..ec05d4fea1a9d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java @@ -37,13 +37,11 @@ import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.util.lang.IgnitePair; import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.junit.Assert; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT; @@ -109,11 +107,6 @@ public class CacheEventWithTxLabelTest extends GridCommonAbstractTest { registerEventListeners(primary(), backup1(), backup2(), client()); } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10270", MvccFeatureChecker.forcedMvcc()); - } - /** * Check all cases for passing transaction label in cash event. * @@ -134,9 +127,6 @@ public void testPassTxLabelInCashEventForAllCases() throws Exception { for (TransactionConcurrency concurrency : TransactionConcurrency.values()) { this.concurrency = concurrency; - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) - continue; - for (int i = 0; i < nodes.length - 1; i++) { Ignite nodeForPut = nodes[i]; Ignite nodeForGet = nodes[i + 1]; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java index 3c4c4968c7f7f..43f3aa3c52985 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java @@ -31,7 +31,6 @@ import org.apache.ignite.failure.StopNodeFailureHandler; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgniteInClosure; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -80,11 +79,6 @@ public void testAsyncCacheFuture() throws Exception { * @throws Exception If failed. */ private void testGet(boolean nearCache, boolean cpyOnRead) throws Exception { - if (MvccFeatureChecker.forcedMvcc()) { - if (!MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) - return; - } - fail = false; Ignite srv = grid(0); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java index d93586e37a0e7..88c57ca8fc031 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java @@ -17,16 +17,8 @@ package org.apache.ignite.internal.processors.cache; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Ignore; -import org.junit.Test; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.cache.CacheMode.REPLICATED; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; /** * Test getEntry and getEntries methods. @@ -41,51 +33,4 @@ public class CacheGetEntryPessimisticRepeatableReadSelfTest extends CacheGetEntr @Override protected TransactionIsolation isolation() { return TransactionIsolation.REPEATABLE_READ; } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testNearTransactionalMvcc() throws Exception { - CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME); - - cfg.setWriteSynchronizationMode(FULL_SYNC); - cfg.setCacheMode(PARTITIONED); - cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - cfg.setName("nearT"); - cfg.setNearConfiguration(new NearCacheConfiguration()); - - test(cfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPartitionedTransactionalMvcc() throws Exception { - CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME); - - cfg.setWriteSynchronizationMode(FULL_SYNC); - cfg.setCacheMode(PARTITIONED); - cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - cfg.setName("partitionedT"); - - test(cfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testReplicatedTransactionalMvcc() throws Exception { - CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME); - - cfg.setWriteSynchronizationMode(FULL_SYNC); - cfg.setCacheMode(REPLICATED); - cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - cfg.setName("replicatedT"); - - test(cfg); - } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetRemoveSkipStoreTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetRemoveSkipStoreTest.java index efd0038c13b68..f8dbf76c39b85 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetRemoveSkipStoreTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetRemoveSkipStoreTest.java @@ -33,7 +33,6 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -71,13 +70,6 @@ private CacheConfiguration configuration( .setWriteThrough(false); } - /** {@inheritDoc} */ - @Override public void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTest(); - } - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java index 0f956633abaa8..df9ee31c39eba 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java @@ -53,14 +53,12 @@ import org.apache.ignite.transactions.TransactionIsolation; import org.eclipse.jetty.util.BlockingArrayQueue; import org.jetbrains.annotations.NotNull; -import org.junit.Assume; import org.junit.Test; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -283,118 +281,12 @@ public void testTxNoBackupsExplicit() throws Exception { doTestPartitionCounterOperation(ccfg); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTx() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestPartitionCounterOperation(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxWithStore() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT, - true); - - doTestPartitionCounterOperation(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxExplicit() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestPartitionCounterOperation(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxReplicated() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, - 0, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestPartitionCounterOperation(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxReplicatedWithStore() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, - 0, - TRANSACTIONAL_SNAPSHOT, - true); - - doTestPartitionCounterOperation(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxNoBackups() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 0, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestPartitionCounterOperation(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxNoBackupsWithStore() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 0, - TRANSACTIONAL_SNAPSHOT, - true); - - doTestPartitionCounterOperation(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxNoBackupsExplicit() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 0, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestPartitionCounterOperation(ccfg); - } - /** * @param ccfg Cache configuration. * @throws Exception If failed. */ - protected void doTestPartitionCounterOperation(CacheConfiguration ccfg) - throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-9323", - ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT); + protected void doTestPartitionCounterOperation(CacheConfiguration ccfg) throws Exception { + assertTrue(ccfg.getAtomicityMode() == TRANSACTIONAL || ccfg.getAtomicityMode() == ATOMIC); ignite(0).createCache(ccfg); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheKeepBinaryTransactionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheKeepBinaryTransactionTest.java index 8e4676106b57e..88ccc2dde49b0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheKeepBinaryTransactionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheKeepBinaryTransactionTest.java @@ -26,7 +26,6 @@ import org.apache.ignite.configuration.TransactionConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.binary.BinaryMarshaller; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -43,10 +42,8 @@ public class CacheKeepBinaryTransactionTest extends GridCommonAbstractTest { TransactionConfiguration txCfg = new TransactionConfiguration(); - if (!MvccFeatureChecker.forcedMvcc()) { - txCfg.setDefaultTxConcurrency(TransactionConcurrency.OPTIMISTIC); - txCfg.setDefaultTxIsolation(TransactionIsolation.REPEATABLE_READ); - } + txCfg.setDefaultTxConcurrency(TransactionConcurrency.OPTIMISTIC); + txCfg.setDefaultTxIsolation(TransactionIsolation.REPEATABLE_READ); cfg.setTransactionConfiguration(txCfg); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsEntitiesCountTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsEntitiesCountTest.java index 3febf26648e79..9e7deab5af9ac 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsEntitiesCountTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsEntitiesCountTest.java @@ -32,9 +32,9 @@ import org.apache.ignite.internal.processors.metric.MetricRegistry; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.metric.LongMetric; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; + import static org.apache.ignite.internal.processors.metric.impl.MetricUtils.cacheMetricsRegistryName; /** @@ -276,10 +276,7 @@ private void checkCacheClusterMetrics(int cacheIdx, metrics.getOffHeapBackupEntriesCount()); assertEquals(cacheInfo + " offHeapPrimaryEntriesCnt", offHeapPrimaryEntriesCnt, metrics.getOffHeapPrimaryEntriesCount()); - - if (!MvccFeatureChecker.forcedMvcc()) // Onheap cache is not supported in Mvcc mode. - assertEquals(cacheInfo + " heapEntriesCnt", heapEntriesCnt, metrics.getHeapEntriesCount()); - + assertEquals(cacheInfo + " heapEntriesCnt", heapEntriesCnt, metrics.getHeapEntriesCount()); assertEquals(cacheInfo + " size", cacheSize, metrics.getSize()); assertEquals(cacheInfo + " keySize", cacheSize, metrics.getKeySize()); assertEquals(cacheInfo + " isEmpty", cacheSize == 0, metrics.isEmpty()); @@ -300,10 +297,7 @@ private void checkCacheClusterMetrics(int cacheIdx, assertEquals(cacheInfo + " offHeapEntriesCnt", offHeapEntriesCnt, offHeapEntriesCntSum); assertEquals(cacheInfo + " offHeapBackupEntriesCnt", offHeapBackupEntriesCnt, offHeapBackupEntriesCntSum); assertEquals(cacheInfo + " offHeapPrimaryEntriesCnt", offHeapPrimaryEntriesCnt, offHeapPrimaryEntriesCntSum); - - if (!MvccFeatureChecker.forcedMvcc()) // Onheap cache is not supported in Mvcc mode. - assertEquals(cacheInfo + " heapEntriesCnt", heapEntriesCnt, heapEntriesCntSum); - + assertEquals(cacheInfo + " heapEntriesCnt", heapEntriesCnt, heapEntriesCntSum); assertEquals(cacheInfo + " isEmpty", cacheSize == 0, isEmptySum); } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java index 165ed3e6d65d4..0cd45d982a5a5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsForClusterGroupSelfTest.java @@ -26,7 +26,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.managers.discovery.IgniteClusterNode; import org.apache.ignite.lang.IgniteClosure; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -58,13 +57,6 @@ public class CacheMetricsForClusterGroupSelfTest extends GridCommonAbstractTest /** Cache 2. */ private IgniteCache cache2; - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.METRICS); - - super.beforeTestsStarted(); - } - /** * Test cluster group metrics in case of statistics enabled. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java index 09ab7364cd09e..d603b82a4343b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMetricsManageTest.java @@ -64,11 +64,9 @@ import org.apache.ignite.mxbean.TransactionsMXBean; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.IgniteSystemProperties.IGNITE_DUMP_TX_COLLISIONS_INTERVAL; @@ -110,8 +108,6 @@ public class CacheMetricsManageTest extends GridCommonAbstractTest { */ @Test public void testNoPdsStatisticsEnable() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-9224", MvccFeatureChecker.forcedMvcc()); - testStatisticsEnable(false); } @@ -120,8 +116,6 @@ public void testNoPdsStatisticsEnable() throws Exception { */ @Test public void testPdsStatisticsEnable() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-9224", MvccFeatureChecker.forcedMvcc()); - testStatisticsEnable(true); } @@ -527,8 +521,6 @@ private void testStatisticsEnable(boolean persistence) throws Exception { @Test @WithSystemProperty(key = IGNITE_DUMP_TX_COLLISIONS_INTERVAL, value = "30000") public void testTxContentionMetric() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-9224", MvccFeatureChecker.forcedMvcc()); - backups = 1; useTestCommSpi = true; @@ -663,8 +655,6 @@ public void testTxContentionMetric() throws Exception { /** Tests metric change interval. */ @Test public void testKeyCollisionsMetricDifferentTimeout() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-9224", MvccFeatureChecker.forcedMvcc()); - backups = 2; useTestCommSpi = true; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMvccTxFastFinishTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMvccTxFastFinishTest.java deleted file mode 100644 index 90eaa3d1f0616..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMvccTxFastFinishTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.apache.ignite.transactions.Transaction; - -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** */ -public class CacheMvccTxFastFinishTest extends CacheTxFastFinishTest { - /** {@inheritDoc} */ - @Override protected void fastFinishTx(Ignite ignite) { - assert MvccFeatureChecker.forcedMvcc(); - - IgniteTransactions txs = ignite.transactions(); - - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); - - for (boolean commit : new boolean[] {true, false}) { - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - checkFastTxFinish(tx, commit); - } - - for (int i = 0; i < 100; i++) { - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.get(i); - - checkNormalTxFinish(tx, commit, true); - } - } - - for (int i = 0; i < 100; i++) { - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(i, i); - - checkNormalTxFinish(tx, commit, false); - } - } - } - } - - /** {@inheritDoc} */ - @Override protected void checkNormalCommittedTx(IgniteInternalTx tx, boolean readOnly) { - if (readOnly) - assertNull(prepareFuture(tx)); - else - assertNotNull(prepareFuture(tx)); - - assertNotNull(finishFuture(tx)); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java index da214ea171362..d9165f87d137f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java @@ -40,13 +40,11 @@ import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.apache.ignite.transactions.TransactionOptimisticException; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -72,8 +70,6 @@ public class CacheNearReaderUpdateTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setPeerClassLoadingEnabled(false); @@ -81,12 +77,6 @@ public class CacheNearReaderUpdateTest extends GridCommonAbstractTest { return cfg; } - /** */ - @Before - public void beforeCacheNearReaderUpdateTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); @@ -333,9 +323,6 @@ private CacheConfiguration cacheConfiguration( int backups, boolean storeEnabled, boolean nearCache) { - if (storeEnabled) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - CacheConfiguration ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); ccfg.setCacheMode(cacheMode); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNoAffinityExchangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNoAffinityExchangeTest.java index 0f9fe2d5fb5cc..6cdd2b82ff88d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNoAffinityExchangeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNoAffinityExchangeTest.java @@ -60,7 +60,6 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeFailedMessage; import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; @@ -93,13 +92,6 @@ public class CacheNoAffinityExchangeTest extends GridCommonAbstractTest { /** Stores errors that triggered failure handler. */ private final Map errs = new ConcurrentHashMap<>(); - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java index 69c5ece8ab82a..a03599d8293d5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java @@ -24,11 +24,10 @@ import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -75,9 +74,6 @@ private CacheConfiguration cacheConfiguration(String gridName, cfg.setAtomicityMode(atomicityMode); cfg.setName(cacheName); - if (atomicityMode == TRANSACTIONAL_SNAPSHOT && !MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) - cfg.setNearConfiguration(null); - return cfg; } @@ -90,15 +86,9 @@ public void testCacheMapEntry() throws Exception { checkCacheMapEntry(TRANSACTIONAL, PARTITIONED, GridNearCacheEntry.class); - if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE)) - checkCacheMapEntry(TRANSACTIONAL_SNAPSHOT, PARTITIONED, GridDhtCacheEntry.class); - checkCacheMapEntry(ATOMIC, REPLICATED, GridDhtCacheEntry.class); checkCacheMapEntry(TRANSACTIONAL, REPLICATED, GridDhtCacheEntry.class); - - if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE)) - checkCacheMapEntry(TRANSACTIONAL_SNAPSHOT, REPLICATED, GridDhtCacheEntry.class); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java index ec246603df3cc..924c8e5d85bae 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutEventListenerErrorSelfTest.java @@ -30,7 +30,6 @@ import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -40,8 +39,6 @@ public class CachePutEventListenerErrorSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setIncludeEventTypes(EventType.EVT_CACHE_OBJECT_PUT); @@ -51,8 +48,6 @@ public class CachePutEventListenerErrorSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - startGridsMultiThreaded(3); Ignite ignite = startClientGrid("client"); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java index f3a17caf956a4..3bebf5a6655d6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java @@ -26,7 +26,6 @@ import org.apache.ignite.cache.CacheMode; import org.apache.ignite.cache.CacheWriteSynchronizationMode; import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -116,9 +115,6 @@ public void testTxConflictGetAndPutIfAbsent() throws Exception { for (TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (TransactionIsolation isolation : TransactionIsolation.values()) { - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) - continue; - try (Transaction tx = txs.txStart(concurrency, isolation)) { Object old = cache.getAndPutIfAbsent(key, 3); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java index 52a92aad8e6be..9840540148ad1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java @@ -24,11 +24,9 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.TransactionConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -38,12 +36,6 @@ * Test for read through store. */ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest { - /** */ - @Before - public void beforeCacheReadThroughRestartSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 2; @@ -115,9 +107,6 @@ private void testReadThroughInTx(boolean needVer) throws Exception { for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) { for (TransactionIsolation txIsolation : TransactionIsolation.values()) { - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(txConcurrency, txIsolation)) - continue; - try (Transaction tx = ignite.transactions().txStart(txConcurrency, txIsolation, 100000, 1000)) { for (int k = 0; k < 1000; k++) { String key = "key" + k; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java index 871da109d2714..430d32a980e38 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java @@ -24,22 +24,13 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Assume; import org.junit.Test; /** * Test remove all method. */ public class CacheRemoveAllSelfTest extends GridCacheAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10082", MvccFeatureChecker.forcedMvcc()); - - super.beforeTest(); - } - - /** {@inheritDoc} */ + /** {@inheritDoc} */ @Override protected long getTestTimeout() { return 2 * 60 * 1000; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java index 049b2bf0e8f39..b329cf5ed503c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java @@ -44,9 +44,9 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; + import static org.apache.ignite.cache.CacheMode.PARTITIONED; /** @@ -267,8 +267,6 @@ private void clientDestroy() throws Exception { */ @Test public void testNearDoubleDestroy() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - startGridsMultiThreaded(gridCount()); nearDestroy(); @@ -552,8 +550,6 @@ public void testClientCloseWithTry() throws Exception { */ @Test public void testNearClose() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - startGridsMultiThreaded(gridCount()); IgniteCache cache0 = grid(0).getOrCreateCache(getNearConfig()); @@ -630,8 +626,6 @@ public void testNearClose() throws Exception { */ @Test public void testNearCloseWithTry() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - startGridsMultiThreaded(gridCount()); String curVal = null; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreTxPutAllMultiNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreTxPutAllMultiNodeTest.java index afc654cd1818b..38dec3799562b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreTxPutAllMultiNodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreTxPutAllMultiNodeTest.java @@ -39,7 +39,6 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.resources.CacheStoreSessionResource; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -62,8 +61,6 @@ public class CacheStoreTxPutAllMultiNodeTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - startGrid(1); startGrid(2); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java index 844b9ec2e23c0..25519de9a95e3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java @@ -18,8 +18,6 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -27,12 +25,6 @@ * */ public class CacheStoreUsageMultinodeDynamicStartTxTest extends CacheStoreUsageMultinodeDynamicStartAbstractTest { - /** */ - @Before - public void beforeCacheStoreUsageMultinodeDynamicStartTxTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java index 0599dc78b4839..fcaa7cc20d71e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java @@ -18,8 +18,6 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -27,12 +25,6 @@ * */ public class CacheStoreUsageMultinodeStaticStartTxTest extends CacheStoreUsageMultinodeStaticStartAbstractTest { - /** */ - @Before - public void beforeCacheStoreUsageMultinodeStaticStartTxTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxFastFinishTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxFastFinishTest.java index 64083ebc72c82..8613a3c2318c4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxFastFinishTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxFastFinishTest.java @@ -28,7 +28,6 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -38,7 +37,6 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.testframework.MvccFeatureChecker.Feature.NEAR_CACHE; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; @@ -83,8 +81,6 @@ public class CacheTxFastFinishTest extends GridCommonAbstractTest { */ @Test public void testFastFinishTxNearCache() throws Exception { - MvccFeatureChecker.skipIfNotSupported(NEAR_CACHE); - nearCache = true; fastFinishTx(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java index 89dbc047db744..a688409ed06da 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java @@ -186,76 +186,6 @@ public void testBackupConsistencyPartitionedFullSync() throws Exception { checkBackupConsistencyGetAll(cfg, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE); } - /** - * @throws Exception If failed. - */ - @Test - public void testBackupConsistencyReplicatedMvcc() throws Exception { - CacheConfiguration cfg = new CacheConfiguration<>("test-cache"); - - cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC); - cfg.setCacheMode(CacheMode.REPLICATED); - cfg.setReadFromBackup(false); - - checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); - - checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testBackupConsistencyReplicatedFullSyncMvcc() throws Exception { - CacheConfiguration cfg = new CacheConfiguration<>("test-cache"); - - cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); - cfg.setCacheMode(CacheMode.REPLICATED); - cfg.setReadFromBackup(false); - - checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); - - checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testBackupConsistencyPartitionedMvcc() throws Exception { - CacheConfiguration cfg = new CacheConfiguration<>("test-cache"); - - cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC); - cfg.setCacheMode(CacheMode.PARTITIONED); - cfg.setBackups(NODES - 1); - cfg.setReadFromBackup(false); - - checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); - - checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testBackupConsistencyPartitionedFullSyncMvcc() throws Exception { - CacheConfiguration cfg = new CacheConfiguration<>("test-cache"); - - cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); - cfg.setCacheMode(CacheMode.PARTITIONED); - cfg.setBackups(NODES - 1); - cfg.setReadFromBackup(false); - - checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); - - checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); - } - /** * @param ccfg Cache configuration. * @throws Exception If failed. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterReadOnlyModeTestUtils.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterReadOnlyModeTestUtils.java index a12f9cb48713d..5c4245342c7e8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterReadOnlyModeTestUtils.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterReadOnlyModeTestUtils.java @@ -37,7 +37,6 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.junit.Assert.fail; @@ -52,23 +51,17 @@ public class ClusterReadOnlyModeTestUtils { /** Replicated transactional cache. */ private static final String REPL_TX_CACHE = "repl_tx_cache"; - /** Replicated transactional cache. */ - private static final String REPL_MVCC_CACHE = "repl_mvcc_cache"; - /** Partitioned atomic cache. */ public static final String PART_ATOMIC_CACHE = "part_atomic_cache"; /** Partitioned transactional cache. */ private static final String PART_TX_CACHE = "part_tx_cache"; - /** Partitioned mvcc transactional cache. */ - private static final String PART_MVCC_CACHE = "part_mvcc_cache"; - /** * @return Configured cache names. */ public static Collection cacheNames() { - return F.asList(REPL_ATOMIC_CACHE, REPL_TX_CACHE, REPL_MVCC_CACHE, PART_ATOMIC_CACHE, PART_TX_CACHE, PART_MVCC_CACHE); + return F.asList(REPL_ATOMIC_CACHE, REPL_TX_CACHE, PART_ATOMIC_CACHE, PART_TX_CACHE); } /** @@ -78,10 +71,8 @@ public static CacheConfiguration[] cacheConfigurations() { return F.asArray( cacheConfiguration(REPL_ATOMIC_CACHE, REPLICATED, ATOMIC, null), cacheConfiguration(REPL_TX_CACHE, REPLICATED, TRANSACTIONAL, null), - cacheConfiguration(REPL_MVCC_CACHE, REPLICATED, TRANSACTIONAL_SNAPSHOT, "mvcc_repl_grp"), cacheConfiguration(PART_ATOMIC_CACHE, PARTITIONED, ATOMIC, "part_grp"), - cacheConfiguration(PART_TX_CACHE, PARTITIONED, TRANSACTIONAL, "part_grp"), - cacheConfiguration(PART_MVCC_CACHE, PARTITIONED, TRANSACTIONAL_SNAPSHOT, "mvcc_part_grp") + cacheConfiguration(PART_TX_CACHE, PARTITIONED, TRANSACTIONAL, "part_grp") ); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java index c9f7a97c4b4af..2aba96d145364 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java @@ -22,9 +22,7 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -42,12 +40,6 @@ public class CrossCacheLockTest extends GridCommonAbstractTest { /** */ private static final String CACHE2 = "cache2"; - /** */ - @Before - public void beforeCrossCacheLockTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java index 507821f5aae2c..42975f9c205b5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java @@ -34,13 +34,11 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.jetbrains.annotations.Nullable; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -74,13 +72,6 @@ public class CrossCacheTxRandomOperationsTest extends GridCommonAbstractTest { return 6 * 60 * 1000; } - /** */ - @Before - public void beforeCrossCacheTxRandomOperationsTest() { - if (nearCacheEnabled()) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); @@ -189,16 +180,7 @@ protected void createCache(CacheMode cacheMode, * @param crossCacheTx If {@code true} uses cross cache transaction. * @throws Exception If failed. */ - private void txOperations(CacheMode cacheMode, - CacheWriteSynchronizationMode writeSync, - boolean crossCacheTx) throws Exception { - if (MvccFeatureChecker.forcedMvcc()) { - assert !nearCacheEnabled(); - - if (writeSync != CacheWriteSynchronizationMode.FULL_SYNC) - return; - } - + private void txOperations(CacheMode cacheMode, CacheWriteSynchronizationMode writeSync, boolean crossCacheTx) throws Exception { Ignite ignite = ignite(0); try { @@ -208,14 +190,12 @@ private void txOperations(CacheMode cacheMode, txOperations(PESSIMISTIC, REPEATABLE_READ, crossCacheTx, false); txOperations(PESSIMISTIC, REPEATABLE_READ, crossCacheTx, true); - if (!MvccFeatureChecker.forcedMvcc()) { - txOperations(OPTIMISTIC, REPEATABLE_READ, crossCacheTx, false); - txOperations(OPTIMISTIC, REPEATABLE_READ, crossCacheTx, true); + txOperations(OPTIMISTIC, REPEATABLE_READ, crossCacheTx, false); + txOperations(OPTIMISTIC, REPEATABLE_READ, crossCacheTx, true); - if (writeSync == FULL_SYNC) { - txOperations(OPTIMISTIC, SERIALIZABLE, crossCacheTx, false); - txOperations(OPTIMISTIC, SERIALIZABLE, crossCacheTx, true); - } + if (writeSync == FULL_SYNC) { + txOperations(OPTIMISTIC, SERIALIZABLE, crossCacheTx, false); + txOperations(OPTIMISTIC, SERIALIZABLE, crossCacheTx, true); } } finally { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java index 50aa3596830a9..af03012533a50 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java @@ -37,14 +37,11 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -96,17 +93,6 @@ public void testInvokeAllTransactionalCache() throws Exception { check(false, createCacheConfiguration(TRANSACTIONAL)); } - /** - * @throws Exception If failed. - */ - @Test - public void testInvokeAllMvccTxCache() throws Exception { - Assume.assumeTrue("https://issues.apache.org/jira/browse/IGNITE-8582", - MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE)); - - check(false, createCacheConfiguration(TRANSACTIONAL_SNAPSHOT)); - } - /** * @throws Exception If failed. */ @@ -131,17 +117,6 @@ public void testInvokeTransactionalCache() throws Exception { check(true, createCacheConfiguration(TRANSACTIONAL)); } - /** - * @throws Exception If failed. - */ - @Test - public void testInvokeMvccTxCache() throws Exception { - Assume.assumeTrue("https://issues.apache.org/jira/browse/IGNITE-8582", - MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE)); - - check(true, createCacheConfiguration(TRANSACTIONAL_SNAPSHOT)); - } - /** * Tests entry's versions consistency after invokeAll. * diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index 499c48b8a1e25..79185837f18f2 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -97,15 +97,13 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.jetbrains.annotations.Nullable; -import org.junit.Assume; -import org.junit.Before; import org.junit.Ignore; import org.junit.Test; + import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -181,12 +179,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract /** */ private static Map cacheCfgMap; - /** */ - @Before - public void beforeGridCacheAbstractFullApiSelfTest() { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-9543", MvccFeatureChecker.forcedMvcc()); - } - /** {@inheritDoc} */ @Override protected long getTestTimeout() { return TEST_TIMEOUT; @@ -204,8 +196,6 @@ public void beforeGridCacheAbstractFullApiSelfTest() { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-9543", MvccFeatureChecker.forcedMvcc()); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractIteratorsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractIteratorsSelfTest.java index afd38e0d9feb7..ce80aeb6038d8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractIteratorsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractIteratorsSelfTest.java @@ -23,8 +23,6 @@ import org.apache.ignite.internal.util.typedef.CA; import org.apache.ignite.internal.util.typedef.CAX; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Assume; import org.junit.Test; /** @@ -98,8 +96,6 @@ public void testCacheIteratorMultithreaded() throws Exception { /** */ @Test public void testEntrySetIterator() { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10082", MvccFeatureChecker.forcedMvcc()); - assert jcache().localSize(CachePeekMode.ALL) == entryCount(); int cnt = 0; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java index 2e64c525851c4..346e9f922f675 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java @@ -53,7 +53,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.jetbrains.annotations.Nullable; @@ -93,8 +92,7 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest { assert cnt >= 1 : "At least one grid must be started"; - if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE)) - initStoreStrategy(); + initStoreStrategy(); startGrids(cnt); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java index eb09236c43ef9..b5687a064f701 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java @@ -39,7 +39,6 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestThread; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; import org.junit.Test; @@ -95,8 +94,6 @@ protected GridCacheBasicApiAbstractTest() { */ @Test public void testBasicLock() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); Lock lock = cache.lock(1); @@ -115,8 +112,6 @@ public void testBasicLock() throws Exception { */ @Test public void testSingleLockReentry() throws IgniteCheckedException { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); Lock lock = cache.lock(1); @@ -146,8 +141,6 @@ public void testSingleLockReentry() throws IgniteCheckedException { */ @Test public void testReentry() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); Lock lock = cache.lock(1); @@ -188,8 +181,6 @@ public void testReentry() throws Exception { */ @Test public void testInterruptLock() throws InterruptedException { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - final IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); final Lock lock = cache.lock(1); @@ -235,8 +226,6 @@ public void testInterruptLock() throws InterruptedException { */ @Test public void testInterruptLockWithTimeout() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - final IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); startGrid(1); @@ -297,8 +286,6 @@ public void testInterruptLockWithTimeout() throws Exception { */ @Test public void testManyLockReentries() throws IgniteCheckedException { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); Integer key = 1; @@ -343,8 +330,6 @@ public void testManyLockReentries() throws IgniteCheckedException { */ @Test public void testLockMultithreaded() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - final IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); final CountDownLatch l1 = new CountDownLatch(1); @@ -464,9 +449,6 @@ public void testLockMultithreaded() throws Exception { */ @Test public void testBasicOps() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); CountDownLatch latch = new CountDownLatch(1); @@ -529,9 +511,6 @@ public void testBasicOps() throws Exception { */ @Test public void testBasicOpsWithReentry() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); int key = (int)System.currentTimeMillis(); @@ -605,8 +584,6 @@ public void testBasicOpsWithReentry() throws Exception { */ @Test public void testMultiLocks() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); Collection keys = Arrays.asList(1, 2, 3); @@ -664,10 +641,6 @@ public void testGetPutRemove() throws IgniteCheckedException { */ @Test public void testPutWithExpiration() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); CacheEventListener lsnr = new CacheEventListener(new CountDownLatch(1)); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java index 325413b9f8646..69880be325c5a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java @@ -30,11 +30,9 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.typedef.P2; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.jetbrains.annotations.Nullable; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -50,12 +48,6 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract /** Cache store. */ private static final GridCacheTestStore store = new GridCacheTestStore(); - /** */ - @Before - public void beforeGridCacheBasicStoreAbstractTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** * */ @@ -81,8 +73,6 @@ protected GridCacheBasicStoreAbstractTest() { /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration c = super.getConfiguration(igniteInstanceName); CacheConfiguration cc = defaultCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java index a824d9cbf849b..f9b59a987fc57 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearAllSelfTest.java @@ -25,9 +25,7 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -65,8 +63,6 @@ public class GridCacheClearAllSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7952", MvccFeatureChecker.forcedMvcc()); - super.beforeTestsStarted(); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocallySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocallySelfTest.java index 5865f53fbb51a..eff2d2624bfbd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocallySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocallySelfTest.java @@ -31,12 +31,12 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; import static org.apache.ignite.internal.processors.cache.GridCacheAdapter.CLEAR_ALL_SPLIT_THRESHOLD; -import static org.apache.ignite.testframework.MvccFeatureChecker.forcedMvcc; /** * Test {@link IgniteCache#localClearAll(java.util.Set)} operations in multinode environment with nodes having caches with different names. @@ -206,9 +206,6 @@ public void testReplicatedSplit() throws Exception { * @throws Exception In case of exception. */ private void test(Mode mode, int keysCnt) throws Exception { - if (forcedMvcc()) - return; - startUp(); // Take in count special case for near-only cache as well. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java index 1081766700816..4e6964e48933c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java @@ -46,9 +46,9 @@ import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheRebalanceMode.ASYNC; @@ -512,33 +512,6 @@ public void testDifferentAtomicity() throws Exception { ); } - /** - * @throws Exception If failed. - */ - @Test - public void testDifferentTxAtomicity() throws Exception { - cacheMode = PARTITIONED; - - checkSecondGridStartFails( - new C1() { - /** {@inheritDoc} */ - @Override public Void apply(CacheConfiguration cfg) { - cfg.setNearConfiguration(null); - cfg.setAtomicityMode(TRANSACTIONAL); - return null; - } - }, - new C1() { - /** {@inheritDoc} */ - @Override public Void apply(CacheConfiguration cfg) { - cfg.setNearConfiguration(null); - cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - return null; - } - } - ); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java index 414ff1caf81c6..c5ab1798ee787 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java @@ -35,10 +35,10 @@ import org.apache.ignite.marshaller.Marshaller; import org.apache.ignite.marshaller.MarshallerContext; import org.apache.ignite.marshaller.jdk.JdkMarshaller; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Ignore; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -204,8 +204,6 @@ public void testReplicated() throws Exception { /** @throws Exception If failed. */ @Test public void testPartitionedNearEnabled() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - IgniteCache cache = createCache(true, PARTITIONED); try { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java index 4b4f5d8047473..1828d48833e73 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java @@ -29,7 +29,6 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; import static org.apache.ignite.internal.processors.cache.version.GridCacheVersionManager.TOP_VER_BASE_TIME; @@ -77,16 +76,6 @@ public void testVersionTransactional() throws Exception { checkVersion(); } - /** - * @throws Exception If failed. - */ - @Test - public void testVersionMvccTx() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - - checkVersion(); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java index 179eae584c5e9..7e328954a40d5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java @@ -32,9 +32,7 @@ import org.apache.ignite.events.Event; import org.apache.ignite.events.EventType; import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.events.EventType.EVT_CACHE_ENTRY_EVICTED; @@ -46,13 +44,6 @@ * Eviction event self test. */ public abstract class GridCacheEvictionEventAbstractTest extends GridCommonAbstractTest { - /** */ - @Before - public void beforeGridCacheEvictionEventAbstractTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - } - /** * */ @@ -62,9 +53,6 @@ protected GridCacheEvictionEventAbstractTest() { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - IgniteConfiguration c = super.getConfiguration(); CacheConfiguration cc = defaultCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFastNodeLeftForTransactionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFastNodeLeftForTransactionTest.java index 5a2f5dc06a1f3..7ffb5f09625c4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFastNodeLeftForTransactionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFastNodeLeftForTransactionTest.java @@ -97,7 +97,6 @@ public class GridCacheFastNodeLeftForTransactionTest extends GridCommonAbstractT /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { return super.getConfiguration(igniteInstanceName) - .setMvccVacuumFrequency(1000) .setCacheConfiguration(createCacheConfigs()) .setGridLogger(listeningLog) .setConnectorConfiguration(new ConnectorConfiguration()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java index 7a9298dbf7327..3a6a43112ab50 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java @@ -34,9 +34,7 @@ import org.apache.ignite.internal.util.typedef.CI1; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -59,12 +57,6 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest return GRID_CNT; } - /** */ - @Before - public void beforeGridCacheFinishPartitionsSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - } - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { grid = (IgniteKernal)grid(0); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGetAndTransformStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGetAndTransformStoreAbstractTest.java index 44ee0fd32b28c..894e9d4e60c9e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGetAndTransformStoreAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheGetAndTransformStoreAbstractTest.java @@ -29,9 +29,7 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -52,12 +50,6 @@ protected GridCacheGetAndTransformStoreAbstractTest() { super(true /*start grid. */); } - /** */ - @Before - public void beforeGridCacheGetAndTransformStoreAbstractTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { store.resetTimestamp(); @@ -76,8 +68,6 @@ public void beforeGridCacheGetAndTransformStoreAbstractTest() { /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration c = super.getConfiguration(igniteInstanceName); CacheConfiguration cc = defaultCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java index e2b5ade6b4048..d823a490dafbb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java @@ -40,13 +40,12 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.lang.IgniteBiTuple; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.jetbrains.annotations.Nullable; -import org.junit.Before; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -77,18 +76,6 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst awaitPartitionMapExchange(); } - /** */ - @Before - public void beforeGridCacheInterceptorAbstractSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.INTERCEPTOR); - - if (nearEnabled()) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - - if (storeEnabled()) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { // No-op. @@ -118,14 +105,6 @@ public void beforeGridCacheInterceptorAbstractSelfTest() { /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.INTERCEPTOR); - - if (nearEnabled()) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - - if (storeEnabled()) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName); if (!storeEnabled()) { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorTransactionalRebalanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorTransactionalRebalanceTest.java index 682fbf1b933e7..87c3f32e7ce57 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorTransactionalRebalanceTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorTransactionalRebalanceTest.java @@ -18,17 +18,11 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.testframework.MvccFeatureChecker; /** * */ public class GridCacheInterceptorTransactionalRebalanceTest extends GridAbstractCacheInterceptorRebalanceTest { - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.INTERCEPTOR); - } - /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return CacheAtomicityMode.TRANSACTIONAL; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java index 563f71a0dbc21..e5c94f79dc6e7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java @@ -36,10 +36,8 @@ import org.apache.ignite.events.EventType; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.typedef.PE; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; @@ -48,16 +46,8 @@ /** */ public class GridCacheMarshallingNodeJoinSelfTest extends GridCommonAbstractTest { - /** */ - @Before - public void beforeGridCacheMarshallingNodeJoinSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); @@ -76,8 +66,6 @@ public void beforeGridCacheMarshallingNodeJoinSelfTest() { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - startGridsMultiThreaded(2); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMixedPartitionExchangeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMixedPartitionExchangeSelfTest.java index b9b6bb7162b8b..090bc175871e4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMixedPartitionExchangeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMixedPartitionExchangeSelfTest.java @@ -30,7 +30,6 @@ import org.apache.ignite.lang.IgniteCallable; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -115,7 +114,7 @@ public void testNodeJoinLeave() throws Exception { } catch (Exception e) { if (!X.hasCause(e, ClusterTopologyCheckedException.class)) - MvccFeatureChecker.assertMvccWriteConflict(e); + throw e; } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java index cb50c9ef1a7df..c0908f6f00557 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java @@ -29,7 +29,6 @@ import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.testframework.MvccFeatureChecker.assertMvccWriteConflict; /** * Multinode update test. @@ -103,20 +102,8 @@ public void testInvoke() throws Exception { final IgniteCache cache = grid(idx).cache(DEFAULT_CACHE_NAME); - for (int i = 0; i < ITERATIONS_PER_THREAD && !failed; i++) { - boolean updated = false; - - while (!updated) { - try { - cache.invoke(key, new IncProcessor()); - - updated = true; - } - catch (Exception e) { - assertMvccWriteConflict(e); - } - } - } + for (int i = 0; i < ITERATIONS_PER_THREAD && !failed; i++) + cache.invoke(key, new IncProcessor()); return null; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java index 0eaedabd20e16..c7288eaf072a9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java @@ -18,9 +18,6 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Assume; -import org.junit.Test; /** * @@ -39,12 +36,4 @@ public class GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest extends GridCa return ccfg; } - - /** {@inheritDoc} */ - @Test - @Override public void testInvoke() throws Exception { - Assume.assumeTrue("https://issues.apache.org/jira/browse/IGNITE-809", MvccFeatureChecker.forcedMvcc()); - - super.testInvoke(); - } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java index 627a936992325..cbfc9e360b981 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java @@ -19,9 +19,7 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Assume; -import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -30,12 +28,6 @@ * TODO: IGNITE-809. */ public class GridCacheMultinodeUpdateNearEnabledSelfTest extends GridCacheMultinodeUpdateAbstractSelfTest { - /** */ - @Before - public void beforeGridCacheMultinodeUpdateNearEnabledSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected NearCacheConfiguration nearConfiguration() { return new NearCacheConfiguration(); @@ -48,9 +40,8 @@ public void beforeGridCacheMultinodeUpdateNearEnabledSelfTest() { /** {@inheritDoc} */ @Test + @Ignore("https://issues.apache.org/jira/browse/IGNITE-809") @Override public void testInvoke() throws Exception { - Assume.assumeTrue("https://issues.apache.org/jira/browse/IGNITE-809", MvccFeatureChecker.forcedMvcc()); - - super.testInvoke(); + // No-op. } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java deleted file mode 100644 index c9e84582fe996..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import java.util.UUID; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheMode.REPLICATED; - -/** - * Tests flags correctness. - */ -public class GridCacheMvccFlagsTest extends GridCommonAbstractTest { - /** Grid. */ - private IgniteKernal grid; - - /** - * - */ - public GridCacheMvccFlagsTest() { - super(true /*start grid. */); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - grid = (IgniteKernal)grid(); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - grid = null; - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration() throws Exception { - IgniteConfiguration cfg = super.getConfiguration(); - - CacheConfiguration cacheCfg = defaultCacheConfiguration(); - - cacheCfg.setCacheMode(REPLICATED); - - cfg.setCacheConfiguration(cacheCfg); - - return cfg; - } - - /** - * - */ - @Test - public void testAllTrueFlags() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID id = UUID.randomUUID(); - - GridCacheVersion ver = new GridCacheVersion(1, 0, 0, 0); - - GridCacheMvccCandidate c = new GridCacheMvccCandidate( - entry, - id, - id, - ver, - 1, - ver, - true, - true, - true, - true, - true, - true, - null, - true - ); - - c.setOwner(); - c.setReady(); - c.setUsed(); - c.setRemoved(); - - short flags = c.flags(); - - info("Candidate: " + c); - - for (GridCacheMvccCandidate.Mask mask : GridCacheMvccCandidate.Mask.values()) - assertTrue("Candidate: " + c, mask.get(flags)); - } - - /** - * - */ - @Test - public void testAllFalseFlags() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID id = UUID.randomUUID(); - - GridCacheVersion ver = new GridCacheVersion(1, 0, 0, 0); - - GridCacheMvccCandidate c = new GridCacheMvccCandidate( - entry, - id, - id, - ver, - 1, - ver, - false, - false, - false, - false, - false, - false, - null, - false - ); - - short flags = c.flags(); - - info("Candidate: " + c); - - for (GridCacheMvccCandidate.Mask mask : GridCacheMvccCandidate.Mask.values()) - assertFalse("Mask check failed [mask=" + mask + ", c=" + c + ']', mask.get(flags)); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java deleted file mode 100644 index b3221193469c9..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java +++ /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. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.CacheWriteSynchronizationMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.cache.CacheMode.REPLICATED; - -/** - * Tests for {@link GridCacheMvccManager}. - */ -public class GridCacheMvccManagerSelfTest extends GridCommonAbstractTest { - /** Cache mode. */ - private CacheMode mode; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - cfg.setCacheConfiguration(cacheConfiguration()); - - return cfg; - } - - /** @return Cache configuration. */ - protected CacheConfiguration cacheConfiguration() { - CacheConfiguration cfg = defaultCacheConfiguration(); - - cfg.setCacheMode(mode); - cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); - cfg.setAtomicityMode(TRANSACTIONAL); - - return cfg; - } - - /** @throws Exception If failed. */ - @Test - public void testReplicatedCache() throws Exception { - mode = REPLICATED; - - testCandidates(3); - } - - /** @throws Exception If failed. */ - @Test - public void testPartitionedCache() throws Exception { - mode = PARTITIONED; - - testCandidates(3); - } - - /** - * @param gridCnt Grid count. - * @throws Exception If failed. - */ - private void testCandidates(int gridCnt) throws Exception { - try { - Ignite ignite = startGridsMultiThreaded(gridCnt); - - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); - - Transaction tx = ignite.transactions().txStart(); - - cache.put(1, 1); - - tx.commit(); - - for (int i = 0; i < gridCnt; i++) { - assert ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME).context().mvcc().localCandidates().isEmpty(); - assert ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME).context().mvcc().remoteCandidates().isEmpty(); - } - } - finally { - stopAllGrids(); - } - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccMultiThreadedUpdateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccMultiThreadedUpdateSelfTest.java deleted file mode 100644 index f48300dac1207..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccMultiThreadedUpdateSelfTest.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import java.util.concurrent.Callable; -import java.util.function.Supplier; -import javax.cache.CacheException; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Multithreaded update test. - */ -public class GridCacheMvccMultiThreadedUpdateSelfTest extends GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest { - /** */ - public static final int THREADS = 5; - - /** {@inheritDoc} */ - @Override protected long getTestTimeout() { - return 5 * 60_000; - } - - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTransformTx() throws Exception { - testTransformTx(keyForNode(0)); - - if (gridCount() > 1) - testTransformTx(keyForNode(1)); - } - - /** - * @param key Key. - * @throws Exception If failed. - */ - private void testTransformTx(final Integer key) throws Exception { - final IgniteCache cache = grid(0).cache(DEFAULT_CACHE_NAME); - - cache.put(key, 0); - - final int ITERATIONS_PER_THREAD = iterations(); - - GridTestUtils.runMultiThreaded(new Callable() { - @Override public Void call() throws Exception { - IgniteTransactions txs = ignite(0).transactions(); - - for (int i = 0; i < ITERATIONS_PER_THREAD && !failed; i++) { - if (i % 500 == 0) - log.info("Iteration " + i); - - doOperation(() -> { - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.invoke(key, new IncProcessor()); - - tx.commit(); - } - }); - } - - return null; - } - }, THREADS, "transform"); - - for (int i = 0; i < gridCount(); i++) { - Integer val = (Integer)grid(i).cache(DEFAULT_CACHE_NAME).get(key); - - assertEquals("Unexpected value for grid " + i, (Integer)(ITERATIONS_PER_THREAD * THREADS), val); - } - - if (failed) { - for (int g = 0; g < gridCount(); g++) - info("Value for cache [g=" + g + ", val=" + grid(g).cache(DEFAULT_CACHE_NAME).get(key) + ']'); - - assertFalse(failed); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutTxPessimistic() throws Exception { - testPutTx(keyForNode(0)); - - if (gridCount() > 1) - testPutTx(keyForNode(1)); - } - - /** - * @param key Key. - * @throws Exception If failed. - */ - private void testPutTx(final Integer key) throws Exception { - final IgniteCache cache = grid(0).cache(DEFAULT_CACHE_NAME); - - cache.put(key, 0); - - final int ITERATIONS_PER_THREAD = iterations(); - - GridTestUtils.runMultiThreaded(new Callable() { - @Override public Void call() throws Exception { - for (int i = 0; i < ITERATIONS_PER_THREAD; i++) { - if (i % 500 == 0) - log.info("Iteration " + i); - - int val0 = i; - doOperation(() -> { - try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - Integer val = cache.getAndPut(key, val0); - - assertNotNull(val); - - tx.commit(); - } - }); - } - - return null; - } - }, THREADS, "put"); - - for (int i = 0; i < gridCount(); i++) { - Integer val = (Integer)grid(i).cache(DEFAULT_CACHE_NAME).get(key); - - assertNotNull("Unexpected value for grid " + i, val); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutxIfAbsentTxPessimistic() throws Exception { - testPutxIfAbsentTx(keyForNode(0)); - - if (gridCount() > 1) - testPutxIfAbsentTx(keyForNode(1)); - } - - /** - * @param key Key. - * @throws Exception If failed. - */ - private void testPutxIfAbsentTx(final Integer key) throws Exception { - final IgniteCache cache = grid(0).cache(DEFAULT_CACHE_NAME); - - cache.put(key, 0); - - final int ITERATIONS_PER_THREAD = iterations(); - - GridTestUtils.runMultiThreaded(new Callable() { - @Override public Void call() throws Exception { - for (int i = 0; i < ITERATIONS_PER_THREAD && !failed; i++) { - if (i % 500 == 0) - log.info("Iteration " + i); - - try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.putIfAbsent(key, 100); - - tx.commit(); - } - } - - return null; - } - }, THREADS, "putxIfAbsent"); - - for (int i = 0; i < gridCount(); i++) { - Integer val = (Integer)grid(i).cache(DEFAULT_CACHE_NAME).get(key); - - assertEquals("Unexpected value for grid " + i, (Integer)0, val); - } - - assertFalse(failed); - } - - /** {@inheritDoc} */ - @Override protected T doOperation(Supplier op) { - while (true) { - try { - return super.doOperation(op); - } - catch (CacheException e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } - } - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java deleted file mode 100644 index 58b5966e9cfdc..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java +++ /dev/null @@ -1,1083 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.UUID; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.jetbrains.annotations.Nullable; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * Test cases for multi-threaded tests in partitioned cache. - */ -public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest { - /** */ - private static final UUID nodeId = UUID.randomUUID(); - - /** Grid. */ - private IgniteKernal grid; - - /** - * - */ - public GridCacheMvccPartitionedSelfTest() { - super(true /*start grid. */); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - grid = (IgniteKernal)grid(); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - grid = null; - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration() throws Exception { - IgniteConfiguration cfg = super.getConfiguration(); - - CacheConfiguration cacheCfg = defaultCacheConfiguration(); - - cacheCfg.setCacheMode(PARTITIONED); - cacheCfg.setBackups(1); - cacheCfg.setAtomicityMode(TRANSACTIONAL); - - cfg.setCacheConfiguration(cacheCfg); - - return cfg; - } - - /** - * Tests remote candidates. - */ - @Test - public void testNearLocalsWithPending() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - - GridCacheMvccCandidate c1 = entry.addRemote(node1, 1, ver1, true); - GridCacheMvccCandidate c2 = entry.addNearLocal(node1, 1, ver2, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - Collection nearLocCands = entry.localCandidates(); - - assertEquals(1, nearLocCands.size()); - assertEquals(ver2, nearLocCands.iterator().next().version()); - - assertEquals(1, rmtCands.size()); - assertEquals(ver1, rmtCands.iterator().next().version()); - - entry.readyNearLocal(ver2, ver2, empty(), empty(), Arrays.asList(ver1)); - - checkLocalOwner(c2, ver2, false); - checkRemote(c1, ver1, false, false); - - assertNotNull(entry.anyOwner()); - assertEquals(ver2, entry.anyOwner().version()); - } - - /** - * Tests remote candidates. - */ - @Test - public void testNearLocalsWithCommitted() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - - GridCacheMvccCandidate c1 = entry.addNearLocal(node1, 1, ver1, true); - GridCacheMvccCandidate c2 = entry.addRemote(node1, 1, ver2, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - Collection nearLocCands = entry.localCandidates(); - - assertEquals(1, nearLocCands.size()); - assertEquals(ver1, nearLocCands.iterator().next().version()); - - assertEquals(1, rmtCands.size()); - assertEquals(ver2, rmtCands.iterator().next().version()); - - entry.readyNearLocal(ver1, ver1, Arrays.asList(ver2), empty(), empty()); - - checkLocal(c1, ver1, true, false, false); - checkRemote(c2, ver2, true, false); - - assertNull(entry.anyOwner()); - } - - /** - * Tests remote candidates. - */ - @Test - public void testNearLocalsWithRolledback() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - - GridCacheMvccCandidate c1 = entry.addNearLocal(node1, 1, ver1, true); - GridCacheMvccCandidate c2 = entry.addRemote(node1, 1, ver2, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - Collection nearLocCands = entry.localCandidates(); - - assertEquals(1, nearLocCands.size()); - assertEquals(ver1, nearLocCands.iterator().next().version()); - - assertEquals(1, rmtCands.size()); - assertEquals(ver2, rmtCands.iterator().next().version()); - - entry.readyNearLocal(ver1, ver1, empty(), Arrays.asList(ver2), empty()); - - checkLocal(c1, ver1, true, false, false); - checkRemote(c2, ver2, true, false); - - assertNull(entry.anyOwner()); - } - - /** - * Tests remote candidates. - */ - @Test - public void testNearLocals() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - - GridCacheMvccCandidate c1 = entry.addNearLocal(node1, 1, ver1, true); - GridCacheMvccCandidate c2 = entry.addNearLocal(node1, 1, ver2, true); - - entry.readyNearLocal(ver2, ver2, empty(), empty(), empty()); - - checkLocalOwner(c2, ver2, false); - checkLocal(c1, ver1, false, false, false); - - Collection cands = entry.localCandidates(); - - assert cands.size() == 2; - assert cands.iterator().next().version().equals(ver2); - - checkLocalOwner(c2, ver2, false); - checkLocal(c1, ver1, false, false, false); - } - - /** - * Tests remote candidates. - */ - @Test - public void testNearLocalsWithOwned() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - - GridCacheMvccCandidate c1 = entry.addRemote(node1, 1, ver1, true); - GridCacheMvccCandidate c2 = entry.addNearLocal(node1, 1, ver2, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - Collection nearLocCands = entry.localCandidates(); - - assertEquals(1, nearLocCands.size()); - assertEquals(ver2, nearLocCands.iterator().next().version()); - - assertEquals(1, rmtCands.size()); - assertEquals(ver1, rmtCands.iterator().next().version()); - - entry.orderOwned(ver1, ver2); - - entry.readyNearLocal(ver2, ver2, empty(), empty(), empty()); - - checkRemote(c1, ver1, false, false); - - assertFalse(c1.owner()); - - checkLocalOwner(c2, ver2, false); - - assertNotNull(entry.anyOwner()); - assertEquals(ver2, entry.anyOwner().version()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAddPendingRemote0() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver0 = version(0); - GridCacheVersion ver1 = version(1); - - entry.addNearLocal(node1, 1, ver1, true); - - entry.readyNearLocal(ver1, ver1, empty(), empty(), Collections.singletonList(ver0)); - - entry.addRemote(node1, 1, ver0, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - Collection nearLocCands = entry.localCandidates(); - - assertEquals(1, nearLocCands.size()); - assertEquals(ver1, nearLocCands.iterator().next().version()); - - assertEquals(1, rmtCands.size()); - assertEquals(ver0, rmtCands.iterator().next().version()); - - assertNotNull(entry.anyOwner()); - assertEquals(ver1, entry.anyOwner().version()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAddPendingRemote1() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver0 = version(0); - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - - GridCacheMvccCandidate c3 = entry.addNearLocal(node1, 1, ver3, true); - - entry.readyNearLocal(ver3, ver3, empty(), empty(), Arrays.asList(ver0, ver1, ver2)); - - GridCacheMvccCandidate c2 = entry.addRemote(node1, 1, ver2, true); - GridCacheMvccCandidate c1 = entry.addRemote(node1, 1, ver1, true); - GridCacheMvccCandidate c0 = entry.addRemote(node1, 1, ver0, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - - assert rmtCands.size() == 3; - - // DHT remote candidates are not reordered and sorted. - GridCacheMvccCandidate[] candArr = new GridCacheMvccCandidate[] {c2, c1, c0}; - - rmtCands = entry.remoteMvccSnapshot(); - - int i = 0; - - for (GridCacheMvccCandidate cand : rmtCands) { - assert cand == candArr[i] : "Invalid candidate in position " + i; - - i++; - } - - assertEquals(c3, entry.anyOwner()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAddPendingRemote2() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver0 = version(0); - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - - GridCacheMvccCandidate c3 = entry.addNearLocal(node1, 1, ver3, true); - entry.addNearLocal(node1, 1, ver2, true); - - entry.readyNearLocal(ver3, ver3, empty(), empty(), Arrays.asList(ver0, ver1, ver2)); - - GridCacheMvccCandidate c1 = entry.addRemote(node1, 1, ver1, true); - GridCacheMvccCandidate c0 = entry.addRemote(node1, 1, ver0, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - - assertEquals(2, rmtCands.size()); - - Collection nearLocCands = entry.localCandidates(); - - assertEquals(2, nearLocCands.size()); - - GridCacheMvccCandidate[] candArr = new GridCacheMvccCandidate[] {c1, c0}; - - int i = 0; - - for (GridCacheMvccCandidate cand : rmtCands) { - assert cand == candArr[i] : "Invalid candidate in position " + i; - - i++; - } - - assertEquals(c3, entry.anyOwner()); - } - - /** - * Tests salvageRemote method - */ - @Test - public void testSalvageRemote() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - - entry.addRemote(node1, 1, ver1, true); - entry.addRemote(node1, 1, ver2, true); - GridCacheMvccCandidate c3 = entry.addNearLocal(node1, 1, ver3, true); - GridCacheMvccCandidate c4 = entry.addRemote(node1, 1, ver4, true); - entry.addRemote(node1, 1, ver5, true); - entry.addRemote(node1, 1, ver6, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - - assertEquals(5, rmtCands.size()); - assertEquals(ver1, rmtCands.iterator().next().version()); - - Collection nearLocCands = entry.localCandidates(); - - assertEquals(1, nearLocCands.size()); - assertEquals(ver3, nearLocCands.iterator().next().version()); - - entry.salvageRemote(ver4); - - rmtCands = entry.remoteMvccSnapshot(); - - boolean before = true; - - for (GridCacheMvccCandidate cand : rmtCands) { - if (cand == c4) { - before = false; - - continue; - } - - if (before && cand != c3) { - assertTrue(cand.owner()); - assertTrue(cand.used()); - } - else { - assertFalse(cand.owner()); - assertFalse(cand.used()); - } - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNearRemoteConsistentOrdering0() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(10); - GridCacheVersion nearVer2 = version(5); - GridCacheVersion ver2 = version(20); - GridCacheVersion ver3 = version(30); - - entry.addRemote(node1, 1, ver1, true); - entry.addNearLocal(node1, 1, nearVer2, true); - entry.addRemote(node1, 1, ver3, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - Collection nearLocCands = entry.localCandidates(); - - assertEquals(1, nearLocCands.size()); - assertEquals(nearVer2, nearLocCands.iterator().next().version()); - - assertEquals(2, rmtCands.size()); - assertEquals(ver1, rmtCands.iterator().next().version()); - - entry.readyNearLocal(nearVer2, ver2, empty(), empty(), empty()); - - assertNull(entry.anyOwner()); - - rmtCands = entry.remoteMvccSnapshot(); - - assertEquals(ver1, rmtCands.iterator().next().version()); - assertTrue(rmtCands.iterator().next().owner()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNearRemoteConsistentOrdering1() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(10); - GridCacheVersion nearVer2 = version(5); - GridCacheVersion ver2 = version(20); - GridCacheVersion ver3 = version(30); - - entry.addRemote(node1, 1, ver1, true); - entry.addNearLocal(node1, 1, nearVer2, true); - entry.addRemote(node1, 1, ver3, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - Collection nearLocCands = entry.localCandidates(); - - assertEquals(1, nearLocCands.size()); - assertEquals(nearVer2, nearLocCands.iterator().next().version()); - - assertEquals(2, rmtCands.size()); - assertEquals(ver1, rmtCands.iterator().next().version()); - - entry.orderCompleted(nearVer2, Arrays.asList(ver3), empty()); - entry.readyNearLocal(nearVer2, ver2, empty(), empty(), Arrays.asList(ver1)); - - nearLocCands = entry.localCandidates(); - rmtCands = entry.remoteMvccSnapshot(); - - assertNull(entry.anyOwner()); - assertEquals(ver3, rmtCands.iterator().next().version()); - assertTrue(rmtCands.iterator().next().owner()); - - GridCacheMvccCandidate cand = nearLocCands.iterator().next(); - - assertTrue(cand.ready()); - assertFalse(cand.owner()); - assertFalse(cand.used()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNearRemoteConsistentOrdering2() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(10); - GridCacheVersion nearVer2 = version(5); - GridCacheVersion ver2 = version(20); - GridCacheVersion ver3 = version(30); - - entry.addRemote(node1, 1, ver1, true); - entry.addNearLocal(node1, 1, nearVer2, true); - entry.addRemote(node1, 1, ver3, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - Collection nearLocCands = entry.localCandidates(); - - assertEquals(1, nearLocCands.size()); - assertEquals(nearVer2, nearLocCands.iterator().next().version()); - - assertEquals(2, rmtCands.size()); - assertEquals(ver1, rmtCands.iterator().next().version()); - - entry.orderCompleted(nearVer2, empty(), empty()); - entry.readyNearLocal(nearVer2, ver2, empty(), empty(), empty()); - - nearLocCands = entry.localCandidates(); - rmtCands = entry.remoteMvccSnapshot(); - - assertNull(entry.anyOwner()); - assertEquals(ver1, rmtCands.iterator().next().version()); - assertTrue(rmtCands.iterator().next().owner()); - - GridCacheMvccCandidate cand = nearLocCands.iterator().next(); - - assertTrue(cand.ready()); - assertFalse(cand.used()); - assertFalse(cand.owner()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNearRemoteConsistentOrdering3() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(10); - GridCacheVersion nearVer2 = version(5); - GridCacheVersion ver2 = version(20); - GridCacheVersion ver3 = version(30); - - entry.addRemote(node1, 1, ver1, true); - entry.addNearLocal(node1, 1, nearVer2, true); - entry.addRemote(node1, 1, ver3, true); - - Collection rmtCands = entry.remoteMvccSnapshot(); - Collection nearLocCands = entry.localCandidates(); - - assertEquals(1, nearLocCands.size()); - assertEquals(nearVer2, nearLocCands.iterator().next().version()); - - assertEquals(2, rmtCands.size()); - assertEquals(ver1, rmtCands.iterator().next().version()); - - entry.orderCompleted(nearVer2, empty(), empty()); - entry.readyNearLocal(nearVer2, ver2, empty(), empty(), Arrays.asList(ver1)); - - rmtCands = entry.remoteMvccSnapshot(); - - assertNotNull(entry.anyOwner()); - checkLocalOwner(entry.anyOwner(), nearVer2, false); - - assertEquals(ver1, rmtCands.iterator().next().version()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSerializableReadLocksAdd() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheVersion serOrder1 = new GridCacheVersion(0, 10, 1); - GridCacheVersion serOrder2 = new GridCacheVersion(0, 20, 1); - GridCacheVersion serOrder3 = new GridCacheVersion(0, 15, 1); - - { - GridCacheMvcc mvcc = new GridCacheMvcc(cache.context()); - - GridCacheTestEntryEx e = new GridCacheTestEntryEx(cache.context(), "1"); - - GridCacheMvccCandidate cand1 = addLocal(mvcc, e, version(1), serOrder1, true); - - assertNotNull(cand1); - - GridCacheMvccCandidate cand2 = addLocal(mvcc, e, version(2), serOrder2, true); - - assertNotNull(cand2); - - GridCacheMvccCandidate cand3 = addLocal(mvcc, e, version(3), serOrder3, false); - - assertNull(cand3); - - cand3 = addLocal(mvcc, e, version(3), serOrder3, true); - - assertNotNull(cand3); - } - - { - GridCacheMvcc mvcc = new GridCacheMvcc(cache.context()); - - GridCacheTestEntryEx e = new GridCacheTestEntryEx(cache.context(), "1"); - - GridCacheMvccCandidate cand1 = addLocal(mvcc, e, version(1), serOrder2, true); - - assertNotNull(cand1); - - GridCacheMvccCandidate cand2 = addLocal(mvcc, e, version(2), serOrder1, true); - - assertNotNull(cand2); - - GridCacheMvccCandidate cand3 = addLocal(mvcc, e, version(3), serOrder3, false); - - assertNull(cand3); - - cand3 = addLocal(mvcc, e, version(3), serOrder3, true); - - assertNotNull(cand3); - } - - { - GridCacheMvcc mvcc = new GridCacheMvcc(cache.context()); - - GridCacheTestEntryEx e = new GridCacheTestEntryEx(cache.context(), "1"); - - GridCacheMvccCandidate cand1 = addLocal(mvcc, e, version(1), serOrder3, false); - - assertNotNull(cand1); - - GridCacheMvccCandidate cand2 = addLocal(mvcc, e, version(2), serOrder2, true); - - assertNotNull(cand2); - - GridCacheMvccCandidate cand3 = addLocal(mvcc, e, version(3), serOrder1, true); - - assertNull(cand3); - - cand3 = addLocal(mvcc, e, version(3), serOrder1, false); - - assertNull(cand3); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSerializableReadLocksAssign() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheVersion serOrder1 = new GridCacheVersion(0, 10, 1); - GridCacheVersion serOrder2 = new GridCacheVersion(0, 20, 1); - GridCacheVersion serOrder3 = new GridCacheVersion(0, 15, 1); - - { - GridCacheMvcc mvcc = new GridCacheMvcc(cache.context()); - - GridCacheTestEntryEx e = new GridCacheTestEntryEx(cache.context(), "1"); - - GridCacheMvccCandidate cand1 = addLocal(mvcc, e, version(1), serOrder1, true); - - assertNotNull(cand1); - - GridCacheMvccCandidate cand2 = addLocal(mvcc, e, version(2), serOrder2, true); - - assertNotNull(cand2); - - GridCacheMvccCandidate cand3 = addLocal(mvcc, e, version(3), serOrder3, false); - - assertNull(cand3); - - cand3 = addLocal(mvcc, e, version(3), serOrder3, true); - - assertNotNull(cand3); - - CacheLockCandidates owners = mvcc.recheck(); - - assertNull(owners); - - cand1.setReady(); - - owners = mvcc.recheck(); - - assertSame(cand1, owners); - checkCandidates(owners, cand1.version()); - - cand2.setReady(); - - owners = mvcc.recheck(); - checkCandidates(owners, cand1.version(), cand2.version()); - - mvcc.remove(cand1.version()); - - owners = mvcc.recheck(); - assertSame(cand2, owners); - checkCandidates(owners, cand2.version()); - } - - { - GridCacheMvcc mvcc = new GridCacheMvcc(cache.context()); - - GridCacheTestEntryEx e = new GridCacheTestEntryEx(cache.context(), "1"); - - GridCacheMvccCandidate cand1 = addLocal(mvcc, e, version(1), serOrder1, true); - - assertNotNull(cand1); - - GridCacheMvccCandidate cand2 = addLocal(mvcc, e, version(2), serOrder2, true); - - assertNotNull(cand2); - - GridCacheMvccCandidate cand3 = addLocal(mvcc, e, version(3), serOrder3, false); - - assertNull(cand3); - - cand3 = addLocal(mvcc, e, version(3), serOrder3, true); - - assertNotNull(cand3); - - CacheLockCandidates owners = mvcc.recheck(); - - assertNull(owners); - - cand2.setReady(); - - owners = mvcc.recheck(); - - assertSame(cand2, owners); - checkCandidates(owners, cand2.version()); - - cand1.setReady(); - - owners = mvcc.recheck(); - checkCandidates(owners, cand1.version(), cand2.version()); - - mvcc.remove(cand2.version()); - - owners = mvcc.recheck(); - assertSame(cand1, owners); - checkCandidates(owners, cand1.version()); - } - } - - /** - * @param all Candidates list. - * @param vers Expected candidates. - */ - private void checkCandidates(CacheLockCandidates all, GridCacheVersion...vers) { - assertNotNull(all); - assertEquals(vers.length, all.size()); - - for (GridCacheVersion ver : vers) - assertTrue(all.hasCandidate(ver)); - } - - /** - * @param mvcc Mvcc. - * @param e Entry. - * @param ver Version. - * @param serOrder Serializable tx version. - * @param read Read lock flag. - * @return Candidate. - */ - @Nullable private GridCacheMvccCandidate addLocal(GridCacheMvcc mvcc, - GridCacheEntryEx e, - GridCacheVersion ver, - GridCacheVersion serOrder, - boolean read) { - return mvcc.addLocal(e, - nodeId, - null, - 1, - ver, - 0, - serOrder, - false, - true, - false, - true, - read - ); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSerializableLocks() throws Exception { - checkSerializableAdd(false); - - checkSerializableAdd(true); - - checkNonSerializableConflict(); - } - - /** - * @throws Exception If failed. - */ - private void checkNonSerializableConflict() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - UUID nodeId = UUID.randomUUID(); - - GridCacheMvcc mvcc = new GridCacheMvcc(cache.context()); - - GridCacheTestEntryEx e = new GridCacheTestEntryEx(cache.context(), "1"); - - GridCacheMvccCandidate cand1 = mvcc.addLocal(e, - nodeId, - null, - 1, - version(1), - 0, - null, - false, - true, - false, - true, - false - ); - - assertNotNull(cand1); - - GridCacheMvccCandidate cand2 = mvcc.addLocal(e, - nodeId, - null, - 1, - version(2), - 0, - new GridCacheVersion(0, 0, 1), - false, - true, - false, - true, - false - ); - - assertNull(cand2); - } - - /** - * @param incVer If {@code true} lock version is incremented. - * @throws Exception If failed. - */ - private void checkSerializableAdd(boolean incVer) throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - UUID nodeId = UUID.randomUUID(); - - GridCacheMvcc mvcc = new GridCacheMvcc(cache.context()); - - GridCacheTestEntryEx e = new GridCacheTestEntryEx(cache.context(), "1"); - - GridCacheVersion serOrder1 = new GridCacheVersion(0, 10, 1); - GridCacheVersion serOrder2 = new GridCacheVersion(0, 20, 1); - GridCacheVersion serOrder3 = new GridCacheVersion(0, 15, 1); - GridCacheVersion serOrder4 = new GridCacheVersion(0, 30, 1); - - GridCacheVersion ver1 = incVer ? version(1) : version(4); - GridCacheVersion ver2 = incVer ? version(2) : version(3); - GridCacheVersion ver3 = incVer ? version(3) : version(2); - GridCacheVersion ver4 = incVer ? version(4) : version(1); - - GridCacheMvccCandidate cand1 = mvcc.addLocal(e, - nodeId, - null, - 1, - ver1, - 0, - serOrder1, - false, - true, - false, - true, - false - ); - - assertNotNull(cand1); - - GridCacheMvccCandidate cand2 = mvcc.addLocal(e, - nodeId, - null, - 2, - ver2, - 0, - serOrder2, - false, - true, - false, - true, - false - ); - - assertNotNull(cand2); - - GridCacheMvccCandidate cand3 = mvcc.addLocal(e, - nodeId, - null, - 3, - ver3, - 0, - serOrder3, - false, - true, - false, - true, - false - ); - - assertNull(cand3); - - GridCacheMvccCandidate cand4 = mvcc.addLocal(e, - nodeId, - null, - 4, - ver4, - 0, - serOrder4, - false, - true, - false, - true, - false - ); - - assertNotNull(cand4); - - CacheLockCandidates owners = mvcc.recheck(); - - assertNull(owners); - - cand2.setReady(); - - owners = mvcc.recheck(); - - assertNull(owners); - - cand1.setReady(); - - owners = mvcc.recheck(); - - assertSame(cand1, owners); - - owners = mvcc.recheck(); - - assertSame(cand1, owners); - - mvcc.remove(cand1.version()); - - owners = mvcc.recheck(); - - assertSame(cand2, owners); - } - - /** - * Gets version based on order. - * - * @param order Order. - * @return Version. - */ - private GridCacheVersion version(int order) { - return new GridCacheVersion(1, order, order, 0); - } - - /** - * Creates an empty list of {@code GridCacheVersion}. - * - * @return Empty list. - */ - private Collection empty() { - return Collections.emptyList(); - } - - /** - * Checks flags on local owner candidate. - * - * @param cand Candidate to check. - * @param ver Cache version. - * @param reentry Reentry flag. - */ - private void checkLocalOwner(GridCacheMvccCandidate cand, GridCacheVersion ver, boolean reentry) { - assert cand != null; - - info("Done candidate: " + cand); - - assert cand.version().equals(ver); - - // Check flags. - assert cand.reentry() == reentry; - - assert !cand.used(); - - assert cand.ready(); - assert cand.owner(); - assert cand.local(); - } - - /** - * @param cand Candidate to check. - * @param ver Version. - * @param owner Owner flag. - * @param used Done flag. - */ - private void checkRemote(GridCacheMvccCandidate cand, GridCacheVersion ver, boolean owner, boolean used) { - assert cand != null; - - info("Done candidate: " + cand); - - assert cand.version().equals(ver); - - // Check flags. - assert cand.used() == used; - assert cand.owner() == owner; - - assert !cand.ready(); - assert !cand.reentry(); - assert !cand.local(); - } - - /** - * Checks flags on local candidate. - * - * @param cand Candidate to check. - * @param ver Cache version. - * @param ready Ready flag. - * @param owner Lock owner. - * @param reentry Reentry flag. - */ - private void checkLocal(GridCacheMvccCandidate cand, GridCacheVersion ver, boolean ready, - boolean owner, boolean reentry) { - assert cand != null; - - info("Done candidate: " + cand); - - assert cand.version().equals(ver); - - // Check flags. - assert cand.ready() == ready; - assert cand.owner() == owner; - assert cand.reentry() == reentry; - - assert !cand.used(); - - assert cand.local(); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java deleted file mode 100644 index ba55d0db3f313..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java +++ /dev/null @@ -1,1864 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.marshaller.Marshaller; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Ignore; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheMode.REPLICATED; - -/** - * Test cases for multi-threaded tests. - */ -// Tests that are not ready to be used with BinaryMarshaller. -@Ignore("https://issues.apache.org/jira/browse/IGNITE-9214") -public class GridCacheMvccSelfTest extends GridCommonAbstractTest { - /** Grid. */ - private IgniteKernal grid; - - /** - * - */ - public GridCacheMvccSelfTest() { - super(true /*start grid. */); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - grid = (IgniteKernal)grid(); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - grid = null; - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration() throws Exception { - IgniteConfiguration cfg = super.getConfiguration(); - - CacheConfiguration cacheCfg = defaultCacheConfiguration(); - - cacheCfg.setCacheMode(REPLICATED); - - cfg.setCacheConfiguration(cacheCfg); - - return cfg; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMarshalUnmarshalCandidate() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx parent = new GridCacheTestEntryEx(cache.context(), "1"); - - GridCacheMvccCandidate cand = new GridCacheMvccCandidate( - parent, - UUID.randomUUID(), - UUID.randomUUID(), - version(1), - 123, - version(2), - /*local*/false, - /*reentry*/false, - true, - false, - false, - false, - null, - false - ); - - Marshaller marshaller = getTestResources().getMarshaller(); - - GridCacheMvccCandidate unmarshalled = marshaller.unmarshal(marshaller.marshal(cand), null); - - info(unmarshalled.toString()); - } - - /** - * Tests remote candidates. - */ - @Test - public void testRemotes() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - - entry.addRemote(node1, 1, ver1, true); - - Collection cands = entry.remoteMvccSnapshot(); - - assert cands.size() == 1; - assert cands.iterator().next().version().equals(ver1); - - entry.addRemote(node2, 5, ver5, true); - - cands = entry.remoteMvccSnapshot(); - - assert cands.size() == 2; - - info(cands); - - // Check order. - checkOrder(cands, ver1, ver5); - - entry.addRemote(node1, 3, ver3, true); - - cands = entry.remoteMvccSnapshot(); - - info(cands); - - assert cands.size() == 3; - - // No reordering happens. - checkOrder(cands, ver1, ver5, ver3); - - entry.doneRemote(ver3); - - checkDone(entry.candidate(ver3)); - - entry.addRemote(node1, 2, ver2, true); - - cands = entry.remoteMvccSnapshot(); - - info(cands); - - assert cands.size() == 4; - - // Check order. - checkOrder(cands, ver1, ver5, ver3, ver2); - - entry.orderCompleted( - new GridCacheVersion(1, 2, 0, 0), - Arrays.asList(new GridCacheVersion(1, 3, 4, 0), ver2, new GridCacheVersion(1, 5, 6, 0)), - Collections.emptyList() - ); - - cands = entry.remoteMvccSnapshot(); - - info(cands); - - assert cands.size() == 4; - - // Done ver 2. - checkOrder(cands, ver1, ver2, ver5, ver3); - - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver2), ver2, true, false); - checkRemote(entry.candidate(ver3), ver3, true, true); - checkRemote(entry.candidate(ver5), ver5, false, false); - - entry.doneRemote(ver5); - - checkDone(entry.candidate(ver5)); - - entry.addRemote(node1, 4, ver4, true); - - cands = entry.remoteMvccSnapshot(); - - info(cands); - - assert cands.size() == 5; - - // Check order. - checkOrder(cands, ver1, ver2, ver5, ver3, ver4); - - entry.orderCompleted(ver3, Arrays.asList(ver2, ver5), Collections.emptyList()); - - cands = entry.remoteMvccSnapshot(); - - info(cands); - - assert cands.size() == 5; - - checkOrder(cands, ver1, ver2, ver5, ver3, ver4); - - assert entry.anyOwner() == null; - - entry.doneRemote(ver1); - - checkRemoteOwner(entry.anyOwner(), ver1); - - entry.removeLock(ver1); - - assert entry.remoteMvccSnapshot().size() == 4; - - assert entry.anyOwner() == null; - - entry.doneRemote(ver2); - - checkRemoteOwner(entry.anyOwner(), ver2); - - entry.removeLock(ver2); - - assert entry.remoteMvccSnapshot().size() == 3; - - checkRemoteOwner(entry.anyOwner(), ver5); - - entry.removeLock(ver3); - - assert entry.remoteMvccSnapshot().size() == 2; - - checkRemoteOwner(entry.anyOwner(), ver5); - - entry.removeLock(ver5); - - assert entry.remoteMvccSnapshot().size() == 1; - - assert entry.anyOwner() == null; - - entry.doneRemote(ver4); - - checkRemoteOwner(entry.anyOwner(), ver4); - - entry.removeLock(ver4); - - assert entry.remoteMvccSnapshot().isEmpty(); - - assert entry.anyOwner() == null; - } - - /** - * Tests that orderOwned does not reorder owned locks. - */ - @Test - public void testNearRemoteWithOwned() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - - GridCacheMvccCandidate c1 = entry.addRemote(node1, 1, ver1, true); - GridCacheMvccCandidate c2 = entry.addRemote(node1, 1, ver2, true); - GridCacheMvccCandidate c3 = entry.addRemote(node1, 1, ver3, true); - GridCacheMvccCandidate c4 = entry.addRemote(node1, 1, ver4, true); - - GridCacheMvccCandidate[] candArr = new GridCacheMvccCandidate[] {c1, c2, c3, c4}; - - Collection rmtCands = entry.remoteMvccSnapshot(); - - assert rmtCands.size() == 4; - assert rmtCands.iterator().next().version().equals(ver1); - - entry.orderOwned(ver1, ver2); - - rmtCands = entry.remoteMvccSnapshot(); - - int i = 0; - - for (GridCacheMvccCandidate cand : rmtCands) { - assertTrue(cand == candArr[i]); - - assertTrue(ver2.equals(cand.ownerVersion()) || cand != c1); - - i++; - } - } - - /** - * Tests that orderOwned does not reorder owned locks. - */ - @Test - public void testNearRemoteWithOwned1() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - - GridCacheMvccCandidate c1 = entry.addRemote(node1, 1, ver1, true); - GridCacheMvccCandidate c2 = entry.addRemote(node1, 1, ver2, true); - GridCacheMvccCandidate c3 = entry.addRemote(node1, 1, ver3, true); - GridCacheMvccCandidate c4 = entry.addRemote(node1, 1, ver4, true); - GridCacheMvccCandidate c5 = entry.addRemote(node1, 1, ver5, true); - GridCacheMvccCandidate c6 = entry.addRemote(node1, 1, ver6, true); - - GridCacheMvccCandidate[] candArr = new GridCacheMvccCandidate[] {c1, c2, c3, c4, c5, c6}; - - Collection cands = entry.remoteMvccSnapshot(); - - assert cands.size() == 6; - assert cands.iterator().next().version().equals(ver1); - - entry.orderOwned(ver1, ver3); - - cands = entry.remoteMvccSnapshot(); - - int i = 0; - - for (GridCacheMvccCandidate cand : cands) { - assert cand == candArr[i]; - - assertTrue(ver3.equals(cand.ownerVersion()) || cand != c1); - - i++; - } - } - - /** - * Tests that orderOwned does not reorder owned locks. - */ - @Test - public void testNearRemoteWithOwned2() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - - GridCacheVersion ver0 = version(0); - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - - GridCacheMvccCandidate c0 = entry.addRemote(node1, 1, ver0, true); - GridCacheMvccCandidate c1 = entry.addRemote(node1, 1, ver1, true); - GridCacheMvccCandidate c2 = entry.addRemote(node1, 1, ver2, true); - GridCacheMvccCandidate c3 = entry.addRemote(node1, 1, ver3, true); - GridCacheMvccCandidate c4 = entry.addRemote(node1, 1, ver4, true); - GridCacheMvccCandidate c5 = entry.addRemote(node1, 1, ver5, true); - GridCacheMvccCandidate c6 = entry.addRemote(node1, 1, ver6, true); - - GridCacheMvccCandidate[] candArr = new GridCacheMvccCandidate[] {c0, c1, c2, c3, c4, c5, c6}; - - Collection cands = entry.remoteMvccSnapshot(); - - assert cands.size() == 7; - assert cands.iterator().next().version().equals(ver0); - - entry.orderOwned(ver1, ver2); - - cands = entry.remoteMvccSnapshot(); - - int i = 0; - - for (GridCacheMvccCandidate cand : cands) { - assert cand == candArr[i]; - - assertTrue(ver2.equals(cand.ownerVersion()) || cand != c1); - - i++; - } - } - - /** - * Tests remote candidates. - */ - @Test - public void testLocal() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - - entry.addLocal(3, ver3, 0, true, true); - - Collection cands = entry.localCandidates(); - - assert cands.size() == 1; - - assert cands.iterator().next().version().equals(ver3); - - entry.addLocal(5, ver5, 0, true, true); - - cands = entry.localCandidates(); - - assert cands.size() == 2; - - info(cands); - - // Check order. - checkOrder(cands, ver3, ver5); - - assert entry.anyOwner() == null; - - entry.readyLocal(ver3); - - checkLocalOwner(entry.anyOwner(), ver3, false); - - // Reentry. - entry.addLocal(3, ver4, 0, true, true); - - checkLocalOwner(entry.anyOwner(), ver4, true); - - assert entry.localCandidates().size() == 2; - assert entry.localCandidates(true).size() == 3; - - // Check order. - checkOrder(entry.localCandidates(true), ver4, ver3, ver5); - - entry.removeLock(ver4); - - assert entry.localCandidates(true).size() == 2; - - entry.readyLocal(ver5); - - checkLocalOwner(entry.anyOwner(), ver3, false); - - // Check order. - checkOrder(entry.localCandidates(true), ver3, ver5); - - entry.removeLock(ver3); - - assert entry.localCandidates(true).size() == 1; - - checkLocalOwner(entry.anyOwner(), ver5, false); - - assert !entry.lockedByAny(ver5); - - entry.removeLock(ver5); - - assert !entry.lockedByAny(); - assert entry.anyOwner() == null; - assert entry.localCandidates(true).isEmpty(); - } - - /** - * Tests assignment of local candidates when remote exist. - */ - @Test - public void testLocalWithRemote() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID nodeId = UUID.randomUUID(); - - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - - entry.addRemote(nodeId, 1, ver2, true); - - entry.addLocal(3, ver3, 0, false, true); - - assert entry.anyOwner() == null; - - entry.readyLocal(ver3); - - assert entry.anyOwner() == null; - - entry.removeLock(ver2); - - assert entry.localCandidates().size() == 1; - - checkLocalOwner(entry.anyOwner(), ver3, false); - - entry.removeLock(ver3); - - assert !entry.lockedByAny(); - assert entry.anyOwner() == null; - assert entry.localCandidates(true).isEmpty(); - } - - /** - * - */ - @Test - public void testCompletedWithBaseInTheMiddle() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - GridCacheVersion ver8 = version(8); - - entry.addRemote(node1, 1, ver1, true); - entry.addRemote(node2, 2, ver2, true); - entry.addRemote(node1, 3, ver3, true); - entry.addRemote(node2, 4, ver4, true); - entry.addRemote(node1, 5, ver5, true); - entry.addRemote(node2, 7, ver7, true); - entry.addRemote(node2, 8, ver8, true); - - GridCacheMvccCandidate doomed = entry.addRemote(node2, 6, ver6, true); - - // No reordering happens. - checkOrder(entry.remoteMvccSnapshot(), ver1, ver2, ver3, ver4, ver5, ver7, ver8, ver6); - - List committed = Arrays.asList(ver4, ver7); - List rolledback = Arrays.asList(ver6); - - entry.orderCompleted(ver2, committed, rolledback); - - assert !entry.lockedBy(ver6); - - checkOrder(entry.remoteMvccSnapshot(), ver1, ver4, ver7, ver2, ver3, ver5, ver8); - - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver2), ver2, false, false); - checkRemote(entry.candidate(ver3), ver3, false, false); - checkRemote(entry.candidate(ver4), ver4, true, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - checkRemote(entry.candidate(ver7), ver7, true, false); - checkRemote(entry.candidate(ver8), ver8, false, false); - - checkRemote(doomed, ver6, false, true); - } - - /** - * - */ - @Test - public void testCompletedWithCompletedBaseInTheMiddle() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - entry.addRemote(node1, 1, ver1, true); - entry.addRemote(node2, 2, ver2, true); - entry.addRemote(node1, 3, ver3, true); - entry.addRemote(node2, 4, ver4, true); - entry.addRemote(node1, 5, ver5, true); - entry.addRemote(node2, 6, ver6, true); - entry.addRemote(node2, 7, ver7, true); - - List committed = Arrays.asList(ver4, ver6, ver2); - - entry.orderCompleted(ver2, committed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver1, ver4, ver6, ver2, ver3, ver5, ver7); - - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver2), ver2, true, false); - checkRemote(entry.candidate(ver3), ver3, false, false); - checkRemote(entry.candidate(ver4), ver4, true, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - checkRemote(entry.candidate(ver6), ver6, true, false); - checkRemote(entry.candidate(ver7), ver7, false, false); - } - - /** - * - */ - @Test - public void testCompletedTwiceWithBaseInTheMiddle() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - entry.addRemote(node1, 1, ver1, true); - entry.addRemote(node2, 2, ver2, true); - entry.addRemote(node1, 3, ver3, true); - entry.addRemote(node2, 4, ver4, true); - entry.addRemote(node1, 5, ver5, true); - entry.addRemote(node2, 6, ver6, true); - entry.addRemote(node2, 7, ver7, true); - - List completed = Arrays.asList(ver4, ver6); - - entry.orderCompleted(ver2, completed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver1, ver4, ver6, ver2, ver3, ver5, ver7); - - entry.orderCompleted(ver4, completed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver1, ver6, ver4, ver2, ver3, ver5, ver7); - - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver2), ver2, false, false); - checkRemote(entry.candidate(ver3), ver3, false, false); - checkRemote(entry.candidate(ver4), ver4, true, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - checkRemote(entry.candidate(ver6), ver6, true, false); - checkRemote(entry.candidate(ver7), ver7, false, false); - } - - /** - * - */ - @Test - public void testCompletedWithBaseInTheMiddleNoChange() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - entry.addRemote(node1, 1, ver1, false); - entry.addRemote(node2, 2, ver2, false); - entry.addRemote(node1, 3, ver3, false); - entry.addRemote(node2, 4, ver4, false); - entry.addRemote(node1, 5, ver5, false); - - List committed = Arrays.asList(ver6, ver7); - - entry.orderCompleted(ver4, committed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver1, ver2, ver3, ver4, ver5); - - // Nothing set to owner since there is no change. - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver2), ver2, false, false); - checkRemote(entry.candidate(ver3), ver3, false, false); - checkRemote(entry.candidate(ver4), ver4, false, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - } - - /** - * - */ - @Test - public void testCompletedWithBaseInTheBeginning() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - entry.addRemote(node1, 1, ver1, false); - entry.addRemote(node2, 2, ver2, false); - entry.addRemote(node1, 3, ver3, false); - entry.addRemote(node2, 4, ver4, false); - entry.addRemote(node1, 5, ver5, false); - entry.addRemote(node2, 6, ver6, false); - entry.addRemote(node2, 7, ver7, false); - - List committed = Arrays.asList(ver4, ver6, ver3); - - entry.orderCompleted(ver1, committed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver3, ver4, ver6, ver1, ver2, ver5, ver7); - - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver2), ver2, false, false); - checkRemote(entry.candidate(ver3), ver3, true, false); - checkRemote(entry.candidate(ver4), ver4, true, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - checkRemote(entry.candidate(ver6), ver6, true, false); - checkRemote(entry.candidate(ver7), ver7, false, false); - } - - /** - * This case should never happen, nevertheless we need to test for it. - */ - @Test - public void testCompletedWithBaseInTheBeginningNoChange() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - entry.addRemote(node1, 1, ver1, false); - entry.addRemote(node2, 2, ver2, false); - entry.addRemote(node1, 3, ver3, false); - entry.addRemote(node2, 4, ver4, false); - entry.addRemote(node1, 5, ver5, false); - - List committed = Arrays.asList(ver6, ver7); - - entry.orderCompleted(ver1, committed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver1, ver2, ver3, ver4, ver5); - - // Nothing set to owner since there is no change. - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver2), ver2, false, false); - checkRemote(entry.candidate(ver3), ver3, false, false); - checkRemote(entry.candidate(ver4), ver4, false, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - } - - /** - * This case should never happen, nevertheless we need to test for it. - */ - @Test - public void testCompletedWithBaseInTheEndNoChange() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - entry.addRemote(node1, 1, ver1, false); - entry.addRemote(node2, 2, ver2, false); - entry.addRemote(node1, 3, ver3, false); - entry.addRemote(node2, 4, ver4, false); - entry.addRemote(node1, 5, ver5, false); - - List committed = Arrays.asList(ver6, ver7); - - entry.orderCompleted(ver5, committed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver1, ver2, ver3, ver4, ver5); - - // Nothing set to owner since there is no change. - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver2), ver2, false, false); - checkRemote(entry.candidate(ver3), ver3, false, false); - checkRemote(entry.candidate(ver4), ver4, false, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - } - - /** - * - */ - @Test - public void testCompletedWithBaseNotPresentInTheMiddle() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - // Don't add version 2. - entry.addRemote(node1, 1, ver1, true); - entry.addRemote(node1, 3, ver3, true); - entry.addRemote(node2, 4, ver4, true); - entry.addRemote(node1, 5, ver5, true); - entry.addRemote(node2, 6, ver6, true); - entry.addRemote(node2, 7, ver7, true); - - List committed = Arrays.asList(ver6, ver4); - - entry.orderCompleted(ver2, committed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver1, ver4, ver6, ver3, ver5, ver7); - - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver3), ver3, false, false); - checkRemote(entry.candidate(ver4), ver4, true, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - checkRemote(entry.candidate(ver6), ver6, true, false); - checkRemote(entry.candidate(ver7), ver7, false, false); - } - - /** - * - */ - @Test - public void testCompletedWithBaseNotPresentInTheMiddleNoChange() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - // Don't add versions 2, 5, 6, 7. - entry.addRemote(node1, 1, ver1, true); - entry.addRemote(node1, 3, ver3, true); - entry.addRemote(node2, 4, ver4, true); - - List committed = Arrays.asList(ver6, ver5, ver7); - - entry.orderCompleted(ver2, committed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver1, ver3, ver4); - - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver3), ver3, false, false); - checkRemote(entry.candidate(ver4), ver4, false, false); - } - - /** - * - */ - @Test - public void testCompletedWithBaseNotPresentInTheBeginning() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - // Don't add version 1. - entry.addRemote(node1, 2, ver2, true); - entry.addRemote(node1, 3, ver3, true); - entry.addRemote(node2, 4, ver4, true); - entry.addRemote(node1, 5, ver5, true); - entry.addRemote(node2, 6, ver6, true); - entry.addRemote(node2, 7, ver7, true); - - List committed = Arrays.asList(ver4, ver6, ver3); - - entry.orderCompleted(ver1, committed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver3, ver4, ver6, ver2, ver5, ver7); - - checkRemote(entry.candidate(ver2), ver2, false, false); - checkRemote(entry.candidate(ver3), ver3, true, false); - checkRemote(entry.candidate(ver4), ver4, true, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - checkRemote(entry.candidate(ver6), ver6, true, false); - checkRemote(entry.candidate(ver7), ver7, false, false); - } - - /** - * - */ - @Test - public void testCompletedWithBaseNotPresentInTheBeginningNoChange() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - // Don't add version 6, 7 - entry.addRemote(node1, 2, ver2, true); - entry.addRemote(node1, 3, ver3, true); - entry.addRemote(node2, 4, ver4, true); - entry.addRemote(node1, 5, ver5, true); - entry.addRemote(node1, 6, ver6, true); - entry.addRemote(node1, 7, ver7, true); - - List committed = Arrays.asList(ver2, ver3); - - entry.orderCompleted(ver1, committed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver2, ver3, ver4, ver5, ver6, ver7); - - checkRemote(entry.candidate(ver2), ver2, true, false); - checkRemote(entry.candidate(ver3), ver3, true, false); - checkRemote(entry.candidate(ver4), ver4, false, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - checkRemote(entry.candidate(ver6), ver6, false, false); - checkRemote(entry.candidate(ver7), ver7, false, false); - } - - /** - * - */ - @Test - public void testCompletedWithBaseNotPresentInTheEndNoChange() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - GridCacheVersion ver6 = version(6); - GridCacheVersion ver7 = version(7); - - // Don't add version 5, 6, 7 - entry.addRemote(node1, 1, ver1, true); - entry.addRemote(node1, 2, ver2, true); - entry.addRemote(node1, 3, ver3, true); - entry.addRemote(node2, 4, ver4, true); - - List committed = Arrays.asList(ver6, ver7); - - entry.orderCompleted(ver5, committed, Collections.emptyList()); - - checkOrder(entry.remoteMvccSnapshot(), ver1, ver2, ver3, ver4); - - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver2), ver2, false, false); - checkRemote(entry.candidate(ver3), ver3, false, false); - checkRemote(entry.candidate(ver4), ver4, false, false); - } - - /** - * Test local and remote candidates together. - */ - @Test - public void testLocalAndRemote() { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - UUID node1 = UUID.randomUUID(); - UUID node2 = UUID.randomUUID(); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - GridCacheVersion ver5 = version(5); - - entry.addRemote(node1, 1, ver1, false); - entry.addLocal(2, ver2, 0, true, true); - - Collection cands = entry.remoteMvccSnapshot(); - - assert cands.size() == 1; - assert cands.iterator().next().version().equals(ver1); - - entry.addRemote(node2, 5, ver5, false); - - cands = entry.remoteMvccSnapshot(); - - assert cands.size() == 2; - - info(cands); - - checkOrder(cands, ver1, ver5); - checkOrder(entry.localCandidates(true), ver2); - - entry.addRemote(node1, 3, ver3, true); - entry.addLocal(4, ver4, 0, /*reenter*/true, false); - - cands = entry.remoteMvccSnapshot(); - - assert cands.size() == 3; - - // Check order. - checkOrder(entry.remoteMvccSnapshot(), ver1, ver5, ver3); - checkOrder(entry.localCandidates(), ver2, ver4); - - entry.orderCompleted( - ver2 /*local version.*/, - Arrays.asList(new GridCacheVersion(1, 1, 2, 0), ver3, new GridCacheVersion(1, 5, 6, 0)), - Collections.emptyList() - ); - - // Done ver3. - checkOrder(entry.remoteMvccSnapshot(), ver1, ver3, ver5); - checkOrder(entry.localCandidates(), ver2, ver4); - - checkRemote(entry.candidate(ver1), ver1, false, false); - checkRemote(entry.candidate(ver3), ver3, true, false); - checkRemote(entry.candidate(ver5), ver5, false, false); - - checkLocal(entry.candidate(ver2), ver2, false, false, false); - checkLocal(entry.candidate(ver4), ver4, false, false, false); - - entry.readyLocal(ver2); - - checkLocal(entry.candidate(ver2), ver2, true, false, false); - checkLocal(entry.candidate(ver4), ver4, false, false, false); - - assert entry.anyOwner() == null; - - entry.doneRemote(ver1); - - checkRemoteOwner(entry.anyOwner(), ver1); - - entry.removeLock(ver1); - - checkOrder(entry.remoteMvccSnapshot(), ver3, ver5); - - assert entry.anyOwner() == null; - - entry.doneRemote(ver3); - - checkRemoteOwner(entry.anyOwner(), ver3); - - entry.removeLock(ver3); - - checkLocalOwner(entry.anyOwner(), ver2, false); - - entry.removeLock(ver2); - - assert !entry.lockedByAny(ver4, ver5); - - checkOrder(entry.remoteMvccSnapshot(), ver5); - checkOrder(entry.localCandidates(), ver4); - - assert entry.anyOwner() == null; - - entry.readyLocal(ver4); - - checkLocalOwner(entry.anyOwner(), ver4, false); - - entry.removeLock(ver4); - - assert entry.anyOwner() == null; - - GridCacheMvccCandidate c5 = entry.candidate(ver5); - - assert c5 != null; - - c5.setOwner(); - - assert entry.anyOwner() == null; - - entry.doneRemote(ver5); - - checkRemoteOwner(entry.anyOwner(), ver5); - - assert !entry.lockedByAny(ver5); - - entry.removeLock(ver5); - - assert !entry.lockedByAny(); - assert entry.anyOwner() == null; - } - - /** - * @throws Exception If test failed. - */ - @Test - public void testMultipleLocalAndRemoteLocks1() throws Exception { - UUID nodeId = UUID.randomUUID(); - - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheContext ctx = cache.context(); - - GridCacheTestEntryEx entry1 = new GridCacheTestEntryEx(ctx, "1"); - GridCacheTestEntryEx entry2 = new GridCacheTestEntryEx(ctx, "2"); - GridCacheTestEntryEx entry3 = new GridCacheTestEntryEx(ctx, "3"); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - - GridCacheMvccCandidate c13 = entry1.addLocal(1, ver3, 0, true, false); - - entry1.readyLocal(ver3); - - checkLocalOwner(entry1.candidate(ver3), ver3, false); - - GridCacheMvccCandidate c11 = entry1.addLocal(2, ver1, 0, true, true); - GridCacheMvccCandidate c21 = entry2.addLocal(2, ver1, 0, true, true); - GridCacheMvccCandidate c31 = entry3.addLocal(2, ver1, 0, true, true); - - GridCacheMvccCandidate c33 = entry3.addLocal(1, ver3, 0, true, false); - - linkCandidates(ctx, c11, c21, c31); - - entry1.readyLocal(ver1); - entry2.readyLocal(ver1); - entry3.readyLocal(ver1); - - checkLocal(entry1.candidate(ver1), ver1, true, false, false); - checkLocal(entry2.candidate(ver1), ver1, true, false, false); - checkLocal(entry3.candidate(ver1), ver1, true, false, false); - - checkLocal(entry3.candidate(ver3), ver3, false, false, false); - - linkCandidates(ctx, c13, c33); - - entry2.addRemote(nodeId, 3, ver2, true); - - checkLocal(entry2.candidate(ver1), ver1, true, false, false); - - entry3.addRemote(nodeId, 3, ver2, false); - - entry3.readyLocal(ver3); - - checkLocal(entry1.candidate(ver3), ver3, true, true, false); - checkLocal(entry3.candidate(ver3), ver3, true, true, false); - checkLocal(entry1.candidate(ver1), ver1, true, false, false); - checkLocal(entry2.candidate(ver1), ver1, true, false, false); - checkLocal(entry3.candidate(ver1), ver1, true, false, false); - - entry1.releaseLocal(1); - - entry2.recheckLock(); - - checkLocal(entry1.candidate(ver1), ver1, true, true, false); - checkLocal(entry2.candidate(ver1), ver1, true, true, false); - checkLocal(entry3.candidate(ver1), ver1, true, false, false); - - entry3.releaseLocal(1); - - checkLocal(entry1.candidate(ver1), ver1, true, true, false); - checkLocal(entry2.candidate(ver1), ver1, true, true, false); - checkLocal(entry3.candidate(ver1), ver1, true, true, false); - } - - /** - * @throws Exception If test failed. - */ - @Test - public void testMultipleLocalAndRemoteLocks2() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheContext ctx = cache.context(); - - GridCacheTestEntryEx entry1 = new GridCacheTestEntryEx(ctx, "1"); - GridCacheTestEntryEx entry2 = new GridCacheTestEntryEx(ctx, "2"); - GridCacheTestEntryEx entry3 = new GridCacheTestEntryEx(ctx, "3"); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - - GridCacheMvccCandidate c13 = entry1.addLocal(1, ver3, 0, true, true); - - entry1.readyLocal(ver3); - - checkLocalOwner(entry1.candidate(ver3), ver3, false); - - GridCacheMvccCandidate c11 = entry1.addLocal(2, ver2, 0, true, false); - GridCacheMvccCandidate c21 = entry2.addLocal(2, ver2, 0, true, false); - GridCacheMvccCandidate c31 = entry3.addLocal(2, ver2, 0, true, false); - - GridCacheMvccCandidate c33 = entry3.addLocal(1, ver3, 0, true, true); - - linkCandidates(ctx, c11, c21, c31); - - entry1.readyLocal(ver2); - entry2.readyLocal(ver2); - entry3.readyLocal(ver2); - - checkLocal(entry1.candidate(ver2), ver2, true, false, false); - checkLocal(entry2.candidate(ver2), ver2, true, false, false); - checkLocal(entry3.candidate(ver2), ver2, true, false, false); - - checkLocal(entry3.candidate(ver3), ver3, false, false, false); - - linkCandidates(ctx, c13, c33); - - entry2.addRemote(UUID.randomUUID(), 3, ver1, true); - - checkLocal(entry2.candidate(ver2), ver2, true, false, false); - - entry3.addRemote(UUID.randomUUID(), 3, ver1, true); - - entry3.readyLocal(ver3); - - checkLocal(entry1.candidate(ver3), ver3, true, true, false); - checkLocal(entry3.candidate(ver3), ver3, true, false, false); - checkLocal(entry1.candidate(ver2), ver2, true, false, false); - checkLocal(entry2.candidate(ver2), ver2, true, false, false); - checkLocal(entry3.candidate(ver2), ver2, true, false, false); - - entry2.removeLock(ver1); - - checkLocal(entry1.candidate(ver3), ver3, true, true, false); - checkLocal(entry3.candidate(ver3), ver3, true, false, false); - checkLocal(entry1.candidate(ver2), ver2, true, false, false); - checkLocal(entry2.candidate(ver2), ver2, true, false, false); - checkLocal(entry3.candidate(ver2), ver2, true, false, false); - - entry3.removeLock(ver1); - - checkLocal(entry1.candidate(ver3), ver3, true, true, false); - checkLocal(entry3.candidate(ver3), ver3, true, true, false); - checkLocal(entry1.candidate(ver2), ver2, true, false, false); - checkLocal(entry2.candidate(ver2), ver2, true, false, false); - checkLocal(entry3.candidate(ver2), ver2, true, false, false); - - entry1.releaseLocal(1); - - entry2.recheckLock(); - - checkLocal(entry1.candidate(ver2), ver2, true, true, false); - checkLocal(entry2.candidate(ver2), ver2, true, true, false); - checkLocal(entry3.candidate(ver2), ver2, true, false, false); - - entry3.releaseLocal(1); - - checkLocal(entry1.candidate(ver2), ver2, true, true, false); - checkLocal(entry2.candidate(ver2), ver2, true, true, false); - checkLocal(entry3.candidate(ver2), ver2, true, true, false); - } - - /** - * @throws Exception If test failed. - */ - @Test - public void testMultipleLocalLocks() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheContext ctx = cache.context(); - - GridCacheTestEntryEx entry1 = new GridCacheTestEntryEx(ctx, "1"); - GridCacheTestEntryEx entry2 = new GridCacheTestEntryEx(ctx, "2"); - GridCacheVersion ver1 = version(1); - GridCacheVersion ver3 = version(3); - - GridCacheMvccCandidate c13 = entry1.addLocal(1, ver3, 0, true, false); - - entry1.readyLocal(ver3); - - checkLocalOwner(entry1.candidate(ver3), ver3, false); - - GridCacheMvccCandidate c11 = entry1.addLocal(2, ver1, 0, true, true); - - GridCacheMvccCandidate c21 = entry2.addLocal(2, ver1, 0, true, false); - - linkCandidates(ctx, c11, c21); - - entry1.readyLocal(ver1); - entry2.readyLocal(ver1); - - checkLocal(entry1.candidate(ver1), ver1, true, false, false); - checkLocal(entry2.candidate(ver1), ver1, true, false, false); - - GridCacheMvccCandidate c23 = entry2.addLocal(1, ver3, 0, true, true); - - linkCandidates(ctx, c13, c23); - - entry2.readyLocal(ver3); - - checkLocalOwner(entry2.candidate(ver3), ver3, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUsedCandidates() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheContext ctx = cache.context(); - - GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - GridCacheVersion ver4 = version(4); - - GridCacheMvccCandidate c1 = entry.addLocal(1, ver1, 0, true, false); - - ctx.mvcc().addNext(ctx, c1); - - ctx.mvcc().contextReset(); - - GridCacheMvccCandidate c2 = entry.addLocal(2, ver2, 0, true, false); - - ctx.mvcc().addNext(ctx, c2); - - ctx.mvcc().contextReset(); - - GridCacheMvccCandidate c3 = entry.addLocal(3, ver3, 0, true, true); - - ctx.mvcc().addNext(ctx, c3); - - ctx.mvcc().contextReset(); - - checkLocal(entry.candidate(ver1), ver1, false, false, false); - checkLocal(entry.candidate(ver2), ver2, false, false, false); - checkLocal(entry.candidate(ver3), ver3, false, false, false); - - entry.readyLocal(ver1); - entry.readyLocal(ver3); - - checkLocal(entry.candidate(ver1), ver1, true, true, false); - checkLocal(entry.candidate(ver2), ver2, false, false, false); - checkLocal(entry.candidate(ver3), ver3, true, false, false); - - entry.removeLock(ver2); - - assert c3 != null; - assert c2 != null; - - checkLocal(c2, ver2, false, false, false, true); - - checkLocal(entry.candidate(ver1), ver1, true, true, false); - checkLocal(entry.candidate(ver3), ver3, true, false, false); - - entry.removeLock(ver1); - - checkLocal(entry.candidate(ver3), ver3, true, true, false); - - GridCacheMvccCandidate c4 = entry.addLocal(4, ver4, 0, true, true); - - ctx.mvcc().addNext(ctx, c4); - - assert c4 != null; - } - - /** - * Test 2 keys with candidates in reverse order. - */ - @Test - public void testReverseOrder1() { - UUID id = UUID.randomUUID(); - - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheContext ctx = cache.context(); - - GridCacheTestEntryEx entry1 = new GridCacheTestEntryEx(cache.context(), "1"); - GridCacheTestEntryEx entry2 = new GridCacheTestEntryEx(cache.context(), "2"); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - - GridCacheMvccCandidate c1k1 = entry1.addLocal(2, ver2, 0, true, false); - - // Link up. - ctx.mvcc().addNext(ctx, c1k1); - - entry1.readyLocal(ver2); - - checkLocal(c1k1, ver2, true, true, false); - - GridCacheMvccCandidate c2k1 = entry1.addRemote(id, 2, ver1, true); - - // Force recheck of assignments. - entry1.recheckLock(); - - checkLocal(c1k1, ver2, true, true, false); - checkRemote(c2k1, ver1, false, false); - - GridCacheMvccCandidate c1k2 = entry2.addLocal(2, ver2, 0, true, false); - - assert c1k2 != null; - - ctx.mvcc().addNext(ctx, c1k2); - - assert c1k2.previous() == c1k1; - - GridCacheMvccCandidate c2k2 = entry2.addRemote(id, 3, ver1, true); - - entry2.readyLocal(c1k2); - - // Local entry2 should become owner, because otherwise remote will be stuck, waiting - // for local entry1, which in turn awaits for local entry2. - checkLocal(c1k2, ver2, true, true, false); - checkRemote(c2k2, ver1, false, false); - } - - /** - * Test 2 keys with candidates in reverse order. - * - * @throws Exception If failed. - */ - @Test - public void testReverseOrder2() throws Exception { - UUID id = UUID.randomUUID(); - - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheContext ctx = cache.context(); - - GridCacheTestEntryEx entry1 = new GridCacheTestEntryEx(ctx, "1"); - GridCacheTestEntryEx entry2 = new GridCacheTestEntryEx(ctx, "2"); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - - // Local with higher version. - GridCacheMvccCandidate v3k1 = entry1.addLocal(3, ver3, 0, true, true); - GridCacheMvccCandidate v3k2 = entry2.addLocal(3, ver3, 0, true, true); - - // Link up. - linkCandidates(ctx, v3k1, v3k2); - - entry1.readyLocal(v3k1); - - checkLocal(v3k1, ver3, true, true, false); - checkLocal(v3k2, ver3, false, false, false); - - // Remote locks. - GridCacheMvccCandidate v2k1 = entry1.addRemote(id, 3, ver2, false); - GridCacheMvccCandidate v2k2 = entry2.addRemote(id, 3, ver2, false); - - checkRemote(v2k1, ver2, false, false); - checkRemote(v2k2, ver2, false, false); - - // Local with lower version. - GridCacheMvccCandidate v1k1 = entry1.addLocal(4, ver1, 0, true, true); - GridCacheMvccCandidate v1k2 = entry2.addLocal(4, ver1, 0, true, true); - - // Link up. - linkCandidates(ctx, v1k1, v1k2); - - entry1.readyLocal(v1k1); - entry2.readyLocal(v1k2); - - checkLocal(v1k1, ver1, true, false, false); - checkLocal(v1k2, ver1, true, false, false); - - checkLocal(v3k2, ver3, false, false, false); - - entry2.readyLocal(v3k2); - - // Note, ver3 should be acquired before ver1 (i.e. in reverse order from natural versions order). - checkLocal(v3k2, ver3, true, true, false); - - checkLocal(v1k1, ver1, true, false, false); - checkLocal(v1k2, ver1, true, false, false); - } - - /** - * Tests local-only locks in reverse order. - * - * @throws Exception If failed. - */ - @Test - public void testReverseOrder3() throws Exception { - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheContext ctx = cache.context(); - - GridCacheTestEntryEx entry1 = new GridCacheTestEntryEx(ctx, "1"); - GridCacheTestEntryEx entry2 = new GridCacheTestEntryEx(ctx, "2"); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver3 = version(3); - - // Local with higher version. - GridCacheMvccCandidate v3k1 = entry1.addLocal(3, ver3, 0, true, false); - GridCacheMvccCandidate v3k2 = entry2.addLocal(3, ver3, 0, true, false); - - linkCandidates(ctx, v3k1, v3k2); - - entry1.readyLocal(ver3); - - checkLocal(v3k1, ver3, true, true, false); - checkLocal(v3k2, ver3, false, false, false); - - GridCacheMvccCandidate v1k1 = entry1.addLocal(4, ver1, 0, true, true); - GridCacheMvccCandidate v1k2 = entry2.addLocal(4, ver1, 0, true, true); - - // Link up. - linkCandidates(ctx, v1k1, v1k2); - - entry1.readyLocal(ver1); - entry2.readyLocal(ver1); - - checkLocal(v3k1, ver3, true, true, false); // Owner. - checkLocal(v3k2, ver3, false, false, false); - - checkLocal(v1k1, ver1, true, false, false); - checkLocal(v1k2, ver1, true, false, false); - - entry2.readyLocal(v3k2); - - checkLocal(v3k1, ver3, true, true, false); - checkLocal(v3k2, ver3, true, true, false); - } - - /** - * Tests local candidates with remote version in the middle on key2. - * - * @throws Exception If failed. - */ - @Test - public void testReverseOrder4() throws Exception { - UUID id = UUID.randomUUID(); - - GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME); - - GridCacheContext ctx = cache.context(); - - GridCacheTestEntryEx entry1 = new GridCacheTestEntryEx(ctx, "1"); - GridCacheTestEntryEx entry2 = new GridCacheTestEntryEx(ctx, "2"); - - GridCacheVersion ver1 = version(1); - GridCacheVersion ver2 = version(2); - GridCacheVersion ver3 = version(3); - - // Local with higher version. - GridCacheMvccCandidate v3k1 = entry1.addLocal(3, ver3, 0, true, false); - GridCacheMvccCandidate v3k2 = entry2.addLocal(3, ver3, 0, true, false); - - linkCandidates(ctx, v3k1, v3k2); - - entry1.readyLocal(ver3); - - checkLocal(v3k1, ver3, true, true, false); - checkLocal(v3k2, ver3, false, false, false); - - GridCacheMvccCandidate v1k1 = entry1.addLocal(4, ver1, 0, true, true); - GridCacheMvccCandidate v1k2 = entry2.addLocal(4, ver1, 0, true, true); - - // Link up. - linkCandidates(ctx, v1k1, v1k2); - - entry1.readyLocal(ver1); - entry2.readyLocal(ver1); - - checkLocal(v3k1, ver3, true, true, false); // Owner. - checkLocal(v3k2, ver3, false, false, false); - - checkLocal(v1k1, ver1, true, false, false); - checkLocal(v1k2, ver1, true, false, false); - - GridCacheMvccCandidate v2k2 = entry2.addRemote(id, 5, ver2, false); - - checkRemote(v2k2, ver2, false, false); - - entry2.readyLocal(v3k2); - - checkLocal(v3k1, ver3, true, true, false); - checkLocal(v3k2, ver3, true, true, false); - } - - /** - * Gets version based on order. - * - * @param order Order. - * @return Version. - */ - private GridCacheVersion version(int order) { - return new GridCacheVersion(1, order, order, 0); - } - - /** - * Links candidates. - * - * @param ctx Cache context. - * @param cands Candidates. - * @throws Exception If failed. - */ - private void linkCandidates(final GridCacheContext ctx, - final GridCacheMvccCandidate... cands) throws Exception { - multithreaded(new Runnable() { - @Override public void run() { - for (GridCacheMvccCandidate cand : cands) { - boolean b = grid.internalCache(DEFAULT_CACHE_NAME).context().mvcc().addNext(ctx, cand); - - assert b; - } - - info("Link thread finished."); - } - }, 1); - } - - /** - * Check order in collection. - * - * @param cands Candidates to check order for. - * @param vers Ordered versions. - */ - private void checkOrder(Collection cands, GridCacheVersion... vers) { - assertEquals(vers.length, cands.size()); - - int i = 0; - - for (GridCacheMvccCandidate cand : cands) { - assert cand.version().equals(vers[i]) : "Invalid order of candidates [cands=" + toString(cands) + - ", order=" + toString(vers) + ']'; - - i++; - } - } - - /** - * @param objs Object to print. - * @return String representation. - */ - private String toString(Iterable objs) { - String eol = System.getProperty("line.separator"); - - StringBuilder buf = new StringBuilder(eol); - - for (Object obj : objs) - buf.append(obj.toString()).append(eol); - - return buf.toString(); - } - - /** - * @param objs Object to print. - * @return String representation. - */ - private String toString(Object[] objs) { - String eol = System.getProperty("line.separator"); - - StringBuilder buf = new StringBuilder(eol); - - for (Object obj : objs) - buf.append(obj.toString()).append(eol); - - return buf.toString(); - } - - /** - * Checks flags on done candidate. - * - * @param cand Candidate to check. - */ - private void checkDone(GridCacheMvccCandidate cand) { - assert cand != null; - - info("Done candidate: " + cand); - - assert cand.used(); - assert cand.owner(); - - assert !cand.ready(); - assert !cand.reentry(); - assert !cand.local(); - } - - /** - * @param cand Candidate to check. - * @param ver Version. - * @param owner Owner flag. - * @param used Done flag. - */ - private void checkRemote(GridCacheMvccCandidate cand, GridCacheVersion ver, boolean owner, boolean used) { - assert cand != null; - - info("Done candidate: " + cand); - - assert cand.version().equals(ver); - - // Check flags. - assert cand.used() == used; - assert cand.owner() == owner; - - assert !cand.ready(); - assert !cand.reentry(); - assert !cand.local(); - } - - /** - * Checks flags on remote owner candidate. - * - * @param cand Candidate to check. - * @param ver Version. - */ - private void checkRemoteOwner(GridCacheMvccCandidate cand, GridCacheVersion ver) { - assert cand != null; - - info("Done candidate: " + cand); - - assert cand.version().equals(ver); - - // Check flags. - assert cand.used(); - assert cand.owner(); - - assert !cand.ready(); - assert !cand.reentry(); - assert !cand.local(); - } - - /** - * Checks flags on local candidate. - * - * @param cand Candidate to check. - * @param ver Cache version. - * @param ready Ready flag. - * @param owner Lock owner. - * @param reentry Reentry flag. - */ - private void checkLocal(GridCacheMvccCandidate cand, GridCacheVersion ver, boolean ready, - boolean owner, boolean reentry) { - assert cand != null; - - info("Done candidate: " + cand); - - assert cand.version().equals(ver); - - // Check flags. - assert cand.ready() == ready; - assert cand.owner() == owner; - assert cand.reentry() == reentry; - - assert !cand.used(); - - assert cand.local(); - } - - /** - * Checks flags on local candidate. - * - * @param cand Candidate to check. - * @param ver Cache version. - * @param ready Ready flag. - * @param owner Lock owner. - * @param reentry Reentry flag. - * @param used Used flag. - */ - private void checkLocal(GridCacheMvccCandidate cand, GridCacheVersion ver, boolean ready, - boolean owner, boolean reentry, boolean used) { - assert cand != null; - - info("Done candidate: " + cand); - - assert cand.version().equals(ver); - - // Check flags. - assert cand.ready() == ready; - assert cand.owner() == owner; - assert cand.reentry() == reentry; - assert cand.used() == used; - - assert cand.local(); - } - - /** - * Checks flags on local owner candidate. - * - * @param cand Candidate to check. - * @param ver Cache version. - * @param reentry Reentry flag. - */ - private void checkLocalOwner(GridCacheMvccCandidate cand, GridCacheVersion ver, boolean reentry) { - assert cand != null; - - info("Done candidate: " + cand); - - assert cand.version().equals(ver); - - // Check flags. - assert cand.reentry() == reentry; - - assert !cand.used(); - - assert cand.ready(); - assert cand.owner(); - assert cand.local(); - } - - /** - * @param cands Candidates to print. - */ - private void info(Iterable cands) { - info("Collection of candidates: "); - - for (GridCacheMvccCandidate c : cands) - info(">>> " + c); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java index 7f9141a3a7a2b..fbe15363d34d3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java @@ -27,10 +27,10 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -50,17 +50,8 @@ public class GridCacheObjectToStringSelfTest extends GridCommonAbstractTest { /** Near enabled flag. */ private boolean nearEnabled; - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration cacheCfg = defaultCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java index 72df2805c4552..dc1979cab4da5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java @@ -130,19 +130,12 @@ public void testReadEvictedPartition() throws Exception { assertEquals(10, cache.get(key)); - if (((IgniteCacheProxy)cache).context().config().getAtomicityMode() != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) { - try (Transaction ignored = grid.transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { - assertEquals(10, cache.get(key)); - } - - try (Transaction ignored = grid.transactions().txStart(PESSIMISTIC, READ_COMMITTED)) { - assertEquals(10, cache.get(key)); - } + try (Transaction ignored = grid.transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + assertEquals(10, cache.get(key)); } - else { - try (Transaction ignored = grid.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - assertEquals(10, cache.get(key)); - } + + try (Transaction ignored = grid.transactions().txStart(PESSIMISTIC, READ_COMMITTED)) { + assertEquals(10, cache.get(key)); } } finally { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java index 5edfcf7a2b1f3..1ed76b33204a9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java @@ -29,9 +29,7 @@ import org.apache.ignite.internal.managers.communication.GridMessageListener; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetRequest; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -116,10 +114,6 @@ public void testGetFromPrimaryNode() throws Exception { */ @Test public void testGetFromBackupNode() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10274", MvccFeatureChecker.forcedMvcc()); - - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - for (int i = 0; i < GRID_CNT; i++) { IgniteCache c = grid(i).cache(DEFAULT_CACHE_NAME); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedWritesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedWritesTest.java index 95ce4758ccfb2..2a54d033d4f3f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedWritesTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedWritesTest.java @@ -27,7 +27,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -44,11 +43,6 @@ public class GridCachePartitionedWritesTest extends GridCommonAbstractTest { /** Cache store. */ private CacheStore store; - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java index cb3e45d61f953..8f1c9850bd124 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java @@ -39,7 +39,6 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; import org.junit.Test; @@ -95,8 +94,6 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest @Test public void testEvictions() throws Exception { try { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - final Ignite ignite1 = startGrid(1); final IgniteCache cache1 = ignite1.cache(DEFAULT_CACHE_NAME); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReloadSelfTest.java index b8f98f2aff0a5..3510dc98de959 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReloadSelfTest.java @@ -30,9 +30,7 @@ import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -56,16 +54,6 @@ public class GridCacheReloadSelfTest extends GridCommonAbstractTest { /** Near enabled flag. */ private boolean nearEnabled = true; - /** */ - @Before - public void beforeGridCacheReloadSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - - if (nearEnabled) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { cacheMode = null; @@ -75,12 +63,6 @@ public void beforeGridCacheReloadSelfTest() { /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - - if (nearEnabled) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setLocalHost("127.0.0.1"); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java index e8b9ebb18a9d9..3c942e335d7a9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java @@ -41,7 +41,6 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; @@ -122,48 +121,6 @@ public void testStopImplicitTransactionsReplicated() throws Exception { testStop(false); } - /** - * @throws Exception If failed. - */ - @Test - public void testStopExplicitMvccTransactions() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - - testStop(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testStopImplicitMvccTransactions() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - - testStop(false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testStopExplicitMvccTransactionsReplicated() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - replicated = true; - - testStop(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testStopImplicitMvccTransactionsReplicated() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - replicated = true; - - testStop(false); - } - /** * @throws Exception If failed. */ @@ -269,12 +226,10 @@ private void cacheOperations(Ignite node, IgniteCache cache) { cache.get(key); - if (cache.getConfiguration(CacheConfiguration.class).getAtomicityMode() != TRANSACTIONAL_SNAPSHOT) { - try (Transaction tx = node.transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { - cache.put(key, key); + try (Transaction tx = node.transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + cache.put(key, key); - tx.commit(); - } + tx.commit(); } try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { @@ -316,8 +271,7 @@ private void testStop(final boolean startTx) throws Exception { @Override public Void call() throws Exception { try { if (startTx) { - TransactionConcurrency concurrency = - atomicityMode != TRANSACTIONAL_SNAPSHOT && (key % 2 == 0) ? OPTIMISTIC : PESSIMISTIC; + TransactionConcurrency concurrency = (key % 2 == 0) ? OPTIMISTIC : PESSIMISTIC; try (Transaction tx = grid(0).transactions().txStart(concurrency, REPEATABLE_READ)) { cache.put(key, key); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java index 248adc7e680df..31208262aba1b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java @@ -39,9 +39,7 @@ import org.apache.ignite.internal.processors.cache.store.CacheLocalStore; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; import org.apache.ignite.marshaller.jdk.JdkMarshaller; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -63,12 +61,6 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract /** Test cache name. */ protected static final String CACHE_NAME = "cache_name"; - /** */ - @Before - public void beforeGridCacheStoreManagerDeserializationTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** * @return Cache mode. */ @@ -102,8 +94,6 @@ private CacheWriteSynchronizationMode cacheWriteSynchronizationMode() { */ @SuppressWarnings("unchecked") protected CacheConfiguration cacheConfiguration() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - CacheConfiguration cc = defaultCacheConfiguration(); // Template diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java index 057d3db6ed627..2d03c8ff93265 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java @@ -120,11 +120,6 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr return false; } - /** {@inheritDoc} */ - @Override public boolean isMvcc() { - return false; - } - /** {@inheritDoc} */ @Override public boolean detached() { return false; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerEvictionSelfTest.java index 2474f021fa7f5..9287ad3d1d744 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerEvictionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerEvictionSelfTest.java @@ -28,7 +28,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Ignore; import org.junit.Test; @@ -47,14 +46,6 @@ public class GridCacheTtlManagerEvictionSelfTest extends GridCommonAbstractTest /** Cache mode. */ private volatile CacheMode cacheMode; - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerSelfTest.java index 511d3833b7871..217fb107bc174 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerSelfTest.java @@ -26,9 +26,9 @@ import org.apache.ignite.internal.util.typedef.CAX; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; + import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -40,17 +40,8 @@ public class GridCacheTtlManagerSelfTest extends GridCommonAbstractTest { /** Test cache mode. */ protected CacheMode cacheMode; - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTxPartitionedLocalStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTxPartitionedLocalStoreSelfTest.java index 313c22b30bcf5..759a9cc99f620 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTxPartitionedLocalStoreSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTxPartitionedLocalStoreSelfTest.java @@ -19,7 +19,6 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -28,13 +27,6 @@ * */ public class GridCacheTxPartitionedLocalStoreSelfTest extends GridCacheAbstractLocalStoreSelfTest { - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected CacheAtomicityMode getAtomicMode() { return TRANSACTIONAL; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java index fab9be9e896d2..ccf17fc87196c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java @@ -27,7 +27,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.junit.Assume; import org.junit.Test; @@ -80,14 +79,6 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach super.beforeTestsStarted(); } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - if (nearEnabled()) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { super.afterTestsStopped(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java index 7e0281f4fe063..f03e7b87106d6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java @@ -32,11 +32,9 @@ import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionRollbackException; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -49,13 +47,6 @@ public class GridCacheVariableTopologySelfTest extends GridCommonAbstractTest { /** */ private static final Random RAND = new Random(); - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7388", MvccFeatureChecker.forcedMvcc()); - - super.beforeTest(); - } - /** Constructs test. */ public GridCacheVariableTopologySelfTest() { super(/* don't start grid */ false); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java index 74d9f1e70a893..9a18bd3a09b57 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java @@ -30,12 +30,10 @@ import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.jetbrains.annotations.Nullable; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; @@ -111,30 +109,6 @@ public void testVersionTxNearEnabled() throws Exception { checkVersion(); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testVersionMvccTx() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - - checkVersion(); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testVersionMvccTxNearEnabled() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - - near = true; - - checkVersion(); - } - /** * @throws Exception If failed. */ @@ -176,12 +150,10 @@ private void checkVersion() throws Exception { checkVersion(String.valueOf(i), PESSIMISTIC); // Update. } - if (atomicityMode != TRANSACTIONAL_SNAPSHOT) { - for (int i = 200; i < 300; i++) { - checkVersion(String.valueOf(i), OPTIMISTIC); // Create. + for (int i = 200; i < 300; i++) { + checkVersion(String.valueOf(i), OPTIMISTIC); // Create. - checkVersion(String.valueOf(i), OPTIMISTIC); // Update. - } + checkVersion(String.valueOf(i), OPTIMISTIC); // Update. } } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java index c32d51898c40c..84b3058daa85f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java @@ -37,7 +37,6 @@ 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; /** @@ -67,14 +66,6 @@ public void testVersionIncreaseTx() throws Exception { checkVersionIncrease(cacheConfigurations(TRANSACTIONAL)); } - /** - * @throws Exception If failed. - */ - @Test - public void testVersionIncreaseMvccTx() throws Exception { - checkVersionIncrease(cacheConfigurations(TRANSACTIONAL_SNAPSHOT)); - } - /** * @param ccfgs Cache configurations. * @throws Exception If failed. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridEvictionPolicyMBeansTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridEvictionPolicyMBeansTest.java index 1608fe5553a98..149451697294e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridEvictionPolicyMBeansTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridEvictionPolicyMBeansTest.java @@ -25,7 +25,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.util.IgniteUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -38,13 +37,6 @@ public GridEvictionPolicyMBeansTest() { super(true); } - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - - super.beforeTestsStarted(); - } - /** * {@inheritDoc} * @@ -89,10 +81,8 @@ public GridEvictionPolicyMBeansTest() { lep.setMaxSize(40); ncf.setNearEvictionPolicy(lep); - if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) { - cache1.setNearConfiguration(ncf); - cache2.setNearConfiguration(ncf); - } + cache1.setNearConfiguration(ncf); + cache2.setNearConfiguration(ncf); cfg.setCacheConfiguration(cache1, cache2); @@ -106,21 +96,17 @@ public void testEvictionPolicyBeans() throws Exception { checkBean("cache1", "org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy", "BatchSize", 10); checkBean("cache1", "org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy", "MaxMemorySize", 20L); - if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) { - checkBean("cache1-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "MaxSize", 40); - checkBean("cache1-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "BatchSize", 10); - checkBean("cache1-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "MaxMemorySize", 500L); - } + checkBean("cache1-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "MaxSize", 40); + checkBean("cache1-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "BatchSize", 10); + checkBean("cache1-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "MaxMemorySize", 500L); checkBean("cache2", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "MaxSize", 30); checkBean("cache2", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "BatchSize", 10); checkBean("cache2", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "MaxMemorySize", 125L); - if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) { - checkBean("cache2-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "MaxSize", 40); - checkBean("cache2-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "BatchSize", 10); - checkBean("cache2-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "MaxMemorySize", 500L); - } + checkBean("cache2-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "MaxSize", 40); + checkBean("cache2-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "BatchSize", 10); + checkBean("cache2-near", "org.apache.ignite.cache.eviction.lru.LruEvictionPolicy", "MaxMemorySize", 500L); } /** Checks that a bean with the specified group and name is available and has the expected attribute */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeAbstractTest.java index ef330e428d91f..9c795bda4daf8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeAbstractTest.java @@ -28,7 +28,6 @@ import java.util.stream.Stream; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cluster.ClusterState; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; @@ -41,7 +40,6 @@ import static java.util.stream.Collectors.toSet; 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.testframework.GridTestUtils.assertThrows; /** @@ -80,10 +78,7 @@ public abstract class IgniteCacheClusterReadOnlyModeAbstractTest extends GridCom protected static final Predicate TX_CACHES_PRED = cfg -> cfg.getAtomicityMode() == TRANSACTIONAL; /** */ - protected static final Predicate MVCC_CACHES_PRED = cfg -> cfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT; - - /** */ - protected static final Predicate NO_MVCC_CACHES_PRED = ATOMIC_CACHES_PRED.or(TX_CACHES_PRED); + protected static final Predicate ANY_CACHES_PRED = ATOMIC_CACHES_PRED.or(TX_CACHES_PRED); /** Started cache configurations. */ protected static Collection> cacheConfigurations; @@ -256,7 +251,6 @@ private void commonChecks() { protected static CacheConfiguration[] filterAndAddNearCacheConfig(CacheConfiguration[] cfgs) { return Stream.of(cfgs) // Near caches doesn't support in a MVCC mode. - .filter(cfg -> cfg.getAtomicityMode() != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) .map(cfg -> cfg.setNearConfiguration(new NearCacheConfiguration<>())) .toArray(CacheConfiguration[]::new); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeSelfTest.java index cd9a330ab3146..5fc1705ed7a5d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheClusterReadOnlyModeSelfTest.java @@ -34,8 +34,6 @@ import static java.util.Arrays.asList; import static java.util.Collections.singleton; import static java.util.stream.Collectors.toMap; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; /** * Tests most of public API methods of {@link IgniteCache} when cluster in a {@link ClusterState#ACTIVE_READ_ONLY} state. @@ -200,11 +198,6 @@ public void testGetAllOutTxAllowed() { for (TransactionIsolation isolation : TransactionIsolation.values()) { CacheConfiguration cfg = cache.getConfiguration(CacheConfiguration.class); - if (level == OPTIMISTIC && cfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) { - // Only pessimistic transactions are supported when MVCC is enabled. - continue; - } - Transaction tx = node.transactions().txStart(level, isolation); try { @@ -230,7 +223,7 @@ public void testGetAllOutTxAllowed() { } } }, - TX_CACHES_PRED.or(MVCC_CACHES_PRED) + TX_CACHES_PRED ); } @@ -243,11 +236,6 @@ public void testGetAllOutTxAsyncAllowed() { for (TransactionIsolation isolation : TransactionIsolation.values()) { CacheConfiguration cfg = cache.getConfiguration(CacheConfiguration.class); - if (level == OPTIMISTIC && cfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) { - // Only pessimistic transactions are supported when MVCC is enabled. - continue; - } - Transaction tx = node.transactions().txStart(level, isolation); try { @@ -273,7 +261,7 @@ public void testGetAllOutTxAsyncAllowed() { } } }, - TX_CACHES_PRED.or(MVCC_CACHES_PRED) + TX_CACHES_PRED ); } @@ -466,52 +454,52 @@ public void testRemoveAllAsyncDenied() { /** */ @Test public void testClearDenied() { - performActionReadOnlyExceptionExpected(IgniteCache::clear, NO_MVCC_CACHES_PRED); + performActionReadOnlyExceptionExpected(IgniteCache::clear, ANY_CACHES_PRED); } /** */ @Test public void testClearAsyncDenied() { - performActionReadOnlyExceptionExpected(cache -> cache.clearAsync().get(), NO_MVCC_CACHES_PRED); + performActionReadOnlyExceptionExpected(cache -> cache.clearAsync().get(), ANY_CACHES_PRED); } /** */ @Test public void testClearWithKeyDenied() { - performActionReadOnlyExceptionExpected(cache -> cache.clear(KEY), NO_MVCC_CACHES_PRED); - performActionReadOnlyExceptionExpected(cache -> cache.clear(UNKNOWN_KEY), NO_MVCC_CACHES_PRED); + performActionReadOnlyExceptionExpected(cache -> cache.clear(KEY), ANY_CACHES_PRED); + performActionReadOnlyExceptionExpected(cache -> cache.clear(UNKNOWN_KEY), ANY_CACHES_PRED); } /** */ @Test public void testClearWithKeyAsyncDenied() { - performActionReadOnlyExceptionExpected(cache -> cache.clearAsync(KEY).get(), NO_MVCC_CACHES_PRED); - performActionReadOnlyExceptionExpected(cache -> cache.clearAsync(UNKNOWN_KEY).get(), NO_MVCC_CACHES_PRED); + performActionReadOnlyExceptionExpected(cache -> cache.clearAsync(KEY).get(), ANY_CACHES_PRED); + performActionReadOnlyExceptionExpected(cache -> cache.clearAsync(UNKNOWN_KEY).get(), ANY_CACHES_PRED); } /** */ @Test public void testClearAllDenied() { - performActionReadOnlyExceptionExpected(cache -> cache.clearAll(kvMap.keySet()), NO_MVCC_CACHES_PRED); + performActionReadOnlyExceptionExpected(cache -> cache.clearAll(kvMap.keySet()), ANY_CACHES_PRED); } /** */ @Test public void testClearAllAsyncDenied() { - performActionReadOnlyExceptionExpected(cache -> cache.clearAllAsync(kvMap.keySet()).get(), NO_MVCC_CACHES_PRED); + performActionReadOnlyExceptionExpected(cache -> cache.clearAllAsync(kvMap.keySet()).get(), ANY_CACHES_PRED); } /** */ @Test public void testLocalClearDenied() { - performActionReadOnlyExceptionExpected(cache -> cache.localClear(KEY), NO_MVCC_CACHES_PRED); - performActionReadOnlyExceptionExpected(cache -> cache.localClear(UNKNOWN_KEY), NO_MVCC_CACHES_PRED); + performActionReadOnlyExceptionExpected(cache -> cache.localClear(KEY), ANY_CACHES_PRED); + performActionReadOnlyExceptionExpected(cache -> cache.localClear(UNKNOWN_KEY), ANY_CACHES_PRED); } /** */ @Test public void testLocalClearAllDenied() { - performActionReadOnlyExceptionExpected(cache -> cache.localClearAll(kvMap.keySet()), NO_MVCC_CACHES_PRED); + performActionReadOnlyExceptionExpected(cache -> cache.localClearAll(kvMap.keySet()), ANY_CACHES_PRED); } /** */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java index 05b9aa8bfdb7b..5bc628ce02e1e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java @@ -67,9 +67,9 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.jetbrains.annotations.Nullable; import org.junit.Test; + import static java.util.concurrent.TimeUnit.MILLISECONDS; import static javax.cache.event.EventType.CREATED; import static javax.cache.event.EventType.EXPIRED; @@ -103,18 +103,9 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb /** */ private static AtomicBoolean serialized = new AtomicBoolean(false); - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName); if (lsnrCfg != null) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerEagerTtlDisabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerEagerTtlDisabledTest.java index 2724e74145bd9..13b5230ffda01 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerEagerTtlDisabledTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerEagerTtlDisabledTest.java @@ -18,19 +18,11 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; /** * Tests expire events when {@link CacheConfiguration#isEagerTtl()} is disabled. */ public class IgniteCacheEntryListenerEagerTtlDisabledTest extends IgniteCacheEntryListenerTxTest { - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected boolean eagerTtl() { return false; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java index fc5890680a531..85034906dac8e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java @@ -34,7 +34,6 @@ 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.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; @@ -123,30 +122,6 @@ public void testEntryProcessorCallOnTxCache() throws Exception { } } - /** - * @throws Exception If failed. - */ - @Test - public void testEntryProcessorCallOnMvccCache() throws Exception { - { - CacheConfiguration ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); - ccfg.setBackups(1); - ccfg.setWriteSynchronizationMode(FULL_SYNC); - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - checkEntryProcessorCallCount(ccfg, 2); - } - - { - CacheConfiguration ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); - ccfg.setBackups(0); - ccfg.setWriteSynchronizationMode(FULL_SYNC); - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - checkEntryProcessorCallCount(ccfg, 1); - } - } - /** * @param ccfg Cache configuration. * @param expCallCnt Expected entry processor calls count. @@ -176,8 +151,6 @@ private void checkEntryProcessorCallCount(CacheConfiguration checkEntryProcessCall(key++, clientCache1, OPTIMISTIC, SERIALIZABLE, expCallCnt + 1); checkEntryProcessCall(key++, clientCache1, PESSIMISTIC, REPEATABLE_READ, expCallCnt + 1); } - else if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) - checkEntryProcessCall(key++, clientCache1, PESSIMISTIC, REPEATABLE_READ, expCallCnt); for (int i = 100; i < 110; i++) { checkEntryProcessCall(key++, srvCache, null, null, expCallCnt); @@ -187,8 +160,6 @@ else if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) checkEntryProcessCall(key++, clientCache1, OPTIMISTIC, SERIALIZABLE, expCallCnt + 1); checkEntryProcessCall(key++, clientCache1, PESSIMISTIC, REPEATABLE_READ, expCallCnt + 1); } - else if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) - checkEntryProcessCall(key++, clientCache1, PESSIMISTIC, REPEATABLE_READ, expCallCnt); } for (int i = 0; i < NODES; i++) @@ -218,8 +189,7 @@ private void checkEntryProcessCall(Integer key, ", concurrency=" + concurrency + ", isolation=" + isolation + "]"); - int expCallCntOnGet = cache.getConfiguration(CacheConfiguration.class).getAtomicityMode() == TRANSACTIONAL_SNAPSHOT ? - 1 : expCallCnt; + int expCallCntOnGet = expCallCnt; Transaction tx; TestReturnValue retVal; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java index 892ce878dfbae..115c6e955450a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java @@ -102,11 +102,10 @@ import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionRollbackException; import org.jetbrains.annotations.Nullable; -import org.junit.Ignore; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -126,9 +125,6 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest { /** */ private static final String GROUP2 = "grp2"; - /** */ - private static final String GROUP3 = "grp3"; - /** */ private static final String CACHE1 = "cache1"; @@ -250,14 +246,6 @@ public void testCreateDestroyCachesTxPartitioned() throws Exception { createDestroyCaches(PARTITIONED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testCreateDestroyCachesMvccTxPartitioned() throws Exception { - createDestroyCaches(PARTITIONED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -274,14 +262,6 @@ public void testCreateDestroyCachesTxReplicated() throws Exception { createDestroyCaches(REPLICATED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testCreateDestroyCachesMvccTxReplicated() throws Exception { - createDestroyCaches(REPLICATED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -298,14 +278,6 @@ public void testScanQueryTxPartitioned() throws Exception { scanQuery(PARTITIONED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testScanQueryMvccTxPartitioned() throws Exception { - scanQuery(PARTITIONED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -322,14 +294,6 @@ public void testScanQueryTxReplicated() throws Exception { scanQuery(REPLICATED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testScanQueryMvccTxReplicated() throws Exception { - scanQuery(REPLICATED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -346,15 +310,6 @@ public void testEntriesTtlTxPartitioned() throws Exception { entriesTtl(PARTITIONED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7311") - @Test - public void testEntriesTtlMvccTxPartitioned() throws Exception { - entriesTtl(PARTITIONED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -371,15 +326,6 @@ public void testEntriesTtlTxReplicated() throws Exception { entriesTtl(REPLICATED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7311") - @Test - public void testEntriesTtlMvccTxReplicated() throws Exception { - entriesTtl(REPLICATED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -396,14 +342,6 @@ public void testCacheIteratorTxPartitioned() throws Exception { cacheIterator(PARTITIONED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testCacheIteratorMvccTxPartitioned() throws Exception { - cacheIterator(PARTITIONED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -420,14 +358,6 @@ public void testCacheIteratorTxReplicated() throws Exception { cacheIterator(REPLICATED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testCacheIteratorMvccTxReplicated() throws Exception { - cacheIterator(REPLICATED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -444,14 +374,6 @@ public void testScanQueryMultiplePartitionsTxPartitioned() throws Exception { scanQueryMultiplePartitions(PARTITIONED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testScanQueryMultiplePartitionsMvccTxPartitioned() throws Exception { - scanQueryMultiplePartitions(PARTITIONED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -468,14 +390,6 @@ public void testScanQueryMultiplePartitionsTxReplicated() throws Exception { scanQueryMultiplePartitions(REPLICATED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testScanQueryMultiplePartitionsMvccTxReplicated() throws Exception { - scanQueryMultiplePartitions(REPLICATED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -484,14 +398,6 @@ public void testContinuousQueryTxReplicated() throws Exception { continuousQuery(REPLICATED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testContinuousQueryMvccTxReplicated() throws Exception { - continuousQuery(REPLICATED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -500,14 +406,6 @@ public void testContinuousQueryTxPartitioned() throws Exception { continuousQuery(PARTITIONED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testContinuousQueryMvccTxPartitioned() throws Exception { - continuousQuery(PARTITIONED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -1386,10 +1284,6 @@ public void testRebalance1() throws Exception { srv0.createCache(cacheConfiguration(GROUP2, "c3", PARTITIONED, TRANSACTIONAL, 2, false)); IgniteCache srv0Cache4 = srv0.createCache(cacheConfiguration(GROUP2, "c4", PARTITIONED, TRANSACTIONAL, 2, false)); - IgniteCache srv0Cache5 = - srv0.createCache(cacheConfiguration(GROUP3, "c5", PARTITIONED, TRANSACTIONAL_SNAPSHOT, 2, false)); - IgniteCache srv0Cache6 = - srv0.createCache(cacheConfiguration(GROUP3, "c6", PARTITIONED, TRANSACTIONAL_SNAPSHOT, 2, false)); final int ITEMS = 1_000; @@ -1398,9 +1292,6 @@ public void testRebalance1() throws Exception { srv0Cache3.put(new Key1(i), i); srv0Cache4.put(new Key1(i), -i); - - srv0Cache5.put(new Key1(i), i); - srv0Cache6.put(new Key1(i), -i); } assertEquals(ITEMS, srv0Cache1.size()); @@ -1408,8 +1299,6 @@ public void testRebalance1() throws Exception { assertEquals(0, srv0Cache2.size()); assertEquals(ITEMS, srv0Cache3.size()); assertEquals(ITEMS, srv0Cache4.localSize()); - assertEquals(ITEMS, srv0Cache5.size()); - assertEquals(ITEMS, srv0Cache6.localSize()); startGrid(1); @@ -1422,8 +1311,6 @@ public void testRebalance1() throws Exception { IgniteCache cache2 = node.cache("c2"); IgniteCache cache3 = node.cache("c3"); IgniteCache cache4 = node.cache("c4"); - IgniteCache cache5 = node.cache("c5"); - IgniteCache cache6 = node.cache("c6"); assertEquals(ITEMS * 2, cache1.size(CachePeekMode.ALL)); assertEquals(ITEMS, cache1.localSize(CachePeekMode.ALL)); @@ -1436,19 +1323,11 @@ public void testRebalance1() throws Exception { assertEquals(ITEMS * 2, cache4.size(CachePeekMode.ALL)); assertEquals(ITEMS, cache4.localSize(CachePeekMode.ALL)); - assertEquals(ITEMS * 2, cache5.size(CachePeekMode.ALL)); - assertEquals(ITEMS, cache5.localSize(CachePeekMode.ALL)); - - assertEquals(ITEMS * 2, cache6.size(CachePeekMode.ALL)); - assertEquals(ITEMS, cache6.localSize(CachePeekMode.ALL)); - for (int k = 0; k < ITEMS; k++) { assertEquals(i, cache1.localPeek(new Key1(i))); assertNull(cache2.localPeek(new Key1(i))); assertEquals(i, cache3.localPeek(new Key1(i))); assertEquals(-i, cache4.localPeek(new Key1(i))); - assertEquals(i, cache5.localPeek(new Key1(i))); - assertEquals(-i, cache6.localPeek(new Key1(i))); } } @@ -1466,8 +1345,6 @@ public void testRebalance1() throws Exception { IgniteCache cache2 = node.cache("c2"); IgniteCache cache3 = node.cache("c3"); IgniteCache cache4 = node.cache("c4"); - IgniteCache cache5 = node.cache("c5"); - IgniteCache cache6 = node.cache("c6"); assertEquals(ITEMS * 3, cache1.size(CachePeekMode.ALL)); assertEquals(ITEMS, cache1.localSize(CachePeekMode.ALL)); @@ -1475,8 +1352,6 @@ public void testRebalance1() throws Exception { assertEquals(ITEMS * 2, cache2.localSize(CachePeekMode.ALL)); assertEquals(ITEMS, cache3.localSize(CachePeekMode.ALL)); assertEquals(ITEMS, cache4.localSize(CachePeekMode.ALL)); - assertEquals(ITEMS, cache5.localSize(CachePeekMode.ALL)); - assertEquals(ITEMS, cache6.localSize(CachePeekMode.ALL)); } IgniteCache srv2Cache1 = srv2.cache("c1"); @@ -1581,14 +1456,6 @@ public void testNoKeyIntersectTx() throws Exception { testNoKeyIntersect(TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testNoKeyIntersectMvccTx() throws Exception { - testNoKeyIntersect(TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -1909,15 +1776,6 @@ public void testCacheApiTxPartitioned() throws Exception { cacheApiTest(PARTITIONED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7952") - @Test - public void testCacheApiMvccTxPartitioned() throws Exception { - cacheApiTest(PARTITIONED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -1926,15 +1784,6 @@ public void testCacheApiTxReplicated() throws Exception { cacheApiTest(REPLICATED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7952") - @Test - public void testCacheApiMvccTxReplicated() throws Exception { - cacheApiTest(REPLICATED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -2756,15 +2605,6 @@ public void testLoadCacheTxPartitioned() throws Exception { loadCache(PARTITIONED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7954") - @Test - public void testLoadCacheMvccTxPartitioned() throws Exception { - loadCache(PARTITIONED, TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -2773,15 +2613,6 @@ public void testLoadCacheTxReplicated() throws Exception { loadCache(REPLICATED, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7954") - @Test - public void testLoadCacheMvccTxReplicated() throws Exception { - loadCache(REPLICATED, TRANSACTIONAL_SNAPSHOT); - } - /** * @param cacheMode Cache mode. * @param atomicityMode Atomicity mode. @@ -3419,16 +3250,6 @@ public void testConfigurationConsistencyValidation() throws Exception { assertTrue("Unexpected message: " + e.getMessage(), e.getMessage().contains("Backups mismatch for caches related to the same group [groupName=grp1")); } - - try { - ignite(i).createCache(cacheConfiguration(GROUP1, "c2", PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, false)); - - fail(); - } - catch (CacheException e) { - assertTrue("Unexpected message: " + e.getMessage(), - e.getMessage().contains("Atomicity mode mismatch for caches related to the same group [groupName=grp1")); - } } } @@ -3688,9 +3509,7 @@ private void continuousQueriesMultipleGroups(int srvs) throws Exception { client.createCache(cacheConfiguration(null, "c7", PARTITIONED, ATOMIC, 1, false)); client.createCache(cacheConfiguration(null, "c8", PARTITIONED, TRANSACTIONAL, 1, false)); - client.createCache(cacheConfiguration(GROUP3, "c9", PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, false)); - - String[] cacheNames = {"c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9"}; + String[] cacheNames = {"c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8"}; AtomicInteger c1 = registerListener(client, "c1"); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java index 5c3ffa345c506..3a792f47be003 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java @@ -17,12 +17,10 @@ package org.apache.ignite.internal.processors.cache; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Ignore; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -30,13 +28,6 @@ * */ public class IgniteCacheInvokeReadThroughSingleNodeTest extends IgniteCacheInvokeReadThroughAbstractTest { - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTest(); - } - /** {@inheritDoc} */ @Override protected void startNodes() throws Exception { startGrid(0); @@ -89,31 +80,4 @@ public void testInvokeReadThroughTxNearCache() throws Exception { public void testInvokeReadThroughTxReplicated() throws Exception { invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL, 0, false)); } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testInvokeReadThroughMvccTx() throws Exception { - invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, false)); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testInvokeReadThroughMvccTxNearCache() throws Exception { - invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, true)); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testInvokeReadThroughMvccTxReplicated() throws Exception { - invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL_SNAPSHOT, 0, false)); - } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java index aa77ca6a16370..3a113effded47 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java @@ -17,13 +17,10 @@ package org.apache.ignite.internal.processors.cache; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -31,13 +28,6 @@ * */ public class IgniteCacheInvokeReadThroughTest extends IgniteCacheInvokeReadThroughAbstractTest { - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTest(); - } - /** {@inheritDoc} */ @Override protected void startNodes() throws Exception { startGridsMultiThreaded(4); @@ -124,49 +114,4 @@ public void testInvokeReadThroughTxNearCache() throws Exception { public void testInvokeReadThroughTxReplicated() throws Exception { invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL, 0, false)); } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testInvokeReadThroughMvccTx0() throws Exception { - invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 0, false)); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testInvokeReadThroughMvccTx1() throws Exception { - invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, false)); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testInvokeReadThroughMvccTx2() throws Exception { - invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 2, false)); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testInvokeReadThroughMvccTxNearCache() throws Exception { - invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, true)); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testInvokeReadThroughMvccTxReplicated() throws Exception { - invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL_SNAPSHOT, 0, false)); - } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMvccTxInvokeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMvccTxInvokeTest.java deleted file mode 100644 index 101d7965b4e63..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMvccTxInvokeTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.NearCacheConfiguration; -import org.junit.Ignore; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * - */ -public class IgniteCacheMvccTxInvokeTest extends IgniteCacheInvokeAbstractTest { - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Override protected NearCacheConfiguration nearConfiguration() { - return null; - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10472") - @Test - @Override public void testInvokeAllAppliedOnceOnBinaryTypeRegistration() { - super.testInvokeAllAppliedOnceOnBinaryTypeRegistration(); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMvccTxNearEnabledInvokeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMvccTxNearEnabledInvokeTest.java deleted file mode 100644 index fb3e280c5edbf..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMvccTxNearEnabledInvokeTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.configuration.NearCacheConfiguration; -import org.junit.Ignore; - -/** - * - */ -@Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") -public class IgniteCacheMvccTxNearEnabledInvokeTest extends IgniteCacheMvccTxInvokeTest { - /** {@inheritDoc} */ - @Override protected NearCacheConfiguration nearConfiguration() { - return new NearCacheConfiguration(); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearLockValueSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearLockValueSelfTest.java index 5297de53682cc..4a83b9f5fa6cb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearLockValueSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearLockValueSelfTest.java @@ -28,7 +28,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -42,8 +41,6 @@ public class IgniteCacheNearLockValueSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - startGrid(1); startClientGrid(0); @@ -51,8 +48,6 @@ public class IgniteCacheNearLockValueSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java index fd41d07221566..7ccd18a86c420 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoSyncForGetTest.java @@ -44,7 +44,6 @@ 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; /** @@ -83,14 +82,6 @@ public void testTxGet() throws Exception { getTest(TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxGet() throws Exception { - getTest(TRANSACTIONAL_SNAPSHOT); - } - /** * @param atomicityMode Cache atomicity mode. * @throws Exception If failed. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java index 3c39ac01c8748..09b3bd2358f1d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughEvictionSelfTest.java @@ -34,7 +34,6 @@ import org.apache.ignite.internal.util.typedef.PA; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.IgniteCacheConfigVariationsAbstractTest; import org.junit.Ignore; import org.junit.Test; @@ -50,13 +49,6 @@ public class IgniteCacheReadThroughEvictionSelfTest extends IgniteCacheConfigVar /** */ private static final int KEYS = 100; - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTest(); - } - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { storeStgy.resetStore(); @@ -68,8 +60,6 @@ public class IgniteCacheReadThroughEvictionSelfTest extends IgniteCacheConfigVar @Ignore("https://issues.apache.org/jira/browse/IGNITE-11849") @Test public void testReadThroughWithExpirePolicy() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - Ignite ig = testedGrid(); CacheConfiguration cc = variationConfig("expire"); @@ -112,8 +102,6 @@ public void testReadThroughWithExpirePolicy() throws Exception { @Ignore("https://issues.apache.org/jira/browse/IGNITE-11849") @Test public void testReadThroughExpirePolicyConfigured() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - Ignite ig = testedGrid(); CacheConfiguration cc = variationConfig("expireConfig"); @@ -168,8 +156,6 @@ public void testReadThroughExpirePolicyConfigured() throws Exception { */ @Test public void testReadThroughEvictionPolicy() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - Ignite ig = testedGrid(); CacheConfiguration cc = variationConfig("eviction"); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java index ce954b6c61727..961a24572b725 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java @@ -35,13 +35,11 @@ import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.lang.IgniteRunnable; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.jetbrains.annotations.Nullable; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; @@ -57,12 +55,6 @@ public class IgniteCacheReadThroughStoreCallTest extends GridCommonAbstractTest /** */ private static final Map storeMap = new ConcurrentHashMap<>(); - /** */ - @Before - public void beforeIgniteCacheReadThroughStoreCallTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { stopAllGrids(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreClusterReadOnlyModeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreClusterReadOnlyModeSelfTest.java index b4386e7d34bdd..71f24253acdae 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreClusterReadOnlyModeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreClusterReadOnlyModeSelfTest.java @@ -29,7 +29,6 @@ import javax.cache.integration.CacheWriterException; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.store.CacheStore; import org.apache.ignite.cache.store.CacheStoreAdapter; import org.apache.ignite.cluster.ClusterState; @@ -88,8 +87,6 @@ public class IgniteCacheStoreClusterReadOnlyModeSelfTest extends GridCommonAbstr */ protected CacheConfiguration[] cacheConfigurations() { return Stream.of(ClusterReadOnlyModeTestUtils.cacheConfigurations()) - // 3'rd party store doesn't support in a MVCC mode. - .filter(cfg -> cfg.getAtomicityMode() != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) .map(cfg -> cfg.setReadThrough(true)) .map(cfg -> cfg.setWriteBehindEnabled(true)) .map(cfg -> cfg.setWriteThrough(true)) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java index 17e893b027290..d336df2bf4505 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java @@ -30,7 +30,6 @@ 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; /** @@ -43,9 +42,6 @@ public class IgniteCacheStoreCollectionTest extends GridCommonAbstractTest { /** */ private static final String CACHE2 = "cache2"; - /** */ - private static final String CACHE3 = "cache3"; - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); @@ -58,11 +54,7 @@ public class IgniteCacheStoreCollectionTest extends GridCommonAbstractTest { ccfg2.setAtomicityMode(TRANSACTIONAL); ccfg2.setWriteSynchronizationMode(FULL_SYNC); - CacheConfiguration ccfg3 = new CacheConfiguration<>(CACHE3); - ccfg3.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - ccfg3.setWriteSynchronizationMode(FULL_SYNC); - - cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3); + cfg.setCacheConfiguration(ccfg1, ccfg2); return cfg; } @@ -81,11 +73,9 @@ public class IgniteCacheStoreCollectionTest extends GridCommonAbstractTest { public void testStoreMap() throws Exception { IgniteCache cache1 = ignite(0).cache(CACHE1); IgniteCache cache2 = ignite(0).cache(CACHE2); - IgniteCache cache3 = ignite(0).cache(CACHE3); checkStoreMap(cache1); checkStoreMap(cache2); - checkStoreMap(cache3); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java index d586bcdb4608b..54093dd44233d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java @@ -18,8 +18,6 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -27,12 +25,6 @@ * */ public class IgniteCacheTxCopyOnReadDisabledTest extends IgniteCacheCopyOnReadDisabledAbstractTest { - /** */ - @Before - public void beforeIgniteCacheTxCopyOnReadDisabledTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java index 5f4246611feb1..6b97e457fbf7d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java @@ -18,19 +18,11 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; /** * */ public class IgniteCacheTxNearEnabledStoreValueTest extends IgniteCacheTxStoreValueTest { - /** */ - @Before - public void beforeIgniteCacheTxNearEnabledStoreValueTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected NearCacheConfiguration nearConfiguration() { return new NearCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java index e013e1dbe18c4..340440fa923fa 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java @@ -17,20 +17,12 @@ package org.apache.ignite.internal.processors.cache; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import org.junit.Test; /** * Tests peek modes with near tx cache. */ public class IgniteCacheTxNearPeekModesTest extends IgniteCacheTxPeekModesTest { - /** */ - @Before - public void beforeIgniteCacheTxNearPeekModesTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected boolean hasNearCache() { return true; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java index f2a11b812ae29..0143408e09ce6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java @@ -20,8 +20,6 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -30,12 +28,6 @@ * */ public class IgniteCacheTxStoreValueTest extends IgniteCacheStoreValueAbstractTest { - /** */ - @Before - public void beforeIgniteCacheTxStoreValueTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.INTERCEPTOR); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 4; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java index 7e171a9655456..8cb1178281438 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java @@ -35,7 +35,6 @@ import org.apache.ignite.internal.processors.query.GridQueryProcessor; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Ignore; import org.junit.Test; /** @@ -52,18 +51,12 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT /** Tx cache name. */ private static final String TX_CACHE_NAME = "tx-cache"; - /** Mvcc tx cache name. */ - private static final String MVCC_TX_CACHE_NAME = "mvcc-tx-cache"; - /** Near atomic cache name. */ private static final String NEAR_ATOMIC_CACHE_NAME = "near-atomic-cache"; /** Near tx cache name. */ private static final String NEAR_TX_CACHE_NAME = "near-tx-cache"; - /** Near mvcc tx cache name. */ - private static final String NEAR_MVCC_TX_CACHE_NAME = "near-mvcc-tx-cache"; - /** Failed caches. */ private static final Set FAILED_CACHES; @@ -74,8 +67,6 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT set.add(TX_CACHE_NAME); set.add(NEAR_ATOMIC_CACHE_NAME); set.add(NEAR_TX_CACHE_NAME); - set.add(MVCC_TX_CACHE_NAME); - set.add(NEAR_MVCC_TX_CACHE_NAME); FAILED_CACHES = Collections.unmodifiableSet(set); } @@ -103,13 +94,7 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT ccfg2.setName(TX_CACHE_NAME); ccfg2.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); - CacheConfiguration ccfg3 = new CacheConfiguration<>(); - - ccfg3.setIndexedTypes(Integer.class, String.class); - ccfg3.setName(MVCC_TX_CACHE_NAME); - ccfg3.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - - cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3); + cfg.setCacheConfiguration(ccfg1, ccfg2); } else GridQueryProcessor.idxCls = FailedIndexing.class; @@ -133,14 +118,6 @@ public void testTransactionalCacheInitialization() throws Exception { checkCacheInitialization(TX_CACHE_NAME); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTransactionalCacheInitialization() throws Exception { - checkCacheInitialization(MVCC_TX_CACHE_NAME); - } - /** * @throws Exception If failed. */ @@ -157,15 +134,6 @@ public void testTransactionalNearCacheInitialization() throws Exception { checkCacheInitialization(NEAR_TX_CACHE_NAME); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccTransactionalNearCacheInitialization() throws Exception { - checkCacheInitialization(NEAR_MVCC_TX_CACHE_NAME); - } - /** * @param cacheName Cache name. * @throws Exception If failed. @@ -204,15 +172,12 @@ private void checkFailedCache(final Ignite client, final String cacheName) { IgniteCache cache; // Start cache with near enabled. - if (NEAR_ATOMIC_CACHE_NAME.equals(cacheName) || NEAR_TX_CACHE_NAME.equals(cacheName) || - NEAR_MVCC_TX_CACHE_NAME.equals(cacheName)) { + if (NEAR_ATOMIC_CACHE_NAME.equals(cacheName) || NEAR_TX_CACHE_NAME.equals(cacheName)) { CacheConfiguration ccfg = new CacheConfiguration(cacheName) .setNearConfiguration(new NearCacheConfiguration()).setSqlSchema("test"); if (NEAR_TX_CACHE_NAME.equals(cacheName)) ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); - else if (NEAR_MVCC_TX_CACHE_NAME.equals(cacheName)) - ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); cache = client.getOrCreateCache(ccfg); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java index eb2806239a81f..a424d10c73aa8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheStartFailoverTest.java @@ -58,7 +58,6 @@ 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; /** @@ -97,14 +96,6 @@ public void testClientStartCoordinatorFailsTx() throws Exception { clientStartCoordinatorFails(TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testClientStartCoordinatorFailsMvccTx() throws Exception { - clientStartCoordinatorFails(TRANSACTIONAL_SNAPSHOT); - } - /** * @param atomicityMode Cache atomicity mode. * @throws Exception If failed. @@ -164,14 +155,6 @@ public void testClientStartLastServerFailsTx() throws Exception { clientStartLastServerFails(TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testClientStartLastServerFailsMvccTx() throws Exception { - clientStartLastServerFails(TRANSACTIONAL_SNAPSHOT); - } - /** * @param atomicityMode Cache atomicity mode. * @throws Exception If failed. @@ -386,7 +369,7 @@ public void testRebalanceStateConcurrentStart() throws Exception { "Cannot serialize transaction due to write conflict (transaction is marked for rollback)" ); - if (txEx == null || ccfg.getAtomicityMode() != TRANSACTIONAL_SNAPSHOT || notContains) + if (txEx == null || notContains) fail("Assert violated because exception was thrown [e=" + e.getMessage() + ']'); } } @@ -564,16 +547,6 @@ private List startCaches(Ignite node, int keys) { cache.putAll(map); } - for (int i = 0; i < 3; i++) { - CacheConfiguration ccfg = cacheConfiguration("mvcc-" + i, TRANSACTIONAL_SNAPSHOT, i); - - IgniteCache cache = node.createCache(ccfg); - - cacheNames.add(ccfg.getName()); - - cache.putAll(map); - } - return cacheNames; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java index 16266872ee5c7..a1930620a7c8b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java @@ -46,9 +46,7 @@ import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.spi.IgniteSpiException; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.junit.Assert; -import org.junit.Assume; import org.junit.Test; import static java.util.concurrent.TimeUnit.SECONDS; @@ -654,8 +652,6 @@ private void checkActivateCacheRestoreConfigurationConflict(ClusterState state) */ @Test public void testDeactivateDuringEvictionAndRebalance() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7384", MvccFeatureChecker.forcedMvcc()); - IgniteEx srv = startGrids(3); srv.cluster().state(ACTIVE); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java index 6dac1e45b6757..2594e294828f5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java @@ -43,7 +43,6 @@ 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; /** @@ -396,39 +395,6 @@ private List cacheConfigurations() { res.add(ccfg); } - { - CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); - - ccfg.setName("cache-7"); - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - ccfg.setBackups(0); - ccfg.setWriteSynchronizationMode(FULL_SYNC); - - res.add(ccfg); - } - - { - CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); - - ccfg.setName("cache-8"); - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - ccfg.setBackups(1); - ccfg.setWriteSynchronizationMode(FULL_SYNC); - - res.add(ccfg); - } - - { - CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); - - ccfg.setName("cache-9"); - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - ccfg.setBackups(1); - ccfg.setWriteSynchronizationMode(FULL_SYNC); - - res.add(ccfg); - } - return res; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java index db2f0c56e82cc..d2a2fad0e9031 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java @@ -271,14 +271,6 @@ public void testStartStopCacheSimpleTransactional() throws Exception { checkStartStopCacheSimple(CacheAtomicityMode.TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testStartStopCacheSimpleTransactionalMvcc() throws Exception { - checkStartStopCacheSimple(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ @@ -295,14 +287,6 @@ public void testStartStopCachesSimpleTransactional() throws Exception { checkStartStopCachesSimple(CacheAtomicityMode.TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testStartStopCachesSimpleTransactionalMvcc() throws Exception { - checkStartStopCachesSimple(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java index 726cf11f3b7d9..09a380f1d68c9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java @@ -44,7 +44,6 @@ 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.CacheAtomicityMode.values; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -378,9 +377,8 @@ public void testStartNewAndClientCaches() throws Exception { cfgs.addAll(cacheConfigurations(null, ATOMIC)); cfgs.addAll(cacheConfigurations(null, TRANSACTIONAL)); - cfgs.addAll(cacheConfigurations(null, TRANSACTIONAL_SNAPSHOT)); - assertEquals(9, cfgs.size()); + assertEquals(6, cfgs.size()); Collection caches = client.getOrCreateCaches(cfgs); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxMultiThreadedAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxMultiThreadedAbstractTest.java deleted file mode 100644 index 90070500a979b..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxMultiThreadedAbstractTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; -import org.jetbrains.annotations.Nullable; -import org.junit.Test; - -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Tests for local transactions. - */ -public abstract class IgniteMvccTxMultiThreadedAbstractTest extends IgniteTxAbstractTest { - /** - * @return Thread count. - */ - protected abstract int threadCount(); - - /** - /** - * @throws IgniteCheckedException If test failed. - */ - @Test - public void testPessimisticRepeatableReadCommitMultithreaded() throws Exception { - checkCommitMultithreaded(PESSIMISTIC, REPEATABLE_READ); - - finalChecks(); - } - - /** - * @throws IgniteCheckedException If test failed. - */ - @Test - public void testPessimisticRepeatableReadRollbackMultithreaded() throws Exception { - checkRollbackMultithreaded(PESSIMISTIC, REPEATABLE_READ); - - finalChecks(); - } - - /** - * @param concurrency Concurrency. - * @param isolation Isolation. - * @throws Exception If check failed. - */ - protected void checkCommitMultithreaded(final TransactionConcurrency concurrency, - final TransactionIsolation isolation) throws Exception { - GridTestUtils.runMultiThreaded(new Callable() { - @Nullable @Override public Object call() throws Exception { - Thread t = Thread.currentThread(); - - t.setName(t.getName() + "-id-" + t.getId()); - - info("Starting commit thread: " + Thread.currentThread().getName()); - - try { - checkCommit(concurrency, isolation); - } - finally { - info("Finished commit thread: " + Thread.currentThread().getName()); - } - - return null; - } - }, threadCount(), concurrency + "-" + isolation); - } - - /** - * @param concurrency Concurrency. - * @param isolation Isolation. - * @throws Exception If check failed. - */ - protected void checkRollbackMultithreaded(final TransactionConcurrency concurrency, - final TransactionIsolation isolation) throws Exception { - final ConcurrentMap map = new ConcurrentHashMap<>(); - GridTestUtils.runMultiThreaded(new Callable() { - @Nullable @Override public Object call() throws Exception { - Thread t = Thread.currentThread(); - - t.setName(t.getName() + "-id-" + t.getId()); - - info("Starting rollback thread: " + Thread.currentThread().getName()); - - try { - checkRollback(map, concurrency, isolation); - - return null; - } - finally { - info("Finished rollback thread: " + Thread.currentThread().getName()); - } - } - }, threadCount(), concurrency + "-" + isolation); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxSingleThreadedAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxSingleThreadedAbstractTest.java deleted file mode 100644 index 48533f480a8ca..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMvccTxSingleThreadedAbstractTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.IgniteCheckedException; -import org.junit.Test; - -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Tests for local transactions. - */ -public abstract class IgniteMvccTxSingleThreadedAbstractTest extends IgniteTxAbstractTest { - /** - * @throws IgniteCheckedException If test failed. - */ - @Test - public void testPessimisticRepeatableReadCommit() throws Exception { - checkCommit(PESSIMISTIC, REPEATABLE_READ); - - finalChecks(); - } - - /** - * @throws IgniteCheckedException If test failed. - */ - @Test - public void testPessimisticRepeatableReadRollback() throws Exception { - checkRollback(PESSIMISTIC, REPEATABLE_READ); - - finalChecks(); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteNearClientCacheCloseTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteNearClientCacheCloseTest.java index 268f07a33798e..46b42a6535ca9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteNearClientCacheCloseTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteNearClientCacheCloseTest.java @@ -33,13 +33,11 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; 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; /** @@ -93,28 +91,6 @@ public void testNearCacheCloseTx2() throws Exception { nearCacheClose(4, true, TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testNearCacheCloseMvccTx1() throws Exception { - nearCacheClose(1, false, TRANSACTIONAL_SNAPSHOT); - - if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) - nearCacheClose(1, true, TRANSACTIONAL_SNAPSHOT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNearCacheCloseMvccTx2() throws Exception { - nearCacheClose(4, false, TRANSACTIONAL_SNAPSHOT); - - if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) - nearCacheClose(4, true, TRANSACTIONAL_SNAPSHOT); - } - /** * @param srvs Number of server nodes. * @param srvNearCache {@code True} to enable near cache on server nodes. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java index 72c668f44741b..797f2b51c518f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java @@ -50,7 +50,6 @@ import org.apache.ignite.transactions.TransactionIsolation; import org.junit.Test; -import static org.apache.ignite.testframework.MvccFeatureChecker.forcedMvcc; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; @@ -103,9 +102,6 @@ protected CacheConfiguration cacheConfiguration(String igniteInstanceName) { */ @Test public void testOnePhaseCommitFromNearNode() throws Exception { - if (forcedMvcc()) - return; - backups = 1; startGrids(GRID_CNT); 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 9d48b21078398..bb7499c36b464 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 void testStreamerOOMPropagation() throws Exception { /** */ 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/IgnitePdsDataRegionMetricsTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsDataRegionMetricsTxTest.java index f31a2a6a90271..8086a4d629e7a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsDataRegionMetricsTxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePdsDataRegionMetricsTxTest.java @@ -19,7 +19,6 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsDataRegionMetricsTest; import org.junit.Ignore; import org.junit.Test; @@ -28,12 +27,6 @@ * */ public class IgnitePdsDataRegionMetricsTxTest extends IgnitePdsDataRegionMetricsTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - return super.getConfiguration(igniteInstanceName) - .setMvccVacuumFrequency(Long.MAX_VALUE); - } - /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration() { return super.cacheConfiguration().setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java index 1fdd6ea805488..65578577aac58 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java @@ -30,7 +30,6 @@ import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -54,13 +53,6 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest { /** Backups. */ private int backups = 1; - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); @@ -75,8 +67,6 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest { * @return Test cache configuration. */ public CacheConfiguration cacheConfiguration(String igniteInstanceName) { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - CacheConfiguration ccfg = defaultCacheConfiguration(); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java index 33d2db684a20f..4586d4b43db8a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java @@ -25,7 +25,6 @@ import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -43,13 +42,6 @@ public class IgnitePutAllUpdateNonPreloadedPartitionSelfTest extends GridCommonA /** Backups. */ private int backups = 1; - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); @@ -64,8 +56,6 @@ public class IgnitePutAllUpdateNonPreloadedPartitionSelfTest extends GridCommonA * @return Test cache configuration. */ public CacheConfiguration cacheConfiguration(String igniteInstanceName) { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - CacheConfiguration ccfg = defaultCacheConfiguration(); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java index 00ac62a0c16a3..4efe3cae6cf67 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java @@ -27,7 +27,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -251,8 +250,6 @@ public void testLockCache() throws Exception { if (atomicityMode() != TRANSACTIONAL) return; - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - final Ignite ignite = grid(0); final String key = "key"; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheGroupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheGroupsTest.java index e270174b53692..706f90a5dc31a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheGroupsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheGroupsTest.java @@ -19,7 +19,6 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -56,12 +55,10 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheGroupsTest putInvalid(CACHE_NAME_3); } - if (!MvccFeatureChecker.forcedMvcc()) { - try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { - putValid(CACHE_NAME_1); - putValid(CACHE_NAME_3); - commitFailed(tx); - } + try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + putValid(CACHE_NAME_1); + putValid(CACHE_NAME_3); + commitFailed(tx); } assertEmpty(CACHE_NAME_1); // Rolled back. @@ -84,19 +81,10 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheGroupsTest startGrid(1); - if (!MvccFeatureChecker.forcedMvcc()) { - try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { - putValid(CACHE_NAME_1); - putValid(CACHE_NAME_3); - tx.commit(); - } - } - else { - try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - putValid(CACHE_NAME_1); - putValid(CACHE_NAME_3); - tx.commit(); - } + try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + putValid(CACHE_NAME_1); + putValid(CACHE_NAME_3); + tx.commit(); } remove(CACHE_NAME_1); @@ -120,30 +108,19 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheGroupsTest assertEmpty(CACHE_NAME_3); // Rolled back. - if (!MvccFeatureChecker.forcedMvcc()) { - try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { - putValid(CACHE_NAME_1); - putValid(CACHE_NAME_3); - commitFailed(tx); - } + try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + putValid(CACHE_NAME_1); + putValid(CACHE_NAME_3); + commitFailed(tx); } assertEmpty(CACHE_NAME_1); // Rolled back. assertEmpty(CACHE_NAME_3); // Rolled back. - if (!MvccFeatureChecker.forcedMvcc()) { - try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { - putValid(DEFAULT_CACHE_NAME); - putValid(CACHE_NAME_3); - tx.commit(); - } - } - else { - try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - putValid(DEFAULT_CACHE_NAME); - putValid(CACHE_NAME_3); - tx.commit(); - } + try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + putValid(DEFAULT_CACHE_NAME); + putValid(CACHE_NAME_3); + tx.commit(); } remove(DEFAULT_CACHE_NAME); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java index 0fa3aa48d6206..40c59b1e2bb01 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java @@ -19,7 +19,6 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -51,18 +50,16 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheTest extends IgniteT putInvalid(CACHE_NAME_1); } - if (!MvccFeatureChecker.forcedMvcc()) { - try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { - putValid(CACHE_NAME_1); - commitFailed(tx); - } - - try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { - putValid(CACHE_NAME_1); - putValid(DEFAULT_CACHE_NAME); - putValid(CACHE_NAME_2); - commitFailed(tx); - } + try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + putValid(CACHE_NAME_1); + commitFailed(tx); + } + + try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + putValid(CACHE_NAME_1); + putValid(DEFAULT_CACHE_NAME); + putValid(CACHE_NAME_2); + commitFailed(tx); } assertEmpty(DEFAULT_CACHE_NAME); // rolled back @@ -103,11 +100,9 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheTest extends IgniteT assertEmpty(DEFAULT_CACHE_NAME); // rolled back assertEmpty(CACHE_NAME_1); // rolled back - if (!MvccFeatureChecker.forcedMvcc()) { - try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { - putValid(CACHE_NAME_1); - commitFailed(tx); - } + try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + putValid(CACHE_NAME_1); + commitFailed(tx); } try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java index 0faf350ce2afc..08ba9b809bf01 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java @@ -42,8 +42,6 @@ import org.apache.ignite.resources.LoggerResource; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -198,8 +196,6 @@ private String testCacheName(int idx) { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7952", MvccFeatureChecker.forcedMvcc()); - super.beforeTest(); startGridsMultiThreaded(GRID_CNT); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest.java index 82a790533994e..07352408db99b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; /** * Topology validator test. @@ -29,11 +28,4 @@ public class IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest extends @Override protected NearCacheConfiguration nearConfiguration() { return new NearCacheConfiguration(); } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - - super.beforeTestsStarted(); - } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheTest.java index f85d2d17ada20..b31f417197701 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheTest.java @@ -18,19 +18,11 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; /** * Topology validator test */ public class IgniteTopologyValidatorNearPartitionedTxCacheTest extends IgniteTopologyValidatorPartitionedTxCacheTest { - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected NearCacheConfiguration nearConfiguration() { return new NearCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java index 412f44ea8be7e..019337f877c3d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java @@ -24,7 +24,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; -import javax.cache.CacheException; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; @@ -33,7 +32,6 @@ import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -217,9 +215,6 @@ protected void checkCommit(TransactionConcurrency concurrency, TransactionIsolat throw e; } } - catch (CacheException e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } catch (Throwable e) { log.error("Unexpected error: " + e, e); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheSelfTest.java index fdfe9c75ecfda..65b38e2634437 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheSelfTest.java @@ -41,11 +41,9 @@ import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.spi.IgniteSpiException; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionTimeoutException; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -105,8 +103,6 @@ public CacheAtomicityMode atomicityMode() { */ @Test public void testUserTxTimeout() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7952", MvccFeatureChecker.forcedMvcc()); - final Ignite ignite = grid(0); final IgniteCache cache = ignite.getOrCreateCache(CACHE_NAME); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java index a5f3e9dcdc96c..0e726bbf90e04 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java @@ -42,14 +42,13 @@ import org.apache.ignite.spi.indexing.IndexingQueryFilter; import org.apache.ignite.spi.indexing.IndexingSpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionHeuristicException; import org.apache.ignite.transactions.TransactionIsolation; import org.jetbrains.annotations.Nullable; -import org.junit.Assume; import org.junit.Test; + import static org.apache.ignite.cache.CacheMode.REPLICATED; /** @@ -98,8 +97,6 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10871", MvccFeatureChecker.forcedMvcc()); - super.beforeTestsStarted(); lastKey = 0; @@ -327,10 +324,6 @@ public void testPutMultipleKeysTx() throws Exception { */ private void checkPutTx(boolean putBefore, TransactionConcurrency concurrency, TransactionIsolation isolation, final Integer... keys) throws Exception { - if (MvccFeatureChecker.forcedMvcc() && - !MvccFeatureChecker.isSupported(concurrency, isolation)) - return; - assertTrue(keys.length > 0); info("Test transaction [concurrency=" + concurrency + ", isolation=" + isolation + ']'); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java index 865e4dcaa5be5..4d9b190c30027 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java @@ -37,13 +37,13 @@ import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.apache.ignite.transactions.TransactionRollbackException; import org.jetbrains.annotations.Nullable; import org.junit.Test; + import static org.apache.ignite.cache.CacheMode.REPLICATED; /** @@ -82,8 +82,6 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName); ccfg.setCacheStoreFactory(singletonFactory(store)); @@ -96,8 +94,6 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - store = new TestStore(); super.beforeTestsStarted(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MvccCacheGroupMetricsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MvccCacheGroupMetricsTest.java deleted file mode 100644 index 480b089603767..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/MvccCacheGroupMetricsTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.junit.Ignore; -import org.junit.Test; - -/** - * - */ -public class MvccCacheGroupMetricsTest extends CacheGroupMetricsTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-12039") - @Test - @Override public void testCacheGroupMetrics() throws Exception { - super.testCacheGroupMetrics(); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionedMvccTxPessimisticCacheGetsDistributionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionedMvccTxPessimisticCacheGetsDistributionTest.java deleted file mode 100644 index de9d9a658afc6..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/PartitionedMvccTxPessimisticCacheGetsDistributionTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.transactions.TransactionIsolation; - -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Tests of pessimistic transactional partitioned cache's 'get' requests distribution. - */ -public class PartitionedMvccTxPessimisticCacheGetsDistributionTest extends PartitionedTransactionalPessimisticCacheGetsDistributionTest { - /** {@inheritDoc} */ - @Override protected TransactionIsolation transactionIsolation() { - return REPEATABLE_READ; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ReplicatedMvccTxPessimisticCacheGetsDistributionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ReplicatedMvccTxPessimisticCacheGetsDistributionTest.java deleted file mode 100644 index 6e2d67c3137d7..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ReplicatedMvccTxPessimisticCacheGetsDistributionTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache; - -import org.apache.ignite.transactions.TransactionIsolation; - -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Tests of pessimistic transactional replicated cache's 'get' requests distribution. - */ -public class ReplicatedMvccTxPessimisticCacheGetsDistributionTest extends ReplicatedTransactionalPessimisticCacheGetsDistributionTest { - /** {@inheritDoc} */ - @Override protected TransactionIsolation transactionIsolation() { - return REPEATABLE_READ; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/TransactionValidationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/TransactionValidationTest.java index 14e1d49239e2e..600bd4ede8794 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/TransactionValidationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/TransactionValidationTest.java @@ -29,9 +29,6 @@ import org.apache.ignite.transactions.Transaction; import org.junit.Test; -import static org.apache.ignite.testframework.MvccFeatureChecker.Feature.NEAR_CACHE; -import static org.apache.ignite.testframework.MvccFeatureChecker.skipIfNotSupported; - /** * Tests check that second operation in transaction fail if it doesn't pass validation. */ @@ -57,8 +54,6 @@ public void validationOnLocalNode() throws Exception { */ @Test public void validationOnNearCache() throws Exception { - skipIfNotSupported(NEAR_CACHE); - validationTest(true, true); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java index 6b7f78ff65fbf..6a5ca2b1ecbd9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java @@ -27,12 +27,10 @@ import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; -import org.junit.Ignore; import org.junit.Test; 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; /** @@ -78,23 +76,6 @@ public void testKeepBinaryWithInterceptor() throws Exception { keepBinaryWithInterceptorPrimitives(cacheConfiguration(TRANSACTIONAL, true)); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-9323") - @Test - public void testKeepBinaryWithInterceptorOnMvccCache() throws Exception { - startGrid(0); - - keepBinaryWithInterceptor(cacheConfiguration(TRANSACTIONAL_SNAPSHOT, false)); - keepBinaryWithInterceptorPrimitives(cacheConfiguration(TRANSACTIONAL_SNAPSHOT, true)); - - startGridsMultiThreaded(1, 3); - - keepBinaryWithInterceptor(cacheConfiguration(TRANSACTIONAL_SNAPSHOT, false)); - keepBinaryWithInterceptorPrimitives(cacheConfiguration(TRANSACTIONAL_SNAPSHOT, true)); - } - /** * @param ccfg Cache configuration. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java index e08d7458b86d1..2c00b9d879acc 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java @@ -34,7 +34,6 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -61,14 +60,6 @@ public void testAsyncOperationsTx() throws Exception { asyncOperations(TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testAsyncOperationsMvccTx() throws Exception { - asyncOperations(TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java index 232f92a944cb2..465b5628bd7f6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java @@ -23,7 +23,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Ignore; import org.junit.Test; /** @@ -99,17 +98,6 @@ public void testCachePreload2() throws Exception { cachePreloadTest(); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testCachePreloadMvcc2() throws Exception { - atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - - cachePreloadTest(); - } - /** * @throws Exception If failed. */ @@ -131,17 +119,6 @@ public void testCachePreload4() throws Exception { cachePreloadTest(); } - /** - * @throws Exception If failed. - */ - @Test - public void testCachePreloadMvcc4() throws Exception { - cacheMode = CacheMode.REPLICATED; - atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - - cachePreloadTest(); - } - /** * @throws Exception If failed. */ @@ -163,18 +140,6 @@ public void testCachePreload6() throws Exception { cachePreloadTest(); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testCachePreloadMvcc6() throws Exception { - sameGrp = false; - atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - - cachePreloadTest(); - } - /** * @throws Exception If failed. */ @@ -198,18 +163,6 @@ public void testCachePreload8() throws Exception { cachePreloadTest(); } - /** - * @throws Exception If failed. - */ - @Test - public void testCachePreloadMvcc8() throws Exception { - sameGrp = false; - cacheMode = CacheMode.REPLICATED; - atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - - cachePreloadTest(); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java index 15a3a2e1e55df..e3d097c2d59d8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java @@ -49,7 +49,6 @@ import org.apache.ignite.lang.IgniteInClosure; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; import org.junit.Ignore; @@ -82,11 +81,6 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT /** Restarts. */ protected volatile boolean restarts; - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockChangingTopologyTest.java index c5eb720703e07..48eec425f0756 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockChangingTopologyTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockChangingTopologyTest.java @@ -30,7 +30,6 @@ import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -41,8 +40,6 @@ public class CacheLockChangingTopologyTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { stopAllGrids(); - - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java index 8142048f6fbde..ba59c95716368 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java @@ -34,7 +34,6 @@ import org.apache.ignite.internal.util.lang.GridAbsPredicate; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Ignore; @@ -53,11 +52,6 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest { /** */ private static final String REPLICATED_TEST_CACHE = "REPLICATED_TEST_CACHE"; - /** {@inheritDoc} */ - @Override public void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePartitionLossWithRestartsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePartitionLossWithRestartsTest.java index 457370f7e7831..73ae531645186 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePartitionLossWithRestartsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePartitionLossWithRestartsTest.java @@ -22,7 +22,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; import org.apache.ignite.cluster.ClusterState; import org.apache.ignite.configuration.CacheConfiguration; @@ -74,33 +73,27 @@ public class CachePartitionLossWithRestartsTest extends GridCommonAbstractTest { @Parameterized.Parameter(value = 3) public int clientIdx; - /** Possible values: true, false */ - @Parameterized.Parameter(value = 4) - public boolean mvccEnabled; - /** */ - @Parameterized.Parameters(name = "{0} {1} {2} {3}") + @Parameterized.Parameters(name = "{0} {1} {2}") public static List parameters() { ArrayList params = new ArrayList<>(); - for (boolean mvcc : new boolean[]{false, true}) { - for (boolean persistent : new boolean[] {false, true}) { - params.add(new Object[] {-1, false, persistent, 3, mvcc}); - params.add(new Object[] {0, false, persistent, 3, mvcc}); - params.add(new Object[] {2, false, persistent, 3, mvcc}); + for (boolean persistent : new boolean[] {false, true}) { + params.add(new Object[] {-1, false, persistent, 3}); + params.add(new Object[] {0, false, persistent, 3}); + params.add(new Object[] {2, false, persistent, 3}); - params.add(new Object[] {-1, false, persistent, -1, mvcc}); - params.add(new Object[] {0, false, persistent, -1, mvcc}); - params.add(new Object[] {2, false, persistent, -1, mvcc}); + params.add(new Object[] {-1, false, persistent, -1}); + params.add(new Object[] {0, false, persistent, -1}); + params.add(new Object[] {2, false, persistent, -1}); - params.add(new Object[] {-1, true, persistent, 3, mvcc}); - params.add(new Object[] {0, true, persistent, 3, mvcc}); - params.add(new Object[] {2, true, persistent, 3, mvcc}); + params.add(new Object[] {-1, true, persistent, 3}); + params.add(new Object[] {0, true, persistent, 3}); + params.add(new Object[] {2, true, persistent, 3}); - params.add(new Object[] {-1, true, persistent, -1, mvcc}); - params.add(new Object[] {0, true, persistent, -1, mvcc}); - params.add(new Object[] {2, true, persistent, -1, mvcc}); - } + params.add(new Object[] {-1, true, persistent, -1}); + params.add(new Object[] {0, true, persistent, -1}); + params.add(new Object[] {2, true, persistent, -1}); } return params; @@ -138,9 +131,6 @@ public static List parameters() { setBackups(0). setAffinity(new RendezvousAffinityFunction(false, PARTS_CNT)); - if (mvccEnabled) - ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - if (startClientCache) cfg.setCacheConfiguration(ccfg); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java index 1b65f5547517c..4fbe4e354e305 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java @@ -45,7 +45,6 @@ import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.testframework.MvccFeatureChecker.assertMvccWriteConflict; /** * @@ -179,18 +178,7 @@ private void doTest(final boolean createCache) throws Exception { if (createCache) { for (int c = 0; c < 5; c++) { for (IgniteCache cache : node.getOrCreateCaches(cacheConfigurations())) { - boolean updated = false; - - while (!updated) { - try { - cache.put(c, c); - - updated = true; - } - catch (Exception e) { - assertMvccWriteConflict(e); - } - } + cache.put(c, c); assertEquals(c, cache.get(c)); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTryLockMultithreadedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTryLockMultithreadedTest.java index 6231c1f050d2d..f8fb20c421c0a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTryLockMultithreadedTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTryLockMultithreadedTest.java @@ -24,7 +24,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -64,11 +63,6 @@ public class CacheTryLockMultithreadedTest extends GridCommonAbstractTest { startClientGrid(SRVS); } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTxNearUpdateTopologyChangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTxNearUpdateTopologyChangeTest.java index bb2993efecf70..bfced88a51053 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTxNearUpdateTopologyChangeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTxNearUpdateTopologyChangeTest.java @@ -19,7 +19,6 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.internal.processors.cache.CacheNearUpdateTopologyChangeAbstractTest; -import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -27,13 +26,6 @@ * */ public class CacheTxNearUpdateTopologyChangeTest extends CacheNearUpdateTopologyChangeAbstractTest { - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java index b33cf6100f35a..41118c2f64eef 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java @@ -19,11 +19,9 @@ import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.processors.cache.GridCacheAbstractByteArrayValuesSelfTest; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.jetbrains.annotations.Nullable; @@ -42,26 +40,16 @@ public abstract class GridCacheAbstractDistributedByteArrayValuesSelfTest extend /** */ private static final String CACHE = "cache"; - /** */ - private static final String MVCC_CACHE = "mvccCache"; - /** Regular caches. */ private static IgniteCache[] caches; - /** Regular caches. */ - private static IgniteCache[] mvccCaches; - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); - CacheConfiguration mvccCfg = cacheConfiguration(MVCC_CACHE) - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - .setNearConfiguration(null); // TODO IGNITE-7187: remove near cache disabling. - CacheConfiguration ccfg = cacheConfiguration(CACHE); - c.setCacheConfiguration(ccfg, mvccCfg); + c.setCacheConfiguration(ccfg); c.setPeerClassLoadingEnabled(peerClassLoading()); @@ -107,20 +95,16 @@ protected CacheConfiguration cacheConfiguration(String name) { assert gridCnt > 0; caches = new IgniteCache[gridCnt]; - mvccCaches = new IgniteCache[gridCnt]; startGridsMultiThreaded(gridCnt); - for (int i = 0; i < gridCnt; i++) { + for (int i = 0; i < gridCnt; i++) caches[i] = grid(i).cache(CACHE); - mvccCaches[i] = grid(i).cache(MVCC_CACHE); - } } /** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { caches = null; - mvccCaches = null; } /** @@ -163,26 +147,6 @@ public void testOptimisticMixed() throws Exception { testTransactionMixed0(caches, OPTIMISTIC, KEY_1, wrap(1), KEY_2, 1); } - /** - * Check whether cache with byte array entry works correctly in PESSIMISTIC transaction. - * - * @throws Exception If failed. - */ - @Test - public void testPessimisticMvcc() throws Exception { - testTransaction0(mvccCaches, PESSIMISTIC, KEY_1, wrap(1)); - } - - /** - * Check whether cache with byte array entry works correctly in PESSIMISTIC transaction. - * - * @throws Exception If failed. - */ - @Test - public void testPessimisticMvccMixed() throws Exception { - testTransactionMixed0(mvccCaches, PESSIMISTIC, KEY_1, wrap(1), KEY_2, 1); - } - /** * Test transaction behavior. * @@ -210,9 +174,6 @@ private void testTransaction0(IgniteCache[] caches, Transaction */ private void testTransactionMixed0(IgniteCache[] caches, TransactionConcurrency concurrency, Integer key1, byte[] val1, @Nullable Integer key2, @Nullable Object val2) throws Exception { - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, REPEATABLE_READ)) - return; - for (IgniteCache cache : caches) { info("Checking cache: " + cache.getName()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java index 63f609eb33944..ed1e374905f64 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java @@ -21,7 +21,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -65,12 +64,6 @@ public abstract class GridCacheAbstractPrimarySyncSelfTest extends GridCommonAbs startGrids(GRID_CNT); } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - if (nearConfiguration() != null) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** * @return Distribution mode. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java index 104f97f7e18bc..67b64468c7b73 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java @@ -30,10 +30,8 @@ import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.junit.Assume; import org.junit.Test; import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -79,10 +77,6 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7952", MvccFeatureChecker.forcedMvcc()); - for (Ignite g : G.allGrids()) g.cache(DEFAULT_CACHE_NAME).clear(); } @@ -324,8 +318,6 @@ public void testOptimisticTransaction() throws Exception { */ @Test public void testPutWithExpiration() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - IgniteCache cache1 = ignite1.cache(DEFAULT_CACHE_NAME); IgniteCache cache2 = ignite2.cache(DEFAULT_CACHE_NAME); IgniteCache cache3 = ignite3.cache(DEFAULT_CACHE_NAME); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java index 2c41faa87637f..14cbf57788f45 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java @@ -30,8 +30,6 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -52,13 +50,6 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst return 4; } - /** */ - @Before - public void beforeCacheStoreListenerRWThroughDisabledTransactionalCacheTest() { - if (nearEnabled()) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { gridCnt = new AtomicInteger(); @@ -94,9 +85,6 @@ public void beforeCacheStoreListenerRWThroughDisabledTransactionalCacheTest() { /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - if (nearEnabled()) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName); cfg.setCacheStoreFactory(null); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java index 6dcc9dbd7ee15..69651ff5090d6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java @@ -27,7 +27,6 @@ import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.events.CacheEvent; import org.apache.ignite.events.Event; @@ -43,9 +42,7 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.events.EventType.EVTS_CACHE; @@ -98,19 +95,6 @@ protected boolean partitioned() { grid(i).events().localListen(evtLsnr, EVTS_CACHE); } - /** */ - @Before - public void beforeGridCacheEventAbstractTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - - return super.cacheConfiguration(igniteInstanceName); - } - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java index 4d573806d6db0..ea1eb7e8caf7e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java @@ -35,10 +35,8 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.testframework.GridTestThread; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -61,12 +59,6 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest { /** (for convenience). */ private static IgniteCache cache2; - /** */ - @Before - public void beforeGridCacheLockAbstractTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - } - /** * */ @@ -87,8 +79,6 @@ protected GridCacheLockAbstractTest() { * @return Cache configuration. */ protected CacheConfiguration cacheConfiguration() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setCacheMode(cacheMode()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java index 614a568b319d2..f87467c5989c4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java @@ -33,7 +33,6 @@ import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -85,11 +84,6 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT cache3 = ignite3.cache(DEFAULT_CACHE_NAME); } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - } - /** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { cache1 = null; @@ -179,8 +173,6 @@ public void testMultiValueMultiNodePut() throws Exception { * @throws Exception If check fails. */ private void checkPuts(int cnt, Ignite... ignites) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - CountDownLatch latch = new CountDownLatch(ignites.length * cnt); CacheEventListener lsnr = new CacheEventListener(latch, EVT_CACHE_OBJECT_PUT); @@ -229,8 +221,6 @@ private void checkPuts(int cnt, Ignite... ignites) throws Exception { */ @Test public void testLockUnlock() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - CacheEventListener lockLsnr1 = new CacheEventListener(ignite1, new CountDownLatch(1), EVT_CACHE_OBJECT_LOCKED); addListener(ignite1, lockLsnr1, EVT_CACHE_OBJECT_LOCKED); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java index 0b0213f17e77a..50e803b52537a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java @@ -36,7 +36,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.testframework.GridTestThread; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; import org.junit.Test; @@ -60,14 +59,6 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr /** Listeners. */ private static Collection> lsnrs = new ArrayList<>(); - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - - super.beforeTest(); - } - /** * */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java index ffa90ff52f63e..a4a973ff56273 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java @@ -34,7 +34,6 @@ import org.apache.ignite.internal.util.typedef.P1; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteFuture; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -107,8 +106,6 @@ protected GridCacheNodeFailureAbstractTest() { * @throws Exception If failed. */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - for (int i = 0; i < GRID_CNT; i++) { if (Ignition.state(IGNITEs.get(i).name()) == STOPPED) { info("Restarting grid: " + i); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java index 2178c95365189..99185792b9815 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java @@ -41,7 +41,6 @@ import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.util.TestTcpCommunicationSpi; import org.junit.Test; @@ -56,11 +55,6 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract /** */ private int backupCnt; - /** {@inheritDoc} */ - @Override public void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest.java deleted file mode 100644 index cf8115c52213f..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.distributed; - -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMvccTxMultiThreadedSelfTest; - -/** - * - */ -public class GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest - extends GridCachePartitionedMvccTxMultiThreadedSelfTest { - /** {@inheritDoc} */ - @Override protected boolean nearEnabled() { - return false; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadEventsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadEventsAbstractSelfTest.java index 40e164a1921ed..337936e10e998 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadEventsAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadEventsAbstractSelfTest.java @@ -30,7 +30,6 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -43,11 +42,6 @@ * */ public abstract class GridCachePreloadEventsAbstractSelfTest extends GridCommonAbstractTest { - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java index d7dbb8f87bc6e..98b384285c567 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadRestartAbstractSelfTest.java @@ -24,9 +24,7 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -126,9 +124,6 @@ public abstract class GridCachePreloadRestartAbstractSelfTest extends GridCommon /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - if (nearEnabled()) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - backups = DFLT_BACKUPS; partitions = DFLT_PARTITIONS; preloadMode = ASYNC; @@ -195,8 +190,6 @@ public void testAsyncPreloadRestart() throws Exception { */ @Test public void testDisabledPreloadRestart() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-11417", MvccFeatureChecker.forcedMvcc()); - preloadMode = NONE; checkRestart(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java index 00905940ca395..1ceb47b067d7f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java @@ -43,11 +43,10 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Ignore; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -323,18 +322,6 @@ public void testTxPartitionedPessimisticSerializable() throws Exception { checkTx(PARTITIONED, PESSIMISTIC, SERIALIZABLE); } - /** - * Test TRANSACTIONAL_SNAPSHOT PARTITIONED cache with PESSIMISTIC/REPEATABLE_READ transaction. - * - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-9321") - @Test - public void testMvccTxPartitionedPessimisticRepeatableRead() throws Exception { - checkMvccTx(PARTITIONED, PESSIMISTIC, REPEATABLE_READ); - } - - /** * Test TRANSACTIONAL REPLICATED cache with OPTIMISTIC/REPEATABLE_READ transaction. * @@ -395,17 +382,6 @@ public void testTxReplicatedPessimisticSerializable() throws Exception { checkTx(REPLICATED, PESSIMISTIC, SERIALIZABLE); } - /** - * Test TRANSACTIONAL_SNAPSHOT REPLICATED cache with PESSIMISTIC/REPEATABLE_READ transaction. - * - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-9321") - @Test - public void testMvccTxReplicatedPessimisticRepeatableRead() throws Exception { - checkMvccTx(REPLICATED, PESSIMISTIC, REPEATABLE_READ); - } - /** * Test ATOMIC PARTITIONED cache. * @@ -458,21 +434,6 @@ private void checkAtomic(CacheMode cacheMode) throws Exception { checkEventNodeIdsStrict(TransformerWithInjection.class.getName(), primaryIdsForKeys(key1, key2)); } - /** - * Check TRANSACTIONAL_SNAPSHOT cache. - * - * @param cacheMode Cache mode. - * @param txConcurrency TX concurrency. - * @param txIsolation TX isolation. - * @throws Exception If failed. - */ - private void checkMvccTx(CacheMode cacheMode, TransactionConcurrency txConcurrency, - TransactionIsolation txIsolation) throws Exception { - initialize(cacheMode, TRANSACTIONAL_SNAPSHOT, txConcurrency, txIsolation); - - checkTx0(); - } - /** * Check TRANSACTIONAL cache. * diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteAbstractTxSuspendResumeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteAbstractTxSuspendResumeTest.java index bcc47455c7c47..2276a7c86a27c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteAbstractTxSuspendResumeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteAbstractTxSuspendResumeTest.java @@ -24,7 +24,6 @@ import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteException; -import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; @@ -41,6 +40,7 @@ import org.apache.ignite.transactions.TransactionIsolation; import org.apache.ignite.transactions.TransactionTimeoutException; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -54,10 +54,6 @@ * */ public abstract class IgniteAbstractTxSuspendResumeTest extends GridCommonAbstractTest { - /** Force mvcc. */ - protected static final boolean FORCE_MVCC = - IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, false); - /** Transaction timeout. */ private static final long TX_TIMEOUT = 400L; @@ -119,8 +115,7 @@ public abstract class IgniteAbstractTxSuspendResumeTest extends GridCommonAbstra awaitCacheOnClient(client, ccfg.getName()); - if (!FORCE_MVCC) - client.createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); + client.createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); } awaitPartitionMapExchange(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java index dce5f63f1db20..54577fa19e541 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java @@ -84,7 +84,6 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -130,11 +129,6 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac return cfg; } - /** {@inheritDoc} */ - @Override public void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - } - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java index 94b011525d89a..7571d93825986 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java @@ -36,14 +36,12 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; import static java.util.concurrent.TimeUnit.SECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -65,7 +63,6 @@ public class IgniteCacheConnectionRecoveryTest extends GridCommonAbstractTest { cfg.setCacheConfiguration( cacheConfiguration("cache1", TRANSACTIONAL), - cacheConfiguration("cache2", TRANSACTIONAL_SNAPSHOT), cacheConfiguration("cache3", ATOMIC)); return cfg; @@ -108,7 +105,6 @@ public void testConnectionRecovery() throws Exception { IgniteCache[] caches = { node.cache("cache1"), - node.cache("cache2"), node.cache("cache3")}; int iter = 0; @@ -117,14 +113,9 @@ public void testConnectionRecovery() throws Exception { try { for (IgniteCache cache : caches) { while (true) { - try { - cache.putAllAsync(data).get(15, SECONDS); - - break; - } - catch (Exception e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } + cache.putAllAsync(data).get(15, SECONDS); + + break; } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java index ba61ecc1302ac..c5874d4460934 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java @@ -31,7 +31,6 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.binary.BinaryMarshaller; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -86,18 +85,8 @@ public void testStartNodes() throws Exception { IgniteCache cache = getCache(ignite, cacheName); - for (int i = 0; i < 100; i++) { - while (true) { - try { - cache.getAndPut(i, i); - - break; - } - catch (Exception e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } - } - } + for (int i = 0; i < 100; i++) + cache.getAndPut(i, i); barrier.await(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java index 2449eb236f6ab..cdffda360116c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java @@ -35,11 +35,9 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.testframework.MvccFeatureChecker.assertMvccWriteConflict; /** * @@ -138,7 +136,6 @@ public void testUpdatesAndCacheStart() throws Exception { ignite0.createCache(cacheConfiguration("atomic-cache", ATOMIC)); ignite0.createCache(cacheConfiguration("tx-cache", TRANSACTIONAL)); - ignite0.createCache(cacheConfiguration("mvcc-tx-cache", TRANSACTIONAL_SNAPSHOT)); final long stopTime = System.currentTimeMillis() + 60_000; @@ -152,7 +149,6 @@ public void testUpdatesAndCacheStart() throws Exception { IgniteCache cache1 = node.cache("atomic-cache"); IgniteCache cache2 = node.cache("tx-cache"); - IgniteCache cache3 = node.cache("mvcc-tx-cache"); ThreadLocalRandom rnd = ThreadLocalRandom.current(); @@ -165,13 +161,6 @@ public void testUpdatesAndCacheStart() throws Exception { cache2.put(key, key); - try { - cache3.put(key, key); - } - catch (Exception e) { - assertMvccWriteConflict(e); // Do not retry. - } - if (iter++ % 1000 == 0) log.info("Update iteration: " + iter); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java index 3bd001937c28d..cc0f4ed07574a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java @@ -45,7 +45,6 @@ import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.testframework.GridTestUtils.assertThrows; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; @@ -63,34 +62,25 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest /** Tx cache. */ private static final String TX_CACHE = "tx"; - /** Mvcc tx cache. */ - private static final String MVCC_TX_CACHE = "mvcc-tx"; - /** Atomic cache. */ private IgniteCache atomicCache; /** Tx cache. */ private IgniteCache txCache; - /** Mvcc tx cache. */ - private IgniteCache mvccTxCache; - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration atomicCfg = new CacheConfiguration(ATOMIC_CACHE); CacheConfiguration txCfg = new CacheConfiguration(TX_CACHE); - CacheConfiguration mvccTxCfg = new CacheConfiguration(MVCC_TX_CACHE); atomicCfg.setBackups(1); txCfg.setBackups(1); - mvccTxCfg.setBackups(1); txCfg.setAtomicityMode(TRANSACTIONAL); - mvccTxCfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - cfg.setCacheConfiguration(atomicCfg, txCfg, mvccTxCfg); + cfg.setCacheConfiguration(atomicCfg, txCfg); ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(LOCAL_IP_FINDER); @@ -108,7 +98,6 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest @Override protected void beforeTest() throws Exception { atomicCache = grid("client").cache(ATOMIC_CACHE); txCache = grid("client").cache(TX_CACHE); - mvccTxCache = grid("client").cache(MVCC_TX_CACHE); } /** @@ -147,28 +136,6 @@ public void testInvokeTx() throws Exception { doInTransaction(client, OPTIMISTIC, SERIALIZABLE, clos); } - /** - * @throws Exception If failed. - */ - @Test - public void testInvokeMvccTx() throws Exception { - testInvoke(mvccTxCache); - testInvokeAll(mvccTxCache); - - IgniteEx client = grid("client"); - - Callable clos = new Callable() { - @Override public Object call() throws Exception { - testInvoke(mvccTxCache); - testInvokeAll(mvccTxCache); - - return null; - } - }; - - doInTransaction(client, PESSIMISTIC, REPEATABLE_READ, clos); - } - /** * @param cache Cache. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java index e9fa2015760cb..7b6c6ad523f84 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java @@ -36,7 +36,6 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -84,14 +83,6 @@ public void testCacheOperationsIdleConnectionCloseTx() throws Exception { cacheOperationsIdleConnectionClose(TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Test - public void testCacheOperationsIdleConnectionCloseMvccTx() throws Exception { - cacheOperationsIdleConnectionClose(TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ 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 794d70ea5a722..8839bfb2855a0 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 % 3]); + 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/IgniteCachePrimarySyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java index a46903a4d4b4f..8e44bdcee297d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java @@ -33,7 +33,6 @@ 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.PRIMARY_SYNC; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; @@ -54,9 +53,6 @@ public class IgniteCachePrimarySyncTest extends GridCommonAbstractTest { /** */ private static final String TX_CACHE = "txCache"; - /** */ - private static final String MVCC_CACHE = "mvccCache"; - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); @@ -73,13 +69,7 @@ public class IgniteCachePrimarySyncTest extends GridCommonAbstractTest { .setBackups(2) .setWriteSynchronizationMode(PRIMARY_SYNC); - CacheConfiguration ccfg3 = new CacheConfiguration<>(MVCC_CACHE) - .setReadFromBackup(false) - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setBackups(2) - .setWriteSynchronizationMode(PRIMARY_SYNC); - - cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3); + cfg.setCacheConfiguration(ccfg1, ccfg2); return cfg; } @@ -106,15 +96,11 @@ public void testPutGet() throws Exception { checkPutGet(ignite.cache(TX_CACHE), null, null, null); - checkPutGet(ignite.cache(MVCC_CACHE), null, null, null); - checkPutGet(ignite.cache(TX_CACHE), ignite.transactions(), OPTIMISTIC, REPEATABLE_READ); checkPutGet(ignite.cache(TX_CACHE), ignite.transactions(), OPTIMISTIC, SERIALIZABLE); checkPutGet(ignite.cache(TX_CACHE), ignite.transactions(), PESSIMISTIC, READ_COMMITTED); - - checkPutGet(ignite.cache(MVCC_CACHE), ignite.transactions(), PESSIMISTIC, REPEATABLE_READ); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java index 1c79885adf801..eb95f78e48670 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java @@ -44,12 +44,10 @@ import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -86,15 +84,6 @@ public void testGetFromBackupStoreReadThroughEnabled() throws Exception { checkGetFromBackupStoreReadThroughEnabled(cacheConfigurations()); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10274") - @Test - public void testMvccGetFromBackupStoreReadThroughEnabled() throws Exception { - checkGetFromBackupStoreReadThroughEnabled(mvccCacheConfigurations()); - } - /** * @throws Exception If failed. */ @@ -147,15 +136,6 @@ public void testGetFromBackupStoreReadThroughDisabled() throws Exception { checkGetFromBackupStoreReadThroughDisabled(cacheConfigurations()); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10274") - @Test - public void testMvccGetFromBackupStoreReadThroughDisabled() throws Exception { - checkGetFromBackupStoreReadThroughDisabled(mvccCacheConfigurations()); - } - /** * @throws Exception If failed. */ @@ -192,15 +172,6 @@ public void testGetFromPrimaryPreloadInProgress() throws Exception { checkGetFromPrimaryPreloadInProgress(cacheConfigurations()); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10274") - @Test - public void testMvccGetFromPrimaryPreloadInProgress() throws Exception { - checkGetFromPrimaryPreloadInProgress(mvccCacheConfigurations()); - } - /** * @throws Exception If failed. */ @@ -295,16 +266,6 @@ public void testNoPrimaryReadPreloadFinished() throws Exception { checkNoPrimaryReadPreloadFinished(cacheConfigurations()); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10274") - @Test - public void testMvccNoPrimaryReadPreloadFinished() throws Exception { - checkNoPrimaryReadPreloadFinished(mvccCacheConfigurations()); - - } - /** * @throws Exception If failed. */ @@ -433,21 +394,6 @@ private List> cacheConfigurations() { return ccfgs; } - /** - * @return Cache configurations to test. - */ - private List> mvccCacheConfigurations() { - List> ccfgs = new ArrayList<>(); - - ccfgs.add(cacheConfiguration(REPLICATED, TRANSACTIONAL_SNAPSHOT, 0, false)); - - ccfgs.add(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, false)); - ccfgs.add(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, true)); - ccfgs.add(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 2, false)); - - return ccfgs; - } - /** * @param cacheMode Cache mode. * @param atomicityMode Cache atomicity mode. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java index 59b2570e1650d..cef60e8bdec56 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java @@ -31,12 +31,10 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetResponse; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -78,15 +76,6 @@ public void testSingleGetMessage() throws Exception { checkSingleGetMessage(cacheConfigurations()); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7371") - @Test - public void testMvccSingleGetMessage() throws Exception { - checkSingleGetMessage(mvccCacheConfigurations()); - } - /** * @throws Exception If failed. */ @@ -282,19 +271,6 @@ private List> cacheConfigurations() { return ccfgs; } - /** - * @return Mvcc cache configurations to test. - */ - private List> mvccCacheConfigurations() { - List> ccfgs = new ArrayList<>(); - - ccfgs.add(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, FULL_SYNC, 0)); - ccfgs.add(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, FULL_SYNC, 1)); - ccfgs.add(cacheConfiguration(REPLICATED, TRANSACTIONAL_SNAPSHOT, FULL_SYNC, 0)); - - return ccfgs; - } - /** * @param cacheMode Cache mode. * @param atomicityMode Cache atomicity mode. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java index 3517d822317a4..c6c12f327c844 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java @@ -29,10 +29,8 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -77,8 +75,6 @@ public class IgniteCacheSystemTransactionsSelfTest extends GridCommonAbstractTes */ @Test public void testSystemTxInsideUserTx() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10473", MvccFeatureChecker.forcedMvcc()); - IgniteKernal ignite = (IgniteKernal)grid(0); IgniteCache jcache = ignite.cache(DEFAULT_CACHE_NAME); @@ -121,9 +117,7 @@ public void testGridNearTxLocalDuplicateAsyncCommit() throws Exception { IgniteInternalCache utilityCache = ignite.context().cache().utilityCache(); - try (GridNearTxLocal itx = MvccFeatureChecker.forcedMvcc() ? - utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ) : - utilityCache.txStartEx(OPTIMISTIC, SERIALIZABLE)) { + try (GridNearTxLocal itx = utilityCache.txStartEx(OPTIMISTIC, SERIALIZABLE)) { utilityCache.put("1", "1"); itx.commitNearTxLocalAsync(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheThreadLocalTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheThreadLocalTxTest.java index 594206714220a..a7f83fd9fbc52 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheThreadLocalTxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheThreadLocalTxTest.java @@ -25,7 +25,6 @@ import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.lang.IgniteFuture; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -87,9 +86,6 @@ private void threadLocalTx(Ignite node) throws Exception { for (TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (TransactionIsolation isolation : TransactionIsolation.values()) { - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) - continue; - for (boolean read : reads) { for (boolean write : writes) { for (int i = 0; i < endOps; i++) 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 167ebca8f8855..576ccf35d0086 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 @@ -29,8 +29,6 @@ import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.configuration.TransactionConfiguration; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.apache.ignite.testframework.MvccFeatureChecker.Feature; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -107,7 +105,7 @@ public void checkModes(int gridCnt) throws Exception { 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); @@ -133,12 +131,6 @@ private void checkTxCache( boolean nearEnabled, boolean useEvicPlc ) throws Exception { - if (atomMode == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) { - if ((nearEnabled && !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE)) || - (useEvicPlc && !MvccFeatureChecker.isSupported(Feature.EVICTION))) - return; // Nothing to do. Mode is not supported. - } - final Ignite ignite = grid(0); final CacheConfiguration ccfg = cacheConfiguration( @@ -163,10 +155,6 @@ private void checkTxCache( for (TransactionIsolation iso : TransactionIsolation.values()) { for (TransactionConcurrency con : TransactionConcurrency.values()) { - if (atomMode == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT && - !MvccFeatureChecker.isSupported(con, iso)) - continue; // Mode not supported. - try (Transaction transaction = ignite.transactions().txStart(con, iso)) { assertEquals(val, cache.get(key)); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java index 69a2a884cdc21..4841c062b25fe 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxStoreSelfTest.java @@ -37,7 +37,6 @@ import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.resources.CacheStoreSessionResource; import org.apache.ignite.resources.IgniteInstanceResource; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.jetbrains.annotations.Nullable; @@ -55,8 +54,6 @@ public class IgniteCrossCacheTxStoreSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration cfg1 = cacheConfiguration("cacheA", new FirstStoreFactory()); @@ -94,8 +91,6 @@ private CacheConfiguration cacheConfiguration(String cacheName, Factory IgniteCache jcache(int i) { - return grid(i).cache(DEFAULT_CACHE_NAME); - } - - /** - * @throws IgniteCheckedException If test failed. - */ - @Test - public void testPessimisticRepeatableRead() throws Exception { - checkTransactionTimeout(PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @param concurrency Concurrency. - * @param isolation Isolation. - * @throws IgniteCheckedException If test failed. - */ - private void checkTransactionTimeout(TransactionConcurrency concurrency, - TransactionIsolation isolation) throws Exception { - int idx = RAND.nextInt(GRID_COUNT); - - IgniteCache cache = jcache(idx); - - Transaction tx = ignite(idx).transactions().txStart(concurrency, isolation, TIMEOUT, 0); - - try { - info("Storing value in cache [key=1, val=1]"); - - cache.put(1, "1"); - - long sleep = TIMEOUT * 2; - - info("Going to sleep for (ms): " + sleep); - - Thread.sleep(sleep); - - info("Storing value in cache [key=1, val=2]"); - - cache.put(1, "2"); - - info("Committing transaction: " + tx); - - tx.commit(); - - assert false : "Timeout never happened for transaction: " + tx; - } - catch (Exception e) { - if (!(X.hasCause(e, TransactionTimeoutException.class))) - throw e; - - info("Received expected timeout exception [msg=" + e.getMessage() + ", tx=" + tx + ']'); - } - finally { - tx.close(); - } - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgnitePessimisticTxSuspendResumeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgnitePessimisticTxSuspendResumeTest.java index 47e0b13ad9e83..5726217dcc503 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgnitePessimisticTxSuspendResumeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgnitePessimisticTxSuspendResumeTest.java @@ -46,10 +46,6 @@ public class IgnitePessimisticTxSuspendResumeTest extends IgniteAbstractTxSuspen */ @Test public void testExplicitLockAndSuspendResume() throws Exception { - // TODO: IGNITE-9324 Lock operations are not supported when MVCC is enabled. - if (FORCE_MVCC) - return; - executeTestForAllCaches(new CI2Exc>() { @Override public void applyx(Ignite ignite, final IgniteCache cache) throws Exception { for (TransactionIsolation isolation : TransactionIsolation.values()) { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java index 265d009e60b00..8f0892be7bdf2 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java @@ -56,14 +56,11 @@ import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.apache.ignite.testframework.MvccFeatureChecker.Feature; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.jetbrains.annotations.NotNull; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -127,8 +124,6 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest { */ @Test public void testSingleKeyCommitFromPrimary() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10518", MvccFeatureChecker.forcedMvcc()); - singleKeyCommitFromPrimary(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, true, false)); singleKeyCommitFromPrimary(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, false)); @@ -143,16 +138,6 @@ public void testSingleKeyCommitFromPrimary() throws Exception { * @throws Exception If failed. */ private void singleKeyCommitFromPrimary(CacheConfiguration ccfg) throws Exception { - if (MvccFeatureChecker.forcedMvcc()) { - if (ccfg.getCacheStoreFactory() != null && - !MvccFeatureChecker.isSupported(Feature.CACHE_STORE)) - return; - - if (ccfg.getNearConfiguration() != null && - !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE)) - return; - } - Ignite ignite = ignite(0); IgniteCache cache = ignite.createCache(ccfg); @@ -172,9 +157,6 @@ private void singleKeyCommitFromPrimary(CacheConfiguration ccfg) for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (final TransactionIsolation isolation : TransactionIsolation.values()) { - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) - continue; - singleKeyCommitFromPrimary(node, ccfg, new IgniteBiInClosure>() { @Override public void apply(Integer key, IgniteCache cache) { Ignite ignite = cache.unwrap(Ignite.class); @@ -279,22 +261,14 @@ public void testSingleKeyPrimaryNodeFail2() throws Exception { * @throws Exception If failed. */ private void singleKeyPrimaryNodeLeft(CacheConfiguration ccfg) throws Exception { - if (MvccFeatureChecker.forcedMvcc()) { - if (ccfg.getCacheStoreFactory() != null && - !MvccFeatureChecker.isSupported(Feature.CACHE_STORE)) - return; - } - Ignite ignite = ignite(0); IgniteCache cache = ignite.createCache(ccfg); try { - if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(Feature.NEAR_CACHE)) { - awaitCacheOnClient(ignite(NODES - 1), ccfg.getName()); + awaitCacheOnClient(ignite(NODES - 1), ccfg.getName()); - ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); - } + ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); for (int i = 0; i < NODES; i++) { Ignite node = ignite(i); @@ -307,9 +281,6 @@ private void singleKeyPrimaryNodeLeft(CacheConfiguration ccfg) t for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (final TransactionIsolation isolation : TransactionIsolation.values()) { - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) - continue; - singleKeyPrimaryNodeLeft(node, ccfg, new IgniteBiInClosure>() { @Override public void apply(Integer key, IgniteCache cache) { Ignite ignite = cache.unwrap(Ignite.class); @@ -399,8 +370,6 @@ private void singleKeyPrimaryNodeLeft( */ @Test public void testSingleKeyCommit() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10518", MvccFeatureChecker.forcedMvcc()); - singleKeyCommit(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, true, false)); singleKeyCommit(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, false)); @@ -415,26 +384,14 @@ public void testSingleKeyCommit() throws Exception { * @throws Exception If failed. */ private void singleKeyCommit(CacheConfiguration ccfg) throws Exception { - if (MvccFeatureChecker.forcedMvcc()) { - if (ccfg.getCacheStoreFactory() != null && - !MvccFeatureChecker.isSupported(Feature.CACHE_STORE)) - return; - - if (ccfg.getNearConfiguration() != null && - !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE)) - return; - } - Ignite ignite = ignite(0); IgniteCache cache = ignite.createCache(ccfg); try { - if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(Feature.NEAR_CACHE)) { - awaitCacheOnClient(ignite(NODES - 1), ccfg.getName()); + awaitCacheOnClient(ignite(NODES - 1), ccfg.getName()); - ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); - } + ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); for (int i = 1; i < NODES; i++) { Ignite node = ignite(i); @@ -449,9 +406,6 @@ private void singleKeyCommit(CacheConfiguration ccfg) throws Exc for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (final TransactionIsolation isolation : TransactionIsolation.values()) { - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) - continue; - singleKeyCommit(node, ccfg, new IgniteBiInClosure>() { @Override public void apply(Integer key, IgniteCache cache) { Ignite ignite = cache.unwrap(Ignite.class); @@ -575,26 +529,14 @@ public void testWaitPrimaryResponse() throws Exception { * @throws Exception If failed. */ private void checkWaitPrimaryResponse(CacheConfiguration ccfg) throws Exception { - if (MvccFeatureChecker.forcedMvcc()) { - if (ccfg.getCacheStoreFactory() != null && - !MvccFeatureChecker.isSupported(Feature.CACHE_STORE)) - return; - - if (ccfg.getNearConfiguration() != null && - !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE)) - return; - } - Ignite ignite = ignite(0); IgniteCache cache = ignite.createCache(ccfg); try { - if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(Feature.NEAR_CACHE)) { - awaitCacheOnClient(ignite(NODES - 1), ccfg.getName()); + awaitCacheOnClient(ignite(NODES - 1), ccfg.getName()); - ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); - } + ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); for (int i = 1; i < NODES; i++) { Ignite node = ignite(i); @@ -622,9 +564,6 @@ private void checkWaitPrimaryResponse(CacheConfiguration ccfg) t for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (final TransactionIsolation isolation : TransactionIsolation.values()) { - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) - continue; - checkWaitPrimaryResponse(node, ccfg, new IgniteBiInClosure>() { @Override public void apply(Integer key, IgniteCache cache) { Ignite ignite = cache.unwrap(Ignite.class); @@ -717,9 +656,6 @@ private void checkWaitPrimaryResponse( */ @Test public void testOnePhaseMessages() throws Exception { - if (MvccFeatureChecker.forcedMvcc()) - return; // Not supported. Commit flow differs for Mvcc mode. - checkOnePhaseMessages(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, false, false)); } @@ -749,9 +685,6 @@ private void checkOnePhaseMessages(CacheConfiguration ccfg) thro for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (final TransactionIsolation isolation : TransactionIsolation.values()) { - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) - continue; - checkOnePhaseMessages(node, ccfg, new IgniteBiInClosure>() { @Override public void apply(Integer key, IgniteCache cache) { Ignite ignite = cache.unwrap(Ignite.class); @@ -916,8 +849,7 @@ private void waitKeyUpdated(Ignite ignite, int expNodes, final String cacheName, private IgniteCache createCache(Ignite ignite, CacheConfiguration ccfg) { IgniteCache cache = ignite.createCache(ccfg); - if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(Feature.NEAR_CACHE)) - ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); + ignite(NODES - 1).createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); return cache; } @@ -941,9 +873,6 @@ private void checkTxSyncMode(Ignite ignite, boolean commit) { for (TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (TransactionIsolation isolation : TransactionIsolation.values()) { - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) - continue; - try (Transaction tx = txs.txStart(concurrency, isolation)) { fullSync1.put(key++, 1); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java index e71e6e8ac13f3..7e6b3e1188b4b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java @@ -42,17 +42,14 @@ import org.apache.ignite.internal.util.lang.GridAbsPredicate; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.lang.IgniteInClosure; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionOptimisticException; -import org.apache.ignite.transactions.TransactionRollbackException; import org.jetbrains.annotations.NotNull; import org.junit.Test; @@ -183,14 +180,6 @@ private void multithreaded(CacheWriteSynchronizationMode syncMode, boolean store, boolean nearCache, boolean restart) throws Exception { - if (MvccFeatureChecker.forcedMvcc()) { - if (store && !MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE)) - return; - - if (nearCache && !MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) - return; - } - final Ignite ignite = ignite(0); createCache(ignite, cacheConfiguration(DEFAULT_CACHE_NAME, syncMode, backups, store), nearCache); @@ -221,16 +210,7 @@ private void multithreaded(CacheWriteSynchronizationMode syncMode, Integer key = rnd.nextInt(MULTITHREADED_TEST_KEYS); - while (true) { - try { - cache.put(key, rnd.nextInt()); - - break; - } - catch (CacheException e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } - } + cache.put(key, rnd.nextInt()); } }); @@ -246,19 +226,7 @@ private void multithreaded(CacheWriteSynchronizationMode syncMode, map.put(key, rnd.nextInt()); } - while (true) { - try { - cache.putAll(map); - - break; - } - catch (CacheException e) { - if (X.hasCause(e, TransactionRollbackException.class)) - return; - - MvccFeatureChecker.assertMvccWriteConflict(e); - } - } + cache.putAll(map); } }); @@ -288,38 +256,36 @@ private void multithreaded(CacheWriteSynchronizationMode syncMode, } }); - if (!MvccFeatureChecker.forcedMvcc()) { - commitMultithreaded(new IgniteBiInClosure>() { - @Override public void apply(Ignite ignite, IgniteCache cache) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); + commitMultithreaded(new IgniteBiInClosure>() { + @Override public void apply(Ignite ignite, IgniteCache cache) { + ThreadLocalRandom rnd = ThreadLocalRandom.current(); + + Map map = new LinkedHashMap<>(); - Map map = new LinkedHashMap<>(); + for (int i = 0; i < 10; i++) { + Integer key = rnd.nextInt(MULTITHREADED_TEST_KEYS); - for (int i = 0; i < 10; i++) { - Integer key = rnd.nextInt(MULTITHREADED_TEST_KEYS); + map.put(key, rnd.nextInt()); + } - map.put(key, rnd.nextInt()); - } + while (true) { + try (Transaction tx = ignite.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) { + for (Map.Entry e : map.entrySet()) + cache.put(e.getKey(), e.getValue()); - while (true) { - try (Transaction tx = ignite.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) { - for (Map.Entry e : map.entrySet()) - cache.put(e.getKey(), e.getValue()); - - tx.commit(); - - break; - } - catch (TransactionOptimisticException ignored) { - // Retry. - } - catch (CacheException | IgniteException ignored) { - break; - } + tx.commit(); + + break; + } + catch (TransactionOptimisticException ignored) { + // Retry. + } + catch (CacheException | IgniteException ignored) { + break; } } - }); - } + } + }); } finally { stop.set(true); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java index 8485f4b9a2fb9..da212228ec5b7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java @@ -37,7 +37,6 @@ import org.junit.Test; import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_REMOVED_ENTRIES_TTL; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE; /** @@ -96,15 +95,6 @@ public void testPessimisticTxLeavesObjectsInLocalPartition() throws Exception { checkTxLeavesObjectsInLocalPartition(cacheConfiguration(), TransactionConcurrency.PESSIMISTIC, SERIALIZABLE); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxLeavesObjectsInLocalPartition() throws Exception { - checkTxLeavesObjectsInLocalPartition(cacheConfiguration().setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT), - TransactionConcurrency.PESSIMISTIC, REPEATABLE_READ); - } - /** * Too many deletes in single transaction may overflow {@link GridDhtLocalPartition#rmvQueue} and entries will be * deleted synchronously in {@link GridDhtLocalPartition#onDeferredDelete(int, KeyCacheObject, GridCacheVersion)}. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java index 8186385efb82d..e99f819d6845c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java @@ -63,7 +63,6 @@ import org.apache.ignite.transactions.Transaction; import org.junit.Test; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; /** @@ -278,10 +277,8 @@ protected void testTxOriginatingNodeFails(Collection keys, final boolea assertNotNull(cache); - if (atomicityMode() != TRANSACTIONAL_SNAPSHOT) { - assertEquals("Failed to check entry value on node: " + checkNodeId, - fullFailure ? initVal : val, cache.localPeek(key)); - } + assertEquals("Failed to check entry value on node: " + checkNodeId, + fullFailure ? initVal : val, cache.localPeek(key)); return null; } @@ -430,9 +427,6 @@ private void checkPrimaryNodeCrash(final boolean commmit) throws Exception { assertFalse(e.getValue().isEmpty()); - if (atomicityMode() == TRANSACTIONAL_SNAPSHOT) - continue; - for (ClusterNode node : e.getValue()) { final UUID checkNodeId = node.id(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java index aeec5ad3b9b0a..04bff72cec215 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java @@ -32,7 +32,6 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; @@ -151,8 +150,7 @@ public void testRemoteTxPreloading() throws Exception { */ @Test public void testLocalTxPreloadingOptimistic() throws Exception { - if (!MvccFeatureChecker.forcedMvcc()) // Do not check optimistic tx for mvcc. - testLocalTxPreloading(OPTIMISTIC); + testLocalTxPreloading(OPTIMISTIC); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxRemoveTimeoutObjectsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxRemoveTimeoutObjectsTest.java index da30dd030238e..31dda376bb289 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxRemoveTimeoutObjectsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxRemoveTimeoutObjectsTest.java @@ -32,10 +32,8 @@ import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionTimeoutException; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; @@ -58,16 +56,6 @@ public class IgniteTxRemoveTimeoutObjectsTest extends GridCacheAbstractSelfTest return 60_000; } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7388", MvccFeatureChecker.forcedMvcc()); - - if (nearEnabled()) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - - super.beforeTest(); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java index f2457c75f71c5..7a2e092ef4862 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java @@ -28,11 +28,9 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.processors.cache.GridCacheGenericTestStore; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -99,8 +97,6 @@ public abstract class GridCacheAbstractTransformWriteThroughSelfTest extends Gri /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); GridCacheGenericTestStore store = new GridCacheGenericTestStore<>(); @@ -123,12 +119,6 @@ public abstract class GridCacheAbstractTransformWriteThroughSelfTest extends Gri return cfg; } - /** */ - @Before - public void beforeCacheStoreListenerRWThroughDisabledTransactionalCacheTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedMvccTxSingleThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedMvccTxSingleThreadedSelfTest.java deleted file mode 100644 index c6ec142c62251..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedMvccTxSingleThreadedSelfTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.CacheWriteSynchronizationMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.processors.cache.IgniteMvccTxSingleThreadedAbstractTest; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * Test Mvcc txs in single-threaded mode for colocated cache. - */ -public class GridCacheColocatedMvccTxSingleThreadedSelfTest extends IgniteMvccTxSingleThreadedAbstractTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - CacheConfiguration ccfg = defaultCacheConfiguration(); - - ccfg.setCacheMode(PARTITIONED); - ccfg.setBackups(1); - ccfg.setNearConfiguration(null); - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - ccfg.setEvictionPolicy(null); - - ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_ASYNC); - - cfg.setCacheConfiguration(ccfg); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 4; - } - - /** {@inheritDoc} */ - @Override protected int keyCount() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int maxKeyValue() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int iterations() { - return 3000; - } - - /** {@inheritDoc} */ - @Override protected boolean isTestDebug() { - return false; - } - - /** {@inheritDoc} */ - @Override protected boolean printMemoryStats() { - return true; - } - -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java index dfb00a28e1edb..3a10ae5ae78c8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java @@ -34,7 +34,6 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.lang.IgniteBiTuple; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -76,8 +75,6 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @SuppressWarnings({"SizeReplaceableByIsEmpty"}) @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - for (int i = 0; i < GRID_CNT; i++) { assert near(grid(i)).size() == 0 : "Near cache size is not zero for grid: " + i; assert dht(grid(i)).size() == 0 : "DHT cache size is not zero for grid: " + i; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java index 41a851a62e88d..b212b0231c2ba 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java @@ -24,7 +24,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -39,11 +38,6 @@ public class GridCacheDhtMappingSelfTest extends GridCommonAbstractTest { /** Number of key backups. */ private static final int BACKUPS = 1; - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java index cea399466f7ac..dec8378d4638e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java @@ -37,7 +37,6 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -98,8 +97,6 @@ public GridCacheDhtPreloadDisabledSelfTest() { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - backups = DFLT_BACKUPS; partitions = DFLT_PARTITIONS; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java index b417dcd47c9e0..53abae0716d29 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java @@ -32,10 +32,8 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -154,8 +152,6 @@ public void testPutGetSync2() throws Exception { */ @Test public void testPutGetNone0() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-11417", MvccFeatureChecker.forcedMvcc()); - preloadMode = NONE; backups = 0; @@ -167,8 +163,6 @@ public void testPutGetNone0() throws Exception { */ @Test public void testPutGetNone1() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-11417", MvccFeatureChecker.forcedMvcc()); - preloadMode = NONE; backups = 1; @@ -180,8 +174,6 @@ public void testPutGetNone1() throws Exception { */ @Test public void testPutGetNone2() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-11417", MvccFeatureChecker.forcedMvcc()); - preloadMode = NONE; backups = 2; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java index 7cce1c44400c2..c4edc3c835d46 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGlobalLoadTest.java @@ -32,7 +32,6 @@ import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.resources.IgniteInstanceResource; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.jetbrains.annotations.Nullable; import org.junit.Assert; import org.junit.Test; @@ -71,13 +70,6 @@ public class GridCacheGlobalLoadTest extends IgniteCacheAbstractTest { return new NearCacheConfiguration(); } - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTestsStarted(); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheClearDuringRebalanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheClearDuringRebalanceTest.java index d3bdd99a78c2d..d7d80ff818f43 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheClearDuringRebalanceTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheClearDuringRebalanceTest.java @@ -25,9 +25,7 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -39,11 +37,6 @@ public class IgniteCacheClearDuringRebalanceTest extends GridCommonAbstractTest /** */ private static final String CACHE_NAME = "cache"; - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7952", MvccFeatureChecker.forcedMvcc()); - } - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java index 4eb6b5b98af18..40606d716cdb0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java @@ -31,8 +31,6 @@ import org.apache.ignite.lang.IgniteFutureTimeoutException; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import org.junit.Test; /** @@ -40,12 +38,6 @@ */ @SuppressWarnings("unchecked") public class IgniteCacheLockFailoverSelfTest extends GridCacheAbstractSelfTest { - /** */ - @Before - public void beforeIgniteCacheLockFailoverSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 2; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java index d7e879a9cf9f2..917f62bc05765 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java @@ -31,9 +31,7 @@ import org.apache.ignite.internal.processors.cache.IgniteInternalCache; import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -53,12 +51,6 @@ public class IgniteCacheMultiTxLockSelfTest extends GridCommonAbstractTest { /** Unexpected lock error. */ private volatile Throwable err; - /** */ - @Before - public void beforeIgniteCacheMultiTxLockSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java index bf28b18fa0c09..d5e24a2e47e43 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java @@ -62,7 +62,6 @@ import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.internal.processors.cache.ExchangeContext.IGNITE_EXCHANGE_COMPATIBILITY_VER_1; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; @@ -123,8 +122,6 @@ public abstract class IgniteCachePrimaryNodeFailureRecoveryAbstractTest extends */ @Test public void testOptimisticPrimaryNodeFailureRecovery1() throws Exception { - if (atomicityMode() == TRANSACTIONAL_SNAPSHOT) return; - primaryNodeFailure(false, false, true); } @@ -133,8 +130,6 @@ public void testOptimisticPrimaryNodeFailureRecovery1() throws Exception { */ @Test public void testOptimisticPrimaryNodeFailureRecovery2() throws Exception { - if (atomicityMode() == TRANSACTIONAL_SNAPSHOT) return; - primaryNodeFailure(true, false, true); } @@ -143,8 +138,6 @@ public void testOptimisticPrimaryNodeFailureRecovery2() throws Exception { */ @Test public void testOptimisticPrimaryNodeFailureRollback1() throws Exception { - if (atomicityMode() == TRANSACTIONAL_SNAPSHOT) return; - primaryNodeFailure(false, true, true); } @@ -153,8 +146,6 @@ public void testOptimisticPrimaryNodeFailureRollback1() throws Exception { */ @Test public void testOptimisticPrimaryNodeFailureRollback2() throws Exception { - if (atomicityMode() == TRANSACTIONAL_SNAPSHOT) return; - primaryNodeFailure(true, true, true); } @@ -292,8 +283,6 @@ private void primaryNodeFailure(boolean locBackupKey, final boolean rollback, bo */ @Test public void testOptimisticPrimaryAndOriginatingNodeFailureRecovery1() throws Exception { - if (atomicityMode() == TRANSACTIONAL_SNAPSHOT) return; - primaryAndOriginatingNodeFailure(false, false, true); } @@ -302,8 +291,6 @@ public void testOptimisticPrimaryAndOriginatingNodeFailureRecovery1() throws Exc */ @Test public void testOptimisticPrimaryAndOriginatingNodeFailureRecovery2() throws Exception { - if (atomicityMode() == TRANSACTIONAL_SNAPSHOT) return; - primaryAndOriginatingNodeFailure(true, false, true); } @@ -312,8 +299,6 @@ public void testOptimisticPrimaryAndOriginatingNodeFailureRecovery2() throws Exc */ @Test public void testOptimisticPrimaryAndOriginatingNodeFailureRollback1() throws Exception { - if (atomicityMode() == TRANSACTIONAL_SNAPSHOT) return; - primaryAndOriginatingNodeFailure(false, true, true); } @@ -322,8 +307,6 @@ public void testOptimisticPrimaryAndOriginatingNodeFailureRollback1() throws Exc */ @Test public void testOptimisticPrimaryAndOriginatingNodeFailureRollback2() throws Exception { - if (atomicityMode() == TRANSACTIONAL_SNAPSHOT) return; - primaryAndOriginatingNodeFailure(true, true, true); } @@ -469,12 +452,10 @@ private void primaryAndOriginatingNodeFailure(final boolean locBackupKey, /** */ private void checkKey(Integer key, boolean rollback, Collection keyNodes, long initUpdCntr) { if (rollback) { - if (atomicityMode() != TRANSACTIONAL_SNAPSHOT) { - for (Ignite ignite : G.allGrids()) { - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); + for (Ignite ignite : G.allGrids()) { + IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); - assertNull("Unexpected value for: " + ignite.name(), cache.localPeek(key)); - } + assertNull("Unexpected value for: " + ignite.name(), cache.localPeek(key)); } for (Ignite ignite : G.allGrids()) { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheMvccTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheMvccTxSelfTest.java deleted file mode 100644 index be7591cd52c43..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCrossCacheMvccTxSelfTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.distributed.dht; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.junit.Test; - -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * - */ -public class IgniteCrossCacheMvccTxSelfTest extends IgniteCrossCacheTxAbstractSelfTest { - /** {@inheritDoc} */ - @Override public CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPessimisticRepeatableRead() throws Exception { - checkTxsSingleOp(PESSIMISTIC, REPEATABLE_READ); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/NotMappedPartitionInTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/NotMappedPartitionInTxTest.java index 8406713f03939..b9aadacaa9328 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/NotMappedPartitionInTxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/NotMappedPartitionInTxTest.java @@ -103,25 +103,6 @@ public void testOneServerTx() throws Exception { } } - /** - * - */ - @Test - public void testOneServerMvcc() throws Exception { - try { - atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - - startGrid(0); - - final IgniteEx client = startClientGrid(1); - - checkNotMapped(client, PESSIMISTIC, REPEATABLE_READ); - } - finally { - stopAllGrids(); - } - } - /** * */ @@ -143,37 +124,13 @@ public void testFourServersTx() throws Exception { } } - /** - * - */ - @Test - public void testFourServersMvcc() throws Exception { - try { - atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - - startGridsMultiThreaded(4); - - final IgniteEx client = startClientGrid(4); - - checkNotMapped(client, PESSIMISTIC, REPEATABLE_READ); - } - finally { - stopAllGrids(); - } - } - /** * @param client Ignite client. */ private void checkNotMapped(final IgniteEx client, final TransactionConcurrency concurrency, final TransactionIsolation isolation) { - String msg; - - if (atomicityMode == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - msg = "Failed to get primary node "; - else - msg = concurrency == PESSIMISTIC ? "Failed to lock keys (all partition nodes left the grid)" : - "Failed to map keys to nodes (partition is not mapped to any node"; + String msg = concurrency == PESSIMISTIC ? "Failed to lock keys (all partition nodes left the grid)" : + "Failed to map keys to nodes (partition is not mapped to any node"; GridTestUtils.assertThrowsAnyCause(log, new Callable() { @Override public Void call() { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAbstractNearPartitionedByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAbstractNearPartitionedByteArrayValuesSelfTest.java index a352f8fa631df..0fdbedd95cb94 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAbstractNearPartitionedByteArrayValuesSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAbstractNearPartitionedByteArrayValuesSelfTest.java @@ -19,8 +19,6 @@ import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.processors.cache.distributed.GridCacheAbstractPartitionedByteArrayValuesSelfTest; -import org.junit.Ignore; -import org.junit.Test; /** * Tests for byte array values in NEAR-PARTITIONED caches. @@ -31,18 +29,4 @@ public abstract class GridCacheAbstractNearPartitionedByteArrayValuesSelfTest ex @Override protected NearCacheConfiguration nearConfiguration() { return new NearCacheConfiguration(); } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - @Override public void testPessimisticMvcc() throws Exception { - super.testPessimisticMvcc(); - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - @Override public void testPessimisticMvccMixed() throws Exception { - super.testPessimisticMvccMixed(); - } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGetStoreErrorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGetStoreErrorSelfTest.java index d8b60f2f9e131..babb03054e0c3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGetStoreErrorSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGetStoreErrorSelfTest.java @@ -29,9 +29,9 @@ import org.apache.ignite.configuration.IgniteReflectionFactory; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -49,19 +49,9 @@ public class GridCacheGetStoreErrorSelfTest extends GridCommonAbstractTest { /** Cache mode for test. */ private CacheMode cacheMode; - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration c = super.getConfiguration(igniteInstanceName); CacheConfiguration cc = defaultCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheMvccNearEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheMvccNearEvictionSelfTest.java deleted file mode 100644 index 3cc5b247e5e02..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheMvccNearEvictionSelfTest.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.internal.processors.cache.distributed.near; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.junit.Ignore; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - -/** - * Test for mvcc cache. - */ -@Ignore("https://issues.apache.org/jira/browse/IGNITE-7187,https://issues.apache.org/jira/browse/IGNITE-7956") -public class GridCacheMvccNearEvictionSelfTest extends GridCacheNearEvictionSelfTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return TRANSACTIONAL_SNAPSHOT; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java index 76b6e2969302b..1988de0a4e086 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java @@ -29,7 +29,6 @@ import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.junit.Test; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -85,8 +84,6 @@ protected int keyCount() { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.METRICS); - super.beforeTest(); for (int i = 0; i < gridCount(); i++) { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java index c1c6a5334d158..9610521693eda 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java @@ -32,11 +32,9 @@ import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.apache.ignite.transactions.TransactionOptimisticException; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheRebalanceMode.NONE; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; @@ -221,24 +219,6 @@ public void testPessimisticSerializable() throws Exception { checkDoubleGet(PESSIMISTIC, SERIALIZABLE, true); } - /** @throws Exception If failed. */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccPessimisticRepeatableReadNoPut() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - - checkDoubleGet(PESSIMISTIC, REPEATABLE_READ, false); - } - - /** @throws Exception If failed. */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccPessimisticRepeatableReadWithPut() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - - checkDoubleGet(PESSIMISTIC, REPEATABLE_READ, true); - } - /** * @param concurrency Concurrency. * @param isolation Isolation. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java index 04a3b00abdbce..e7d4caf15d51a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java @@ -53,11 +53,9 @@ import org.apache.ignite.internal.util.typedef.T2; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.jetbrains.annotations.Nullable; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -95,21 +93,9 @@ public GridCacheNearMultiNodeSelfTest() { super(false /* don't start grid. */); } - /** */ - @Before - public void beforeGridCacheNearMultiNodeSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - } - /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration cacheCfg = defaultCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java index 07d0b758d0c79..dc20ff846f306 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java @@ -31,10 +31,8 @@ import org.apache.ignite.internal.processors.cache.GridCacheEntryEx; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -50,12 +48,6 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest { /** Cache store. */ private static TestStore store = new TestStore(); - /** */ - @Before - public void beforeGridCacheNearOneNodeSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** * */ @@ -77,8 +69,6 @@ public GridCacheNearOneNodeSelfTest() { /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - IgniteConfiguration cfg = super.getConfiguration(); TcpDiscoverySpi disco = new TcpDiscoverySpi(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java index 8be46ca1b4ffc..65d1da8f01eae 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java @@ -28,7 +28,6 @@ import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -47,11 +46,6 @@ public class GridCacheNearOnlyTopologySelfTest extends GridCommonAbstractTest { /** Use cache flag. */ private boolean cache = true; - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java index 4f34b34349642..a30644b06de12 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java @@ -26,7 +26,6 @@ import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.processors.cache.GridCacheGenericTestStore; import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -54,8 +53,6 @@ public class GridCacheNearPartitionedClearSelfTest extends GridCommonAbstractTes /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - startGrids(GRID_CNT); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java index 73e0c1ae10943..2741588d64ec6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java @@ -30,7 +30,6 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -63,11 +62,6 @@ public class GridCacheNearReaderPreloadSelfTest extends GridCommonAbstractTest { /** Cache on backup node. */ private IgniteCache cache3; - /** {@inheritDoc} */ - @Override public void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { cache1 = null; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java index 4ca513f75de81..2dcc51f42917e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java @@ -45,7 +45,6 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -68,11 +67,6 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest { /** Test cache affinity. */ private GridCacheModuloAffinityFunction aff = new GridCacheModuloAffinityFunction(); - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java index a350f8203ff1b..f07b8034e96ba 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java @@ -19,7 +19,6 @@ import org.apache.ignite.cache.CacheMode; import org.apache.ignite.internal.processors.cache.IgniteTxExceptionAbstractSelfTest; -import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -27,13 +26,6 @@ * Tests near cache. */ public class GridCacheNearTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected CacheMode cacheMode() { return PARTITIONED; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPreloadSelfTest.java index b6ab56daf001f..c6f28cc03edc0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPreloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxPreloadSelfTest.java @@ -21,8 +21,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.processors.cache.distributed.IgniteTxPreloadAbstractTest; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -30,12 +28,6 @@ * Tests cache transaction during preloading. */ public class GridCacheNearTxPreloadSelfTest extends IgniteTxPreloadAbstractTest { - /** */ - @Before - public void beforeGridCacheNearTxPreloadSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected CacheMode cacheMode() { return PARTITIONED; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java index 3f89b1cb9d5c7..ae31ecc84cab3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedBasicStoreMultiNodeSelfTest.java @@ -30,10 +30,8 @@ import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.processors.cache.GridCacheTestStore; import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -52,15 +50,6 @@ public class GridCachePartitionedBasicStoreMultiNodeSelfTest extends GridCommonA /** Cache store. */ private static List stores; - /** */ - @Before - public void beforeGridCachePartitionedBasicStoreMultiNodeSelfTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - if (nearCacheConfiguration() != null) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { for (GridCacheTestStore store : stores) @@ -93,11 +82,6 @@ public void beforeGridCachePartitionedBasicStoreMultiNodeSelfTest() { /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - if (nearCacheConfiguration() != null) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - IgniteConfiguration c = super.getConfiguration(igniteInstanceName); CacheConfiguration cc = defaultCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java index 008508c85feb9..f16c4db88175c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEventSelfTest.java @@ -21,7 +21,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.processors.cache.distributed.GridCacheEventAbstractTest; -import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -31,13 +30,6 @@ * Tests events. */ public class GridCachePartitionedEventSelfTest extends GridCacheEventAbstractTest { - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - - super.beforeTest(); - } - /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { CacheConfiguration cfg = defaultCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java index 5694313058e35..7cf4530121cee 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java @@ -30,7 +30,6 @@ import org.apache.ignite.internal.util.typedef.P1; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteFuture; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -46,11 +45,6 @@ public class GridCachePartitionedExplicitLockNodeFailureSelfTest extends GridCom /** */ public static final int GRID_CNT = 4; - /** {@inheritDoc} */ - @Override public void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java index 2c4c54e58b046..7b1a1df430e63 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java @@ -29,7 +29,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.TransactionConfiguration; import org.apache.ignite.stream.StreamReceiver; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -91,8 +90,6 @@ protected CacheConfiguration cacheConfiguration() throws Exception { */ @Test public void testHitsAndMisses() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.METRICS); - startGrids(GRID_CNT); awaitPartitionMapExchange(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java index c7480405651b5..d3684b82e966d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java @@ -26,7 +26,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiInClosure; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; import org.junit.Test; @@ -44,11 +43,6 @@ public class GridCachePartitionedLoadCacheSelfTest extends GridCommonAbstractTes /** Puts count. */ private static final int PUT_CNT = 100; - /** {@inheritDoc} */ - @Override public void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMetricsSelfTest.java index a7b37329fd79e..5eaf745226725 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMetricsSelfTest.java @@ -20,7 +20,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.processors.cache.GridCacheTransactionalAbstractMetricsSelfTest; -import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; @@ -33,13 +32,6 @@ public class GridCachePartitionedMetricsSelfTest extends GridCacheTransactionalA /** */ private static final int GRID_CNT = 2; - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.METRICS); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); @@ -51,8 +43,6 @@ public class GridCachePartitionedMetricsSelfTest extends GridCacheTransactionalA /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.METRICS); - CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName); cfg.setCacheMode(PARTITIONED); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxMultiThreadedSelfTest.java deleted file mode 100644 index b126720486a31..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxMultiThreadedSelfTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.distributed.near; - -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.internal.processors.cache.IgniteMvccTxMultiThreadedAbstractTest; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Assume; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; - -/** - * Tests for partitioned cache transactions. - */ -public class GridCachePartitionedMvccTxMultiThreadedSelfTest extends IgniteMvccTxMultiThreadedAbstractTest { - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - if (nearEnabled()) - Assume.assumeTrue(MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)); - - super.beforeTestsStarted(); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - CacheConfiguration ccfg = defaultCacheConfiguration(); - - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - ccfg.setCacheMode(PARTITIONED); - ccfg.setBackups(1); - - ccfg.setEvictionPolicy(null); - - ccfg.setWriteSynchronizationMode(FULL_SYNC); - - ccfg.setNearConfiguration(nearEnabled() ? new NearCacheConfiguration() : null); - - cfg.setCacheConfiguration(ccfg); - - return cfg; - } - - /** - * @return {@code True} if near cache is enabled. - */ - protected boolean nearEnabled() { - return true; - } - - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int keyCount() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int maxKeyValue() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int threadCount() { - return 5; - } - - /** {@inheritDoc} */ - @Override protected int iterations() { - return 1000; - } - - /** {@inheritDoc} */ - @Override protected boolean isTestDebug() { - return false; - } - - /** {@inheritDoc} */ - @Override protected boolean printMemoryStats() { - return true; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxSingleThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxSingleThreadedSelfTest.java deleted file mode 100644 index 36da6ab11d4f5..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxSingleThreadedSelfTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.distributed.near; - -import org.apache.ignite.cache.CacheWriteSynchronizationMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.processors.cache.IgniteMvccTxSingleThreadedAbstractTest; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * Tests for partitioned cache transactions. - */ -public class GridCachePartitionedMvccTxSingleThreadedSelfTest extends IgniteMvccTxSingleThreadedAbstractTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - CacheConfiguration ccfg = defaultCacheConfiguration(); - - ccfg.setCacheMode(PARTITIONED); - ccfg.setBackups(1); - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - ccfg.setNearConfiguration(null); - ccfg.setEvictionPolicy(null); - - ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_ASYNC); - - cfg.setCacheConfiguration(ccfg); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 4; - } - - /** {@inheritDoc} */ - @Override protected int keyCount() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int maxKeyValue() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int iterations() { - return 3000; - } - - /** {@inheritDoc} */ - @Override protected boolean isTestDebug() { - return false; - } - - /** {@inheritDoc} */ - @Override protected boolean printMemoryStats() { - return true; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxTimeoutSelfTest.java deleted file mode 100644 index 070bdc3c5ec9d..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMvccTxTimeoutSelfTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.distributed.near; - -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.processors.cache.distributed.IgniteMvccTxTimeoutAbstractTest; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * Simple cache test. - */ -public class GridCachePartitionedMvccTxTimeoutSelfTest extends IgniteMvccTxTimeoutAbstractTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration c = super.getConfiguration(igniteInstanceName); - - CacheConfiguration cc = defaultCacheConfiguration(); - - cc.setCacheMode(PARTITIONED); - cc.setBackups(1); - cc.setAtomicityMode(TRANSACTIONAL); - - //cacheCfg.setPreloadMode(NONE); - - c.setCacheConfiguration(cc); - - return c; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedStorePutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedStorePutSelfTest.java index 60709fc57e8ea..93554fbfa2624 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedStorePutSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedStorePutSelfTest.java @@ -25,7 +25,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.processors.cache.distributed.GridCacheModuloAffinityFunction; import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -44,17 +43,8 @@ public class GridCachePartitionedStorePutSelfTest extends GridCommonAbstractTest /** */ private static AtomicInteger loads; - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCacheConfiguration(cacheConfiguration()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePutArrayValueSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePutArrayValueSelfTest.java index 5caf1b974b7b2..01b9360f50114 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePutArrayValueSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePutArrayValueSelfTest.java @@ -22,12 +22,10 @@ import java.io.ObjectInput; import java.io.ObjectOutput; import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheInternal; import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -41,14 +39,6 @@ public class GridCachePutArrayValueSelfTest extends GridCacheAbstractSelfTest { return 4; } - /** {@inheritDoc} */ - @Override protected void initStoreStrategy() throws IgniteCheckedException { - if (!MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE)) - return; - - super.initStoreStrategy(); - } - /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { CacheConfiguration cacheCfg = super.cacheConfiguration(igniteInstanceName); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheStoreUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheStoreUpdateTest.java index 612d2a54cd69b..45a77668a8652 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheStoreUpdateTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheStoreUpdateTest.java @@ -38,7 +38,6 @@ import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; @@ -62,9 +61,6 @@ public class GridNearCacheStoreUpdateTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - srv = startGrid("server"); client = startClientGrid("client"); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java index a949bcd6874f5..a911a53485455 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java @@ -24,9 +24,7 @@ import org.apache.ignite.cache.store.CacheStoreAdapter; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -74,8 +72,6 @@ private CacheConfiguration cacheConfiguration() { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-8582", MvccFeatureChecker.forcedMvcc()); - startGridsMultiThreaded(GRID_CNT); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java index c66df12716cc9..2f53f61b6c6f9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java @@ -29,9 +29,7 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractTest; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -43,12 +41,6 @@ * */ public class IgniteCacheNearOnlyTxTest extends IgniteCacheAbstractTest { - /** */ - @Before - public void beforeIgniteCacheNearOnlyTxTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 2; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java index 2312e6187efbb..4f9215f113bb5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java @@ -22,9 +22,7 @@ import org.apache.ignite.cache.CachePeekMode; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -36,12 +34,6 @@ */ @SuppressWarnings("RedundantMethodOverride") public class IgniteCacheNearReadCommittedTest extends GridCacheAbstractSelfTest { - /** */ - @Before - public void beforeIgniteCacheNearReadCommittedTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 2; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteTxExceptionNodeFailTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteTxExceptionNodeFailTest.java index 64a043a2aad1a..6187320a2441e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteTxExceptionNodeFailTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteTxExceptionNodeFailTest.java @@ -52,7 +52,6 @@ import static org.apache.ignite.events.EventType.EVT_NODE_LEFT; import static org.apache.ignite.internal.TestRecordingCommunicationSpi.spi; import static org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishFuture.ALL_PARTITION_OWNERS_LEFT_GRID_MSG; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccUtils.mvccEnabled; /** * Tests check a result of commit when a node fail before send {@link GridNearTxFinishResponse} to transaction @@ -175,18 +174,16 @@ public void testNodeFailBeforeSendGridNearTxFinishResponse() throws Exception { assertTrue(msg.contains(ALL_PARTITION_OWNERS_LEFT_GRID_MSG)); - if (!mvccEnabled(grid1.context())) { - Pattern msgPtrn; + Pattern msgPtrn; - msgPtrn = Pattern.compile(" \\[cacheName=" + DEFAULT_CACHE_NAME + - ", partition=\\d+, " + - "key=KeyCacheObjectImpl \\[part=\\d+, val=" + key0 + - ", hasValBytes=true\\]\\]"); + msgPtrn = Pattern.compile(" \\[cacheName=" + DEFAULT_CACHE_NAME + + ", partition=\\d+, " + + "key=KeyCacheObjectImpl \\[part=\\d+, val=" + key0 + + ", hasValBytes=true\\]\\]"); - Matcher matcher = msgPtrn.matcher(msg); + Matcher matcher = msgPtrn.matcher(msg); - assertTrue("Message does not match: [msg=" + msg + ']', matcher.find()); - } + assertTrue("Message does not match: [msg=" + msg + ']', matcher.find()); } stopNodeFut.get(10_000); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java index 3669a36075941..23fb6800557ab 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java @@ -27,12 +27,10 @@ import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -63,15 +61,6 @@ public void testNearCacheSyncUpdateTx() throws Exception { nearCacheSyncUpdateTx(TRANSACTIONAL); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testNearCacheSyncUpdateMvccTx() throws Exception { - nearCacheSyncUpdateTx(TRANSACTIONAL_SNAPSHOT); - } - /** * @param atomicityMode Atomicity mode. * @throws Exception If failed. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersMvccTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersMvccTest.java deleted file mode 100644 index 4166cfcabb5df..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingPartitionCountersMvccTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.distributed.rebalancing; - -import org.apache.ignite.cache.CacheAtomicityMode; - -/** - * - */ -public class GridCacheRebalancingPartitionCountersMvccTest extends GridCacheRebalancingPartitionCountersTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java index ad253443d559b..0939a91edc2ee 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java @@ -34,8 +34,6 @@ import org.apache.ignite.cache.query.ScanQuery; 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.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgniteKernal; @@ -60,9 +58,9 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; + import static org.apache.ignite.cache.CacheRebalanceMode.NONE; /** @@ -106,13 +104,6 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest { @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration iCfg = super.getConfiguration(igniteInstanceName); - if (MvccFeatureChecker.forcedMvcc()) { - iCfg.setDataStorageConfiguration(new DataStorageConfiguration() - .setDefaultDataRegionConfiguration( - new DataRegionConfiguration().setMaxSize(400L * 1024 * 1024) - )); - } - TcpCommunicationSpi commSpi = new CollectingCommunicationSpi(); commSpi.setTcpNoDelay(true); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingMvccTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingMvccTest.java deleted file mode 100644 index cadd25db9543b..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingWithAsyncClearingMvccTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.distributed.rebalancing; - -import org.apache.ignite.cache.CacheAtomicityMode; - -/** - * - */ -public class GridCacheRebalancingWithAsyncClearingMvccTest extends GridCacheRebalancingWithAsyncClearingTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Override protected long getTestTimeout() { - return super.getTestTimeout() * 2; // Parent test generates a lot of data and is inherently slow in mvcc mode. - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMetricsSelfTest.java index 5b5cbd0e0566a..25a02a4295df9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMetricsSelfTest.java @@ -19,7 +19,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.processors.cache.GridCacheTransactionalAbstractMetricsSelfTest; -import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -30,17 +29,8 @@ public class GridCacheReplicatedMetricsSelfTest extends GridCacheTransactionalAb /** */ private static final int GRID_CNT = 2; - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.METRICS); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.METRICS); - CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName); cfg.setCacheMode(REPLICATED); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMvccTxMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMvccTxMultiThreadedSelfTest.java deleted file mode 100644 index 87e69df680a6d..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMvccTxMultiThreadedSelfTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.distributed.replicated; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.processors.cache.IgniteMvccTxMultiThreadedAbstractTest; - -import static org.apache.ignite.cache.CacheMode.REPLICATED; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; - -/** - * Tests for replicated transactions. - */ -public class GridCacheReplicatedMvccTxMultiThreadedSelfTest extends IgniteMvccTxMultiThreadedAbstractTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - CacheConfiguration ccfg = defaultCacheConfiguration(); - - ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - ccfg.setCacheMode(REPLICATED); - ccfg.setEvictionPolicy(null); - - ccfg.setWriteSynchronizationMode(FULL_SYNC); - - cfg.setCacheConfiguration(ccfg); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int keyCount() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int maxKeyValue() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int threadCount() { - return 5; - } - - /** {@inheritDoc} */ - @Override protected int iterations() { - return 1000; - } - - /** {@inheritDoc} */ - @Override protected boolean isTestDebug() { - return false; - } - - /** {@inheritDoc} */ - @Override protected boolean printMemoryStats() { - return true; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMvccTxSingleThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMvccTxSingleThreadedSelfTest.java deleted file mode 100644 index e87d5cc9ab988..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMvccTxSingleThreadedSelfTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.distributed.replicated; - -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.processors.cache.IgniteMvccTxSingleThreadedAbstractTest; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.REPLICATED; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; - -/** - * Tests for replicated transactions. - */ -public class GridCacheReplicatedMvccTxSingleThreadedSelfTest extends IgniteMvccTxSingleThreadedAbstractTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - CacheConfiguration ccfg = defaultCacheConfiguration(); - - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - ccfg.setCacheMode(REPLICATED); - ccfg.setEvictionPolicy(null); - ccfg.setWriteSynchronizationMode(FULL_SYNC); - - cfg.setCacheConfiguration(ccfg); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int keyCount() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int maxKeyValue() { - return 3; - } - - /** {@inheritDoc} */ - @Override protected int iterations() { - return 20; - } - - /** {@inheritDoc} */ - @Override protected boolean isTestDebug() { - return false; - } - - /** {@inheritDoc} */ - @Override protected boolean printMemoryStats() { - return true; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMvccTxTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMvccTxTimeoutSelfTest.java deleted file mode 100644 index d5075a7913bd6..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedMvccTxTimeoutSelfTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.distributed.replicated; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.processors.cache.distributed.IgniteMvccTxTimeoutAbstractTest; - -import static org.apache.ignite.cache.CacheMode.REPLICATED; - -/** - * Simple cache test. - */ -public class GridCacheReplicatedMvccTxTimeoutSelfTest extends IgniteMvccTxTimeoutAbstractTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - CacheConfiguration ccfg = defaultCacheConfiguration(); - - ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - ccfg.setCacheMode(REPLICATED); - - cfg.setCacheConfiguration(ccfg); - - return cfg; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java index 0b7016a61ce79..39124b2aab58d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java @@ -23,10 +23,8 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -79,8 +77,6 @@ public GridCacheSyncReplicatedPreloadSelfTest() { @SuppressWarnings({"TooBroadScope"}) @Test public void testNodeRestart() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10082", MvccFeatureChecker.forcedMvcc()); - int keyCnt = 1000; int retries = 20; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java index e0f91fe2cf82f..0cd0ba9f437f0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java @@ -53,9 +53,7 @@ import org.apache.ignite.plugin.CachePluginConfiguration; import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -551,8 +549,6 @@ public void testExternalClassesAtMessage() throws Exception { */ @Test public void testExternalClassesAtEventP2pDisabled() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - testExternalClassesAtEvent0(true); } @@ -561,8 +557,6 @@ public void testExternalClassesAtEventP2pDisabled() throws Exception { */ @Test public void testExternalClassesAtEvent() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - testExternalClassesAtEvent0(false); } @@ -747,8 +741,6 @@ public void testBatchSize10000() throws Exception { */ @Test public void testMultipleNodes() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10082", MvccFeatureChecker.forcedMvcc()); - preloadMode = ASYNC; batchSize = 256; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/DhtAndNearEvictionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/DhtAndNearEvictionTest.java index e6e83942535c5..5d087751411f3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/DhtAndNearEvictionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/DhtAndNearEvictionTest.java @@ -36,7 +36,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridStringLogger; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -51,8 +50,6 @@ public class DhtAndNearEvictionTest extends GridCommonAbstractTest { /** */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setGridLogger(strLog); @@ -64,13 +61,6 @@ public class DhtAndNearEvictionTest extends GridCommonAbstractTest { return cfg; } - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); - - super.beforeTestsStarted(); - } - /** */ @Override protected void beforeTest() throws Exception { super.beforeTest(); @@ -98,8 +88,6 @@ public class DhtAndNearEvictionTest extends GridCommonAbstractTest { */ @Test public void testConcurrentWritesAndReadsWithReadThrough() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - startGrid(0); startGrid(1); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java index 928707ce580e2..03cdb3aaf2818 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java @@ -35,10 +35,10 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.processors.cache.CacheEvictableEntryImpl; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; + import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; @@ -242,21 +242,14 @@ private void checkPolicyConsistency() throws Exception { int j = rnd.nextInt(keyCnt); - while (true) { - try (Transaction tx = ignite.transactions().txStart()) { - // Put or remove? - if (rnd.nextBoolean()) - cache.put(j, j); - else - cache.remove(j); - - tx.commit(); - - break; - } - catch (Exception e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } + try (Transaction tx = ignite.transactions().txStart()) { + // Put or remove? + if (rnd.nextBoolean()) + cache.put(j, j); + else + cache.remove(j); + + tx.commit(); } if (i != 0 && i % 5000 == 0) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java index c444a3d57a8d8..430a6206b90ec 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java @@ -32,7 +32,6 @@ import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -163,9 +162,6 @@ private void checkPolicy0() throws Exception { for (TransactionIsolation isolation : TransactionIsolation.values()) { txIsolation = isolation; - if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) - continue; - Ignite g = startGrids(); IgniteCache cache = g.cache(DEFAULT_CACHE_NAME); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesPartitionedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesPartitionedSelfTest.java index a1d708bb8f301..9dda33d4cad6d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesPartitionedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesPartitionedSelfTest.java @@ -19,7 +19,6 @@ import org.apache.ignite.Ignite; import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.junit.Test; /** @@ -41,9 +40,4 @@ public class GridCacheEmptyEntriesPartitionedSelfTest extends GridCacheEmptyEntr @Override public void testFifo() throws Exception { super.testFifo(); } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java index 7b8730eed84ae..4c2ef66da531e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java @@ -32,9 +32,9 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -102,8 +102,6 @@ public void testReplicated() throws Exception { /** @throws Exception If failed. */ @Test public void testPartitioned() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - mode = PARTITIONED; nearEnabled = true; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java index 4ca536169bf68..8d5abf6665397 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java @@ -31,9 +31,9 @@ import org.apache.ignite.events.Event; import org.apache.ignite.events.EventType; import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; + import static java.util.concurrent.TimeUnit.SECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -61,8 +61,6 @@ public class GridCacheEvictionLockUnlockSelfTest extends GridCommonAbstractTest /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - IgniteConfiguration c = super.getConfiguration(igniteInstanceName); CacheConfiguration cc = defaultCacheConfiguration(); @@ -88,13 +86,6 @@ public class GridCacheEvictionLockUnlockSelfTest extends GridCommonAbstractTest return c; } - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - - super.beforeTestsStarted(); - } - /** @throws Exception If failed. */ @Test public void testReplicated() throws Exception { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java index 164b52ad4e370..fd139f778fee8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java @@ -37,7 +37,6 @@ import org.apache.ignite.configuration.TransactionConfiguration; import org.apache.ignite.internal.processors.cache.GridCacheGenericTestStore; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -57,8 +56,6 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration c = super.getConfiguration(igniteInstanceName); TransactionConfiguration txCfg = c.getTransactionConfiguration(); @@ -100,13 +97,6 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest { return c; } - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTestsStarted(); - } - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { plc = null; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearEvictionPolicySelfTest.java index db76ada7d3e98..641a73505786e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearEvictionPolicySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearEvictionPolicySelfTest.java @@ -26,12 +26,10 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC; @@ -94,17 +92,6 @@ public void testTransactionalNearEvictionMaxSize() throws Exception { checkNearEvictionMaxSize(); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187,https://issues.apache.org/jira/browse/IGNITE-7956") - @Test - public void testMvccTransactionalNearEvictionMaxSize() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - - checkNearEvictionMaxSize(); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java index 6aa9fd4d45a2e..f0f0842a87292 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java @@ -27,12 +27,10 @@ import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Ignore; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; @@ -97,18 +95,6 @@ public void testPartitionedTransactionalNearEvictionMaxSize() throws Exception { checkNearEvictionMaxSize(); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187,https://issues.apache.org/jira/browse/IGNITE-7956") - @Test - public void testPartitionedMvccTransactionalNearEvictionMaxSize() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - cacheMode = PARTITIONED; - - checkNearEvictionMaxSize(); - } - /** * @throws Exception If failed. */ @@ -131,18 +117,6 @@ public void testReplicatedTransactionalNearEvictionMaxSize() throws Exception { checkNearEvictionMaxSize(); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187,https://issues.apache.org/jira/browse/IGNITE-7956") - @Test - public void testReplicatedMvccTransactionalNearEvictionMaxSize() throws Exception { - atomicityMode = TRANSACTIONAL_SNAPSHOT; - cacheMode = REPLICATED; - - checkNearEvictionMaxSize(); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMetricTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMetricTest.java index 5299cda00b613..9f40cf4958431 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMetricTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMetricTest.java @@ -25,7 +25,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl; -import org.junit.Ignore; import org.junit.Test; /** @@ -50,15 +49,6 @@ public void testPageEvictionMetric() throws Exception { checkPageEvictionMetric(CacheAtomicityMode.ATOMIC); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10738") - @Test - public void testPageEvictionMetricMvcc() throws Exception { - checkPageEvictionMetric(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java index c28299488fce4..959fb7ab60405 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionMultinodeAbstractTest.java @@ -24,7 +24,6 @@ import org.apache.ignite.cache.CachePeekMode; import org.apache.ignite.cache.CacheWriteSynchronizationMode; import org.apache.ignite.configuration.CacheConfiguration; -import org.junit.Ignore; import org.junit.Test; /** @@ -80,21 +79,6 @@ public void testPageEviction() throws Exception { } } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10738") - @Test - public void testPageEvictionMvcc() throws Exception { - for (int i = 0; i < CACHE_MODES.length; i++) { - CacheConfiguration cfg = cacheConfig( - "evict" + i, null, CACHE_MODES[i], CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, - CacheWriteSynchronizationMode.FULL_SYNC); - - createCacheAndTestEviction(cfg); - } - } - /** * @param cfg Config. * @throws Exception If failed. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPagesRecyclingAndReusingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPagesRecyclingAndReusingTest.java index 47e1266b21b19..31445888763a8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPagesRecyclingAndReusingTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionPagesRecyclingAndReusingTest.java @@ -28,7 +28,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseList; -import org.junit.Ignore; import org.junit.Test; /** @@ -72,25 +71,6 @@ public void testPagesRecyclingAndReusingTxReplicated() throws Exception { testPagesRecyclingAndReusing(CacheAtomicityMode.TRANSACTIONAL, CacheMode.REPLICATED); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10738") - @Test - public void testPagesRecyclingAndReusingMvccTxPartitioned() throws Exception { - testPagesRecyclingAndReusing(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, CacheMode.PARTITIONED); - } - - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10738") - @Test - public void testPagesRecyclingAndReusingMvccTxReplicated() throws Exception { - testPagesRecyclingAndReusing(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, CacheMode.REPLICATED); - } - /** * @param atomicityMode Atomicity mode. * @param cacheMode Cache mode. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionReadThroughTest.java index 2e0d6adf13667..a064453408c56 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionReadThroughTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionReadThroughTest.java @@ -29,7 +29,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.DataPageEvictionMode; import org.apache.ignite.configuration.IgniteConfiguration; -import org.junit.Ignore; import org.junit.Test; /** @@ -57,24 +56,6 @@ public void testEvictionWithReadThroughTxReplicated() throws Exception { testEvictionWithReadThrough(CacheAtomicityMode.TRANSACTIONAL, CacheMode.REPLICATED); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582,https://issues.apache.org/jira/browse/IGNITE-7956") - @Test - public void testEvictionWithReadThroughMvccTxReplicated() throws Exception { - testEvictionWithReadThrough(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, CacheMode.REPLICATED); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582,https://issues.apache.org/jira/browse/IGNITE-7956") - @Test - public void testEvictionWithReadThroughMvccTxPartitioned() throws Exception { - testEvictionWithReadThrough(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, CacheMode.PARTITIONED); - } - /** * @param atomicityMode Atomicity mode. * @param cacheMode Cache mode. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionTouchOrderTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionTouchOrderTest.java index a8af7aaeb40be..742514b76547c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionTouchOrderTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionTouchOrderTest.java @@ -23,7 +23,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.DataPageEvictionMode; import org.apache.ignite.configuration.IgniteConfiguration; -import org.junit.Ignore; import org.junit.Test; /** @@ -60,24 +59,6 @@ public void testTouchOrderWithFairFifoEvictionTxReplicated() throws Exception { testTouchOrderWithFairFifoEviction(CacheAtomicityMode.TRANSACTIONAL, CacheMode.REPLICATED); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10738,https://issues.apache.org/jira/browse/IGNITE-7956") - @Test - public void testTouchOrderWithFairFifoEvictionMvccTxReplicated() throws Exception { - testTouchOrderWithFairFifoEviction(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, CacheMode.REPLICATED); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10738,https://issues.apache.org/jira/browse/IGNITE-7956") - @Test - public void testTouchOrderWithFairFifoEvictionMvccTxPartitioned() throws Exception { - testTouchOrderWithFairFifoEviction(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, CacheMode.PARTITIONED); - } - /** * @param atomicityMode Atomicity mode. * @param cacheMode Cache mode. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceAbstractTest.java index cedd77344347d..b658792b21ef5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionWithRebalanceAbstractTest.java @@ -23,7 +23,6 @@ import org.apache.ignite.cache.CachePeekMode; import org.apache.ignite.cache.CacheWriteSynchronizationMode; import org.apache.ignite.configuration.CacheConfiguration; -import org.junit.Ignore; import org.junit.Test; /** @@ -38,15 +37,6 @@ public void testEvictionWithRebalance() throws Exception { checkEvictionWithRebalance(CacheAtomicityMode.ATOMIC); } - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10738") - @Test - public void testEvictionWithRebalanceMvcc() throws Exception { - checkEvictionWithRebalance(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java index a3ce7b5c9c075..009372383da5f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java @@ -35,8 +35,6 @@ import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractTest; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import org.junit.Test; /** @@ -52,8 +50,6 @@ public abstract class IgniteCacheLoadAllAbstractTest extends IgniteCacheAbstract /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName); ccfg.setWriteThrough(writeThrough); @@ -65,16 +61,8 @@ public abstract class IgniteCacheLoadAllAbstractTest extends IgniteCacheAbstract return ccfg; } - /** */ - @Before - public void beforeIgniteCacheLoadAllAbstractTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - super.beforeTest(); storeMap = new ConcurrentHashMap<>(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLoaderWriterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLoaderWriterTest.java index 91b4b94e7a80e..d2b26f7cc01bf 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLoaderWriterTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxLoaderWriterTest.java @@ -19,10 +19,7 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -31,19 +28,6 @@ * */ public class IgniteCacheTxLoaderWriterTest extends IgniteCacheLoaderWriterAbstractTest { - /** */ - @Before - public void beforeIgniteCacheTxLoaderWriterTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - return super.cacheConfiguration(igniteInstanceName); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 3; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java index d6fee25e0bf1f..f5dc55521c392 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoLoadPreviousValueTest.java @@ -17,28 +17,12 @@ package org.apache.ignite.internal.processors.cache.integration; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; /** * */ public class IgniteCacheTxNearEnabledNoLoadPreviousValueTest extends IgniteCacheTxNoLoadPreviousValueTest { - /** */ - @Before - public void beforeIgniteCacheTxNearEnabledNoLoadPreviousValueTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - - return super.cacheConfiguration(igniteInstanceName); - } - /** {@inheritDoc} */ @Override protected NearCacheConfiguration nearConfiguration() { return new NearCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java index 60eaa1e2c98b2..52715c7919dc5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNearEnabledNoWriteThroughTest.java @@ -17,28 +17,12 @@ package org.apache.ignite.internal.processors.cache.integration; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; /** * */ public class IgniteCacheTxNearEnabledNoWriteThroughTest extends IgniteCacheTxNoWriteThroughTest { - /** */ - @Before - public void beforeIgniteCacheTxNearEnabledNoWriteThroughTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - - return super.cacheConfiguration(igniteInstanceName); - } - /** {@inheritDoc} */ @Override protected NearCacheConfiguration nearConfiguration() { return new NearCacheConfiguration(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java index 5c888485d044a..e26ac0ada5739 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoLoadPreviousValueTest.java @@ -19,10 +19,7 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -31,19 +28,6 @@ * */ public class IgniteCacheTxNoLoadPreviousValueTest extends IgniteCacheNoLoadPreviousValueAbstractTest { - /** */ - @Before - public void beforeIgniteCacheTxNoLoadPreviousValueTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - return super.cacheConfiguration(igniteInstanceName); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 3; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoReadThroughTest.java index 19c18cce594c1..0298b19ade3b0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoReadThroughTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoReadThroughTest.java @@ -19,10 +19,7 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -31,19 +28,6 @@ * */ public class IgniteCacheTxNoReadThroughTest extends IgniteCacheNoReadThroughAbstractTest { - /** */ - @Before - public void beforeIgniteCacheTxNoReadThroughTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - return super.cacheConfiguration(igniteInstanceName); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 3; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoWriteThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoWriteThroughTest.java index f7e0ddad30f19..0d04e4ed015fa 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoWriteThroughTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxNoWriteThroughTest.java @@ -19,10 +19,7 @@ import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -31,19 +28,6 @@ * */ public class IgniteCacheTxNoWriteThroughTest extends IgniteCacheNoWriteThroughAbstractTest { - /** */ - @Before - public void beforeIgniteCacheTxNoWriteThroughTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - return super.cacheConfiguration(igniteInstanceName); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 3; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java index 9a574c0347c67..d878e5e62e16d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java @@ -23,14 +23,11 @@ import org.apache.ignite.IgniteTransactions; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -42,19 +39,6 @@ * */ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstractTest { - /** */ - @Before - public void beforeIgniteCacheTxStoreSessionTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - return super.cacheConfiguration(igniteInstanceName); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 3; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java index b9339935098b6..1bdd04291ed45 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java @@ -22,8 +22,6 @@ import javax.cache.integration.CacheWriterException; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -32,12 +30,6 @@ * parameter. */ public class IgniteCacheTxStoreSessionWriteBehindCoalescingTest extends IgniteCacheStoreSessionWriteBehindAbstractTest { - /** */ - @Before - public void beforeIgniteCacheTxStoreSessionWriteBehindCoalescingTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; @@ -50,8 +42,6 @@ public void beforeIgniteCacheTxStoreSessionWriteBehindCoalescingTest() { */ @SuppressWarnings("unchecked") @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName); ccfg.setWriteBehindCoalescing(false); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindTest.java index 798fcae706566..553d27f36dba5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindTest.java @@ -18,9 +18,6 @@ package org.apache.ignite.internal.processors.cache.integration; import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -28,19 +25,6 @@ * */ public class IgniteCacheTxStoreSessionWriteBehindTest extends IgniteCacheStoreSessionWriteBehindAbstractTest { - /** */ - @Before - public void beforeIgniteCacheTxStoreSessionWriteBehindTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - return super.cacheConfiguration(igniteInstanceName); - } - /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractBasicCoordinatorFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractBasicCoordinatorFailoverTest.java deleted file mode 100644 index 42bed2a59249c..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractBasicCoordinatorFailoverTest.java +++ /dev/null @@ -1,870 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import java.util.concurrent.Callable; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; -import javax.cache.Cache; -import javax.cache.CacheException; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.query.QueryCursor; -import org.apache.ignite.cache.query.ScanQuery; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.cluster.ClusterTopologyException; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.TestRecordingCommunicationSpi; -import org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager; -import org.apache.ignite.internal.processors.cache.distributed.TestCacheNodeExcludingFilter; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest; -import org.apache.ignite.internal.processors.cache.mvcc.msg.MvccSnapshotResponse; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteBiInClosure; -import org.apache.ignite.lang.IgniteBiPredicate; -import org.apache.ignite.lang.IgniteInClosure; -import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; -import org.jetbrains.annotations.Nullable; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Base class for Mvcc coordinator failover test. - */ -public abstract class CacheMvccAbstractBasicCoordinatorFailoverTest extends CacheMvccAbstractTest { - /** - * @param concurrency Transaction concurrency. - * @param isolation Transaction isolation. - * @throws Exception If failed. - */ - @SuppressWarnings("unchecked") - protected void coordinatorFailureSimple( - final TransactionConcurrency concurrency, - final TransactionIsolation isolation, - ReadMode readMode, - WriteMode writeMode - ) throws Exception { - assert concurrency == PESSIMISTIC && isolation == REPEATABLE_READ; - - testSpi = true; - - startGrids(3); - - client = true; - - final Ignite client = startGrid(3); - - final IgniteCache cache = client.createCache( - cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class)); - - final Integer key1 = primaryKey(jcache(1)); - final Integer key2 = primaryKey(jcache(2)); - - TestRecordingCommunicationSpi crdSpi = TestRecordingCommunicationSpi.spi(ignite(0)); - - crdSpi.blockMessages(MvccSnapshotResponse.class, client.name()); - - IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable() { - @Override public Object call() throws Exception { - try { - try (Transaction tx = client.transactions().txStart(concurrency, isolation)) { - writeByMode(cache, key1, 1, writeMode, INTEGER_CODEC); - writeByMode(cache, key2, 2, writeMode, INTEGER_CODEC); - - tx.commit(); - } - - fail(); - } - catch (ClusterTopologyException e) { - info("Expected exception: " + e); - } - catch (CacheException e) { - info("Expected exception: " + e); - } - catch (Throwable e) { - fail("Unexpected exception: " + e); - } - - return null; - } - }, "tx-thread"); - - crdSpi.waitForBlocked(); - - stopGrid(0); - - fut.get(); - - assertNull(readByMode(cache, key1, readMode, INTEGER_CODEC)); - assertNull(readByMode(cache, key2, readMode, INTEGER_CODEC)); - - try (Transaction tx = client.transactions().txStart(concurrency, isolation)) { - writeByMode(cache, key1, 1, writeMode, INTEGER_CODEC); - writeByMode(cache, key2, 2, writeMode, INTEGER_CODEC); - - tx.commit(); - } - - assertEquals(1, readByMode(cache, key1, readMode, INTEGER_CODEC)); - assertEquals(2, readByMode(cache, key2, readMode, INTEGER_CODEC)); - } - - /** - * @param readDelay {@code True} if delays get requests. - * @param readInTx {@code True} to read inside transaction. - * @throws Exception If failed. - */ - @SuppressWarnings("unchecked") - protected void readInProgressCoordinatorFails(boolean readDelay, - final boolean readInTx, - final TransactionConcurrency concurrency, - final TransactionIsolation isolation, - ReadMode readMode, - WriteMode writeMode, - @Nullable IgniteInClosure cfgC) throws Exception { - final int COORD_NODES = 5; - final int SRV_NODES = 4; - - if (readDelay) - testSpi = true; - - startGrids(COORD_NODES); - - startGridsMultiThreaded(COORD_NODES, SRV_NODES); - - client = true; - - Ignite client = startGrid(COORD_NODES + SRV_NODES); - - final List cacheNames = new ArrayList<>(); - - final int KEYS = 100; - - final Map vals = new LinkedHashMap<>(); - - for (int i = 0; i < KEYS; i++) - vals.put(i, 0); - - String[] exclude = new String[COORD_NODES]; - - for (int i = 0; i < COORD_NODES; i++) - exclude[i] = testNodeName(i); - - for (CacheConfiguration ccfg : cacheConfigurations()) { - ccfg.setName("cache-" + cacheNames.size()); - - if (cfgC != null) - cfgC.apply(ccfg); - - // First server nodes are 'dedicated' coordinators. - ccfg.setNodeFilter(new TestCacheNodeExcludingFilter(exclude)); - - cacheNames.add(ccfg.getName()); - - IgniteCache cache = client.createCache(ccfg); - - boolean updated = false; - - while (!updated) { - try (Transaction tx = client.transactions().txStart(concurrency, isolation)) { - tx.timeout(TX_TIMEOUT); - - writeAllByMode(cache, vals, writeMode, INTEGER_CODEC); - - tx.commit(); - - updated = true; - } - catch (Exception e) { - handleTxException(e); - } - } - } - - if (readDelay) { - for (int i = COORD_NODES; i < COORD_NODES + SRV_NODES + 1; i++) { - TestRecordingCommunicationSpi.spi(ignite(i)).closure(new IgniteBiInClosure() { - @Override public void apply(ClusterNode node, Message msg) { - if (msg instanceof GridNearGetRequest) - doSleep(ThreadLocalRandom.current().nextLong(50) + 1); - } - }); - } - } - - final AtomicBoolean done = new AtomicBoolean(); - - try { - final AtomicInteger readNodeIdx = new AtomicInteger(0); - - IgniteInternalFuture getFut = GridTestUtils.runMultiThreadedAsync(new Callable() { - @Override public Void call() throws Exception { - try { - Ignite node = ignite(COORD_NODES + (readNodeIdx.getAndIncrement() % (SRV_NODES + 1))); - - int cnt = 0; - - while (!done.get() && !Thread.currentThread().isInterrupted()) { - for (String cacheName : cacheNames) { - IgniteCache cache = node.cache(cacheName); - - Map res = null; - - if (readInTx) { - try (Transaction tx = node.transactions().txStart(concurrency, isolation)) { - tx.timeout(TX_TIMEOUT); - - res = readAllByMode(cache, vals.keySet(), readMode, INTEGER_CODEC); - - tx.commit(); - } - catch (Exception e) { // TODO Remove catch clause when IGNITE-8841 implemented. - handleTxException(e); - } - } - else - res = readAllByMode(cache, vals.keySet(), readMode, INTEGER_CODEC); - - if (readInTx) { // TODO IGNITE-8841 - assertTrue( - "res.size=" + (res == null ? 0 : res.size()) + ", res=" + res, - res == null || vals.size() == res.size() - ); - } - else { - assertEquals(vals.size(), res.size()); - - Integer val0 = null; - - for (Integer val : res.values()) { - if (val0 == null) - val0 = val; - else - assertEquals(val0, val); - } - } - } - - cnt++; - } - - log.info("Finished [node=" + node.name() + ", readCnt=" + cnt + ']'); - - return null; - } - catch (Throwable e) { - error("Unexpected error: " + e, e); - - throw e; - } - } - }, ((SRV_NODES + 1) + 1) * 2, "get-thread"); - - IgniteInternalFuture putFut1 = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - Ignite node = ignite(COORD_NODES); - - List caches = new ArrayList<>(); - - for (String cacheName : cacheNames) - caches.add(node.cache(cacheName)); - - Integer val = 1; - - while (!done.get()) { - Map vals = new LinkedHashMap<>(); - - for (int i = 0; i < KEYS; i++) - vals.put(i, val); - - for (IgniteCache cache : caches) { - try { - try (Transaction tx = node.transactions().txStart(concurrency, isolation)) { - tx.timeout(TX_TIMEOUT); - - writeAllByMode(cache, vals, writeMode, INTEGER_CODEC); - - tx.commit(); - } - } - catch (Exception e) { - handleTxException(e); - } - } - - val++; - } - - return null; - } - }, "putAll-thread"); - - IgniteInternalFuture putFut2 = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - Ignite node = ignite(COORD_NODES); - - IgniteCache cache = node.cache(cacheNames.get(0)); - - Integer val = 0; - - while (!done.get()) { - try { - try (Transaction tx = node.transactions().txStart(concurrency, isolation)) { - tx.timeout(TX_TIMEOUT); - - writeByMode(cache, Integer.MAX_VALUE, val, writeMode, INTEGER_CODEC); - - tx.commit(); - } - } - catch (Exception e) { - handleTxException(e); - } - - val++; - } - - return null; - } - }, "put-thread"); - - for (int i = 0; i < COORD_NODES && !getFut.isDone(); i++) { - U.sleep(3000); - - stopGrid(i); - - awaitPartitionMapExchange(); - } - - done.set(true); - - getFut.get(); - putFut1.get(); - putFut2.get(); - - for (Ignite node : G.allGrids()) - checkActiveQueriesCleanup(node); - } - finally { - done.set(true); - } - } - - /** - * @param concurrency Tx concurrency level. - * @param isolation Tx isolation level. - * @param cfgC Cache cfg closure. - * @param readMode Read mode. - * @param writeMode Write mode. - * @throws Exception If failed. - */ - protected void txInProgressCoordinatorChangeSimple( - final TransactionConcurrency concurrency, - final TransactionIsolation isolation, - @Nullable IgniteInClosure cfgC, - ReadMode readMode, - WriteMode writeMode) throws Exception { - MvccProcessorImpl.coordinatorAssignClosure(new CoordinatorAssignClosure()); - - Ignite srv0 = startGrids(4); - - client = true; - - startGrid(4); - - client = false; - - nodeAttr = CRD_ATTR; - - int crdIdx = 5; - - startGrid(crdIdx); - - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT). - setNodeFilter(new CoordinatorNodeFilter()); - - if (cfgC != null) - cfgC.apply(ccfg); - - srv0.createCache(ccfg); - - Set keys = F.asSet(1, 2, 3); - - for (int i = 0; i < 5; i++) { - Ignite node = ignite(i); - - info("Test with node: " + node.name()); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = node.transactions().txStart(concurrency, isolation)) { - assertTrue(readAllByMode(cache, keys, readMode, INTEGER_CODEC).isEmpty()); - - startGrid(crdIdx + 1); - - stopGrid(crdIdx); - - crdIdx++; - - tx.commit(); - } - catch (Exception e) { - handleTxException(e); - } - - checkActiveQueriesCleanup(ignite(crdIdx)); - } - } - - /** - * @param fromClient {@code True} if read from client node, otherwise from server node. - * @throws Exception If failed. - */ - protected void readInProgressCoordinatorFailsSimple(boolean fromClient, - @Nullable IgniteInClosure cfgC, - ReadMode readMode, - WriteMode writeMode) throws Exception { - for (boolean readInTx : new boolean[]{false, true}) { - for (int i = 1; i <= 3; i++) { - readInProgressCoordinatorFailsSimple(fromClient, i, readInTx, cfgC, readMode, writeMode); - - afterTest(); - } - } - } - - /** - * @param fromClient {@code True} if read from client node, otherwise from server node. - * @param crdChangeCnt Number of coordinator changes. - * @param readInTx {@code True} to read inside transaction. - * @param cfgC Cache configuration closure. - * @param readMode Read mode. - * @param writeMode Write mode. - * @throws Exception If failed. - */ - @SuppressWarnings("unchecked") - private void readInProgressCoordinatorFailsSimple(boolean fromClient, - int crdChangeCnt, - final boolean readInTx, - @Nullable IgniteInClosure cfgC, - ReadMode readMode, - WriteMode writeMode) throws Exception { - info("readInProgressCoordinatorFailsSimple [fromClient=" + fromClient + - ", crdChangeCnt=" + crdChangeCnt + - ", readInTx=" + readInTx + ']'); - - testSpi = true; - - client = false; - - final int SRVS = 3; - final int COORDS = crdChangeCnt + 1; - - startGrids(SRVS + COORDS); - - client = true; - - assertTrue(startGrid(SRVS + COORDS).configuration().isClientMode()); - - final Ignite getNode = fromClient ? ignite(SRVS + COORDS) : ignite(COORDS); - - String[] excludeNodes = new String[COORDS]; - - for (int i = 0; i < COORDS; i++) - excludeNodes[i] = testNodeName(i); - - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT). - setNodeFilter(new TestCacheNodeExcludingFilter(excludeNodes)); - - if (cfgC != null) - cfgC.apply(ccfg); - - final IgniteCache cache = getNode.createCache(ccfg); - - final Set keys = new TreeSet<>(); - - List keys1 = primaryKeys(jcache(COORDS), 10); - List keys2 = primaryKeys(jcache(COORDS + 1), 10); - - keys.addAll(keys1); - keys.addAll(keys2); - - Map vals = new LinkedHashMap(); - - for (Integer key : keys) - vals.put(key, -1); - - try (Transaction tx = getNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - writeAllByMode(cache, vals, writeMode, INTEGER_CODEC); - - tx.commit(); - } - - final TestRecordingCommunicationSpi getNodeSpi = TestRecordingCommunicationSpi.spi(getNode); - - getNodeSpi.blockMessages(new IgniteBiPredicate() { - @Override public boolean apply(ClusterNode node, Message msg) { - String msgClsName = msg.getClass().getSimpleName(); - - return msgClsName.matches("GridNearGetRequest|GridH2QueryRequest|GridCacheQueryRequest"); - } - }); - - IgniteInternalFuture getFut = GridTestUtils.runAsync(new Callable() { - @Override public Object call() throws Exception { - Map res = null; - - if (readInTx) { - try (Transaction tx = getNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - res = readAllByMode(cache, keys, readMode, INTEGER_CODEC); - - tx.rollback(); - } - catch (Exception e) { - handleTxException(e); - } - } - else - res = readAllByMode(cache, keys, readMode, INTEGER_CODEC); - - assertTrue((res != null || readInTx) || (res != null && 20 == res.size())); - - if (res != null) { - Integer val = null; - - for (Integer val0 : res.values()) { - assertNotNull(val0); - - if (val == null) - val = val0; - else - assertEquals("res=" + res, val, val0); - } - } - - return null; - } - }, "get-thread"); - - getNodeSpi.waitForBlocked(); - - for (int i = 0; i < crdChangeCnt; i++) - stopGrid(i); - - for (int i = 0; i < 10; i++) { - vals = new LinkedHashMap(); - - for (Integer key : keys) - vals.put(key, i); - - while (true) { - try (Transaction tx = getNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - writeAllByMode(cache, vals, writeMode, INTEGER_CODEC); - - tx.commit(); - - break; - } - catch (Exception e) { - handleTxException(e); - } - } - } - - getNodeSpi.stopBlock(true); - - getFut.get(); - - for (Ignite node : G.allGrids()) - checkActiveQueriesCleanup(node); - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("unchecked") - protected void checkCoordinatorChangeActiveQueryClientFails_Simple(@Nullable IgniteInClosure cfgC, - ReadMode readMode, - WriteMode writeMode) throws Exception { - testSpi = true; - - client = false; - - final int SRVS = 3; - final int COORDS = 1; - - startGrids(SRVS + COORDS); - - client = true; - - Ignite client = startGrid(SRVS + COORDS); - - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT). - setNodeFilter(new TestCacheNodeExcludingFilter(testNodeName(0))); - - if (cfgC != null) - cfgC.apply(ccfg); - - final IgniteCache cache = client.createCache(ccfg); - - final Map vals = new LinkedHashMap<>(); - - for (int i = 0; i < 100; i++) - vals.put(i, i); - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - writeAllByMode(cache, vals, writeMode, INTEGER_CODEC); - - tx.commit(); - } - - final TestRecordingCommunicationSpi clientSpi = TestRecordingCommunicationSpi.spi(client); - - clientSpi.blockMessages(new IgniteBiPredicate() { - @Override public boolean apply(ClusterNode node, Message msg) { - String msgClsName = msg.getClass().getSimpleName(); - - return msgClsName.matches("GridNearGetRequest|GridH2QueryRequest|GridCacheQueryRequest"); - } - }); - - IgniteInternalFuture getFut = GridTestUtils.runAsync(new Callable() { - @Override public Object call() throws Exception { - Map res = readAllByMode(cache, vals.keySet(), readMode, INTEGER_CODEC); - - assertEquals(vals, res); - - return null; - } - }, "get-thread"); - - clientSpi.waitForBlocked(); - - stopGrid(0); - - clientSpi.stopBlock(true); - - getFut.get(); - - for (Ignite node : G.allGrids()) - checkActiveQueriesCleanup(node); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMultipleCoordinatorsLeft2Persistence() throws Exception { - persistence = true; - - checkCoordinatorsLeft(2, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMultipleCoordinatorsLeft3Persistence() throws Exception { - persistence = true; - - checkCoordinatorsLeft(3, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMultipleCoordinatorsLeft4() throws Exception { - checkCoordinatorsLeft(4, true); - } - - /** - * @param num Number of coordinators to stop. - * @throws Exception If failed. - */ - @SuppressWarnings("unchecked") - private void checkCoordinatorsLeft(int num, boolean stopCrdFirst) throws Exception { - disableScheduledVacuum = true; - - final int DATA_NODES = 3; - - final int NODES = num + DATA_NODES; - - nodeAttr = CRD_ATTR; - - // Do not use startMultithreaded here. - startGrids(num); - - nodeAttr = null; - - startGridsMultiThreaded(num, DATA_NODES); - - List victims = new ArrayList<>(num); - List survivors = new ArrayList<>(DATA_NODES); - - for (int i = 0; i < NODES; i++) { - if (i < num) - victims.add(grid(i)); - else - survivors.add(grid(i)); - } - - if (log.isInfoEnabled()) { - log.info("Nodes to be stopped [" + - victims.stream(). - map(n -> n.cluster().localNode().id().toString()) - .collect(Collectors.joining(", ")) + ']'); - - log.info("Nodes not to be stopped [" + - survivors.stream(). - map(n -> n.cluster().localNode().id().toString()) - .collect(Collectors.joining(", ")) + ']'); - } - - Ignite nearNode = survivors.get(0); - - if (persistence) - nearNode.cluster().state(ClusterState.ACTIVE); - - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, DATA_NODES - 1, DFLT_PARTITION_COUNT) - .setNodeFilter(new CoordinatorNodeFilter()); - - IgniteCache cache = nearNode.createCache(ccfg); - - try (Transaction tx = nearNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int key = 0; key < 10; key++) - cache.put(key, 1); - - tx.commit(); - } - - List stopThreads = victims.stream() - .map(v -> new Thread(() -> stopGrid(v.name()))) - .collect(Collectors.toList()); - - ScanQuery scan = new ScanQuery<>(); - - QueryCursor> cur = survivors.get(0).cache(DEFAULT_CACHE_NAME).query(scan); - - Iterator> it = cur.iterator(); - - assertTrue(it.hasNext()); - assertEquals(1, it.next().getValue()); - - if (log.isInfoEnabled()) - log.info("Start stopping nodes."); - - // Stop nodes and join threads. - if (stopCrdFirst) { - for (Thread t : stopThreads) - t.start(); - } - else { - // We should stop the oldest node last. - GridCachePartitionExchangeManager exch = ((IgniteEx)survivors.get(1)).context().cache().context().exchange(); - - GridDhtTopologyFuture lastFinished = exch.lastFinishedFuture(); - - for (int i = 1; i < stopThreads.size(); i++) - stopThreads.get(i).start(); - - while (lastFinished == exch.lastTopologyFuture()) - doSleep(1); - - stopThreads.get(0).start(); - } - - for (Thread t : stopThreads) - t.join(); - - if (log.isInfoEnabled()) - log.info("All nodes stopped."); - - assertTrue(it.hasNext()); - assertEquals(1, it.next().getValue()); - - for (Ignite node : survivors) { - for (int key = 0; key < 10; key++) - assertEquals(1, node.cache(DEFAULT_CACHE_NAME).get(key)); - } - - try (Transaction tx = nearNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int key = 0; key < 10; key++) - cache.put(key, 2); - - tx.commit(); - } - catch (Exception e) { - stopAllGrids(true); - - fail(X.getFullStackTrace(e)); - } - - for (Ignite node : survivors) { - for (int key = 0; key < 10; key++) - assertEquals(2, node.cache(DEFAULT_CACHE_NAME).get(key)); - } - - try (Transaction tx = nearNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int key = 0; key < 10; key++) - cache.put(key, 3); - - tx.commit(); - } - catch (Exception e) { - stopAllGrids(true); - - fail(X.getFullStackTrace(e)); - } - - for (Ignite node : survivors) { - for (int key = 0; key < 10; key++) - assertEquals(3, node.cache(DEFAULT_CACHE_NAME).get(key)); - } - - while (it.hasNext()) - assertEquals(1, (int)it.next().getValue()); - - cur.close(); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractCoordinatorFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractCoordinatorFailoverTest.java deleted file mode 100644 index 97184df584156..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractCoordinatorFailoverTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.junit.Test; - -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.GET; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SCAN; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.PUT; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Mvcc cache API coordinator failover test. - */ -public abstract class CacheMvccAbstractCoordinatorFailoverTest extends CacheMvccAbstractBasicCoordinatorFailoverTest { - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGet_Server_Backups0_CoordinatorFails_Persistence() throws Exception { - persistence = true; - - accountsTxReadAll(2, 0, 0, 64, - null, true, GET, PUT, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGet_SingleNode_CoordinatorFails() throws Exception { - accountsTxReadAll(1, 0, 0, 1, - null, true, GET, PUT, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_Server_Backups0_CoordinatorFails() throws Exception { - accountsTxReadAll(2, 0, 0, 64, - null, true, SCAN, PUT, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_SingleNode_CoordinatorFails_Persistence() throws Exception { - persistence = true; - - accountsTxReadAll(1, 0, 0, 1, - null, true, SCAN, PUT, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_Server_Backups0_RestartCoordinator_GetPut() throws Exception { - putAllGetAll(RestartMode.RESTART_CRD, 2, 0, 0, 64, - null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_SingleNode_RestartCoordinator_GetPut_Persistence() throws Exception { - persistence = true; - - putAllGetAll(RestartMode.RESTART_CRD, 1, 0, 0, 1, - null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_Servers_Backups0__PutGet_CoordinatorFails_Persistence() throws Exception { - persistence = true; - - updateNObjectsTest(5, 2, 0, 0, 64, DFLT_TEST_TIME, - null, GET, PUT, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_SingleNode__PutGet_CoordinatorFails() throws Exception { - updateNObjectsTest(7, 1, 0, 0, 1, DFLT_TEST_TIME, - null, GET, PUT, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCoordinatorFailureSimplePessimisticTxPutGet() throws Exception { - coordinatorFailureSimple(PESSIMISTIC, REPEATABLE_READ, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testReadInProgressCoordinatorFailsSimple_FromClientPutGet() throws Exception { - readInProgressCoordinatorFailsSimple(true, null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCoordinatorChangeActiveQueryClientFails_Simple() throws Exception { - checkCoordinatorChangeActiveQueryClientFails_Simple(null, GET, PUT); - } - -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractFeatureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractFeatureTest.java deleted file mode 100644 index 47de24cd82181..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractFeatureTest.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import javax.cache.Cache; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteException; -import org.apache.ignite.IgniteInterruptedException; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.annotations.QuerySqlField; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.util.lang.IgniteClosure2X; -import org.apache.ignite.internal.util.lang.IgnitePair; -import org.apache.ignite.internal.util.tostring.GridToStringInclude; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.transactions.Transaction; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * Test that checks - */ -public abstract class CacheMvccAbstractFeatureTest extends CacheMvccAbstractTest { - /** */ - private static final String CACHE_NAME = "Person"; - - /** */ - private static Ignite node; - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - cleanPersistenceDir(); - - startGrids(4); - - node = grid(0); - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - node = null; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - CacheConfiguration ccfg = new CacheConfiguration<>(CACHE_NAME); - - ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - - ccfg.setIndexedTypes(Integer.class, Person.class); - - node.createCache(ccfg); - - for (int i = 0; i < 100; i++) - cache().put(i, new Person("Name" + i, "LastName" + i)); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - node.destroyCache(CACHE_NAME); - } - - /** - * @param clo Closure to check consistency upon. - * @throws Exception if failed. - */ - void doTestConsistency(IgniteClosure2X clo) throws Exception { - ExecutorService svc = Executors.newFixedThreadPool(2); - - CountDownLatch startLatch = new CountDownLatch(1); - - CountDownLatch endLatch = new CountDownLatch(1); - - try { - Future> fut = svc.submit(new Callable>() { - @Override public IgnitePair call() { - try (Transaction ignored = node.transactions().txStart()) { - // First result that we'll later check w/respect to REPEATABLE READ semantic. - Object res1 = clo.apply(null, null); - - Object res2 = clo.apply(startLatch, endLatch); - - return new IgnitePair<>(res1, res2); - } - } - }); - - svc.submit(new Runnable() { - @Override public void run() { - try { - startLatch.await(); - } - catch (InterruptedException e) { - throw new IgniteInterruptedException(e); - } - - try { - modifyData(jdbcTx()); - } - catch (SQLException e) { - throw new IgniteException(e); - } - - endLatch.countDown(); - } - }).get(); - - IgnitePair res2 = fut.get(); - - assertEquals(res2.get1(), res2.get2()); - } - finally { - svc.shutdown(); - } - } - - /** - * @return Whether native or SQL transactions must be used. - */ - boolean jdbcTx() { - return false; - } - - /** - * @param jdbcTx Whether concurrent transaction must be of SQL type. - */ - private void modifyData(boolean jdbcTx) throws SQLException { - Set keys = new HashSet<>(10); - - for (int i = 0; i < 10; i++) { - int idx; - - do { - idx = (int)(Math.random() * 100); - } - while (!keys.add(idx)); - } - - if (!jdbcTx) { - try (Transaction ignored = node.transactions().txStart()) { - for (int idx : keys) { - boolean rmv = Math.random() > 0.5; - - if (rmv) - cache().remove(idx); - else { - Person p = cache().get(idx); - - cache().put(idx, new Person(p.fName, p.fName + "Updated")); - } - } - } - } - else { - try (Connection c = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1")) { - c.setAutoCommit(false); - - for (int idx : keys) { - boolean rmv = Math.random() > 0.5; - - if (rmv) { - try (Statement s = c.createStatement()) { - s.execute("DELETE FROM \"Person\".PERSON WHERE _key = " + idx); - } - } - else { - try (Statement s = c.createStatement()) { - s.execute("UPDATE \"Person\".PERSON SET lname = concat(lname, 'Updated')" + - "WHERE _key = " + idx); - } - } - } - - try (Statement s = c.createStatement()) { - s.execute("COMMIT"); - } - } - } - } - - /** - * @return Cache. - */ - IgniteCache cache() { - return node.cache(CACHE_NAME); - } - - /** - * - */ - static class Person implements Serializable { - /** */ - @GridToStringInclude - @QuerySqlField(index = true, groups = "full_name") - private String fName; - - /** */ - @GridToStringInclude - @QuerySqlField(index = true, groups = "full_name") - private String lName; - - /** - * @param fName First name. - * @param lName Last name. - */ - public Person(String fName, String lName) { - this.fName = fName; - this.lName = lName; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(Person.class, this); - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (o == null || getClass() != o.getClass()) - return false; - - Person person = (Person)o; - - return Objects.equals(fName, person.fName) && - Objects.equals(lName, person.lName); - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return Objects.hash(fName, lName); - } - } - - /** */ - static final Comparator> ENTRY_CMP = - new Comparator>() { - @Override public int compare(Cache.Entry o1, Cache.Entry o2) { - return o1.getKey().compareTo(o2.getKey()); - } - }; - - /** - * - */ - static List entriesToPersons(List> entries) { - entries.sort(ENTRY_CMP); - - List res = new ArrayList<>(); - - for (Cache.Entry e : entries) - res.add(e.getValue()); - - return res; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java deleted file mode 100644 index 2880e4fe1a06d..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java +++ /dev/null @@ -1,2447 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; -import java.util.concurrent.Callable; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.stream.Collectors; -import javax.cache.Cache; -import javax.cache.CacheException; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.CacheWriteSynchronizationMode; -import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; -import org.apache.ignite.cache.query.FieldsQueryCursor; -import org.apache.ignite.cache.query.QueryCursor; -import org.apache.ignite.cache.query.ScanQuery; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cache.query.SqlQuery; -import org.apache.ignite.cache.query.annotations.QuerySqlField; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.cluster.ClusterTopologyException; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.DataRegionConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.TransactionConfiguration; -import org.apache.ignite.configuration.WALMode; -import org.apache.ignite.failure.StopNodeFailureHandler; -import org.apache.ignite.internal.GridKernalContext; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteFutureCancelledCheckedException; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.TestRecordingCommunicationSpi; -import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; -import org.apache.ignite.internal.processors.cache.KeyCacheObject; -import org.apache.ignite.internal.processors.query.IgniteSQLException; -import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException; -import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException; -import org.apache.ignite.internal.util.future.GridCompoundIdentityFuture; -import org.apache.ignite.internal.util.lang.GridAbsPredicate; -import org.apache.ignite.internal.util.lang.GridCloseableIterator; -import org.apache.ignite.internal.util.lang.GridInClosure3; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteBiPredicate; -import org.apache.ignite.lang.IgniteBiTuple; -import org.apache.ignite.lang.IgniteClosure; -import org.apache.ignite.lang.IgniteInClosure; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionException; -import org.apache.ignite.transactions.TransactionIsolation; -import org.apache.ignite.transactions.TransactionSerializationException; -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.cache.CacheMode.REPLICATED; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL_SUM; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.DML; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * - */ -public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest { - /** */ - protected static final ObjectCodec INTEGER_CODEC = new IntegerCodec(); - - /** */ - protected static final ObjectCodec ACCOUNT_CODEC = new AccountCodec(); - - /** */ - static final int DFLT_PARTITION_COUNT = RendezvousAffinityFunction.DFLT_PARTITION_COUNT; - - /** */ - static final String CRD_ATTR = "testCrd"; - - /** */ - static final long DFLT_TEST_TIME = SF.applyLB(30_000, 3_000); - - /** */ - protected static final int PAGE_SIZE = DataStorageConfiguration.DFLT_PAGE_SIZE; - - /** */ - protected static final int SRVS = 4; - - /** */ - protected boolean client; - - /** */ - protected boolean testSpi; - - /** */ - protected String nodeAttr; - - /** */ - protected boolean persistence; - - /** */ - protected CacheConfiguration ccfg; - - /** */ - protected CacheConfiguration[] ccfgs; - - /** */ - protected boolean disableScheduledVacuum; - - /** */ - protected static final int TX_TIMEOUT = 3000; - - /** - * @return Cache mode. - */ - protected abstract CacheMode cacheMode(); - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - cfg.setFailureHandler(new StopNodeFailureHandler()); - - if (disableScheduledVacuum) - cfg.setMvccVacuumFrequency(Integer.MAX_VALUE); - - if (testSpi) - cfg.setCommunicationSpi(new TestRecordingCommunicationSpi()); - - ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); - - cfg.setClientMode(client); - - assert (ccfg == null) || (ccfgs == null); - - if (ccfg != null) - cfg.setCacheConfiguration(ccfg); - - if (ccfgs != null) - cfg.setCacheConfiguration(ccfgs); - - if (nodeAttr != null) - cfg.setUserAttributes(F.asMap(nodeAttr, true)); - - DataStorageConfiguration storageCfg = new DataStorageConfiguration(); - - storageCfg.setWalMode(WALMode.LOG_ONLY); - storageCfg.setPageSize(PAGE_SIZE); - - DataRegionConfiguration regionCfg = new DataRegionConfiguration(); - - regionCfg.setPersistenceEnabled(persistence); - regionCfg.setMaxSize(64L * 1024 * 1024); - - storageCfg.setDefaultDataRegionConfiguration(regionCfg); - - cfg.setDataStorageConfiguration(storageCfg); - - cfg.setConsistentId(gridName); - - cfg.setTransactionConfiguration(new TransactionConfiguration() - .setDefaultTxConcurrency(TransactionConcurrency.PESSIMISTIC) - .setDefaultTxIsolation(TransactionIsolation.REPEATABLE_READ)); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected long getTestTimeout() { - return DFLT_TEST_TIME + 60_000; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - ccfg = null; - ccfgs = null; - - MvccProcessorImpl.coordinatorAssignClosure(null); - - cleanPersistenceDir(); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - persistence = false; - - try { - verifyOldVersionsCleaned(); - - verifyCoordinatorInternalState(); - } - finally { - stopAllGrids(); - - MvccProcessorImpl.coordinatorAssignClosure(null); - - cleanPersistenceDir(); - } - - super.afterTest(); - } - - /** - * @param cfgC Optional closure applied to cache configuration. - * @throws Exception If failed. - */ - final void cacheRecreate(@Nullable IgniteInClosure cfgC) throws Exception { - Ignite srv0 = startGrid(0); - - final int PARTS = 64; - - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, PARTS); - - if (cfgC != null) - cfgC.apply(ccfg); - - IgniteCache cache = (IgniteCache)srv0.createCache(ccfg); - - for (int k = 0; k < PARTS * 2; k++) { - assertNull(cache.get(k)); - - int vals = k % 3 + 1; - - for (int v = 0; v < vals; v++) - cache.put(k, new MvccTestAccount(v, 1)); - - assertEquals(vals - 1, cache.get(k).val); - } - - srv0.destroyCache(cache.getName()); - - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, PARTS); - - if (cfgC != null) - cfgC.apply(ccfg); - - cache = (IgniteCache)srv0.createCache(ccfg); - - for (int k = 0; k < PARTS * 2; k++) { - assertNull(cache.get(k)); - - int vals = k % 3 + 2; - - for (int v = 0; v < vals; v++) - cache.put(k, new MvccTestAccount(v + 100, 1)); - - assertEquals(vals - 1 + 100, cache.get(k).val); - } - - srv0.destroyCache(cache.getName()); - - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, PARTS); - - IgniteCache cache0 = (IgniteCache)srv0.createCache(ccfg); - - for (long k = 0; k < PARTS * 2; k++) { - assertNull(cache0.get(k)); - - int vals = (int)(k % 3 + 2); - - for (long v = 0; v < vals; v++) - cache0.put(k, v); - - assertEquals((long)(vals - 1), (Object)cache0.get(k)); - } - } - - /** - * @param srvs Number of server nodes. - * @param clients Number of client nodes. - * @param cacheBackups Number of cache backups. - * @param cacheParts Number of cache partitions. - * @param cfgC Optional closure applied to cache configuration. - * @param withRmvs If {@code true} then in addition to puts tests also executes removes. - * @param readMode Read mode. - * @param writeMode Write mode. - * @throws Exception If failed. - */ - final void accountsTxReadAll( - final int srvs, - final int clients, - int cacheBackups, - int cacheParts, - @Nullable IgniteInClosure cfgC, - final boolean withRmvs, - final ReadMode readMode, - final WriteMode writeMode - ) throws Exception { - accountsTxReadAll(srvs, clients, cacheBackups, cacheParts, cfgC, withRmvs, readMode, writeMode, DFLT_TEST_TIME, null); - } - - /** - * @param srvs Number of server nodes. - * @param clients Number of client nodes. - * @param cacheBackups Number of cache backups. - * @param cacheParts Number of cache partitions. - * @param cfgC Optional closure applied to cache configuration. - * @param withRmvs If {@code true} then in addition to puts tests also executes removes. - * @param readMode Read mode. - * @param writeMode Write mode. - * @param testTime Test time. - * @throws Exception If failed. - */ - final void accountsTxReadAll( - final int srvs, - final int clients, - int cacheBackups, - int cacheParts, - @Nullable IgniteInClosure cfgC, - final boolean withRmvs, - final ReadMode readMode, - final WriteMode writeMode, - long testTime, - RestartMode restartMode - ) throws Exception { - final int ACCOUNTS = 20; - - final int ACCOUNT_START_VAL = 1000; - - final int writers = 4; - - final int readers = 4; - - final IgniteInClosure> init = new IgniteInClosure>() { - @Override public void apply(IgniteCache cache) { - final IgniteTransactions txs = cache.unwrap(Ignite.class).transactions(); - - if (writeMode == WriteMode.PUT) { - Map accounts = new HashMap<>(); - - for (int i = 0; i < ACCOUNTS; i++) - accounts.put(i, new MvccTestAccount(ACCOUNT_START_VAL, 1)); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.putAll(accounts); - - tx.commit(); - } - } - else if (writeMode == WriteMode.DML) { - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("insert into MvccTestAccount(_key, val, updateCnt) values " + - "(?," + ACCOUNT_START_VAL + ",1)"); - - for (int i = 0; i < ACCOUNTS; i++) { - try (FieldsQueryCursor> cur = cache.query(qry.setArgs(i))) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - } - } - else - assert false : "Unknown write mode"; - } - }; - - final RemovedAccountsTracker rmvdTracker = new RemovedAccountsTracker(ACCOUNTS); - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int cnt = 0; - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - try { - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - cnt++; - - int i1 = rnd.nextInt(ACCOUNTS), i2 = rnd.nextInt(ACCOUNTS); - - while (i2 == i1) - i2 = rnd.nextInt(ACCOUNTS); - - Integer id1 = Math.min(i1, i2); - Integer id2 = Math.max(i1, i2); - - Set keys = new HashSet<>(); - - keys.add(id1); - keys.add(id2); - - Integer cntr1 = null; - Integer cntr2 = null; - - Integer rmvd = null; - Integer inserted = null; - - MvccTestAccount a1; - MvccTestAccount a2; - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - Map accounts = null; - - if (writeMode == WriteMode.PUT) - accounts = cache.cache.getAll(keys); - else if (writeMode == WriteMode.DML) - accounts = getAllSql(cache); - else - assert false : "Unknown write mode"; - - a1 = accounts.get(id1); - a2 = accounts.get(id2); - - if (!withRmvs) { - assertNotNull(a1); - assertNotNull(a2); - - cntr1 = a1.updateCnt + 1; - cntr2 = a2.updateCnt + 1; - - if (writeMode == WriteMode.PUT) { - cache.cache.put(id1, new MvccTestAccount(a1.val + 1, cntr1)); - cache.cache.put(id2, new MvccTestAccount(a2.val - 1, cntr2)); - } - else if (writeMode == WriteMode.DML) { - updateSql(cache, id1, a1.val + 1, cntr1); - updateSql(cache, id2, a2.val - 1, cntr2); - } - else - assert false : "Unknown write mode"; - } - else { - if (a1 != null || a2 != null) { - if (a1 != null && a2 != null) { - if (rnd.nextInt(10) == 0) { - if (rmvdTracker.size() < ACCOUNTS / 2) { - rmvd = rnd.nextBoolean() ? id1 : id2; - - assertTrue(rmvdTracker.markRemoved(rmvd)); - } - } - - if (rmvd != null) { - if (writeMode == WriteMode.PUT) { - if (rmvd.equals(id1)) { - cache.cache.remove(id1); - cache.cache.put(id2, new MvccTestAccount(a1.val + a2.val, 1)); - } - else { - cache.cache.put(id1, new MvccTestAccount(a1.val + a2.val, 1)); - cache.cache.remove(id2); - } - } - else if (writeMode == WriteMode.DML) { - if (rmvd.equals(id1)) { - removeSql(cache, id1); - updateSql(cache, id2, a1.val + a2.val, 1); - } - else { - updateSql(cache, id1, a1.val + a2.val, 1); - removeSql(cache, id2); - } - } - else - assert false : "Unknown write mode"; - } - else { - if (writeMode == WriteMode.PUT) { - cache.cache.put(id1, new MvccTestAccount(a1.val + 1, 1)); - cache.cache.put(id2, new MvccTestAccount(a2.val - 1, 1)); - } - else if (writeMode == WriteMode.DML) { - updateSql(cache, id1, a1.val + 1, 1); - updateSql(cache, id2, a2.val - 1, 1); - } - else - assert false : "Unknown write mode"; - } - } - else { - if (a1 == null) { - inserted = id1; - - if (writeMode == WriteMode.PUT) { - cache.cache.put(id1, new MvccTestAccount(100, 1)); - cache.cache.put(id2, new MvccTestAccount(a2.val - 100, 1)); - } - else if (writeMode == WriteMode.DML) { - insertSql(cache, id1, 100, 1); - updateSql(cache, id2, a2.val - 100, 1); - } - else - assert false : "Unknown write mode"; - } - else { - inserted = id2; - - if (writeMode == WriteMode.PUT) { - cache.cache.put(id1, new MvccTestAccount(a1.val - 100, 1)); - cache.cache.put(id2, new MvccTestAccount(100, 1)); - } - else if (writeMode == WriteMode.DML) { - updateSql(cache, id1, a1.val - 100, 1); - insertSql(cache, id2, 100, 1); - } - else - assert false : "Unknown write mode"; - } - } - } - } - - tx.commit(); - - // In case of tx success mark inserted. - if (inserted != null) { - assert withRmvs; - - assertTrue(rmvdTracker.unmarkRemoved(inserted)); - } - } - catch (Throwable e) { - if (rmvd != null) { - assert withRmvs; - - // If tx fails, unmark removed. - assertTrue(rmvdTracker.unmarkRemoved(rmvd)); - } - - throw e; - } - - if (!withRmvs) { - Map accounts = null; - - if (writeMode == WriteMode.PUT) - accounts = cache.cache.getAll(keys); - else if (writeMode == WriteMode.DML) - accounts = getAllSql(cache); - else - assert false : "Unknown write mode"; - - a1 = accounts.get(id1); - a2 = accounts.get(id2); - - assertNotNull(a1); - assertNotNull(a2); - - assertTrue(a1.updateCnt >= cntr1); - assertTrue(a2.updateCnt >= cntr2); - } - } - catch (Exception e) { - handleTxException(e); - } - finally { - cache.readUnlock(); - } - } - - info("Writer finished, updates: " + cnt); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - Set keys = new LinkedHashSet<>(); - - Map lastUpdateCntrs = new HashMap<>(); - - SqlFieldsQuery sumQry = new SqlFieldsQuery("select sum(val) from MvccTestAccount"); - - while (!stop.get()) { - while (keys.size() < ACCOUNTS) - keys.add(rnd.nextInt(ACCOUNTS)); - - TestCache cache = randomCache(caches, rnd); - - Map accounts = null; - - try { - switch (readMode) { - case GET: { - accounts = cache.cache.getAll(keys); - - break; - } - - case SCAN: { - accounts = new HashMap<>(); - - Iterator> it = cache.cache.iterator(); - - try { - for (; it.hasNext(); ) { - IgniteCache.Entry e = it.next(); - MvccTestAccount old = accounts.put(e.getKey(), e.getValue()); - - assertNull("new=" + e + ", old=" + old, old); - } - } - finally { - U.closeQuiet((AutoCloseable)it); - } - - break; - } - - case SQL: { - accounts = new HashMap<>(); - - if (rnd.nextBoolean()) { - SqlQuery qry = - new SqlQuery<>(MvccTestAccount.class, "_key >= 0"); - - for (IgniteCache.Entry e : cache.cache.query(qry).getAll()) { - MvccTestAccount old = accounts.put(e.getKey(), e.getValue()); - - assertNull(old); - } - } - else { - SqlFieldsQuery qry = new SqlFieldsQuery("select _key, val from MvccTestAccount"); - - for (List row : cache.cache.query(qry).getAll()) { - Integer id = (Integer)row.get(0); - Integer val = (Integer)row.get(1); - - MvccTestAccount old = accounts.put(id, new MvccTestAccount(val, 1)); - - assertNull(old); - } - } - - break; - } - - case SQL_SUM: { - Long sum; - - if (rnd.nextBoolean()) { - List> res = cache.cache.query(sumQry).getAll(); - - assertEquals(1, res.size()); - - sum = (Long)res.get(0).get(0); - } - else { - Map res = readAllByMode(cache.cache, keys, readMode, ACCOUNT_CODEC); - - sum = (Long)((Map.Entry)res.entrySet().iterator().next()).getValue(); - } - - assertEquals(ACCOUNT_START_VAL * ACCOUNTS, sum.intValue()); - - break; - } - - default: { - fail(); - - return; - } - } - } - finally { - cache.readUnlock(); - } - - if (accounts != null) { - if (!withRmvs) - assertEquals(ACCOUNTS, accounts.size()); - - int sum = 0; - - for (int i = 0; i < ACCOUNTS; i++) { - MvccTestAccount account = accounts.get(i); - - if (account != null) { - sum += account.val; - - Integer cntr = lastUpdateCntrs.get(i); - - if (cntr != null) - assertTrue(cntr <= account.updateCnt); - - lastUpdateCntrs.put(i, cntr); - } - else - assertTrue(withRmvs); - } - - assertEquals(ACCOUNTS * ACCOUNT_START_VAL, sum); - } - } - - if (idx == 0) { - TestCache cache = randomCache(caches, rnd); - - Map accounts; - - ReadMode readMode0 = readMode == SQL_SUM ? SQL : readMode; - - try { - accounts = readAllByMode(cache.cache, keys, readMode0, ACCOUNT_CODEC);; - } - finally { - cache.readUnlock(); - } - - int sum = 0; - - for (int i = 0; i < ACCOUNTS; i++) { - MvccTestAccount account = accounts.get(i); - - assertTrue(account != null || withRmvs); - - info("Account [id=" + i + ", val=" + (account != null ? account.val : null) + ']'); - - if (account != null) - sum += account.val; - } - - info("Sum: " + sum); - } - } - }; - - readWriteTest( - restartMode, - srvs, - clients, - cacheBackups, - cacheParts, - writers, - readers, - testTime, - cfgC, - init, - writer, - reader); - } - - /** - * Returns all accounts from cache by means of SQL. - * - * @param cache Cache. - * @return All accounts - */ - protected static Map getAllSql(TestCache cache) { - Map accounts = new HashMap<>(); - - SqlFieldsQuery qry = new SqlFieldsQuery("select _key, val, updateCnt from MvccTestAccount"); - - for (List row : cache.cache.query(qry).getAll()) { - Integer id = (Integer)row.get(0); - Integer val = (Integer)row.get(1); - Integer updateCnt = (Integer)row.get(2); - - MvccTestAccount old = accounts.put(id, new MvccTestAccount(val, updateCnt)); - - assertNull(old); - } - - return accounts; - } - - /** - * Updates account by means of SQL API. - * - * @param cache Cache. - * @param key Key. - * @param val Value. - * @param updateCnt Update counter. - */ - private static void updateSql(TestCache cache, Integer key, Integer val, Integer updateCnt) { - SqlFieldsQuery qry = new SqlFieldsQuery("update MvccTestAccount set val=" + val + ", updateCnt=" + - updateCnt + " where _key=" + key); - - cache.cache.query(qry).getAll(); - } - - /** - * Removes account by means of SQL API. - * - * @param cache Cache. - * @param key Key. - */ - protected static void removeSql(TestCache cache, Integer key) { - SqlFieldsQuery qry = new SqlFieldsQuery("delete from MvccTestAccount where _key=" + key); - - cache.cache.query(qry).getAll(); - } - - /** - * Merge account by means of SQL API. - * - * @param cache Cache. - * @param key Key. - * @param val Value. - * @param updateCnt Update counter. - */ - protected static void mergeSql(TestCache cache, Integer key, Integer val, Integer updateCnt) { - SqlFieldsQuery qry = new SqlFieldsQuery("merge into MvccTestAccount(_key, val, updateCnt) values " + - " (" + key + ", " + val + ", " + updateCnt + ")"); - - cache.cache.query(qry).getAll(); - } - - /** - * Inserts account by means of SQL API. - * - * @param cache Cache. - * @param key Key. - * @param val Value. - * @param updateCnt Update counter. - */ - private static void insertSql(TestCache cache, int key, Integer val, Integer updateCnt) { - SqlFieldsQuery qry = new SqlFieldsQuery("insert into MvccTestAccount(_key, val, updateCnt) values " + - " (" + key + ", " + val + ", " + updateCnt + ")"); - - cache.cache.query(qry).getAll(); - } - - /** - * @param restartMode Restart mode. - * @param srvs Number of server nodes. - * @param clients Number of client nodes. - * @param cacheBackups Number of cache backups. - * @param cacheParts Number of cache partitions. - * @param readMode Read mode. - * @throws Exception If failed. - */ - @SuppressWarnings("unchecked") - protected void putAllGetAll( - RestartMode restartMode, - final int srvs, - final int clients, - int cacheBackups, - int cacheParts, - @Nullable IgniteInClosure cfgC, - ReadMode readMode, - WriteMode writeMode - ) throws Exception { - final int RANGE = 20; - - final int writers = 4; - - final int readers = 4; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int min = idx * RANGE; - int max = min + RANGE; - - info("Thread range [min=" + min + ", max=" + max + ']'); - - // Sorted map for put to avoid deadlocks. - Map map = new TreeMap<>(); - - // Unordered key sequence. - Set keys = new LinkedHashSet<>(); - - int v = idx * 1_000_000; - - boolean first = true; - - while (!stop.get()) { - while (keys.size() < RANGE) { - int key = rnd.nextInt(min, max); - - if (keys.add(key)) - map.put(key, v); - } - - TestCache cache = randomCache(caches, rnd); - - try { - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - if (!first && rnd.nextBoolean()) { - Map res = readAllByMode(cache.cache, keys, readMode, INTEGER_CODEC); - - for (Integer k : keys) - assertEquals("res=" + res, v - 1, (Object)res.get(k)); - } - - writeAllByMode(cache.cache, map, writeMode, INTEGER_CODEC); - - tx.commit(); - - v++; - - first = false; - } - - if (rnd.nextBoolean()) { - Map res = readAllByMode(cache.cache, keys, readMode, INTEGER_CODEC); - - for (Integer k : keys) - assertEquals("key=" + k, v - 1, (Object)res.get(k)); - } - } - catch (Exception e) { - handleTxException(e); - } - finally { - cache.readUnlock(); - - keys.clear(); - - map.clear(); - } - } - - info("Writer done, updates: " + v); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - Set keys = new LinkedHashSet<>(); - - Map readVals = new HashMap<>(); - - while (!stop.get()) { - int range = rnd.nextInt(0, writers); - - int min = range * RANGE; - int max = min + RANGE; - - keys.clear(); - - while (keys.size() < RANGE) - keys.add(rnd.nextInt(min, max)); - - TestCache cache = randomCache(caches, rnd); - - Map map; - - try { - map = readAllByMode(cache.cache, keys, readMode, INTEGER_CODEC); - } - catch (Exception e) { - handleTxException(e); - - continue; - } - finally { - cache.readUnlock(); - } - - assertTrue("Invalid map size: " + map.size() + ", map=" + map, map.isEmpty() || map.size() == RANGE); - - Integer val0 = null; - - for (Map.Entry e: map.entrySet()) { - Integer val = e.getValue(); - - assertNotNull(val); - - if (val0 == null) { - Integer readVal = readVals.get(range); - - if (readVal != null) - assertTrue("readVal=" + readVal + ", val=" + val + ", map=" + map, readVal <= val); - - readVals.put(range, val); - - val0 = val; - } - else { - if (!F.eq(val0, val)) { - assertEquals("Unexpected value [range=" + range + ", key=" + e.getKey() + ']' + - ", map=" + map, - val0, - val); - } - } - } - } - } - }; - - readWriteTest( - restartMode, - srvs, - clients, - cacheBackups, - cacheParts, - writers, - readers, - DFLT_TEST_TIME, - cfgC, - null, - writer, - reader); - - for (Ignite node : G.allGrids()) - checkActiveQueriesCleanup(node); - } - - - - /** - * @param N Number of object to update in single transaction. - * @param srvs Number of server nodes. - * @param clients Number of client nodes. - * @param cacheBackups Number of cache backups. - * @param cacheParts Number of cache partitions. - * @param time Test time. - * @param readMode Read mode. - * @throws Exception If failed. - */ - @SuppressWarnings("unchecked") - protected void updateNObjectsTest( - final int N, - final int srvs, - final int clients, - int cacheBackups, - int cacheParts, - long time, - @Nullable IgniteInClosure cfgC, - ReadMode readMode, - WriteMode writeMode, - RestartMode restartMode - ) throws Exception { - final int TOTAL = 20; - - assert N <= TOTAL; - - info("updateNObjectsTest [n=" + N + ", total=" + TOTAL + ']'); - - final int writers = 4; - - final int readers = 4; - - final IgniteInClosure> init = new IgniteInClosure>() { - @Override public void apply(IgniteCache cache) { - final IgniteTransactions txs = cache.unwrap(Ignite.class).transactions(); - - Map vals = new LinkedHashMap<>(); - - for (int i = 0; i < TOTAL; i++) - vals.put(i, N); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - writeAllByMode(cache, vals, writeMode, INTEGER_CODEC); - - tx.commit(); - } - } - }; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int cnt = 0; - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - TreeSet keys = new TreeSet<>(); - - while (keys.size() < N) - keys.add(rnd.nextInt(TOTAL)); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - Map curVals = readAllByMode(cache.cache, keys, readMode, INTEGER_CODEC); - - assertEquals(N, curVals.size()); - - Map newVals = new TreeMap<>(); - - for (Map.Entry e : curVals.entrySet()) - newVals.put(e.getKey(), e.getValue() + 1); - - writeAllByMode(cache.cache, newVals, writeMode, INTEGER_CODEC); - - tx.commit(); - } - catch (Exception e) { - handleTxException(e); - } - finally { - cache.readUnlock(); - } - - cnt++; - } - - info("Writer finished, updates: " + cnt); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - Set keys = new LinkedHashSet<>(); - - while (!stop.get()) { - while (keys.size() < TOTAL) - keys.add(rnd.nextInt(TOTAL)); - - TestCache cache = randomCache(caches, rnd); - - Map vals = null; - - try { - vals = readAllByMode(cache.cache, keys, readMode, INTEGER_CODEC); - } - catch (Exception e) { - handleTxException(e); - } - finally { - cache.readUnlock(); - } - - assertEquals("vals=" + vals, TOTAL, vals.size()); - - int sum = 0; - - for (int i = 0; i < TOTAL; i++) { - Integer val = vals.get(i); - - assertNotNull(val); - - sum += val; - } - - assertEquals(0, sum % N); - } - - if (idx == 0) { - TestCache cache = randomCache(caches, rnd); - - Map vals; - - try { - vals = readAllByMode(cache.cache, keys, readMode, INTEGER_CODEC); - } - finally { - cache.readUnlock(); - } - - int sum = 0; - - for (int i = 0; i < TOTAL; i++) { - Integer val = vals.get(i); - - info("Value [id=" + i + ", val=" + val + ']'); - - sum += val; - } - - info("Sum [sum=" + sum + ", mod=" + sum % N + ']'); - } - } - }; - - readWriteTest( - restartMode, - srvs, - clients, - cacheBackups, - cacheParts, - writers, - readers, - time, - cfgC, - init, - writer, - reader); - } - - /** - * @param restartMode Restart mode. - * @param srvs Number of server nodes. - * @param clients Number of client nodes. - * @param cacheBackups Number of cache backups. - * @param cacheParts Number of cache partitions. - * @param time Test time. - * @param cfgC Optional closure applied to cache configuration. - * @param writers Number of writers. - * @param readers Number of readers. - * @param init Optional init closure. - * @param writer Writers threads closure. - * @param reader Readers threads closure. - * @throws Exception If failed. - */ - final void readWriteTest( - final RestartMode restartMode, - final int srvs, - final int clients, - int cacheBackups, - int cacheParts, - final int writers, - final int readers, - final long time, - @Nullable IgniteInClosure cfgC, - IgniteInClosure> init, - final GridInClosure3, AtomicBoolean> writer, - final GridInClosure3, AtomicBoolean> reader) throws Exception { - if (restartMode == RestartMode.RESTART_CRD) - MvccProcessorImpl.coordinatorAssignClosure(new CoordinatorAssignClosure()); - - Ignite srv0 = startGridsMultiThreaded(srvs); - - if (clients > 0) { - client = true; - - startGridsMultiThreaded(srvs, clients); - - client = false; - } - - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), - FULL_SYNC, - cacheBackups, - cacheParts); - - if (restartMode == RestartMode.RESTART_CRD) - ccfg.setNodeFilter(new CoordinatorNodeFilter()); - - if (cfgC != null) - cfgC.apply(ccfg); - - IgniteCache cache = srv0.createCache(ccfg); - - int crdIdx = srvs + clients; - - if (restartMode == RestartMode.RESTART_CRD) { - nodeAttr = CRD_ATTR; - - startGrid(crdIdx); - } - - if (init != null) - init.apply(cache); - - final List caches = new ArrayList<>(srvs + clients); - - for (int i = 0; i < srvs + clients; i++) { - Ignite node = grid(i); - - caches.add(new TestCache(node.cache(cache.getName()))); - } - - final long stopTime = U.currentTimeMillis() + time; - - final AtomicBoolean stop = new AtomicBoolean(); - - try { - final AtomicInteger writerIdx = new AtomicInteger(); - - IgniteInternalFuture writeFut = GridTestUtils.runMultiThreadedAsync(new Callable() { - @Override public Void call() throws Exception { - try { - int idx = writerIdx.getAndIncrement(); - - writer.apply(idx, caches, stop); - } - catch (Throwable e) { - if (restartMode != null && X.hasCause(e, ClusterTopologyException.class)) { - log.info("Writer error: " + e); - - return null; - } - - error("Unexpected error: " + e, e); - - stop.set(true); - - fail("Unexpected error: " + e); - } - - return null; - } - }, writers, "writer"); - - final AtomicInteger readerIdx = new AtomicInteger(); - - IgniteInternalFuture readFut = GridTestUtils.runMultiThreadedAsync(new Callable() { - @Override public Void call() throws Exception { - try { - int idx = readerIdx.getAndIncrement(); - - reader.apply(idx, caches, stop); - } - catch (Throwable e) { - if (restartMode != null && X.hasCause(e, ClusterTopologyException.class)) { - log.info("Writer error: " + e); - - return null; - } - - error("Unexpected error: " + e, e); - - stop.set(true); - - fail("Unexpected error: " + e); - } - - return null; - } - }, readers, "reader"); - - GridTestUtils.runAsync(() -> { - while (System.currentTimeMillis() < stopTime) - doSleep(1000); - - stop.set(true); - }); - - while (System.currentTimeMillis() < stopTime && !stop.get()) { - Thread.sleep(1000); - - if (System.currentTimeMillis() >= stopTime || stop.get()) - break; - - if (restartMode != null) { - switch (restartMode) { - case RESTART_CRD: { - log.info("Start new coordinator: " + (crdIdx + 1)); - - startGrid(crdIdx + 1); - - log.info("Stop current coordinator: " + crdIdx); - - stopGrid(crdIdx); - - crdIdx++; - - awaitPartitionMapExchange(); - - break; - } - - case RESTART_RND_SRV: { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int idx = rnd.nextInt(srvs); - - TestCache cache0 = caches.get(idx); - - cache0.stopLock.writeLock().lock(); - - log.info("Stop node: " + idx); - - stopGrid(idx); - - log.info("Start new node: " + idx); - - Ignite srv = startGrid(idx); - - cache0 = new TestCache(srv.cache(DEFAULT_CACHE_NAME)); - - synchronized (caches) { - caches.set(idx, cache0); - } - - awaitPartitionMapExchange(); - - break; - } - - default: - fail(); - } - } - } - - Exception ex = null; - - try { - writeFut.get(); - } - catch (IgniteCheckedException e) { - ex = e; - } - - try { - readFut.get(); - } - catch (IgniteCheckedException e) { - if (ex != null) - ex.addSuppressed(e); - else - ex = e; - } - - if (ex != null) - throw ex; - } - finally { - stop.set(true); - } - } - - /** - * @param cacheMode Cache mode. - * @param syncMode Write synchronization mode. - * @param backups Number of backups. - * @param parts Number of partitions. - * @return Cache configuration. - */ - final CacheConfiguration cacheConfiguration( - CacheMode cacheMode, - CacheWriteSynchronizationMode syncMode, - int backups, - int parts) { - CacheConfiguration ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); - - ccfg.setCacheMode(cacheMode); - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - ccfg.setWriteSynchronizationMode(syncMode); - ccfg.setAffinity(new RendezvousAffinityFunction(false, parts)); - - if (cacheMode == PARTITIONED) - ccfg.setBackups(backups); - - return ccfg; - } - - /** - * Handles transaction exception. - * @param e Exception. - */ - protected void handleTxException(Exception e) { - if (log.isDebugEnabled()) - log.debug("Exception during tx execution: " + X.getFullStackTrace(e)); - - if (X.hasCause(e, IgniteFutureCancelledCheckedException.class)) - return; - - if (X.hasCause(e, ClusterTopologyException.class)) - return; - - if (X.hasCause(e, ClusterTopologyCheckedException.class)) - return; - - if (X.hasCause(e, IgniteTxRollbackCheckedException.class)) - return; - - if (X.hasCause(e, TransactionException.class)) - return; - - if (X.hasCause(e, IgniteTxTimeoutCheckedException.class)) - return; - - if (X.hasCause(e, TransactionSerializationException.class)) - return; - - if (X.hasCause(e, CacheException.class)) { - CacheException cacheEx = X.cause(e, CacheException.class); - - if (cacheEx != null && cacheEx.getMessage() != null) { - if (cacheEx.getMessage().contains("Data node has left the grid during query execution")) - return; - } - - if (cacheEx != null && cacheEx.getMessage() != null) { - if (cacheEx.getMessage().contains("Query was interrupted.")) - return; - } - - if (cacheEx != null && cacheEx.getMessage() != null) { - if (cacheEx.getMessage().contains("Failed to fetch data from node")) - return; - } - - if (cacheEx != null && cacheEx.getMessage() != null) { - if (cacheEx.getMessage().contains("Failed to send message")) - return; - } - } - - if (X.hasCause(e, IgniteSQLException.class)) { - IgniteSQLException sqlEx = X.cause(e, IgniteSQLException.class); - - if (sqlEx != null && sqlEx.getMessage() != null) { - if (sqlEx.getMessage().contains("Transaction is already completed.")) - return; - } - } - - fail("Unexpected tx exception. " + X.getFullStackTrace(e)); - } - - /** - * @throws Exception If failed. - */ - final void verifyCoordinatorInternalState() throws Exception { - for (Ignite node : G.allGrids()) { - final MvccProcessorImpl crd = mvccProcessor(node); - - if (!crd.mvccEnabled()) - continue; - - crd.stopVacuumWorkers(); // to prevent new futures creation. - - Map activeTxs = GridTestUtils.getFieldValue(crd, "activeTxs"); - Map cntrFuts = GridTestUtils.getFieldValue(crd, "snapLsnrs"); - Map ackFuts = GridTestUtils.getFieldValue(crd, "ackFuts"); - Map activeTrackers = GridTestUtils.getFieldValue(crd, "activeTrackers"); - - GridAbsPredicate cond = () -> { - log.info("activeTxs=" + activeTxs + ", cntrFuts=" + cntrFuts + ", ackFuts=" + ackFuts + - ", activeTrackers=" + activeTrackers); - - boolean empty = true; - - for (Map map : cntrFuts.values()) - if (!(empty = map.isEmpty())) - break; - - return activeTxs.isEmpty() && empty && ackFuts.isEmpty() && activeTrackers.isEmpty(); - }; - - GridTestUtils.waitForCondition(cond, TX_TIMEOUT); - - assertTrue("activeTxs: " + activeTxs, activeTxs.isEmpty()); - - boolean empty = true; - - for (Map map : cntrFuts.values()) - if (!(empty = map.isEmpty())) break; - - assertTrue("cntrFuts: " + cntrFuts, empty); - assertTrue("ackFuts: " + ackFuts, ackFuts.isEmpty()); - assertTrue("activeTrackers: " + activeTrackers, activeTrackers.isEmpty()); - - checkActiveQueriesCleanup(node); - } - } - - /** - * Checks if less than 2 versions remain after the vacuum cleanup. - * - * @throws Exception If failed. - */ - protected void verifyOldVersionsCleaned() throws Exception { - boolean retry; - - try { - runVacuumSync(); - - // Check versions. - retry = !checkOldVersions(false); - } - catch (Exception e) { - U.warn(log(), "Failed to perform vacuum, will retry.", e); - - retry = true; - } - - if (retry) { // Retry on a stable topology with a newer snapshot. - awaitPartitionMapExchange(); - - waitMvccQueriesDone(); - - runVacuumSync(); - - checkOldVersions(true); - } - } - - /** - * Waits until all active queries are terminated on the Mvcc coordinator. - * - * @throws Exception If failed. - */ - private void waitMvccQueriesDone() throws Exception { - for (Ignite node : G.allGrids()) { - checkActiveQueriesCleanup(node); - } - } - - /** - * Checks if outdated versions were cleaned after the vacuum process. - * - * @param failIfNotCleaned Fail test if not cleaned. - * @return {@code False} if not cleaned. - * @throws IgniteCheckedException If failed. - */ - private boolean checkOldVersions(boolean failIfNotCleaned) throws IgniteCheckedException { - for (Ignite node : G.allGrids()) { - for (IgniteCacheProxy cache : ((IgniteKernal)node).caches()) { - GridCacheContext cctx = cache.context(); - - if (!cctx.userCache() || !cctx.group().mvccEnabled() || F.isEmpty(cctx.group().caches()) || cctx.shared().closed(cctx)) - continue; - - try (GridCloseableIterator it = (GridCloseableIterator)cache.withKeepBinary().iterator()) { - while (it.hasNext()) { - IgniteBiTuple entry = (IgniteBiTuple)it.next(); - - KeyCacheObject key = cctx.toCacheKeyObject(entry.getKey()); - - List> vers = cctx.offheap().mvccAllVersions(cctx, key) - .stream().filter(t -> t.get1() != null).collect(Collectors.toList()); - - if (vers.size() > 1) { - if (failIfNotCleaned) - fail("[key=" + key.value(null, false) + "; vers=" + vers + ']'); - else - return false; - } - } - } - } - } - - return true; - } - - /** - * Runs vacuum on all nodes and waits for its completion. - * - * @throws IgniteCheckedException If failed. - */ - private void runVacuumSync() throws IgniteCheckedException { - GridCompoundIdentityFuture fut = new GridCompoundIdentityFuture<>(); - - // Run vacuum manually. - for (Ignite node : G.allGrids()) { - if (!node.configuration().isClientMode()) { - MvccProcessorImpl crd = mvccProcessor(node); - - if (!crd.mvccEnabled() || GridTestUtils.getFieldValue(crd, "vacuumWorkers") == null) - continue; - - assert GridTestUtils.getFieldValue(crd, "txLog") != null; - - fut.add(crd.runVacuum()); - } - } - - fut.markInitialized(); - - // Wait vacuum finished. - fut.get(getTestTimeout()); - } - - /** - * @param node Ignite node. - * @return Mvcc processor. - */ - protected MvccProcessorImpl mvccProcessor(Ignite node) { - GridKernalContext ctx = ((IgniteEx)node).context(); - - MvccProcessor crd = ctx.coordinators(); - - assertNotNull(crd); - - return (MvccProcessorImpl)crd; - } - - /** - * @param node Node. - * @throws Exception If failed. - */ - protected final void checkActiveQueriesCleanup(Ignite node) throws Exception { - final MvccProcessorImpl prc = mvccProcessor(node); - - MvccCoordinator crd = prc.currentCoordinator(); - - if (!crd.local()) - return; - - assertTrue("Coordinator is not initialized: " + prc, GridTestUtils.waitForCondition(crd::initialized, 8_000)); - - assertTrue("Active queries are not cleared: " + node.name(), GridTestUtils.waitForCondition( - new GridAbsPredicate() { - @Override public boolean apply() { - Object activeQueries = GridTestUtils.getFieldValue(prc, "activeQueries"); - - synchronized (activeQueries) { - Long minQry = GridTestUtils.getFieldValue(activeQueries, "minQry"); - - if (minQry != null) - log.info("Min query: " + minQry); - - Map queriesMap = GridTestUtils.getFieldValue(activeQueries, "activeQueries"); - - boolean empty = true; - - for (Map.Entry e : queriesMap.entrySet()) { - if (!e.getValue().isEmpty()) { - empty = false; - - log.info("Active queries: " + e); - } - } - - return empty && minQry == null; - } - } - }, 8_000) - ); - - assertTrue("Previous coordinator queries are not empty: " + node.name(), GridTestUtils.waitForCondition( - new GridAbsPredicate() { - @Override public boolean apply() { - PreviousQueries prevQueries = GridTestUtils.getFieldValue(prc, "prevQueries"); - - synchronized (prevQueries) { - Map queries = GridTestUtils.getFieldValue(prevQueries, "active"); - Boolean prevDone = GridTestUtils.getFieldValue(prevQueries, "done"); - - if (!queries.isEmpty() || !prevDone) - log.info("Previous coordinator state [prevDone=" + prevDone + ", queries=" + queries + ']'); - - return queries.isEmpty(); - } - } - }, 8_000) - ); - } - - /** - * @return Cache configurations. - */ - protected List> cacheConfigurations() { - List> ccfgs = new ArrayList<>(); - - ccfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, RendezvousAffinityFunction.DFLT_PARTITION_COUNT)); - ccfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, RendezvousAffinityFunction.DFLT_PARTITION_COUNT)); - ccfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 2, RendezvousAffinityFunction.DFLT_PARTITION_COUNT)); - ccfgs.add(cacheConfiguration(REPLICATED, FULL_SYNC, 0, RendezvousAffinityFunction.DFLT_PARTITION_COUNT)); - - return ccfgs; - } - - /** - * Reads value from cache for the given key using given read mode. - * - * @param cache Cache. - * @param key Key. - * @param readMode Read mode. - * @param codec Sql object codec. - * @return Value. - */ - @SuppressWarnings("unchecked") - protected Object readByMode(IgniteCache cache, final Object key, ReadMode readMode, ObjectCodec codec) { - assert cache != null && key != null && readMode != null && readMode != SQL_SUM; - assert readMode != SQL || codec != null; - - boolean emulateLongQry = ThreadLocalRandom.current().nextBoolean(); - - switch (readMode) { - case GET: - return cache.get(key); - - case SCAN: - ScanQuery scanQry = new ScanQuery(new IgniteBiPredicate() { - @Override public boolean apply(Object k, Object v) { - if (emulateLongQry) - doSleep(ThreadLocalRandom.current().nextInt(50)); - - return k.equals(key); - } - }); - - List res = cache.query(scanQry).getAll(); - - assertTrue(res.size() <= 1); - - return res.isEmpty() ? null : ((IgniteBiTuple)res.get(0)).getValue(); - - case SQL: - String qry = "SELECT * FROM " + codec.tableName() + " WHERE _key=" + key; - - SqlFieldsQuery sqlFieldsQry = new SqlFieldsQuery(qry); - - if (emulateLongQry) - sqlFieldsQry.setLazy(true).setPageSize(1); - - List rows; - - if (emulateLongQry) { - FieldsQueryCursor cur = cache.query(sqlFieldsQry); - - rows = new ArrayList<>(); - - for (List row : cur) { - rows.add(row); - - doSleep(ThreadLocalRandom.current().nextInt(50)); - } - } - else - rows = cache.query(sqlFieldsQry).getAll(); - - assertTrue(rows.size() <= 1); - - return rows.isEmpty() ? null : codec.decode(rows.get(0)); - - default: - throw new AssertionError("Unsupported read mode: " + readMode); - } - } - - /** - * Writes value into cache using given write mode. - * - * @param cache Cache. - * @param key Key. - * @param val Value. - * @param writeMode Write mode. - * @param codec Sql object codec. - */ - @SuppressWarnings("unchecked") - protected void writeByMode(IgniteCache cache, final Object key, Object val, WriteMode writeMode, ObjectCodec codec) { - assert writeMode != DML || codec != null; - assert cache != null && key != null && writeMode != null && val != null; - - switch (writeMode) { - case PUT: - cache.put(key, val); - - return; - - case DML: - String qry = "MERGE INTO " + codec.tableName() + " (" + codec.columnsNames() + ") VALUES " + - '(' + key + ", " + codec.encode(val) + ')'; - - List rows = cache.query(new SqlFieldsQuery(qry)).getAll(); - - assertTrue(rows.size() <= 1); - - return; - - default: - throw new AssertionError("Unsupported write mode: " + writeMode); - } - } - - - /** - * Reads value from cache for the given key using given read mode. - * - * @param cache Cache. - * @param keys Key. - * @param readMode Read mode. - * @param codec Value codec. - * @return Value. - */ - @SuppressWarnings("unchecked") - protected Map readAllByMode(IgniteCache cache, Set keys, ReadMode readMode, ObjectCodec codec) { - assert cache != null && keys != null && readMode != null; - assert readMode != SQL || codec != null; - - boolean emulateLongQry = ThreadLocalRandom.current().nextBoolean(); - - switch (readMode) { - case GET: - return cache.getAll(keys); - - case SCAN: - ScanQuery scanQry = new ScanQuery(new IgniteBiPredicate() { - @Override public boolean apply(Object k, Object v) { - if (emulateLongQry) - doSleep(ThreadLocalRandom.current().nextInt(50)); - - return keys.contains(k); - } - }); - - Map res; - - try (QueryCursor qry = cache.query(scanQry)) { - res = (Map)qry.getAll() - .stream() - .collect(Collectors.toMap(v -> ((IgniteBiTuple)v).getKey(), v -> ((IgniteBiTuple)v).getValue())); - - assertTrue("res.size()=" + res.size() + ", keys.size()=" + keys.size(), res.size() <= keys.size()); - } - - return res; - - case SQL: - StringBuilder b = new StringBuilder("SELECT " + codec.columnsNames() + " FROM " + codec.tableName() + " WHERE _key IN ("); - - boolean first = true; - - for (Object key : keys) { - if (first) - first = false; - else - b.append(", "); - - b.append(key); - } - - b.append(')'); - - String qry = b.toString(); - - SqlFieldsQuery sqlFieldsQry = new SqlFieldsQuery(qry); - - if (emulateLongQry) - sqlFieldsQry.setLazy(true).setPageSize(1); - - List rows; - - try (FieldsQueryCursor cur = cache.query(sqlFieldsQry)) { - if (emulateLongQry) { - rows = new ArrayList<>(); - - for (List row : cur) { - rows.add(row); - - doSleep(ThreadLocalRandom.current().nextInt(50)); - } - } - else - rows = cur.getAll(); - } - - if (rows.isEmpty()) - return Collections.emptyMap(); - - res = new HashMap(); - - for (List row : rows) - res.put(row.get(0), codec.decode(row)); - - return res; - - case SQL_SUM: - b = new StringBuilder("SELECT SUM(" + codec.aggregateColumnName() + ") FROM " + codec.tableName() + " WHERE _key IN ("); - - first = true; - - for (Object key : keys) { - if (first) - first = false; - else - b.append(", "); - - b.append(key); - } - - b.append(')'); - - qry = b.toString(); - - FieldsQueryCursor cur = cache.query(new SqlFieldsQuery(qry)); - - rows = cur.getAll(); - - if (rows.isEmpty()) - return Collections.emptyMap(); - - res = new HashMap(); - - for (List row : rows) - res.put(row.get(0), row.get(0)); - - return res; - - default: - throw new AssertionError("Unsupported read mode: " + readMode); - } - } - - /** - * Writes all entries using given write mode. - * - * @param cache Cache. - * @param entries Entries to write. - * @param writeMode Write mode. - * @param codec Entry codec. - */ - @SuppressWarnings("unchecked") - protected void writeAllByMode(IgniteCache cache, final Map entries, WriteMode writeMode, ObjectCodec codec) { - assert cache != null && entries != null && writeMode != null; - assert writeMode != DML || codec != null; - - switch (writeMode) { - case PUT: - cache.putAll(entries); - - return; - - case DML: - StringBuilder b = new StringBuilder("MERGE INTO " + codec.tableName() + " (" + codec.columnsNames() + ") VALUES "); - - boolean first = true; - - for (Object entry : entries.entrySet()) { - Map.Entry e = (Map.Entry)entry; - if (first) - first = false; - else - b.append(", "); - - b.append('(') - .append(e.getKey()) - .append(", ") - .append(codec.encode(e.getValue())) - .append(')'); - } - - String qry = b.toString(); - - cache.query(new SqlFieldsQuery(qry)).getAll(); - - return; - - default: - throw new AssertionError("Unsupported write mode: " + writeMode); - } - } - - /** - * Object codec for SQL queries. - * - * @param Type. - */ - private interface ObjectCodec { - /** - * Decodes object from SQL request result. - * - * @param row SQL request result. - * @return Decoded object. - */ - T decode(List row); - - /** - * Encodes object into SQL string for INSERT clause. - * - * @param obj Object. - * @return Sql string. - */ - String encode(T obj); - - /** - * @return Table name. - */ - String tableName(); - - /** - * @return Columns names. - */ - String columnsNames(); - - /** - * @return Column for aggregate functions. - */ - String aggregateColumnName(); - } - - /** - * Codec for {@code Integer} table. - */ - private static class IntegerCodec implements ObjectCodec { - /** {@inheritDoc} */ - @Override public Integer decode(List row) { - return (Integer)row.get(1); - } - - /** {@inheritDoc} */ - @Override public String encode(Integer obj) { - return String.valueOf(obj); - } - - /** {@inheritDoc} */ - @Override public String tableName() { - return "Integer"; - } - - /** {@inheritDoc} */ - @Override public String columnsNames() { - return "_key, _val"; - } - - /** {@inheritDoc} */ - @Override public String aggregateColumnName() { - return "_val"; - } - } - - /** - * Codec for {@code MvccTestAccount} table. - */ - private static class AccountCodec implements ObjectCodec { - /** {@inheritDoc} */ - @Override public MvccTestAccount decode(List row) { - Integer val = (Integer)row.get(1); - Integer updateCnt = (Integer)row.get(2); - - return new MvccTestAccount(val, updateCnt); - } - - /** {@inheritDoc} */ - @Override public String encode(MvccTestAccount obj) { - return String.valueOf(obj.val) + ", " + String.valueOf(obj.updateCnt); - } - - /** {@inheritDoc} */ - @Override public String tableName() { - return "MvccTestAccount"; - } - - /** {@inheritDoc} */ - @Override public String columnsNames() { - return "_key, val, updateCnt"; - } - - /** {@inheritDoc} */ - @Override public String aggregateColumnName() { - return "val"; - } - } - - /** - * @param caches Caches. - * @param rnd Random. - * @return Random cache. - */ - static TestCache randomCache( - List caches, - ThreadLocalRandom rnd) { - synchronized (caches) { - if (caches.size() == 1) { - TestCache cache = caches.get(0); - - assertTrue(cache.readLock()); - - return cache; - } - - for (;;) { - int idx = rnd.nextInt(caches.size()); - - TestCache testCache = caches.get(idx); - - if (testCache.readLock()) - return testCache; - } - } - } - - /** - * - */ - static class MvccTestAccount { - /** */ - @QuerySqlField(index = false) - final int val; - - /** */ - @QuerySqlField - final int updateCnt; - - /** - * @param val Value. - * @param updateCnt Updates counter. - */ - MvccTestAccount(int val, int updateCnt) { - assert updateCnt > 0; - - this.val = val; - this.updateCnt = updateCnt; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - MvccTestAccount account = (MvccTestAccount)o; - return val == account.val && - updateCnt == account.updateCnt; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - - return Objects.hash(val, updateCnt); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "MvccTestAccount{" + - "val=" + val + - ", updateCnt=" + updateCnt + - '}'; - } - } - - /** - * - */ - enum ReadMode { - /** */ - GET, - - /** */ - SCAN, - - /** */ - SQL, - - /** */ - SQL_SUM, - - /** */ - INVOKE - } - - /** - * - */ - enum WriteMode { - /** */ - DML, - - /** */ - PUT, - - /** */ - INVOKE - } - - /** - * - */ - enum RestartMode { - /** - * Dedicated coordinator node is restarted during test. - */ - RESTART_CRD, - - /** */ - RESTART_RND_SRV - } - - /** - * - */ - static class CoordinatorNodeFilter implements IgnitePredicate { - /** {@inheritDoc} */ - @Override public boolean apply(ClusterNode node) { - return node.attribute(CRD_ATTR) == null; - } - } - - /** - * - */ - static class CoordinatorAssignClosure implements IgniteClosure, ClusterNode> { - /** {@inheritDoc} */ - @Override public ClusterNode apply(Collection clusterNodes) { - for (ClusterNode node : clusterNodes) { - if (node.attribute(CRD_ATTR) != null) { - assert !node.isClient(); - - return node; - } - } - - return null; - } - } - - /** - * - */ - static class TestCache { - /** */ - final IgniteCache cache; - - /** Locks node to avoid node restart while test operation is in progress. */ - final ReadWriteLock stopLock = new ReentrantReadWriteLock(); - - /** - * @param cache Cache. - */ - TestCache(IgniteCache cache) { - this.cache = cache; - } - - /** - * @return {@code True} if locked. - */ - boolean readLock() { - return stopLock.readLock().tryLock(); - } - - /** - * - */ - void readUnlock() { - stopLock.readLock().unlock(); - } - } - - /** - * - */ - static class InitIndexing implements IgniteInClosure { - /** */ - private final Class[] idxTypes; - - /** - * @param idxTypes Indexed types. - */ - InitIndexing(Class... idxTypes) { - this.idxTypes = idxTypes; - } - - /** {@inheritDoc} */ - @Override public void apply(CacheConfiguration cfg) { - cfg.setIndexedTypes(idxTypes); - } - } - - /** - * Removed accounts tracker. - */ - private static class RemovedAccountsTracker { - /** */ - private final Map rmvdKeys; - - /** - * @param size Size. - */ - RemovedAccountsTracker(int size) { - this.rmvdKeys = new HashMap<>(size); - - for (int i = 0; i < size; i++) - rmvdKeys.put(i, 0); - } - - /** - * @return Size. - */ - public synchronized int size() { - int size = 0; - - for (int i = 0; i < rmvdKeys.size(); i++) { - if (rmvdKeys.get(i) > 0) - size++; - } - - return size; - } - - /** - * @param id Id. - * @return {@code True} if success. - */ - synchronized boolean markRemoved(Integer id) { - Integer rmvdCntr = rmvdKeys.get(id); - - Integer newCntr = rmvdCntr + 1; - - rmvdKeys.put(id, newCntr); - - return newCntr >= 0; - } - - /** - * @param id Id. - * @return {@code True} if success. - */ - synchronized boolean unmarkRemoved(Integer id) { - Integer rmvdCntr = rmvdKeys.get(id); - - Integer newCntr = rmvdCntr - 1; - - rmvdKeys.put(id, newCntr); - - return newCntr >= 0; - } - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClientReconnectTest.java deleted file mode 100644 index de40d4c9ee7c3..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClientReconnectTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.events.Event; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Test; - -import static java.util.concurrent.TimeUnit.SECONDS; -import static org.apache.ignite.events.EventType.EVT_NODE_JOINED; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccCoordinator.DISCONNECTED_COORDINATOR; -import static org.apache.ignite.testframework.GridTestUtils.waitForCondition; - -/** - * Tests Mvcc coordinator change on client reconnect. - */ -public class CacheMvccClientReconnectTest extends GridCommonAbstractTest { - /** */ - final CountDownLatch latch = new CountDownLatch(1); - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - if (igniteInstanceName.contains("client")) { - Map, int[]> lsnrs = new HashMap<>(); - - lsnrs.put(new IgnitePredicate() { - @Override public boolean apply(Event evt) { - try { - // Wait for the discovery notifier worker processed client disconnection. - latch.await(); - } - catch (InterruptedException e) { - log.error("Unexpected exception.", e); - - fail("Unexpected exception: " + e.getMessage()); - } - - return true; - } - }, new int[] {EVT_NODE_JOINED}); - - cfg.setLocalEventListeners(lsnrs); - } - - return cfg; - } - - /** - * Checks that events processed after client disconnect will not change coordinator until client reconnected. - * - * @throws Exception If failed. - */ - @Test - public void testClientReconnect() throws Exception { - startGrid(0); - - IgniteEx client = startClientGrid("client"); - - MvccProcessor coordProc = client.context().coordinators(); - - // Creates the join event. - startGrid(1); - - stopGrid(0, true); - stopGrid(1, true); - - client.context().discovery().reconnect(); - - // Wait for the discovery notifier worker processed client disconnection. - assertTrue("Failed to wait for client disconnected.", - waitForCondition(() -> client.cluster().clientReconnectFuture() != null, 10_000)); - - assertTrue("Failed to wait for setting disconnected coordinator.", waitForCondition( - () -> DISCONNECTED_COORDINATOR.equals(coordProc.currentCoordinator()), 2000)); - - // The discovery event thread may continue processing events when the notifier worker already processed - // the client disconnection or a local join. It may lead to setting a wrong coordinator. - latch.countDown(); - - startGrid(0); - - client.cluster().clientReconnectFuture().get(10, SECONDS); - - assertEquals(grid(0).localNode().id(), coordProc.currentCoordinator().nodeId()); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClientTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClientTopologyTest.java deleted file mode 100644 index 4eefa2de77bef..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClientTopologyTest.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.util.AttributeNodeFilter; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - -/** - * Tests cover cases for correct MVCC flag set for client topology. - * Client topology, in relation to a specific cache, consist of nodes that match both conditions: - * - filtered with AttributeNodeFilter for the cache; - * - don't configured with CacheConfiguration for the cache. - */ -@SuppressWarnings("unchecked") -public class CacheMvccClientTopologyTest extends GridCommonAbstractTest { - /** - * Index of node that in client topology - */ - private static final int clientModeIdx = 0; - - /** - * Index of node that holds a cache - */ - private static final int cacheModeIdx = 1; - - /** - * Check that by default MVCC is disabled for client topology - */ - @Test - public void testMvccDisabledByDefaultForClientTopology() throws Exception { - // when - final IgniteEx crd = startGrid(getTestIgniteInstanceName(clientModeIdx)); - checkTopology(1); - - // then - assertNodesMvccDisabled(crd); - } - - /** - * Check that MVCC is enabled for client topology if node with MVCC cache joined - */ - @Test - public void testMvccEnabledForClientTopology() throws Exception { - // when - final IgniteEx crd = startGrid(getTestIgniteInstanceName(clientModeIdx)); - final IgniteEx node = startGrid(getTestIgniteInstanceName(cacheModeIdx)); - - checkTopology(2); - - // then - assertNodesMvccEnabled(crd, node); - } - - /** - * Check that MVCC status doesn't change for client topology when MVCC cache node left - */ - @Test - public void testMvccEnabledForClientTopologyAfterCacheNodeLeft() throws Exception { - // when - final IgniteEx crd = startGrid(getTestIgniteInstanceName(clientModeIdx)); - startGrid(getTestIgniteInstanceName(cacheModeIdx)); - - checkTopology(2); - stopGrid(cacheModeIdx); - checkTopology(1); - - // then - assertNodesMvccEnabled(crd); - } - - /** - * Check that MVCC status doesn't change for client topology when MVCC cache node coordinator left - */ - @Test - public void testMvccEnabledForClientTopologyStartedAfterCacheJoined() throws Exception { - // when - startGrid(getTestIgniteInstanceName(cacheModeIdx)); - final IgniteEx node = startGrid(getTestIgniteInstanceName(clientModeIdx)); - - checkTopology(2); - stopGrid(cacheModeIdx); - checkTopology(1); - - // then - assertNodesMvccEnabled(node); - } - - /** - * Check that MVCC is disabled when cluster state changed to INACTIVE - */ - @Test - public void testMvccDisbledForClientTopologyAfterClusterStateChangeToInactive() throws Exception { - // when - final IgniteEx crd = startGrid(getTestIgniteInstanceName(clientModeIdx)); - final IgniteEx node = startGrid(getTestIgniteInstanceName(cacheModeIdx)); - - checkTopology(2); - crd.cluster().state(ClusterState.INACTIVE); - - // then - assertNodesMvccDisabled(crd, node); - } - - /** - * Check that MVCC is disabled for client topology if cluster state is INACTIVE but cache node joined - */ - @Test - public void testMvccDisabledForClientTopologyCrdBeforeClusterStateChange() throws Exception { - // given - IgniteConfiguration crdCfg = getInactiveConfiguration(clientModeIdx); - IgniteConfiguration nodeCfg = getInactiveConfiguration(cacheModeIdx); - - // when - final IgniteEx crd = startGrid(crdCfg); - final IgniteEx node = startGrid(nodeCfg); - checkTopology(2); - - // then - assertNodesMvccDisabled(crd); - assertNodesMvccEnabled(node); - } - - /** - * Check that MVCC is disabled for client topology if cluster state is INACTIVE but cache node joined - */ - @Test - public void testMvccDisabledForClientTopologyBeforeClusterStateChange() throws Exception { - // given - IgniteConfiguration crdCfg = getInactiveConfiguration(cacheModeIdx); - IgniteConfiguration nodeCfg = getInactiveConfiguration(clientModeIdx); - - // when - final IgniteEx crd = startGrid(crdCfg); - final IgniteEx node = startGrid(nodeCfg); - checkTopology(2); - - // then - assertNodesMvccEnabled(crd); - assertNodesMvccDisabled(node); - } - - /** - * Check that MVCC is disabled for client topology if cluster changed state to ACTIVE - */ - @Test - public void testMvccDisabledForClientTopologyAfterClusterStateChange() throws Exception { - // given - IgniteConfiguration crdCfg = getConfiguration(getTestIgniteInstanceName(clientModeIdx)) - .setClusterStateOnStart(ClusterState.INACTIVE); - - // when - final IgniteEx crd = (IgniteEx)startGrid(getTestIgniteInstanceName(clientModeIdx), crdCfg); - - checkTopology(1); - crd.cluster().state(ClusterState.ACTIVE); - - // then - assertNodesMvccDisabled(crd); - } - - /** - * Check that MVCC is enabled for client topology if cluster state changed to ACTIVE and cache node joined - */ - @Test - public void testMvccEnabledForClientTopologyAfterClusterStateChange() throws Exception { - // given - IgniteConfiguration crdCfg = getInactiveConfiguration(clientModeIdx); - IgniteConfiguration nodeCfg = getInactiveConfiguration(cacheModeIdx); - - // when - final IgniteEx crd = startGrid(crdCfg); - final IgniteEx node = startGrid(nodeCfg); - checkTopology(2); - - crd.cluster().state(ClusterState.ACTIVE); - - // then - assertNodesMvccEnabled(crd, node); - } - - /** - * Check that MVCC is enabled for client topology when cluster state changed to ACTIVE and cache node left - */ - @Test - public void testMvccEnabledForClientTopologyAfterClusterStateChangeAndNodeLeft() throws Exception { - // given - IgniteConfiguration crdCfg = getInactiveConfiguration(clientModeIdx); - IgniteConfiguration nodeCfg = getInactiveConfiguration(cacheModeIdx); - - // when - final IgniteEx crd = startGrid(crdCfg); - startGrid(nodeCfg); - - checkTopology(2); - crd.cluster().state(ClusterState.ACTIVE); - - stopGrid(cacheModeIdx); - checkTopology(1); - - // then - assertNodesMvccEnabled(crd); - } - - /** - * Check that MVCC is enabled for client topology when cluster state changed to ACTIVE and new cache node joined - */ - @Test - public void testMvccEnabledForClientTopologyAfterClusterStateChangeAndCacheNodeJoined() throws Exception { - // given - IgniteConfiguration crdCfg = getInactiveConfiguration(clientModeIdx); - - // when - final IgniteEx crd = startGrid(crdCfg); - crd.cluster().state(ClusterState.ACTIVE); - - final IgniteEx node = startGrid(getTestIgniteInstanceName(cacheModeIdx)); - checkTopology(2); - - // then - assertNodesMvccEnabled(crd, node); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - super.afterTest(); - stopAllGrids(); - } - - /** - * Configure nodes in client mode (filtered by AttributeNodeFilter, no CacheConfiguration is set) - * or in ordinary server mode. - */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); - - if (getTestIgniteInstanceIndex(igniteInstanceName) != clientModeIdx) { - String attrName = "has_cache"; - Object attrVal = Boolean.TRUE; - - CacheConfiguration ccfg = defaultCacheConfiguration() - .setNearConfiguration(null) - .setNodeFilter(new AttributeNodeFilter(attrName, attrVal)) - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - return cfg - .setCacheConfiguration(ccfg) - .setUserAttributes(F.asMap(attrName, attrVal)); - } - - return cfg; - } - - /** - * Configuration with INACTIVE state on start - */ - private IgniteConfiguration getInactiveConfiguration(int idx) throws Exception { - return getConfiguration(getTestIgniteInstanceName(idx)) - .setClusterStateOnStart(ClusterState.INACTIVE); - } - - /** - * Asserts if any node enables MVCC - */ - private void assertNodesMvccDisabled(IgniteEx... nodes) { - assertNodesMvccIs(false, nodes); - } - - /** - * Asserts if any node doesn't enable MVCC - */ - private void assertNodesMvccEnabled(IgniteEx... nodes) { - assertNodesMvccIs(true, nodes); - } - - /** - * Asserts if any node MVCC status doesn't equal expected - */ - private void assertNodesMvccIs(boolean enabled, IgniteEx... nodes) { - for (IgniteEx n: nodes) - assertEquals("Check node: " + n.name(), enabled, n.context().coordinators().mvccEnabled()); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java deleted file mode 100644 index 2526953792d10..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.DataRegionConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.WALMode; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * - */ -public class CacheMvccClusterRestartTest extends GridCommonAbstractTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - cfg.setConsistentId(gridName); - - DataStorageConfiguration storageCfg = new DataStorageConfiguration(); - - storageCfg.setWalMode(WALMode.LOG_ONLY); - storageCfg.setPageSize(1024); - - DataRegionConfiguration regionCfg = new DataRegionConfiguration(); - - regionCfg.setPersistenceEnabled(true); - regionCfg.setMaxSize(100 * 1024 * 1024); - - storageCfg.setDefaultDataRegionConfiguration(regionCfg); - - cfg.setDataStorageConfiguration(storageCfg); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - super.afterTestsStopped(); - - stopAllGrids(); - - cleanPersistenceDir(); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - cleanPersistenceDir(); - - super.beforeTest(); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - super.afterTest(); - - stopAllGrids(); - - cleanPersistenceDir(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRestart1() throws Exception { - restart1(3, 3); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRestart2() throws Exception { - restart1(1, 3); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRestart3() throws Exception { - restart1(3, 1); - } - - /** - * @param srvBefore Number of servers before restart. - * @param srvAfter Number of servers after restart. - * @throws Exception If failed. - */ - private void restart1(int srvBefore, int srvAfter) throws Exception { - Ignite srv0 = startGridsMultiThreaded(srvBefore); - - IgniteCache cache = srv0.createCache(cacheConfiguration()); - - Set keys = new HashSet<>(primaryKeys(cache, 1, 0)); - - try (Transaction tx = srv0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (Integer k : keys) - cache.put(k, k); - - tx.commit(); - } - - stopAllGrids(); - - srv0 = startGridsMultiThreaded(srvAfter); - - cache = srv0.cache(DEFAULT_CACHE_NAME); - - Map res = cache.getAll(keys); - - assertEquals(keys.size(), res.size()); - - for (Integer k : keys) - assertEquals(k, cache.get(k)); - - try (Transaction tx = srv0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (Integer k : keys) - cache.put(k, k + 1); - - tx.commit(); - } - - for (Integer k : keys) - assertEquals(k + 1, cache.get(k)); - } - - /** - * @return Cache configuration. - */ - private CacheConfiguration cacheConfiguration() { - CacheConfiguration ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); - - ccfg.setWriteSynchronizationMode(FULL_SYNC); - ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - ccfg.setBackups(2); - - return ccfg; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java deleted file mode 100644 index aebc120ac6014..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccConfigurationValidationTest.java +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.io.Serializable; -import java.util.UUID; -import java.util.concurrent.Callable; -import javax.cache.Cache; -import javax.cache.CacheException; -import javax.cache.configuration.Factory; -import javax.cache.expiry.ExpiryPolicy; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheInterceptor; -import org.apache.ignite.cache.CacheRebalanceMode; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.DataRegionConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.lang.IgniteBiTuple; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.jetbrains.annotations.Nullable; -import org.junit.Test; -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.configuration.DataPageEvictionMode.RANDOM_2_LRU; -import static org.apache.ignite.configuration.DataPageEvictionMode.RANDOM_LRU; - -/** - * - */ -@SuppressWarnings("unchecked") -public class CacheMvccConfigurationValidationTest extends GridCommonAbstractTest { - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - - super.afterTest(); - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ThrowableNotThrown") - @Test - public void testMvccModeMismatchForGroup1() throws Exception { - final Ignite node = startGrid(0); - - node.createCache(new CacheConfiguration("cache1").setGroupName("grp1").setAtomicityMode(ATOMIC)); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() { - node.createCache( - new CacheConfiguration("cache2").setGroupName("grp1").setAtomicityMode(TRANSACTIONAL_SNAPSHOT)); - - return null; - } - }, CacheException.class, null); - - node.createCache(new CacheConfiguration("cache2").setGroupName("grp1").setAtomicityMode(ATOMIC)); - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ThrowableNotThrown") - @Test - public void testMvccModeMismatchForGroup2() throws Exception { - final Ignite node = startGrid(0); - - node.createCache( - new CacheConfiguration("cache1").setGroupName("grp1").setAtomicityMode(TRANSACTIONAL_SNAPSHOT)); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() { - node.createCache(new CacheConfiguration("cache2").setGroupName("grp1").setAtomicityMode(ATOMIC)); - - return null; - } - }, CacheException.class, null); - - node.createCache( - new CacheConfiguration("cache2").setGroupName("grp1").setAtomicityMode(TRANSACTIONAL_SNAPSHOT)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccLocalCacheDisabled() throws Exception { - final Ignite node1 = startGrid(1); - final Ignite node2 = startGrid(2); - - IgniteCache cache1 = node1.createCache(new CacheConfiguration("cache1") - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT)); - - cache1.put(1, 1); - cache1.put(2, 2); - cache1.put(2, 2); - - IgniteCache cache3 = node2.createCache(new CacheConfiguration("cache3") - .setAtomicityMode(TRANSACTIONAL)); - - cache3.put(1, 1); - cache3.put(2, 2); - cache3.put(3, 3); - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ThrowableNotThrown") - @Test - public void testNodeRestartWithCacheModeChangedTxToMvcc() throws Exception { - cleanPersistenceDir(); - - //Enable persistence. - DataStorageConfiguration storageCfg = new DataStorageConfiguration(); - DataRegionConfiguration regionCfg = new DataRegionConfiguration(); - regionCfg.setPersistenceEnabled(true); - storageCfg.setDefaultDataRegionConfiguration(regionCfg); - IgniteConfiguration cfg = getConfiguration("testGrid"); - cfg.setDataStorageConfiguration(storageCfg); - cfg.setConsistentId(cfg.getIgniteInstanceName()); - - Ignite node = startGrid(cfg); - - node.cluster().state(ClusterState.ACTIVE); - - CacheConfiguration ccfg1 = new CacheConfiguration("test1").setAtomicityMode(TRANSACTIONAL); - - IgniteCache cache = node.createCache(ccfg1); - - cache.put(1, 1); - cache.put(1, 2); - cache.put(2, 2); - - stopGrid(cfg.getIgniteInstanceName()); - - CacheConfiguration ccfg2 = new CacheConfiguration().setName(ccfg1.getName()) - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - IgniteConfiguration cfg2 = getConfiguration("testGrid") - .setConsistentId(cfg.getIgniteInstanceName()) - .setCacheConfiguration(ccfg2) - .setDataStorageConfiguration(storageCfg); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - startGrid(cfg2); - - return null; - } - }, IgniteCheckedException.class, "Cannot start cache. Statically configured atomicity mode differs from"); - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("ThrowableNotThrown") - @Test - public void testNodeRestartWithCacheModeChangedMvccToTx() throws Exception { - cleanPersistenceDir(); - - //Enable persistence. - DataStorageConfiguration storageCfg = new DataStorageConfiguration(); - DataRegionConfiguration regionCfg = new DataRegionConfiguration(); - regionCfg.setPersistenceEnabled(true); - regionCfg.setPageEvictionMode(RANDOM_LRU); - storageCfg.setDefaultDataRegionConfiguration(regionCfg); - IgniteConfiguration cfg = getConfiguration("testGrid"); - cfg.setDataStorageConfiguration(storageCfg); - cfg.setConsistentId(cfg.getIgniteInstanceName()); - - Ignite node = startGrid(cfg); - - node.cluster().state(ClusterState.ACTIVE); - - CacheConfiguration ccfg1 = new CacheConfiguration("test1").setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - IgniteCache cache = node.createCache(ccfg1); - - cache.put(1, 1); - cache.put(1, 2); - cache.put(2, 2); - - stopGrid(cfg.getIgniteInstanceName()); - - CacheConfiguration ccfg2 = new CacheConfiguration().setName(ccfg1.getName()) - .setAtomicityMode(TRANSACTIONAL); - - IgniteConfiguration cfg2 = getConfiguration("testGrid") - .setConsistentId(cfg.getIgniteInstanceName()) - .setCacheConfiguration(ccfg2) - .setDataStorageConfiguration(storageCfg); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - startGrid(cfg2); - - return null; - } - }, IgniteCheckedException.class, "Cannot start cache. Statically configured atomicity mode"); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccInMemoryEvictionDisabled() throws Exception { - final String memRegName = "in-memory-evictions"; - - // Enable in-memory eviction. - DataRegionConfiguration regionCfg = new DataRegionConfiguration(); - regionCfg.setPersistenceEnabled(false); - regionCfg.setPageEvictionMode(RANDOM_2_LRU); - regionCfg.setName(memRegName); - - DataStorageConfiguration storageCfg = new DataStorageConfiguration(); - storageCfg.setDefaultDataRegionConfiguration(regionCfg); - - IgniteConfiguration cfg = getConfiguration("testGrid"); - cfg.setDataStorageConfiguration(storageCfg); - - Ignite node = startGrid(cfg); - - CacheConfiguration ccfg1 = new CacheConfiguration("test1") - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setDataRegionName(memRegName); - - try { - node.createCache(ccfg1); - - fail("In memory evictions should be disabled for MVCC caches."); - } - catch (Exception e) { - assertTrue(X.getFullStackTrace(e).contains("Data pages evictions cannot be used with TRANSACTIONAL_SNAPSHOT")); - } - } - - /** - * Test TRANSACTIONAL_SNAPSHOT and near cache. - * - * @throws Exception If failed. - */ - @SuppressWarnings("unchecked") - @Test - public void testTransactionalSnapshotLimitations() throws Exception { - assertCannotStart( - mvccCacheConfig().setRebalanceMode(CacheRebalanceMode.NONE), - "Rebalance mode NONE cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode" - ); - - assertCannotStart( - mvccCacheConfig().setNearConfiguration(new NearCacheConfiguration<>()), - "near cache cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode" - ); - - assertCannotStart( - mvccCacheConfig().setReadThrough(true), - "readThrough cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode" - ); - - assertCannotStart( - mvccCacheConfig().setWriteThrough(true), - "writeThrough cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode" - ); - - assertCannotStart( - mvccCacheConfig().setWriteBehindEnabled(true), - "writeBehindEnabled cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode" - ); - - assertCannotStart( - mvccCacheConfig().setExpiryPolicyFactory(new TestExpiryPolicyFactory()), - "expiry policy cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode" - ); - - assertCannotStart( - mvccCacheConfig().setInterceptor(new TestCacheInterceptor()), - "interceptor cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode" - ); - } - - /** - * Checks if passed in {@code 'Throwable'} has given class in {@code 'cause'} hierarchy - * including that throwable itself and it contains passed message. - *

    - * Note that this method follows includes {@link Throwable#getSuppressed()} - * into check. - * - * @param t Throwable to check (if {@code null}, {@code false} is returned). - * @param cls Cause class to check (if {@code null}, {@code false} is returned). - * @param msg Message to check. - * @return {@code True} if one of the causing exception is an instance of passed in classes - * and it contains the passed message, {@code false} otherwise. - */ - private boolean hasCauseWithMessage(@Nullable Throwable t, Class cls, String msg) { - if (t == null) - return false; - - assert cls != null; - - for (Throwable th = t; th != null; th = th.getCause()) { - if (cls.isAssignableFrom(th.getClass()) && th.getMessage() != null && th.getMessage().contains(msg)) - return true; - - for (Throwable n : th.getSuppressed()) { - if (hasCauseWithMessage(n, cls, msg)) - return true; - } - - if (th.getCause() == th) - break; - } - - return false; - } - - /** - * Make sure cache cannot be started with the given configuration. - * - * @param ccfg Cache configuration. - * @param msg Message. - * @throws Exception If failed. - */ - @SuppressWarnings("unchecked") - private void assertCannotStart(CacheConfiguration ccfg, String msg) throws Exception { - Ignite node = startGrid(0); - - try { - try { - node.getOrCreateCache(ccfg); - - fail("Cache should not start."); - } - catch (Exception e) { - if (msg != null) { - assert e.getMessage() != null : "Error message is null"; - assertTrue(hasCauseWithMessage(e, IgniteCheckedException.class, msg)); - } - } - } - finally { - stopAllGrids(); - } - } - - /** - * @return MVCC-enabled cache configuration. - */ - private static CacheConfiguration mvccCacheConfig() { - return new CacheConfiguration().setName(DEFAULT_CACHE_NAME + UUID.randomUUID()) - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - } - - /** - * Test expiry policy. - */ - private static class TestExpiryPolicyFactory implements Factory, Serializable { - /** {@inheritDoc} */ - @Override public ExpiryPolicy create() { - return null; - } - } - - /** - * Test cache interceptor. - */ - private static class TestCacheInterceptor implements CacheInterceptor, Serializable { - /** {@inheritDoc} */ - @Nullable - @Override public Object onGet(Object key, @Nullable Object val) { - return null; - } - - /** {@inheritDoc} */ - @Nullable @Override public Object onBeforePut(Cache.Entry entry, Object newVal) { - return null; - } - - /** {@inheritDoc} */ - @Override public void onAfterPut(Cache.Entry entry) { - // No-op. - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteBiTuple onBeforeRemove(Cache.Entry entry) { - return null; - } - - /** {@inheritDoc} */ - @Override public void onAfterRemove(Cache.Entry entry) { - // No-op. - } - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccIteratorWithConcurrentTransactionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccIteratorWithConcurrentTransactionTest.java deleted file mode 100644 index c9cd9925e32ab..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccIteratorWithConcurrentTransactionTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import javax.cache.Cache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.util.lang.IgniteClosure2X; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.junit.Test; - -/** - * - */ -public class CacheMvccIteratorWithConcurrentTransactionTest extends CacheMvccAbstractFeatureTest { - /** - * @throws Exception if failed. - */ - @Test - public void testScanQuery() throws Exception { - doTestConsistency(clo); - } - - /** Test closure. */ - private final IgniteClosure2X> clo = - new IgniteClosure2X>() { - @Override public List applyx(CountDownLatch startLatch, CountDownLatch endLatch2) - throws IgniteCheckedException { - Iterator> it = cache().iterator(); - - List> pres = new ArrayList<>(); - - for (int i = 0; i < 50; i++) - pres.add(it.next()); - - if (startLatch != null) - startLatch.countDown(); - - while (it.hasNext()) - pres.add(it.next()); - - if (endLatch2 != null) - U.await(endLatch2); - - return entriesToPersons(pres); - } - }; -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccLocalEntriesWithConcurrentTransactionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccLocalEntriesWithConcurrentTransactionTest.java deleted file mode 100644 index 2fefb80776719..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccLocalEntriesWithConcurrentTransactionTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import javax.cache.Cache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.cache.CachePeekMode; -import org.apache.ignite.internal.util.lang.IgniteClosure2X; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.junit.Test; - -/** - * - */ -public class CacheMvccLocalEntriesWithConcurrentTransactionTest extends CacheMvccAbstractFeatureTest { - /** - * @throws Exception if failed. - */ - @Test - public void testLocalEntries() throws Exception { - doTestConsistency(clo); - } - - /** Test closure. */ - private final IgniteClosure2X> clo = - new IgniteClosure2X>() { - @Override public List applyx(CountDownLatch startLatch, CountDownLatch endLatch2) - throws IgniteCheckedException { - Iterator> it = cache().localEntries(CachePeekMode.PRIMARY).iterator(); - - List> pres = new ArrayList<>(); - - for (int i = 0; i < 10; i++) - pres.add(it.next()); - - if (startLatch != null) - startLatch.countDown(); - - while (it.hasNext()) - pres.add(it.next()); - - if (endLatch2 != null) - U.await(endLatch2); - - return entriesToPersons(pres); - } - }; -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccOperationChecksTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccOperationChecksTest.java deleted file mode 100644 index b20212e734b59..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccOperationChecksTest.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.Collection; -import java.util.Collections; -import java.util.Set; -import java.util.concurrent.Callable; -import javax.cache.expiry.EternalExpiryPolicy; -import javax.cache.expiry.ExpiryPolicy; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.processors.cache.GridCacheAdapter; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteBiPredicate; -import org.apache.ignite.lang.IgniteFuture; -import org.apache.ignite.testframework.GridTestUtils; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * - */ -public class CacheMvccOperationChecksTest extends CacheMvccAbstractTest { - /** Empty Class[]. */ - private static final Class[] E = new Class[]{}; - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** - * @throws Exception if failed. - */ - @Test - public void testClearOperationsUnsupported() throws Exception { - checkOperationUnsupported("clear", m("Clear"), E); - - checkOperationUnsupported("clearAsync", m("Clear"), E); - - checkOperationUnsupported("clear", m("Clear"), t(Object.class), 1); - - checkOperationUnsupported("clearAsync", m("Clear"), t(Object.class), 1); - - checkOperationUnsupported("clearAll", m("Clear"), t(Set.class), Collections.singleton(1)); - - checkOperationUnsupported("clearAllAsync", m("Clear"), t(Set.class), - Collections.singleton(1)); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testLoadOperationsUnsupported() throws Exception { - checkOperationUnsupported("loadCache", m("Load"), t(IgniteBiPredicate.class, Object[].class), - P, new Object[]{ 1 }); - - checkOperationUnsupported("loadCacheAsync", m("Load"), t(IgniteBiPredicate.class, Object[].class), - P, new Object[]{ 1 }); - - checkOperationUnsupported("localLoadCache", m("Load"), t(IgniteBiPredicate.class, Object[].class), - P, new Object[]{ 1 }); - - checkOperationUnsupported("localLoadCacheAsync", m("Load"), t(IgniteBiPredicate.class, Object[].class), - P, new Object[]{ 1 }); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testLockOperationsUnsupported() throws Exception { - checkOperationUnsupported("lock", m("Lock"), t(Object.class), 1); - - checkOperationUnsupported("lockAll", m("Lock"), t(Collection.class), Collections.singleton(1)); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testEvictOperationsUnsupported() throws Exception { - checkOperationUnsupported("localEvict", m("Evict"), t(Collection.class), Collections.singleton(1)); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testWithExpiryPolicyUnsupported() throws Exception { - checkOperationUnsupported("withExpiryPolicy", m("withExpiryPolicy"), t(ExpiryPolicy.class), - EternalExpiryPolicy.factoryOf().create()); - } - - /** - * @param opTypeName Operation type name. - * @return Typical error message from {@link GridCacheAdapter}. - */ - private static String m(String opTypeName) { - return opTypeName + " operations are not supported on transactional caches when MVCC is enabled."; - } - - /** - * @param types Parameter types. - * @return Types array. - */ - private static Class[] t(Class... types) { - return types; - } - - /** - * @param mtdName Method name. - * @param errMsg Expected error message. - * @param paramTypes Operation param types. - * @param args Operation arguments. - * @throws Exception if failed. - */ - @SuppressWarnings("ThrowableNotThrown") - private void checkOperationUnsupported(String mtdName, String errMsg, Class[] paramTypes, - Object... args) throws Exception { - final boolean async = mtdName.endsWith("Async"); - - try (final Ignite node = startGrid(0)) { - final CacheConfiguration cfg = new CacheConfiguration<>("cache"); - - cfg.setCacheMode(cacheMode()); - cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - try (IgniteCache cache = node.createCache(cfg)) { - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - try { - Object o = U.invoke(null, cache, mtdName, paramTypes, args); - - if (async) { - assertTrue(o instanceof IgniteFuture); - - ((IgniteFuture)o).get(); - } - } - catch (Exception e) { - if (e.getCause() == null) - throw e; - - if (e.getCause().getCause() == null) - throw e; - - throw (Exception)e.getCause().getCause(); - } - - return null; - } - }, UnsupportedOperationException.class, errMsg); - } - } - } - - /** - * - */ - private static final IgniteBiPredicate P = new IgniteBiPredicate() { - @Override public boolean apply(Object o, Object o2) { - return false; - } - }; -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedCoordinatorFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedCoordinatorFailoverTest.java deleted file mode 100644 index eb27ce19d8b4a..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedCoordinatorFailoverTest.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.CacheConfiguration; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.GET; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SCAN; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.PUT; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Coordinator failover test for partitioned caches. - */ -public class CacheMvccPartitionedCoordinatorFailoverTest extends CacheMvccAbstractCoordinatorFailoverTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGet_ClientServer_Backups2_CoordinatorFails_Persistence() throws Exception { - persistence = true; - - accountsTxReadAll(4, 2, 2, DFLT_PARTITION_COUNT, - null, true, GET, PUT, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGet_Server_Backups1_CoordinatorFails() throws Exception { - accountsTxReadAll(2, 0, 1, DFLT_PARTITION_COUNT, - null, true, GET, PUT, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_ClientServer_Backups2_CoordinatorFails() throws Exception { - accountsTxReadAll(4, 2, 2, DFLT_PARTITION_COUNT, - null, true, SCAN, PUT, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_Server_Backups1_CoordinatorFails_Persistence() throws Exception { - persistence = true; - - accountsTxReadAll(2, 0, 1, DFLT_PARTITION_COUNT, - null, true, SCAN, PUT, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups2_RestartCoordinator_GetPut() throws Exception { - putAllGetAll(RestartMode.RESTART_CRD, 4, 2, 2, DFLT_PARTITION_COUNT, - null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups1_RestartCoordinator_GetPut_Persistence() throws Exception { - persistence = true; - - putAllGetAll(RestartMode.RESTART_CRD, 2, 1, 1, 64, - null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_ClientServer_Backups1_PutGet_CoordinatorFails_Persistence() throws Exception { - persistence = true; - - updateNObjectsTest(3, 5, 3, 1, DFLT_PARTITION_COUNT, DFLT_TEST_TIME, - null, GET, PUT, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_ClientServer_Backups1__PutGet_CoordinatorFails() throws Exception { - updateNObjectsTest(10, 3, 2, 1, DFLT_PARTITION_COUNT, DFLT_TEST_TIME, - null, GET, PUT, RestartMode.RESTART_CRD); - } - - - /** - * @throws Exception If failed. - */ - @Test - public void testGetReadInProgressCoordinatorFails() throws Exception { - readInProgressCoordinatorFails(false, false, PESSIMISTIC, REPEATABLE_READ, GET, PUT, null); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testGetReadInsideTxInProgressCoordinatorFails() throws Exception { - readInProgressCoordinatorFails(false, true, PESSIMISTIC, REPEATABLE_READ, GET, PUT, null); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testGetReadInProgressCoordinatorFails_ReadDelay() throws Exception { - readInProgressCoordinatorFails(true, false, PESSIMISTIC, REPEATABLE_READ, GET, PUT, null); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testGetReadInsideTxInProgressCoordinatorFails_ReadDelay() throws Exception { - readInProgressCoordinatorFails(true, true, PESSIMISTIC, REPEATABLE_READ, GET, PUT, null); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testReadInProgressCoordinatorFailsSimple_FromServerPutGet() throws Exception { - readInProgressCoordinatorFailsSimple(false, null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testActivateDeactivateCLuster() throws Exception { - disableScheduledVacuum = true; - persistence = true; - - final int DATA_NODES = 3; - - // Do not use startMultithreaded here. - startGrids(DATA_NODES); - - Ignite near = grid(DATA_NODES - 1); - - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, DATA_NODES - 1, DFLT_PARTITION_COUNT); - - near.cluster().state(ClusterState.ACTIVE); - - IgniteCache cache = near.createCache(ccfg); - - cache.put(1, 1); - - near.cluster().state(ClusterState.INACTIVE); - - stopGrid(0); - - near.cluster().state(ClusterState.ACTIVE); - - assertEquals(1, cache.get(1)); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorLazyStartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorLazyStartTest.java deleted file mode 100644 index 884408db3d25e..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorLazyStartTest.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.CacheWriteSynchronizationMode; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.junit.Test; - -/** - * Tests for a lazy MVCC processor start. - */ -@SuppressWarnings("unchecked") -public class CacheMvccProcessorLazyStartTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPreconfiguredCacheMvccNotStarted() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(CacheMode.PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 0, 1); - ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); - - IgniteConfiguration cfg = getConfiguration(); - cfg.setCacheConfiguration(ccfg); - IgniteConfiguration cfg2 = getConfiguration("node2"); - - IgniteEx node1 = startGrid(cfg); - IgniteEx node2 = startGrid(cfg2); - - IgniteCache cache = node1.cache(ccfg.getName()); - - cache.put(1, 1); - cache.put(1, 2); - - assertFalse(mvccEnabled(node1)); - assertFalse(mvccEnabled(node2)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPreconfiguredCacheMvccStarted() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(CacheMode.PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 0, 1); - - IgniteConfiguration cfg1 = getConfiguration(); - cfg1.setCacheConfiguration(ccfg); - IgniteConfiguration cfg2 = getConfiguration("node2"); - - IgniteEx node1 = startGrid(cfg1); - IgniteEx node2 = startGrid(cfg2); - - IgniteCache cache = node1.cache(ccfg.getName()); - - cache.put(1, 1); - cache.put(1, 2); - - assertTrue(mvccEnabled(node1)); - assertTrue(mvccEnabled(node2)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccRestartedWithDynamicCache() throws Exception { - persistence = true; - - IgniteEx node1 = startGrid(1); - IgniteEx node2 = startGrid(2); - - assertFalse(mvccEnabled(node1)); - assertFalse(mvccEnabled(node2)); - - node1.cluster().state(ClusterState.ACTIVE); - - assertFalse(mvccEnabled(node1)); - assertFalse(mvccEnabled(node2)); - - CacheConfiguration ccfg = cacheConfiguration(CacheMode.PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 0, 1); - - IgniteCache cache = node1.createCache(ccfg); - - cache.put(1, 1); - cache.put(1, 2); - - assertTrue(mvccEnabled(node1)); - assertTrue(mvccEnabled(node2)); - - stopGrid(1); - stopGrid(2); - - node1 = startGrid(1); - node2 = startGrid(2); - - node1.cluster().state(ClusterState.ACTIVE); - - assertTrue(mvccEnabled(node1)); - assertTrue(mvccEnabled(node2)); - - cache = node1.cache(ccfg.getName()); - - cache.put(1, 1); - cache.put(1, 2); - - assertTrue(mvccEnabled(node1)); - assertTrue(mvccEnabled(node2)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccStartedWithDynamicCache() throws Exception { - IgniteEx node1 = startGrid(1); - IgniteEx node2 = startGrid(2); - - assertFalse(mvccEnabled(node1)); - assertFalse(mvccEnabled(node2)); - - CacheConfiguration ccfg = cacheConfiguration(CacheMode.PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 0, 1); - - IgniteCache cache = node1.createCache(ccfg); - - cache.put(1, 1); - cache.put(1, 2); - - assertTrue(mvccEnabled(node1)); - assertTrue(mvccEnabled(node2)); - - stopGrid(1); - stopGrid(2); - - node1 = startGrid(1); - node2 = startGrid(2); - - // Should not be started because we do not have persistence enabled - assertFalse(mvccEnabled(node1)); - assertFalse(mvccEnabled(node2)); - - cache = node1.createCache(ccfg); - - cache.put(1, 1); - cache.put(1, 2); - - assertTrue(mvccEnabled(node1)); - assertTrue(mvccEnabled(node2)); - } - - /** - * @param node Node. - * @return {@code True} if {@link MvccProcessor} is started. - */ - private boolean mvccEnabled(IgniteEx node) { - return node.context().coordinators().mvccEnabled(); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorTest.java deleted file mode 100644 index 5b38deef66ca8..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccProcessorTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxState; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * - */ -public class CacheMvccProcessorTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTreeWithPersistence() throws Exception { - persistence = true; - - checkTreeOperations(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTreeWithoutPersistence() throws Exception { - persistence = false; - - checkTreeOperations(); - } - - /** - * @throws Exception If failed. - */ - private void checkTreeOperations() throws Exception { - IgniteEx grid = startGrid(0); - - grid.cluster().state(ClusterState.ACTIVE); - - grid.createCache(new CacheConfiguration<>("test").setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT)); - - MvccProcessorImpl mvccProcessor = mvccProcessor(grid); - - assertEquals(TxState.NA, mvccProcessor.state(new MvccVersionImpl(1, 1, MvccUtils.MVCC_OP_COUNTER_NA))); - - grid.context().cache().context().database().checkpointReadLock(); - try { - mvccProcessor.updateState(new MvccVersionImpl(1, 1, MvccUtils.MVCC_OP_COUNTER_NA), TxState.PREPARED); - mvccProcessor.updateState(new MvccVersionImpl(1, 2, MvccUtils.MVCC_OP_COUNTER_NA), TxState.PREPARED); - mvccProcessor.updateState(new MvccVersionImpl(1, 3, MvccUtils.MVCC_OP_COUNTER_NA), TxState.COMMITTED); - mvccProcessor.updateState(new MvccVersionImpl(1, 4, MvccUtils.MVCC_OP_COUNTER_NA), TxState.ABORTED); - mvccProcessor.updateState(new MvccVersionImpl(1, 5, MvccUtils.MVCC_OP_COUNTER_NA), TxState.ABORTED); - mvccProcessor.updateState(new MvccVersionImpl(1, 6, MvccUtils.MVCC_OP_COUNTER_NA), TxState.PREPARED); - } - finally { - grid.context().cache().context().database().checkpointReadUnlock(); - } - - if (persistence) { - stopGrid(0, false); - grid = startGrid(0); - - grid.cluster().state(ClusterState.ACTIVE); - - mvccProcessor = mvccProcessor(grid); - } - - assertEquals(TxState.PREPARED, mvccProcessor.state(new MvccVersionImpl(1, 1, MvccUtils.MVCC_OP_COUNTER_NA))); - assertEquals(TxState.PREPARED, mvccProcessor.state(new MvccVersionImpl(1, 2, MvccUtils.MVCC_OP_COUNTER_NA))); - assertEquals(TxState.COMMITTED, mvccProcessor.state(new MvccVersionImpl(1, 3, MvccUtils.MVCC_OP_COUNTER_NA))); - assertEquals(TxState.ABORTED, mvccProcessor.state(new MvccVersionImpl(1, 4, MvccUtils.MVCC_OP_COUNTER_NA))); - assertEquals(TxState.ABORTED, mvccProcessor.state(new MvccVersionImpl(1, 5, MvccUtils.MVCC_OP_COUNTER_NA))); - assertEquals(TxState.PREPARED, mvccProcessor.state(new MvccVersionImpl(1, 6, MvccUtils.MVCC_OP_COUNTER_NA))); - - mvccProcessor.removeUntil(new MvccVersionImpl(1, 5, MvccUtils.MVCC_OP_COUNTER_NA)); - - assertEquals(TxState.NA, mvccProcessor.state(new MvccVersionImpl(1, 1, MvccUtils.MVCC_OP_COUNTER_NA))); - assertEquals(TxState.NA, mvccProcessor.state(new MvccVersionImpl(1, 2, MvccUtils.MVCC_OP_COUNTER_NA))); - assertEquals(TxState.NA, mvccProcessor.state(new MvccVersionImpl(1, 3, MvccUtils.MVCC_OP_COUNTER_NA))); - assertEquals(TxState.NA, mvccProcessor.state(new MvccVersionImpl(1, 4, MvccUtils.MVCC_OP_COUNTER_NA))); - assertEquals(TxState.NA, mvccProcessor.state(new MvccVersionImpl(1, 5, MvccUtils.MVCC_OP_COUNTER_NA))); - assertEquals(TxState.PREPARED, mvccProcessor.state(new MvccVersionImpl(1, 6, MvccUtils.MVCC_OP_COUNTER_NA))); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccRemoteTxOnNearNodeStartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccRemoteTxOnNearNodeStartTest.java deleted file mode 100644 index c9aab16ed9051..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccRemoteTxOnNearNodeStartTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import com.google.common.collect.ImmutableMap; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.affinity.Affinity; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** */ -public class CacheMvccRemoteTxOnNearNodeStartTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** - * Ensures that remote transaction on near node is started - * when first request is sent to OWNING partition and second to MOVING partition. - * @throws Exception if failed. - */ - @Test - public void testRemoteTxOnNearNodeIsStartedIfPartitionIsMoving() throws Exception { - startGridsMultiThreaded(3); - - IgniteCache cache = grid(0).getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - .setCacheMode(cacheMode()) - .setBackups(1) - ); - - ArrayList keys = new ArrayList<>(); - - Affinity aff = grid(0).affinity(DEFAULT_CACHE_NAME); - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(grid(1).localNode(), i) && aff.isBackup(grid(0).localNode(), i)) { - keys.add(i); - break; - } - } - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(grid(1).localNode(), i) && aff.isBackup(grid(2).localNode(), i)) { - keys.add(i); - break; - } - } - - assert keys.size() == 2; - - stopGrid(2); - - try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.putAll(ImmutableMap.of( - keys.get(0), 0, - keys.get(1), 1) - ); - - tx.commit(); - } - - // assert transaction was committed without errors - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedCoordinatorFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedCoordinatorFailoverTest.java deleted file mode 100644 index dc948cd9e460c..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedCoordinatorFailoverTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -/** - * Coordinator failover test for replicated caches. - */ -public class CacheMvccReplicatedCoordinatorFailoverTest extends CacheMvccAbstractCoordinatorFailoverTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.REPLICATED; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccScanQueryWithConcurrentTransactionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccScanQueryWithConcurrentTransactionTest.java deleted file mode 100644 index 230bd6e69b377..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccScanQueryWithConcurrentTransactionTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import javax.cache.Cache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.cache.query.QueryCursor; -import org.apache.ignite.cache.query.ScanQuery; -import org.apache.ignite.internal.util.lang.IgniteClosure2X; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteBiPredicate; -import org.junit.Test; - -/** - * - */ -public class CacheMvccScanQueryWithConcurrentTransactionTest extends CacheMvccAbstractFeatureTest { - /** - * @throws Exception if failed. - */ - @Test - public void testScanQuery() throws Exception { - doTestConsistency(clo); - } - - /** Test closure. */ - private final IgniteClosure2X> clo = - new IgniteClosure2X>() { - @Override public List applyx(CountDownLatch startLatch, CountDownLatch endLatch2) - throws IgniteCheckedException { - IgniteBiPredicate f = new IgniteBiPredicate() { - @Override public boolean apply(Integer k, Person v) { - return k % 2 == 0; - } - }; - - try (QueryCursor> cur = cache().query(new ScanQuery() - .setFilter(f))) { - Iterator> it = cur.iterator(); - - List> pres = new ArrayList<>(); - - for (int i = 0; i < 50; i++) - pres.add(it.next()); - - if (startLatch != null) - startLatch.countDown(); - - while (it.hasNext()) - pres.add(it.next()); - - if (endLatch2 != null) - U.await(endLatch2); - - return entriesToPersons(pres); - } - } - }; -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeWithConcurrentTransactionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeWithConcurrentTransactionTest.java deleted file mode 100644 index 5a51cc3d70238..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeWithConcurrentTransactionTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.concurrent.CountDownLatch; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.util.lang.IgniteClosure2X; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.junit.Test; - -/** - * - */ -public class CacheMvccSizeWithConcurrentTransactionTest extends CacheMvccAbstractFeatureTest { - /** - * @throws Exception if failed. - */ - @Test - public void testSize() throws Exception { - doTestConsistency(clo); - } - - /** Test closure. */ - private final IgniteClosure2X clo = - new IgniteClosure2X() { - @Override public Integer applyx(CountDownLatch startLatch, CountDownLatch endLatch2) - throws IgniteCheckedException { - if (startLatch != null) - startLatch.countDown(); - - int res = cache().size(); - - if (endLatch2 != null) - U.await(endLatch2); - - return res; - } - }; -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java deleted file mode 100644 index 112ae8626623d..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java +++ /dev/null @@ -1,3628 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; -import java.util.concurrent.Callable; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; -import javax.cache.Cache; -import javax.cache.CacheException; -import javax.cache.expiry.Duration; -import javax.cache.expiry.TouchedExpiryPolicy; -import javax.cache.processor.EntryProcessorException; -import javax.cache.processor.MutableEntry; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteDataStreamer; -import org.apache.ignite.IgniteException; -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.cache.CacheEntryProcessor; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.affinity.Affinity; -import org.apache.ignite.cache.query.ScanQuery; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.cluster.ClusterTopologyException; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.TestRecordingCommunicationSpi; -import org.apache.ignite.internal.processors.cache.CacheObject; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.GridCacheMapEntry; -import org.apache.ignite.internal.processors.cache.KeyCacheObject; -import org.apache.ignite.internal.processors.cache.distributed.TestCacheNodeExcludingFilter; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetRequest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetResponse; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishRequest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishResponse; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse; -import org.apache.ignite.internal.processors.cache.mvcc.msg.MvccAckRequestQueryCntr; -import org.apache.ignite.internal.processors.cache.mvcc.msg.MvccAckRequestTx; -import org.apache.ignite.internal.processors.cache.mvcc.msg.MvccSnapshotResponse; -import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; -import org.apache.ignite.internal.util.lang.GridAbsPredicate; -import org.apache.ignite.internal.util.lang.GridInClosure3; -import org.apache.ignite.internal.util.typedef.CI1; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.internal.util.typedef.internal.CU; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteBiPredicate; -import org.apache.ignite.lang.IgniteBiTuple; -import org.apache.ignite.lang.IgniteInClosure; -import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionIsolation; -import org.jetbrains.annotations.Nullable; -import org.junit.Ignore; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.GET; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SCAN; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.PUT; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccQueryTracker.MVCC_TRACKER_ID_NA; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * - */ -@SuppressWarnings("unchecked") -public class CacheMvccTransactionsTest extends CacheMvccAbstractTest { - /** */ - private static final long SCALED_10SEC_TEST_TIME = SF.applyLB(10_000, 3_000); - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** - * @throws Exception if failed. - */ - @Test - public void testEmptyTx() throws Exception { - Ignite node = startGrids(2); - - IgniteCache cache = node.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, DFLT_PARTITION_COUNT)); - - cache.putAll(Collections.emptyMap()); - - IgniteTransactions txs = node.transactions(); - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.commit(); - } - finally { - stopAllGrids(); - } - } - - /** - * @throws Exception if failed. - */ - @Test - public void testImplicitTxOps() throws Exception { - checkTxWithAllCaches(new CI1>() { - @Override public void apply(IgniteCache cache) { - try { - List keys = testKeys(cache); - - for (Integer key : keys) { - log.info("Test key: " + key); - - Integer val = cache.get(key); - - assertNull(val); - - assertFalse(cache.containsKey(key)); - - cache.put(key, -1); - - val = (Integer)checkAndGet(true, cache, key, GET, SCAN); - - assertEquals(Integer.valueOf(-1), val); - - assertTrue(cache.containsKey(key)); - - cache.put(key, key); - - val = (Integer)checkAndGet(true, cache, key, GET, SCAN); - - assertEquals(key, val); - - cache.remove(key); - - val = cache.get(key); - - assertNull(val); - - val = (Integer)checkAndGet(false, cache, key, SCAN, GET); - - assertNull(val); - - assertTrue(cache.putIfAbsent(key, key)); - - val = (Integer)checkAndGet(true, cache, key, GET, SCAN); - - assertEquals(key, val); - - val = cache.getAndReplace(key, -1); - - assertEquals(key, val); - - val = (Integer)checkAndGet(true, cache, key, GET, SCAN); - - assertEquals(Integer.valueOf(-1), val); - - val = cache.getAndRemove(key); - - assertEquals(Integer.valueOf(-1), val); - - val = cache.get(key); - - assertNull(val); - - val = (Integer)checkAndGet(false, cache, key, SCAN, GET); - - assertNull(val); - - val = cache.getAndPutIfAbsent(key, 1); - - assertNull(val); - - val = (Integer)checkAndGet(false, cache, key, SCAN, GET); - - assertEquals((Integer)1, val); - - val = cache.getAndPutIfAbsent(key, 1); - - assertEquals((Integer)1, val); - - val = (Integer)checkAndGet(false, cache, key, SCAN, GET); - - assertEquals((Integer)1, val); - - assertFalse(cache.remove(key, 2)); - - val = (Integer)checkAndGet(false, cache, key, SCAN, GET); - - assertEquals((Integer)1, val); - - cache.remove(key, 1); - - val = (Integer)checkAndGet(false, cache, key, SCAN, GET); - - assertNull(val); - } - } - catch (Exception e) { - throw new IgniteException(e); - } - } - }); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPessimisticTx1() throws Exception { - checkTxWithAllCaches(new CI1>() { - @Override public void apply(IgniteCache cache) { - try { - IgniteTransactions txs = cache.unwrap(Ignite.class).transactions(); - - List keys = testKeys(cache); - - for (Integer key : keys) { - log.info("Test key: " + key); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - Integer val = cache.get(key); - - assertNull(val); - - cache.put(key, key); - - val = (Integer)checkAndGet(true, cache, key, GET, SCAN); - - assertEquals(key, val); - - tx.commit(); - } - - Integer val = (Integer)checkAndGet(false, cache, key, SCAN, GET); - - assertEquals(key, val); - } - } - catch (Exception e) { - throw new IgniteException(e); - } - } - }); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPessimisticTx2() throws Exception { - checkTxWithAllCaches(new CI1>() { - @Override public void apply(IgniteCache cache) { - try { - IgniteTransactions txs = cache.unwrap(Ignite.class).transactions(); - - List keys = testKeys(cache); - - for (Integer key : keys) { - log.info("Test key: " + key); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key, key); - cache.put(key + 1, key + 1); - - assertEquals(key, checkAndGet(true, cache, key, GET, SCAN)); - assertEquals(key + 1, checkAndGet(true, cache, key + 1, GET, SCAN)); - - tx.commit(); - } - - assertEquals(key, checkAndGet(false, cache, key, GET, SCAN)); - assertEquals(key + 1, checkAndGet(false, cache, key + 1, GET, SCAN)); - } - } - catch (Exception e) { - throw new IgniteException(e); - } - } - }); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPessimisticTx3() throws Exception { - checkTxWithAllCaches(new CI1>() { - @Override public void apply(IgniteCache cache) { - try { - IgniteTransactions txs = cache.unwrap(Ignite.class).transactions(); - - List keys = testKeys(cache); - - for (Integer key : keys) { - log.info("Test key: " + key); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - Integer val = cache.get(key); - - assertNull(val); - - Integer res = cache.invoke(key, new CacheEntryProcessor() { - @Override public Integer process(MutableEntry entry, - Object... arguments) throws EntryProcessorException { - - entry.setValue(key); - - return -key; - } - }); - - assertEquals(Integer.valueOf(-key), res); - - val = (Integer)checkAndGet(true, cache, key, GET, SCAN); - - assertEquals(key, val); - - tx.commit(); - } - - Integer val = (Integer)checkAndGet(false, cache, key, SCAN, GET); - - assertEquals(key, val); - } - } - catch (Exception e) { - throw new IgniteException(e); - } - } - }); - } - - /** - * @param c Closure to run. - * @throws Exception If failed. - */ - private void checkTxWithAllCaches(IgniteInClosure> c) throws Exception { - client = false; - - startGridsMultiThreaded(SRVS); - - client = true; - - startGrid(SRVS); - - try { - for (CacheConfiguration ccfg : cacheConfigurations()) { - logCacheInfo(ccfg); - - ignite(0).createCache(ccfg); - - try { - Ignite node = ignite(0); - - IgniteCache cache = node.cache(ccfg.getName()); - - c.apply(cache); - } - finally { - ignite(0).destroyCache(ccfg.getName()); - } - } - - verifyCoordinatorInternalState(); - } - finally { - stopAllGrids(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testWithCacheGroups() throws Exception { - Ignite srv0 = startGrid(0); - - List ccfgs = new ArrayList<>(); - - for (int c = 0; c < 3; c++) { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, FULL_SYNC, 0, DFLT_PARTITION_COUNT); - - ccfg.setName("cache-" + c); - ccfg.setGroupName("grp1"); - - ccfgs.add(ccfg); - } - - srv0.createCaches(ccfgs); - - final int PUTS = 5; - - for (int i = 0; i < PUTS; i++) { - for (int c = 0; c < 3; c++) { - IgniteCache cache = srv0.cache("cache-" + c); - - Map vals = new HashMap<>(); - - for (int k = 0; k < 10; k++) { - cache.put(k, i); - - vals.put(k, i); - - assertEquals(i, checkAndGet(false, cache, k, SCAN, GET)); - } - - assertEquals(vals, checkAndGetAll(false, cache, vals.keySet(), GET, SCAN)); - } - } - - for (int c = 0; c < 3; c++) { - IgniteCache cache = srv0.cache("cache-" + c); - - Map vals = new HashMap<>(); - - for (int k = 0; k < 10; k++) { - if (k % 2 == 0) - vals.put(k, PUTS - 1); - else { - cache.remove(k); - - assertNull(checkAndGet(false, cache, k, SCAN, GET)); - } - } - - assertEquals(vals, checkAndGetAll(false, cache, vals.keySet(), GET, SCAN)); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCacheRecreate() throws Exception { - cacheRecreate(null); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testActiveQueriesCleanup() throws Exception { - activeQueriesCleanup(false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testActiveQueriesCleanupTx() throws Exception { - activeQueriesCleanup(true); - } - - /** - * @param tx If {@code true} tests reads inside transaction. - * @throws Exception If failed. - */ - private void activeQueriesCleanup(final boolean tx) throws Exception { - startGridsMultiThreaded(SRVS); - - client = true; - - Ignite client = startGrid(SRVS); - - final int NODES = SRVS + 1; - - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, FULL_SYNC, 1, 512); - - client.createCache(ccfg); - - final long stopTime = System.currentTimeMillis() + 5000; - - GridTestUtils.runMultiThreaded(new IgniteInClosure() { - @Override public void apply(Integer idx) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - Ignite node = ignite(idx % NODES); - - IgniteTransactions txs = node.transactions(); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - while (System.currentTimeMillis() < stopTime) { - int keyCnt = rnd.nextInt(10) + 1; - - Set keys = new HashSet<>(); - - for (int i = 0; i < keyCnt; i++) - keys.add(rnd.nextInt()); - - if (tx) { - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.getAll(keys); - - if (rnd.nextBoolean()) - tx.commit(); - else - tx.rollback(); - } - } - else - cache.getAll(keys); - } - } - }, NODES * 2, "get-thread"); - - for (Ignite node : G.allGrids()) - checkActiveQueriesCleanup(node); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTxReadIsolationSimple() throws Exception { - Ignite srv0 = startGrids(4); - - client = true; - - startGrid(4); - - for (CacheConfiguration ccfg : cacheConfigurations()) { - IgniteCache cache0 = srv0.createCache(ccfg); - - final Map startVals = new HashMap<>(); - - final int KEYS = 10; - - for (int i = 0; i < KEYS; i++) - startVals.put(i, 0); - - for (final TransactionIsolation isolation : TransactionIsolation.values()) { - for (final Ignite node : G.allGrids()) { - info("Run test [node=" + node.name() + ", isolation=" + isolation + ']'); - - try (Transaction tx = srv0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache0.putAll(startVals); - - tx.commit(); - } - - final CountDownLatch readStart = new CountDownLatch(1); - - final CountDownLatch readProceed = new CountDownLatch(1); - - IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - assertEquals(0, checkAndGet(false, cache, 0, SCAN, GET)); - - readStart.countDown(); - - assertTrue(readProceed.await(5, TimeUnit.SECONDS)); - - assertEquals(0, checkAndGet(true, cache, 1, GET, SCAN)); - - assertEquals(0, checkAndGet(true, cache, 2, GET, SCAN)); - - Map res = checkAndGetAll(true, cache, startVals.keySet(), GET, SCAN); - - assertEquals(startVals.size(), res.size()); - - for (Map.Entry e : res.entrySet()) - assertEquals("Invalid value for key: " + e.getKey(), 0, e.getValue()); - - tx.rollback(); - } - - return null; - } - }); - - assertTrue(readStart.await(5, TimeUnit.SECONDS)); - - for (int i = 0; i < KEYS; i++) { - try (Transaction tx = srv0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - if (i % 2 == 0) - cache0.put(i, 1); - else - cache0.remove(i); - - tx.commit(); - } - } - - readProceed.countDown(); - - fut.get(); - } - } - - srv0.destroyCache(cache0.getName()); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutGetAllSimple() throws Exception { - Ignite node = startGrid(0); - - IgniteTransactions txs = node.transactions(); - - final IgniteCache cache = node.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, 1)); - - final int KEYS = 10_000; - - Set keys = new HashSet<>(); - - for (int k = 0; k < KEYS; k++) - keys.add(k); - - Map map = checkAndGetAll(false, cache, keys, SCAN, GET); - - assertTrue(map.isEmpty()); - - for (int v = 0; v < 3; v++) { - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int k = 0; k < KEYS; k++) { - if (k % 2 == 0) - cache.put(k, v); - } - - tx.commit(); - } - - map = checkAndGetAll(false, cache, keys, SCAN, GET); - - for (int k = 0; k < KEYS; k++) { - if (k % 2 == 0) - assertEquals(v, map.get(k)); - else - assertNull(map.get(k)); - } - - assertEquals(KEYS / 2, map.size()); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - map = checkAndGetAll(true, cache, keys, SCAN, GET); - - for (int k = 0; k < KEYS; k++) { - if (k % 2 == 0) - assertEquals(v, map.get(k)); - else - assertNull(map.get(k)); - } - - assertEquals(KEYS / 2, map.size()); - - tx.commit(); - } - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutRemoveSimple() throws Exception { - putRemoveSimple(false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutRemoveSimple_LargeKeys() throws Exception { - putRemoveSimple(true); - } - - /** - * @param largeKeys {@code True} to use large keys (not fitting in single page). - * @throws Exception If failed. - */ - private void putRemoveSimple(boolean largeKeys) throws Exception { - Ignite node = startGrid(0); - - IgniteTransactions txs = node.transactions(); - - final IgniteCache cache = node.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, 1)); - - final int KEYS = 100; - - checkValues(new HashMap<>(), cache); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int k = 0; k < KEYS; k++) - cache.remove(testKey(largeKeys, k)); - - tx.commit(); - } - - checkValues(new HashMap<>(), cache); - - Map expVals = new HashMap<>(); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int k = 0; k < KEYS; k++) { - Object key = testKey(largeKeys, k); - - expVals.put(key, k); - - cache.put(key, k); - } - - tx.commit(); - } - - checkValues(expVals, cache); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int k = 0; k < KEYS; k++) { - if (k % 2 == 0) { - Object key = testKey(largeKeys, k); - - cache.remove(key); - - expVals.remove(key); - } - } - - tx.commit(); - } - - checkValues(expVals, cache); - - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - Object key = testKey(largeKeys, 0); - - for (int i = 0; i < 500; i++) { - boolean rmvd; - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - if (rnd.nextBoolean()) { - cache.remove(key); - - rmvd = true; - } - else { - cache.put(key, i); - - rmvd = false; - } - - tx.commit(); - } - - if (rmvd) { - assertNull(checkAndGet(false, cache, key, SCAN, GET)); - assertTrue(checkAndGetAll(false, cache, F.asSet(key), SCAN, GET).isEmpty()); - } - else { - assertEquals(i, checkAndGet(false, cache, key, SCAN, GET)); - - Map res = checkAndGetAll(false, cache, F.asSet(key), SCAN, GET); - - assertEquals(i, res.get(key)); - } - } - } - - /** - * @param largeKeys {@code True} to use large keys (not fitting in single page). - * @param idx Index. - * @return Key instance. - */ - private static Object testKey(boolean largeKeys, int idx) { - if (largeKeys) { - int payloadSize = PAGE_SIZE + ThreadLocalRandom.current().nextInt(PAGE_SIZE * 10); - - return new TestKey(idx, payloadSize); - } - else - return idx; - } - - /** - * @param expVals Expected values. - * @param cache Cache. - */ - private void checkValues(Map expVals, IgniteCache cache) { - for (Map.Entry e : expVals.entrySet()) - assertEquals(e.getValue(), checkAndGet(false, cache, e.getKey(), SCAN, GET)); - - Map res = checkAndGetAll(false, cache, expVals.keySet(), SCAN, GET); - - assertEquals(expVals, res); - - res = new HashMap<>(); - - for (IgniteCache.Entry e : cache) - res.put(e.getKey(), e.getValue()); - - assertEquals(expVals, res); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testThreadUpdatesAreVisibleForThisThread() throws Exception { - final Ignite ignite = startGrid(0); - - final IgniteCache cache = ignite.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, 1)); - - final int THREADS = Runtime.getRuntime().availableProcessors() * 2; - - final int KEYS = 10; - - final CyclicBarrier b = new CyclicBarrier(THREADS); - - GridTestUtils.runMultiThreaded(new IgniteInClosure() { - @Override public void apply(Integer idx) { - try { - int min = idx * KEYS; - int max = min + KEYS; - - Set keys = new HashSet<>(); - - for (int k = min; k < max; k++) - keys.add(k); - - b.await(); - - for (int i = 0; i < 100; i++) { - try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int k = min; k < max; k++) - cache.put(k, i); - - tx.commit(); - } - - Map res = checkAndGetAll(false, cache, keys, SCAN, GET); - - for (Integer key : keys) - assertEquals(i, res.get(key)); - - assertEquals(KEYS, res.size()); - } - } - catch (Exception e) { - error("Unexpected error: " + e, e); - - fail("Unexpected error: " + e); - } - } - }, THREADS, "test-thread"); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testWaitPreviousTxAck() throws Exception { - testSpi = true; - - startGrid(0); - - client = true; - - final Ignite ignite = startGrid(1); - - final IgniteCache cache = - ignite.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, 16)); - - try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(1, 1); - cache.put(2, 1); - - tx.commit(); - } - - TestRecordingCommunicationSpi clientSpi = TestRecordingCommunicationSpi.spi(ignite); - - clientSpi.blockMessages((node, msg) -> msg instanceof MvccAckRequestTx); - - IgniteInternalFuture txFut1 = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(1, 2); - - tx.commit(); - } - - return null; - } - }); - - IgniteInternalFuture txFut2 = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(2, 3); - - tx.commit(); - } - - // Should see changes made by both tx1 and tx2. - Map res = checkAndGetAll(false, cache, F.asSet(1, 2), SCAN, GET); - - assertEquals(2, res.get(1)); - assertEquals(3, res.get(2)); - - return null; - } - }); - - clientSpi.waitForBlocked(2); - - Thread.sleep(1000); - - clientSpi.stopBlock(true); - - txFut1.get(); - txFut2.get(); - - Map res = checkAndGetAll(false, cache, F.asSet(1, 2), SCAN, GET); - - assertEquals(2, res.get(1)); - assertEquals(3, res.get(2)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPartialCommitResultNoVisible() throws Exception { - testSpi = true; - - startGrids(2); - - client = true; - - final Ignite ignite = startGrid(2); - - awaitPartitionMapExchange(); - - final IgniteCache cache = - ignite.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, 16)); - - final Integer key1 = primaryKey(ignite(0).cache(cache.getName())); - final Integer key2 = primaryKey(ignite(1).cache(cache.getName())); - - info("Test keys [key1=" + key1 + ", key2=" + key2 + ']'); - - try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key1, 1); - cache.put(key2, 1); - - tx.commit(); - } - - Integer val = 1; - - // Allow finish update for key1 and block update for key2. - - TestRecordingCommunicationSpi clientSpi = TestRecordingCommunicationSpi.spi(ignite); - TestRecordingCommunicationSpi srvSpi = TestRecordingCommunicationSpi.spi(ignite(0)); - - for (int i = 0; i < 10; i++) { - info("Iteration: " + i); - - clientSpi.blockMessages(GridNearTxFinishRequest.class, getTestIgniteInstanceName(1)); - - srvSpi.record(GridNearTxFinishResponse.class); - - final Integer newVal = val + 1; - - IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key1, newVal); - cache.put(key2, newVal); - - tx.commit(); - } - - return null; - } - }); - - try { - srvSpi.waitForRecorded(); - - srvSpi.recordedMessages(true); - - assertFalse(fut.isDone()); - - if (i % 2 == 1) { - // Execute one more update to increase counter. - try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(primaryKeys(jcache(0), 1, 100_000).get(0), 1); - - tx.commit(); - } - } - - Set keys = new HashSet<>(); - - keys.add(key1); - keys.add(key2); - - Map res; - - res = checkAndGetAll(false, cache, keys, SCAN, GET); - - assertEquals(val, res.get(key1)); - assertEquals(val, res.get(key2)); - - clientSpi.stopBlock(true); - - fut.get(); - - res = checkAndGetAll(false, cache, keys, SCAN, GET); - - assertEquals(newVal, res.get(key1)); - assertEquals(newVal, res.get(key2)); - - val = newVal; - } - finally { - clientSpi.stopBlock(true); - } - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCleanupWaitsForGet1() throws Exception { - boolean[] vals = {true, false}; - - for (boolean otherPuts : vals) { - for (boolean putOnStart : vals) { - for (boolean inTx : vals) { - cleanupWaitsForGet1(otherPuts, putOnStart, inTx); - - afterTest(); - } - } - } - } - - /** - * @param otherPuts {@code True} to update unrelated keys to increment mvcc counter. - * @param putOnStart {@code True} to put data in cache before getAll. - * @param inTx {@code True} to read inside transaction. - * @throws Exception If failed. - */ - private void cleanupWaitsForGet1(boolean otherPuts, final boolean putOnStart, final boolean inTx) throws Exception { - info("cleanupWaitsForGet [otherPuts=" + otherPuts + - ", putOnStart=" + putOnStart + - ", inTx=" + inTx + "]"); - - testSpi = true; - - client = false; - - final Ignite srv = startGrid(0); - - client = true; - - final Ignite client = startGrid(1); - - awaitPartitionMapExchange(); - - final IgniteCache clientCache = - client.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, 16)); - - final IgniteCache srvCache = srv.cache(clientCache.getName()); - - final Integer key1 = 1; - final Integer key2 = 2; - - if (putOnStart) { - try (Transaction tx = srv.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - srvCache.put(key1, 0); - srvCache.put(key2, 0); - - tx.commit(); - } - } - - if (otherPuts) { - for (int i = 0; i < 3; i++) { - try (Transaction tx = srv.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - srvCache.put(1_000_000 + i, 99); - - tx.commit(); - } - } - } - - TestRecordingCommunicationSpi clientSpi = TestRecordingCommunicationSpi.spi(client); - - clientSpi.blockMessages(GridNearGetRequest.class, getTestIgniteInstanceName(0)); - - IgniteInternalFuture getFut = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - Map vals; - - if (inTx) { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - vals = checkAndGetAll(false, clientCache, F.asSet(key1, key2), SCAN, GET); - - tx.rollback(); - } - } - else - vals = checkAndGetAll(false, clientCache, F.asSet(key1, key2), SCAN, GET); - - if (putOnStart) { - assertEquals(2, vals.size()); - assertEquals(0, (Object)vals.get(key1)); - assertEquals(0, (Object)vals.get(key2)); - } - else - assertEquals(0, vals.size()); - - return null; - } - }, "get-thread"); - - clientSpi.waitForBlocked(); - - for (int i = 0; i < 5; i++) { - try (Transaction tx = srv.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - srvCache.put(key1, i + 1); - srvCache.put(key2, i + 1); - - tx.commit(); - } - } - - clientSpi.stopBlock(true); - - getFut.get(); - - IgniteCache cache = client.cache(srvCache.getName()); - - Map vals = checkAndGetAll(false, cache, F.asSet(key1, key2), SCAN, GET); - - assertEquals(2, vals.size()); - assertEquals(5, (Object)vals.get(key1)); - assertEquals(5, (Object)vals.get(key2)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCleanupWaitsForGet3() throws Exception { - for (int i = 0; i < 4; i++) { - cleanupWaitsForGet3(i + 1); - - afterTest(); - } - } - - /** - * @param updates Number of updates. - * @throws Exception If failed. - */ - private void cleanupWaitsForGet3(int updates) throws Exception { - /* - Simulate case when coordinator assigned query version has active transaction, - query is delayed, after this active transaction finish and the same key is - updated several more times before query starts. - */ - testSpi = true; - - client = false; - - startGrids(1); - - client = true; - - final Ignite client = startGrid(1); - - awaitPartitionMapExchange(); - - final IgniteCache cache = client.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, 16)); - - final Integer key1 = 1; - final Integer key2 = 2; - - for (int i = 0; i < updates; i++) { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key1, i); - cache.put(key2, i); - - tx.commit(); - } - } - - TestRecordingCommunicationSpi crdSpi = TestRecordingCommunicationSpi.spi(grid(0)); - - TestRecordingCommunicationSpi clientSpi = TestRecordingCommunicationSpi.spi(client); - - clientSpi.blockMessages(new IgniteBiPredicate() { - /** */ - private boolean blocked; - - @Override public boolean apply(ClusterNode node, Message msg) { - if (!blocked && (msg instanceof MvccAckRequestTx)) { - blocked = true; - - return true; - } - return false; - } - }); - - final IgniteInternalFuture putFut = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key2, 3); - - tx.commit(); - } - - return null; - } - }, "put"); - - clientSpi.waitForBlocked(); - - for (int i = 0; i < updates; i++) { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key1, i + 3); - - tx.commit(); - } - } - - // Delay version for getAll. - crdSpi.blockMessages(new IgniteBiPredicate() { - /** */ - private boolean blocked; - - @Override public boolean apply(ClusterNode node, Message msg) { - if (!blocked && (msg instanceof MvccSnapshotResponse)) { - blocked = true; - - return true; - } - return false; - } - }); - - final IgniteInternalFuture getFut = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - final Map res1 = checkAndGetAll(false, cache, F.asSet(key1, key2), SCAN); - final Map res2 = checkAndGetAll(false, cache, F.asSet(key1, key2), GET); - - assertEquals(2, res1.size()); - assertEquals(2, res2.size()); - - return null; - } - }, "get"); - - crdSpi.waitForBlocked(); - - clientSpi.stopBlock(true); - - putFut.get(); - - for (int i = 0; i < updates; i++) { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key2, i + 4); - - tx.commit(); - } - } - - crdSpi.stopBlock(true); - - getFut.get(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_SingleNode_GetAll() throws Exception { - putAllGetAll(null, 1, 0, 0, 64, null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_SingleNode_SinglePartition_GetAll() throws Exception { - putAllGetAll(null, 1, 0, 0, 1, null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups0_GetAll() throws Exception { - putAllGetAll(null, 4, 2, 0, 64, null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups0_Persistence_GetAll() throws Exception { - persistence = true; - - testPutAllGetAll_ClientServer_Backups0_GetAll(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups1_GetAll() throws Exception { - putAllGetAll(null, 4, 2, 1, 64, null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups2_GetAll() throws Exception { - putAllGetAll(null, 4, 2, 2, 64, null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups1_RestartCoordinator_GetAll() throws Exception { - putAllGetAll(RestartMode.RESTART_CRD, 4, 2, 1, 64, null, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_SingleNode_Scan() throws Exception { - putAllGetAll(null, 1, 0, 0, 64, null, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_SingleNode_SinglePartition_Scan() throws Exception { - putAllGetAll(null, 1, 0, 0, 1, null, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups0_Scan() throws Exception { - putAllGetAll(null, 4, 2, 0, 64, null, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups0_Persistence_Scan() throws Exception { - persistence = true; - - testPutAllGetAll_ClientServer_Backups0_Scan(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups1_Scan() throws Exception { - putAllGetAll(null, 4, 2, 1, 64, null, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups2_Scan() throws Exception { - putAllGetAll(null, 4, 2, 2, 64, null, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups1_RestartCoordinator_Scan() throws Exception { - putAllGetAll(RestartMode.RESTART_CRD, 4, 2, 1, 64, null, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-9949") - @Test - public void testPutAllGetAll_ClientServer_Backups1_Restart_Scan() throws Exception { - putAllGetAll(RestartMode.RESTART_RND_SRV, 4, 2, 1, 64, null, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGetAll_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, null, false, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGetAll_WithRemoves_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, null, true, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGetAll_SingleNode_SinglePartition() throws Exception { - accountsTxReadAll(1, 0, 0, 1, null, false, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGetAll_WithRemoves_SingleNode_SinglePartition() throws Exception { - accountsTxReadAll(1, 0, 0, 1, null, true, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGetAll_ClientServer_Backups0() throws Exception { - accountsTxReadAll(4, 2, 0, 64, null, false, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGetAll_WithRemoves_ClientServer_Backups0() throws Exception { - accountsTxReadAll(4, 2, 0, 64, null, true, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGetAll_ClientServer_Backups1() throws Exception { - accountsTxReadAll(4, 2, 1, 64, null, false, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGetAll_WithRemoves_ClientServer_Backups1() throws Exception { - accountsTxReadAll(4, 2, 1, 64, null, true, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGetAll_ClientServer_Backups2() throws Exception { - accountsTxReadAll(4, 2, 2, 64, null, false, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxGetAll_WithRemoves_ClientServer_Backups2() throws Exception { - accountsTxReadAll(4, 2, 2, 64, null, true, GET, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_SingleNode_SinglePartition() throws Exception { - accountsTxReadAll(1, 0, 0, 1, null, false, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_WithRemoves_SingleNode_SinglePartition() throws Exception { - accountsTxReadAll(1, 0, 0, 1, null, true, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, null, false, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_WithRemoves_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, null, true, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_ClientServer_Backups0() throws Exception { - accountsTxReadAll(4, 2, 0, 64, null, false, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_WithRemoves_ClientServer_Backups0() throws Exception { - accountsTxReadAll(4, 2, 0, 64, null, true, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_ClientServer_Backups1() throws Exception { - accountsTxReadAll(4, 2, 1, 64, null, false, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_WithRemoves_ClientServer_Backups1() throws Exception { - accountsTxReadAll(4, 2, 1, 64, null, true, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_ClientServer_Backups2() throws Exception { - accountsTxReadAll(4, 2, 2, 64, null, false, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxScan_WithRemoves_ClientServer_Backups2() throws Exception { - accountsTxReadAll(4, 2, 2, 64, null, true, SCAN, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPessimisticTxGetAllReadsSnapshot_SingleNode_SinglePartition() throws Exception { - txReadsSnapshot(1, 0, 0, 1, GET); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPessimisticTxGetAllReadsSnapshot_ClientServer() throws Exception { - txReadsSnapshot(4, 2, 1, 64, GET); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPessimisticTxScanReadsSnapshot_SingleNode_SinglePartition() throws Exception { - txReadsSnapshot(1, 0, 0, 1, SCAN); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPessimisticTxScanReadsSnapshot_ClientServer() throws Exception { - txReadsSnapshot(4, 2, 1, 64, SCAN); - } - - /** - * @param srvs Number of server nodes. - * @param clients Number of client nodes. - * @param cacheBackups Number of cache backups. - * @param cacheParts Number of cache partitions. - * @param readMode Read mode. - * @throws Exception If failed. - */ - private void txReadsSnapshot( - final int srvs, - final int clients, - int cacheBackups, - int cacheParts, - ReadMode readMode - ) throws Exception { - final int ACCOUNTS = 20; - - final int ACCOUNT_START_VAL = 1000; - - final int writers = 4; - - final int readers = 4; - - final IgniteInClosure> init = new IgniteInClosure>() { - @Override public void apply(IgniteCache cache) { - final IgniteTransactions txs = cache.unwrap(Ignite.class).transactions(); - - Map accounts = new HashMap<>(); - - for (int i = 0; i < ACCOUNTS; i++) - accounts.put(i, new MvccTestAccount(ACCOUNT_START_VAL, 1)); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.putAll(accounts); - - tx.commit(); - } - } - }; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int cnt = 0; - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - try { - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - cnt++; - - Integer id1 = rnd.nextInt(ACCOUNTS); - Integer id2 = rnd.nextInt(ACCOUNTS); - - while (id1.equals(id2)) - id2 = rnd.nextInt(ACCOUNTS); - - if (id1 > id2) { - int tmp = id1; - id1 = id2; - id2 = tmp; - } - - Set keys = new HashSet<>(); - - keys.add(id1); - keys.add(id2); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - MvccTestAccount a1; - MvccTestAccount a2; - - Map accounts = checkAndGetAll(false, cache.cache, keys, readMode); - - a1 = accounts.get(id1); - a2 = accounts.get(id2); - - assertNotNull(a1); - assertNotNull(a2); - - cache.cache.put(id1, new MvccTestAccount(a1.val + 1, 1)); - cache.cache.put(id2, new MvccTestAccount(a2.val - 1, 1)); - - tx.commit(); - } - catch (CacheException ex) { - MvccFeatureChecker.assertMvccWriteConflict(ex); - } - } - finally { - cache.readUnlock(); - } - } - - info("Writer finished, updates: " + cnt); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int cnt = 0; - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - Map accounts = new HashMap<>(); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - int remaining = ACCOUNTS; - - do { - int readCnt = rnd.nextInt(remaining) + 1; - - Set readKeys = new TreeSet<>(); - - for (int i = 0; i < readCnt; i++) - readKeys.add(accounts.size() + i); - - Map readRes = - checkAndGetAll(false, cache.cache, readKeys, readMode); - - assertEquals(readCnt, readRes.size()); - - accounts.putAll(readRes); - - remaining = ACCOUNTS - accounts.size(); - } - while (remaining > 0); - - validateSum(accounts); - - tx.commit(); - - cnt++; - } - finally { - cache.readUnlock(); - } - } - - info("Reader finished, txs: " + cnt); - } - - /** - * @param accounts Read accounts. - */ - private void validateSum(Map accounts) { - int sum = 0; - - for (int i = 0; i < ACCOUNTS; i++) { - MvccTestAccount account = accounts.get(i); - - assertNotNull(account); - - sum += account.val; - } - - assertEquals(ACCOUNTS * ACCOUNT_START_VAL, sum); - } - }; - - readWriteTest( - null, - srvs, - clients, - cacheBackups, - cacheParts, - writers, - readers, - DFLT_TEST_TIME, - null, - init, - writer, - reader); - } - - /** - * @throws Exception If failed - */ - @Test - public void testOperationsSequenceScanConsistency_SingleNode_SinglePartition() throws Exception { - operationsSequenceConsistency(1, 0, 0, 1, SCAN); - } - - /** - * @throws Exception If failed - */ - @Test - public void testOperationsSequenceScanConsistency_SingleNode() throws Exception { - operationsSequenceConsistency(1, 0, 0, 64, SCAN); - } - - /** - * @throws Exception If failed - */ - @Test - public void testOperationsSequenceScanConsistency_ClientServer_Backups0() throws Exception { - operationsSequenceConsistency(4, 2, 0, 64, SCAN); - } - - /** - * @throws Exception If failed - */ - @Test - public void testOperationsSequenceScanConsistency_ClientServer_Backups1() throws Exception { - operationsSequenceConsistency(4, 2, 1, 64, SCAN); - } - - /** - * @throws Exception If failed - */ - @Test - public void testOperationsSequenceGetConsistency_SingleNode_SinglePartition() throws Exception { - operationsSequenceConsistency(1, 0, 0, 1, GET); - } - - /** - * @throws Exception If failed - */ - @Test - public void testOperationsSequenceGetConsistency_SingleNode() throws Exception { - operationsSequenceConsistency(1, 0, 0, 64, GET); - } - - /** - * @throws Exception If failed - */ - @Test - public void testOperationsSequenceGetConsistency_ClientServer_Backups0() throws Exception { - operationsSequenceConsistency(4, 2, 0, 64, GET); - } - - /** - * @throws Exception If failed - */ - @Test - public void testOperationsSequenceGetConsistency_ClientServer_Backups1() throws Exception { - operationsSequenceConsistency(4, 2, 1, 64, GET); - } - - /** - * @param srvs Number of server nodes. - * @param clients Number of client nodes. - * @param cacheBackups Number of cache backups. - * @param cacheParts Number of cache partitions. - * @param readMode Read mode. - * @throws Exception If failed. - */ - private void operationsSequenceConsistency( - final int srvs, - final int clients, - int cacheBackups, - int cacheParts, - ReadMode readMode - ) throws Exception { - final int writers = 4; - - final int readers = 4; - - final AtomicInteger keyCntr = new AtomicInteger(); - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int cnt = 0; - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - try { - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - Integer key = keyCntr.incrementAndGet(); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.cache.put(key, new Value(idx, cnt++)); - - tx.commit(); - } - - if (key > 100_000) - break; - } - finally { - cache.readUnlock(); - } - } - - info("Writer finished, updates: " + cnt); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - Set keys = new HashSet(); - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - try { - Map> vals = new HashMap<>(); - - switch (readMode) { - case SCAN: - for (Cache.Entry e : cache.cache) { - Value val = e.getValue(); - - assertNotNull(val); - - TreeSet cntrs = vals.get(val.key); - - if (cntrs == null) - vals.put(val.key, cntrs = new TreeSet<>()); - - boolean add = cntrs.add(val.cnt); - - assertTrue(add); - } - - break; - - case GET: - for (int i = keys.size(); i < keyCntr.get(); i++) - keys.add(i); - - Iterable> entries = cache.cache.getAll(keys).entrySet(); - - for (Map.Entry e : entries) { - Value val = e.getValue(); - - assertNotNull(val); - - TreeSet cntrs = vals.get(val.key); - - if (cntrs == null) - vals.put(val.key, cntrs = new TreeSet<>()); - - boolean add = cntrs.add(val.cnt); - - assertTrue(add); - } - - break; - - default: - fail("Unsupported read mode: " + readMode.name() + '.'); - } - - for (TreeSet readCntrs : vals.values()) { - for (int i = 0; i < readCntrs.size(); i++) - assertTrue(readCntrs.contains(i)); - } - } - finally { - cache.readUnlock(); - } - } - } - }; - - readWriteTest( - null, - srvs, - clients, - cacheBackups, - cacheParts, - writers, - readers, - SCALED_10SEC_TEST_TIME, - null, - null, - writer, - reader); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-12041") - @Test - public void testNodesRestartNoHang() throws Exception { - final int srvs = 4; - final int clients = 4; - final int writers = 6; - final int readers = 2; - - final int KEYS = 100_000; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - Map map = new TreeMap<>(); - Set keys = new LinkedHashSet(); - - int cnt = 0; - - while (!stop.get()) { - int keysCnt = rnd.nextInt(32) + 1; - - while (keys.size() < keysCnt) { - int key = rnd.nextInt(KEYS); - - if (keys.add(key)) - map.put(key, cnt); - } - - TestCache cache = randomCache(caches, rnd); - - try { - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - if (rnd.nextBoolean()) { - Map res = checkAndGetAll(false, cache.cache, map.keySet(), - rnd.nextBoolean() ? GET : SCAN); - - assertNotNull(res); - } - - cache.cache.putAll(map); - - tx.commit(); - } - catch (Exception e) { - if (!X.hasCause(e, ClusterTopologyException.class)) - MvccFeatureChecker.assertMvccWriteConflict(e); - } - } - finally { - cache.readUnlock(); - - keys.clear(); - map.clear(); - } - - cnt++; - } - - info("Writer done, updates: " + cnt); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - Set keys = new LinkedHashSet<>(); - - while (!stop.get()) { - int keyCnt = rnd.nextInt(64) + 1; - - while (keys.size() < keyCnt) - keys.add(rnd.nextInt(KEYS)); - - TestCache cache = randomCache(caches, rnd); - - Map map; - - try { - map = checkAndGetAll(false, cache.cache, keys, rnd.nextBoolean() ? GET : SCAN); - - assertNotNull(map); - } - finally { - cache.readUnlock(); - } - - keys.clear(); - } - } - }; - - readWriteTest( - RestartMode.RESTART_RND_SRV, - srvs, - clients, - 1, - 256, - writers, - readers, - DFLT_TEST_TIME, - null, - null, - writer, - reader); - - for (Ignite node : G.allGrids()) - checkActiveQueriesCleanup(node); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testActiveQueryCleanupOnNodeFailure() throws Exception { - testSpi = true; - - final Ignite srv = startGrid(0); - - srv.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, 1024)); - - client = true; - - final Ignite client = startGrid(1); - - TestRecordingCommunicationSpi srvSpi = TestRecordingCommunicationSpi.spi(srv); - - srvSpi.blockMessages(GridNearGetResponse.class, getTestIgniteInstanceName(1)); - - TestRecordingCommunicationSpi.spi(client).blockMessages(MvccAckRequestQueryCntr.class, - getTestIgniteInstanceName(0)); - - IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - cache.getAll(F.asSet(1, 2, 3)); - - return null; - } - }); - - srvSpi.waitForBlocked(); - - assertFalse(fut.isDone()); - - stopGrid(1); - - checkActiveQueriesCleanup(ignite(0)); - - try { - fut.get(); - } - catch (Exception ignore) { - // No-op. - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRebalanceSimple() throws Exception { - Ignite srv0 = startGrid(0); - - IgniteCache cache = (IgniteCache)srv0.createCache( - cacheConfiguration(PARTITIONED, FULL_SYNC, 0, DFLT_PARTITION_COUNT)); - - Map map; - Map resMap; - - try (Transaction tx = srv0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - map = new HashMap<>(); - - for (int i = 0; i < DFLT_PARTITION_COUNT * 3; i++) - map.put(i, i); - - cache.putAll(map); - - tx.commit(); - } - - startGrid(1); - - awaitPartitionMapExchange(); - - resMap = checkAndGetAll(false, cache, map.keySet(), GET, SCAN); - - assertEquals(map.size(), resMap.size()); - - for (int i = 0; i < map.size(); i++) - assertEquals(i, (Object)resMap.get(i)); - - try (Transaction tx = srv0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int i = 0; i < DFLT_PARTITION_COUNT * 3; i++) - map.put(i, i + 1); - - cache.putAll(map); - - tx.commit(); - } - try (Transaction tx = srv0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int i = 0; i < DFLT_PARTITION_COUNT * 3; i++) - map.put(i, i + 2); - - cache.putAll(map); - - tx.commit(); - } - - startGrid(2); - - awaitPartitionMapExchange(); - - resMap = checkAndGetAll(false, cache, map.keySet(), GET, SCAN); - - assertEquals(map.size(), map.size()); - - for (int i = 0; i < map.size(); i++) - assertEquals(i + 2, (Object)resMap.get(i)); - - // Run fake transaction - try (Transaction tx = srv0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - Integer val = cache.get(0); - - cache.put(0, val); - - tx.commit(); - } - - resMap = checkAndGetAll(false, cache, map.keySet(), GET, SCAN); - - assertEquals(map.size(), map.size()); - - for (int i = 0; i < map.size(); i++) - assertEquals(i + 2, (Object)resMap.get(i)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRebalanceWithRemovedValuesSimple() throws Exception { - Ignite node = startGrid(0); - - IgniteTransactions txs = node.transactions(); - - final IgniteCache cache = node.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, 64)); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int k = 0; k < 100; k++) - cache.remove(k); - - tx.commit(); - } - - Map expVals = new HashMap<>(); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int k = 100; k < 200; k++) { - cache.put(k, k); - - expVals.put(k, k); - } - - tx.commit(); - } - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int k = 100; k < 200; k++) { - if (k % 2 == 0) { - cache.remove(k); - - expVals.remove(k); - } - } - - tx.commit(); - } - - startGrid(1); - - awaitPartitionMapExchange(); - - checkValues(expVals, jcache(1)); - - stopGrid(0); - - checkValues(expVals, jcache(1)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTxPrepareFailureSimplePessimisticTx() throws Exception { - testSpi = true; - - startGrids(3); - - client = true; - - final Ignite client = startGrid(3); - - final IgniteCache cache = client.createCache( - cacheConfiguration(PARTITIONED, FULL_SYNC, 0, DFLT_PARTITION_COUNT)); - - final Integer key1 = primaryKey(jcache(1)); - final Integer key2 = primaryKey(jcache(2)); - - TestRecordingCommunicationSpi srv1Spi = TestRecordingCommunicationSpi.spi(ignite(1)); - - srv1Spi.blockMessages(GridNearTxPrepareResponse.class, client.name()); - - IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable() { - @Override public Object call() throws Exception { - try { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key1, 1); - cache.put(key2, 2); - - tx.commit(); - } - - fail(); - } - catch (ClusterTopologyException e) { - info("Expected exception: " + e); - } - - return null; - } - }, "tx-thread"); - - GridTestUtils.waitForCondition( - new GridAbsPredicate() { - @Override public boolean apply() { - return srv1Spi.hasBlockedMessages() || fut.isDone() && fut.error() != null; - } - }, 10_000 - ); - - if (fut.isDone()) - fut.get(); // Just to fail with future error. - - assertFalse(fut.isDone()); - - stopGrid(1); - - fut.get(); - - assertNull(cache.get(key1)); - assertNull(cache.get(key2)); - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key1, 1); - cache.put(key2, 2); - - tx.commit(); - } - - assertEquals(1, checkAndGet(false, cache, key1, GET, SCAN)); - assertEquals(2, checkAndGet(false, cache, key2, GET, SCAN)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccCoordinatorChangeSimple() throws Exception { - Ignite srv0 = startGrid(0); - - final List cacheNames = new ArrayList<>(); - - for (CacheConfiguration ccfg : cacheConfigurations()) { - ccfg.setName("cache-" + cacheNames.size()); - - cacheNames.add(ccfg.getName()); - - srv0.createCache(ccfg); - } - - checkPutGet(cacheNames); - - for (int i = 0; i < 3; i++) { - startGrid(i + 1); - - awaitPartitionMapExchange(); - - checkPutGet(cacheNames); - - checkCoordinatorsConsistency(null); - } - - client = true; - - for (int i = 0; i < 3; i++) { - Ignite node = startGrid(i + 4); - - // Init client caches outside of transactions. - for (String cacheName : cacheNames) - node.cache(cacheName); - - checkPutGet(cacheNames); - - checkCoordinatorsConsistency(null); - } - - for (int i = 0; i < 3; i++) { - stopGrid(i); - - awaitPartitionMapExchange(); - - checkPutGet(cacheNames); - - checkCoordinatorsConsistency(null); - } - } - - /** - * @param cacheNames Cache names. - */ - private void checkPutGet(List cacheNames) { - List nodes = G.allGrids(); - - assertFalse(nodes.isEmpty()); - - Ignite putNode = nodes.get(ThreadLocalRandom.current().nextInt(nodes.size())); - - Map vals = new HashMap(); - - Integer val = ThreadLocalRandom.current().nextInt(); - - for (int i = 0; i < 10; i++) - vals.put(i, val); - - try (Transaction tx = putNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (String cacheName : cacheNames) - putNode.cache(cacheName).putAll(vals); - - tx.commit(); - } - - for (Ignite node : nodes) { - for (String cacheName : cacheNames) { - Map res = checkAndGetAll(false, node.cache(cacheName), vals.keySet(), SCAN, GET); - - assertEquals(vals, res); - } - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccCoordinatorInfoConsistency() throws Exception { - for (int i = 0; i < 4; i++) { - startGrid(i); - - if (persistence && i == 0) - ignite(i).cluster().state(ClusterState.ACTIVE); - - checkCoordinatorsConsistency(i + 1); - } - - client = true; - - startGrid(4); - - checkCoordinatorsConsistency(5); - - startGrid(5); - - checkCoordinatorsConsistency(6); - - client = false; - - stopGrid(0); - - awaitPartitionMapExchange(); - - checkCoordinatorsConsistency(5); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccCoordinatorInfoConsistency_Persistence() throws Exception { - persistence = true; - - testMvccCoordinatorInfoConsistency(); - } - - /** - * @param expNodes Expected nodes number. - */ - private void checkCoordinatorsConsistency(@Nullable Integer expNodes) { - List nodes = G.allGrids(); - - if (expNodes != null) - assertEquals(expNodes, (Integer)nodes.size()); - - MvccCoordinator crd = null; - - for (Ignite node : G.allGrids()) { - MvccCoordinator crd0 = mvccProcessor(node).currentCoordinator(); - - if (crd != null) - assertEquals(crd, crd0); - else - crd = crd0; - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testGetVersionRequestFailover() throws Exception { - final int NODES = 5; - - testSpi = true; - - startGridsMultiThreaded(NODES - 1); - - client = true; - - Ignite client = startGrid(NODES - 1); - - final List cacheNames = new ArrayList<>(); - - final Map vals = new HashMap<>(); - - for (int i = 0; i < 100; i++) - vals.put(i, i); - - for (CacheConfiguration ccfg : cacheConfigurations()) { - ccfg.setName("cache-" + cacheNames.size()); - - ccfg.setNodeFilter(new TestCacheNodeExcludingFilter(getTestIgniteInstanceName(0))); - - cacheNames.add(ccfg.getName()); - - IgniteCache cache = client.createCache(ccfg); - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - writeAllByMode(cache, vals, PUT, INTEGER_CODEC); - - tx.commit(); - } - } - - final AtomicInteger nodeIdx = new AtomicInteger(1); - - final AtomicBoolean done = new AtomicBoolean(); - - try { - IgniteInternalFuture getFut = GridTestUtils.runMultiThreadedAsync(new Callable() { - @Override public Void call() throws Exception { - Ignite node = ignite(nodeIdx.getAndIncrement()); - - int cnt = 0; - - while (!done.get()) { - for (String cacheName : cacheNames) { - // TODO IGNITE-6754 add SQL and SCAN support. - Map res = readAllByMode(node.cache(cacheName), vals.keySet(), GET, INTEGER_CODEC); - - assertEquals(vals, res); - } - - cnt++; - } - - log.info("Finished [node=" + node.name() + ", cnt=" + cnt + ']'); - - return null; - } - }, NODES - 1, "get-thread"); - - doSleep(1000); - - TestRecordingCommunicationSpi crdSpi = TestRecordingCommunicationSpi.spi(ignite(0)); - - crdSpi.blockMessages(new IgniteBiPredicate() { - @Override public boolean apply(ClusterNode node, Message msg) { - return msg instanceof MvccSnapshotResponse; - } - }); - - crdSpi.waitForBlocked(); - - stopGrid(0); - - doSleep(1000); - - done.set(true); - - getFut.get(); - } - finally { - done.set(true); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testLoadWithStreamer() throws Exception { - startGridsMultiThreaded(5); - - client = true; - - startGrid(5); - - Ignite node = ignite(0); - - IgniteCache cache = node.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 2, 64)); - - final int KEYS = 1_000; - - Map data = new HashMap<>(); - - try (IgniteDataStreamer streamer = node.dataStreamer(cache.getName())) { - for (int i = 0; i < KEYS; i++) { - streamer.addData(i, i); - - data.put(i, i); - } - } - - checkValues(data, cache); - - checkCacheData(data, cache.getName()); - - checkPutGet(F.asList(cache.getName())); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_SingleNode_SinglePartition_Get() throws Exception { - int[] nValues = {3, 5, 10}; - - for (int n : nValues) { - updateNObjectsTest(n, 1, 0, 0, 1, - SCALED_10SEC_TEST_TIME, null, GET, PUT, null); - - afterTest(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_SingleNode_Get() throws Exception { - int[] nValues = {3, 5, 10}; - - for (int n : nValues) { - updateNObjectsTest(n, 1, 0, 0, 64, - SCALED_10SEC_TEST_TIME, null, GET, PUT, null); - - afterTest(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_SingleNode_SinglePartition_Scan() throws Exception { - int[] nValues = {3, 5, 10}; - - for (int n : nValues) { - updateNObjectsTest(n, 1, 0, 0, 1, - SCALED_10SEC_TEST_TIME, null, SCAN, PUT, null); - - afterTest(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_SingleNode_Scan() throws Exception { - int[] nValues = {3, 5, 10}; - - for (int n : nValues) { - updateNObjectsTest(n, 1, 0, 0, 64, - SCALED_10SEC_TEST_TIME, null, SCAN, PUT, null); - - afterTest(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_ClientServer_Backups2_Get() throws Exception { - int[] nValues = {3, 5, 10}; - - for (int n : nValues) { - updateNObjectsTest(n, 4, 2, 2, DFLT_PARTITION_COUNT, - SCALED_10SEC_TEST_TIME, null, GET, PUT, null); - - afterTest(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_ClientServer_Backups1_Scan() throws Exception { - int[] nValues = {3, 5, 10}; - - for (int n : nValues) { - updateNObjectsTest(n, 2, 1, 1, DFLT_PARTITION_COUNT, - SCALED_10SEC_TEST_TIME, null, SCAN, PUT, null); - - afterTest(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testImplicitPartsScan_SingleNode_SinglePartition() throws Exception { - doImplicitPartsScanTest(1, 0, 0, 1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testImplicitPartsScan_SingleNode() throws Exception { - doImplicitPartsScanTest(1, 0, 0, 64); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testImplicitPartsScan_ClientServer_Backups0() throws Exception { - doImplicitPartsScanTest(4, 2, 0, 64); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testImplicitPartsScan_ClientServer_Backups1() throws Exception { - doImplicitPartsScanTest(4, 2, 1, 64); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testImplicitPartsScan_ClientServer_Backups2() throws Exception { - doImplicitPartsScanTest(4, 2, 2, 64); - } - - /** - * @param srvs Number of server nodes. - * @param clients Number of client nodes. - * @param cacheBackups Number of cache backups. - * @param cacheParts Number of cache partitions. - * @throws Exception If failed. - */ - private void doImplicitPartsScanTest( - final int srvs, - final int clients, - int cacheBackups, - int cacheParts) throws Exception { - final int KEYS_PER_PART = 20; - - final int writers = 4; - - final int readers = 4; - - Map> keysByParts = new HashMap<>(); - - final IgniteInClosure> init = new IgniteInClosure>() { - @Override public void apply(IgniteCache cache) { - final IgniteTransactions txs = cache.unwrap(Ignite.class).transactions(); - - for (int i = 0; i < cacheParts; i++) { - List keys = new ArrayList<>(); - - keysByParts.put(i, keys); - } - - Affinity aff = affinity(cache); - - int cntr = 0; - int key = 0; - - while (cntr < KEYS_PER_PART * cacheParts) { - int part = aff.partition(key); - - List keys = keysByParts.get(part); - - if (keys.size() < KEYS_PER_PART) { - keys.add(key); - - cntr++; - } - - key++; - } - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (List keys : keysByParts.values()) - for (Integer k : keys) - cache.put(k, new MvccTestAccount(0, 1)); - - tx.commit(); - } - } - }; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - while (!stop.get()) { - int part = rnd.nextInt(cacheParts); - - List partKeys = keysByParts.get(part); - - TestCache cache = randomCache(caches, rnd); - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - Integer k1 = partKeys.get(rnd.nextInt(KEYS_PER_PART)); - Integer k2 = partKeys.get(rnd.nextInt(KEYS_PER_PART)); - - while (k1.equals(k2)) - k2 = partKeys.get(rnd.nextInt(KEYS_PER_PART)); - - if (k1 > k2) { - int tmp = k1; - k1 = k2; - k2 = tmp; - } - - TreeSet keys = new TreeSet<>(); - - keys.add(k1); - keys.add(k2); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - Map accs = cache.cache.getAll(keys); - - MvccTestAccount acc1 = accs.get(k1); - MvccTestAccount acc2 = accs.get(k2); - - assertNotNull(acc1); - assertNotNull(acc2); - - cache.cache.put(k1, new MvccTestAccount(acc1.val + 1, acc1.updateCnt + 1)); - cache.cache.put(k2, new MvccTestAccount(acc2.val - 1, acc2.updateCnt + 1)); - - tx.commit(); - } - catch (CacheException ex) { - MvccFeatureChecker.assertMvccWriteConflict(ex); - } - finally { - cache.readUnlock(); - } - } - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - while (!stop.get()) { - int part = rnd.nextInt(cacheParts); - - TestCache cache = randomCache(caches, rnd); - - try { - Affinity aff = affinity(cache.cache); - - ScanQuery qry = new ScanQuery<>(part); - - List> res = cache.cache.query(qry).getAll(); - - int sum = 0; - - for (Cache.Entry entry : res) { - Integer key = entry.getKey(); - MvccTestAccount acc = entry.getValue(); - - assertEquals(part, aff.partition(key)); - - sum += acc.val; - } - - assertEquals(0, sum); - - } - finally { - cache.readUnlock(); - } - - if (idx == 0) { - cache = randomCache(caches, rnd); - - try { - ScanQuery qry = new ScanQuery<>(); - - List> res = cache.cache.query(qry).getAll(); - - int sum = 0; - - for (Cache.Entry entry : res) { - Integer key = entry.getKey(); - MvccTestAccount acc = entry.getValue(); - - sum += acc.val; - } - - assertEquals(0, sum); - } - finally { - cache.readUnlock(); - } - } - } - } - }; - - readWriteTest( - null, - srvs, - clients, - cacheBackups, - cacheParts, - writers, - readers, - SCALED_10SEC_TEST_TIME, - null, - init, - writer, - reader); - } - - /** - * @throws IgniteCheckedException If failed. - */ - @Test - public void testSize() throws Exception { - Ignite node = startGrid(0); - - IgniteCache cache = node.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, 1)); - - assertEquals(cache.size(), 0); - - final int KEYS = 10; - - // Initial put. - for (int i = 0; i < KEYS; i++) { - final Integer key = i; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key, i); - - tx.commit(); - } - - assertEquals(i + 1, cache.size()); - } - - // Update. - for (int i = 0; i < KEYS; i++) { - final Integer key = i; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key, i); - - tx.commit(); - } - - assertEquals(KEYS, cache.size()); - } - - int size = KEYS; - - // Remove. - for (int i = 0; i < KEYS; i++) { - if (i % 2 == 0) { - final Integer key = i; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.remove(key); - - tx.commit(); - } - - size--; - - assertEquals(size, cache.size()); - } - } - - // Check size does not change if remove already removed keys. - for (int i = 0; i < KEYS; i++) { - if (i % 2 == 0) { - final Integer key = i; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.remove(key); - - tx.commit(); - } - - assertEquals(size, cache.size()); - } - } - - // Check rollback create. - for (int i = 0; i < KEYS; i++) { - if (i % 2 == 0) { - final Integer key = i; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key, i); - - tx.rollback(); - } - - assertEquals(size, cache.size()); - } - } - - // Check rollback update. - for (int i = 0; i < KEYS; i++) { - final Integer key = i; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key, -1); - - tx.rollback(); - } - - assertEquals(size, cache.size()); - } - - // Check rollback create. - for (int i = 0; i < KEYS; i++) { - if (i % 2 == 0) { - final Integer key = i; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key, i); - - tx.rollback(); - } - - assertEquals(size, cache.size()); - } - } - - // Check rollback update. - for (int i = 0; i < KEYS; i++) { - final Integer key = i; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key, -1); - - tx.rollback(); - } - - assertEquals(size, cache.size()); - } - - // Check rollback remove. - for (int i = 0; i < KEYS; i++) { - final Integer key = i; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.remove(key); - - tx.rollback(); - } - - assertEquals(size, cache.size()); - } - - // Restore original state. - for (int i = 0; i < KEYS; i++) { - if (i % 2 == 0) { - final Integer key = i; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key, i); - - tx.commit(); - } - - size++; - - assertEquals(size, cache.size()); - } - } - - // Check state. - for (int i = 0; i < KEYS; i++) - assertEquals(i, cache.get(i)); - } - - /** - * @throws IgniteCheckedException If failed. - */ - @Test - public void testInternalApi() throws Exception { - Ignite node = startGrid(0); - - IgniteCache cache = node.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, 1)); - - GridCacheContext cctx = - ((IgniteKernal)node).context().cache().context().cacheContext(CU.cacheId(cache.getName())); - - MvccProcessorImpl crd = mvccProcessor(node); - - // Start query to prevent cleanup. - MvccSnapshotFuture fut = new MvccSnapshotFuture(); - - crd.requestReadSnapshotAsync(crd.currentCoordinator(), fut); - - fut.get(); - - final int KEYS = 1000; - - for (int i = 0; i < 10; i++) { - for (int k = 0; k < KEYS; k++) { - final Integer key = k; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key, i); - - tx.commit(); - } - } - } - - for (int k = 0; k < KEYS; k++) { - final Integer key = k; - - KeyCacheObject key0 = cctx.toCacheKeyObject(key); - - List> vers = cctx.offheap().mvccAllVersions(cctx, key0); - - assertEquals(10, vers.size()); - - CacheDataRow row = cctx.offheap().read(cctx, key0); - - Object val = ((CacheObject)vers.get(0).get1()).value(cctx.cacheObjectContext(), false); - - checkRow(cctx, row, key0, val); - - for (IgniteBiTuple ver : vers) { - MvccVersion cntr = ver.get2(); - - MvccSnapshot readVer = - new MvccSnapshotWithoutTxs(cntr.coordinatorVersion(), cntr.counter(), MvccUtils.MVCC_READ_OP_CNTR, 0); - - row = cctx.offheap().mvccRead(cctx, key0, readVer); - - Object verVal = ((CacheObject)ver.get1()).value(cctx.cacheObjectContext(), false); - - checkRow(cctx, row, key0, verVal); - } - - checkRow(cctx, - cctx.offheap().mvccRead(cctx, key0, version(vers.get(0).get2().coordinatorVersion() + 1, 1)), - key0, - val); - - checkRow(cctx, - cctx.offheap().mvccRead(cctx, key0, version(vers.get(0).get2().coordinatorVersion(), vers.get(0).get2().counter() + 1)), - key0, - val); - - MvccSnapshotResponse ver = version(vers.get(0).get2().coordinatorVersion(), 100000); - - for (int v = 0; v < vers.size(); v++) { - MvccVersion cntr = vers.get(v).get2(); - - ver.addTx(cntr.counter()); - - row = cctx.offheap().mvccRead(cctx, key0, ver); - - if (v == vers.size() - 1) - assertNull(row); - else { - Object nextVal = ((CacheObject)vers.get(v + 1).get1()).value(cctx.cacheObjectContext(), false); - - checkRow(cctx, row, key0, nextVal); - } - } - } - - KeyCacheObject key = cctx.toCacheKeyObject(KEYS); - - cache.put(key, 0); - - cache.remove(key); - - cctx.offheap().mvccRemoveAll((GridCacheMapEntry)cctx.cache().entryEx(key)); - - crd.ackQueryDone(fut.get(), MVCC_TRACKER_ID_NA); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7311") - @Test - public void testExpiration() throws Exception { - final IgniteEx node = startGrid(0); - - IgniteCache cache = node.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, 64)); - - final IgniteCache expiryCache = - cache.withExpiryPolicy(new TouchedExpiryPolicy(new Duration(TimeUnit.SECONDS, 1))); - - for (int i = 0; i < 10; i++) - expiryCache.put(1, i); - - assertTrue("Failed to wait for expiration", GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - return expiryCache.localPeek(1) == null; - } - }, 5000)); - - for (int i = 0; i < 11; i++) { - if (i % 2 == 0) - expiryCache.put(1, i); - else - expiryCache.remove(1); - } - - assertTrue("Failed to wait for expiration", GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - return expiryCache.localPeek(1) == null; - } - }, 5000)); - - expiryCache.put(1, 1); - - assertTrue("Failed to wait for expiration", GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - try { - GridCacheContext cctx = node.context().cache().context().cacheContext(CU.cacheId(DEFAULT_CACHE_NAME)); - - KeyCacheObject key = cctx.toCacheKeyObject(1); - - return cctx.offheap().read(cctx, key) == null; - } - catch (Exception e) { - fail(); - - return false; - } - } - }, 5000)); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7311") - @Test - public void testChangeExpireTime() throws Exception { - final IgniteEx node = startGrid(0); - - IgniteCache cache = node.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, 64)); - - cache.put(1, 1); - - final IgniteCache expiryCache = - cache.withExpiryPolicy(new TouchedExpiryPolicy(new Duration(TimeUnit.SECONDS, 1))); - - expiryCache.get(1); - } - - /** - * @param cctx Context. - * @param row Row. - * @param expKey Expected row key. - * @param expVal Expected row value. - */ - private void checkRow(GridCacheContext cctx, CacheDataRow row, KeyCacheObject expKey, Object expVal) { - assertNotNull(row); - assertEquals(expKey, row.key()); - assertEquals(expVal, row.value().value(cctx.cacheObjectContext(), false)); - } - - /** - * @param crdVer Coordinator version. - * @param cntr Counter. - * @return Version. - */ - private MvccSnapshotResponse version(long crdVer, long cntr) { - MvccSnapshotResponse res = new MvccSnapshotResponse(); - - res.init(0, crdVer, cntr, MvccUtils.MVCC_START_OP_CNTR, MvccUtils.MVCC_COUNTER_NA, 0); - - return res; - } - - /** - * @param ccfg Cache configuration. - */ - private void logCacheInfo(CacheConfiguration ccfg) { - log.info("Test cache [mode=" + ccfg.getCacheMode() + - ", sync=" + ccfg.getWriteSynchronizationMode() + - ", backups=" + ccfg.getBackups() + - ", near=" + (ccfg.getNearConfiguration() != null) + - ']'); - } - - /** - * @param cache Cache. - * @return Test keys. - * @throws Exception If failed. - */ - private List testKeys(IgniteCache cache) throws Exception { - CacheConfiguration ccfg = cache.getConfiguration(CacheConfiguration.class); - - List keys = new ArrayList<>(); - - if (ccfg.getCacheMode() == PARTITIONED) - keys.add(nearKey(cache)); - - keys.add(primaryKey(cache)); - - if (ccfg.getBackups() != 0) - keys.add(backupKey(cache)); - - return keys; - } - - /** - * Checks values obtained with different read modes. - * And returns value in case of it's equality for all read modes. - * Do not use in tests with writers contention. - * - * // TODO remove inTx flag in IGNITE-6938 - * @param inTx Flag whether current read is inside transaction. - * This is because reads can't see writes made in current transaction. - * @param cache Cache. - * @param key Key. - * @param readModes Read modes to check. - * @return Value. - */ - private Object checkAndGet(boolean inTx, IgniteCache cache, Object key, ReadMode... readModes) { - assert readModes != null && readModes.length > 0; - - if (inTx) - return getByReadMode(inTx, cache, key, GET); - - Object prevVal = null; - - for (int i = 0; i < readModes.length; i++) { - ReadMode readMode = readModes[i]; - - Object curVal = getByReadMode(inTx, cache, key, readMode); - - if (i == 0) - prevVal = curVal; - else { - assertEquals("Different results on " + readModes[i - 1].name() + " and " + - readMode.name() + " read modes.", prevVal, curVal); - - prevVal = curVal; - } - } - - return prevVal; - } - - /** - * Reads value from cache for the given key using given read mode. - * - * // TODO IGNITE-6938 remove inTx flag - * // TODO IGNITE-6739 add SQL-get support "select _key, _val from cache where _key = key" - * @param inTx Flag whether current read is inside transaction. - * This is because reads can't see writes made in current transaction. - * @param cache Cache. - * @param key Key. - * @param readMode Read mode. - * @return Value. - */ - private Object getByReadMode(boolean inTx, IgniteCache cache, final Object key, ReadMode readMode) { - - // TODO Remove in IGNITE-6938 - if (inTx) - readMode = GET; - - switch (readMode) { - case GET: - return cache.get(key); - - case SCAN: - List res = cache.query(new ScanQuery(new IgniteBiPredicate() { - @Override public boolean apply(Object k, Object v) { - return k.equals(key); - } - })).getAll(); - - assertTrue(res.size() <= 1); - - return res.isEmpty() ? null : ((IgniteBiTuple)res.get(0)).getValue(); - - default: - throw new IgniteException("Unsupported read mode: " + readMode); - } - } - - /** - * Checks values obtained with different read modes. - * And returns value in case of it's equality for all read modes. - * Do not use in tests with writers contention. - * - * // TODO remove inTx flag in IGNITE-6938 - * @param inTx Flag whether current read is inside transaction. - * This is because reads can't see writes made in current transaction. - * @param cache Cache. - * @param keys Key. - * @param readModes Read modes to check. - * @return Value. - */ - private Map checkAndGetAll(boolean inTx, IgniteCache cache, Set keys, ReadMode... readModes) { - assert readModes != null && readModes.length > 0; - - if (inTx) - return getAllByReadMode(inTx, cache, keys, GET); - - Map prevVal = null; - - for (int i = 0; i < readModes.length; i++) { - ReadMode readMode = readModes[i]; - - Map curVal = getAllByReadMode(inTx, cache, keys, readMode); - - if (i == 0) - prevVal = curVal; - else { - assertEquals("Different results on read modes " + readModes[i - 1] + " and " + - readMode.name(), prevVal, curVal); - - prevVal = curVal; - } - } - - return prevVal; - } - - /** - * Reads value from cache for the given key using given read mode. - * - * // TODO IGNITE-6938 remove inTx flag - * // TODO IGNITE-6739 add SQL-get support "select _key, _val from cache where _key in ... keySet" - * @param inTx Flag whether current read is inside transaction. - * This is because reads can't see writes made in current transaction. - * @param cache Cache. - * @param keys Key. - * @param readMode Read mode. - * @return Value. - */ - private Map getAllByReadMode(boolean inTx, IgniteCache cache, Set keys, ReadMode readMode) { - - // TODO Remove in IGNITE-6938 - if (inTx) - readMode = GET; - - switch (readMode) { - case GET: - return cache.getAll(keys); - - case SCAN: - Map res = (Map)cache.query(new ScanQuery(new IgniteBiPredicate() { - @Override public boolean apply(Object k, Object v) { - return keys.contains(k); - } - })).getAll() - .stream() - .collect(Collectors.toMap(v -> ((IgniteBiTuple)v).getKey(), v -> ((IgniteBiTuple)v).getValue())); - - assertTrue(res.size() <= keys.size()); - - return res; - - default: - throw new IgniteException("Unsupported read mode: " + readMode); - } - } - - /** - * - */ - static class Value { - /** */ - int key; - - /** */ - int cnt; - - /** - * @param key Key. - * @param cnt Update count. - */ - Value(int key, int cnt) { - this.key = key; - this.cnt = cnt; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(Value.class, this); - } - } - - /** - * - */ - static class TestKey implements Serializable { - /** */ - private final int key; - - /** */ - private final byte[] payload; - - /** - * @param key Key. - * @param payloadSize Payload size. - */ - public TestKey(int key, int payloadSize) { - this.key = key; - this.payload = new byte[payloadSize]; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (o == null || getClass() != o.getClass()) - return false; - - TestKey testKey = (TestKey)o; - - if (key != testKey.key) - return false; - - return Arrays.equals(payload, testKey.payload); - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - int res = key; - - res = 31 * res + Arrays.hashCode(payload); - - return res; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return "TestKey [k=" + key + ", payloadLen=" + payload.length + ']'; - } - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTxFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTxFailoverTest.java deleted file mode 100644 index d4c3e4b07f01a..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTxFailoverTest.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.Collections; -import java.util.concurrent.CyclicBarrier; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheWriteSynchronizationMode; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.DataRegionConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.WALMode; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager; -import org.apache.ignite.internal.processors.cache.CacheInvalidStateException; -import org.apache.ignite.internal.processors.cache.WalStateManager; -import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager; -import org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager; -import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.GridAbstractTest; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Test; - -/** - * Check Tx state recovery from WAL. - */ -public class CacheMvccTxFailoverTest extends GridCommonAbstractTest { - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - cleanPersistenceDir(); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - - super.afterTest(); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - return super.getConfiguration(igniteInstanceName) - .setDataStorageConfiguration(new DataStorageConfiguration() - .setDefaultDataRegionConfiguration(new DataRegionConfiguration() - .setMaxSize(100_000_000L) - .setPersistenceEnabled(true)) - .setWalMode(WALMode.BACKGROUND) - ) - .setMvccVacuumFrequency(Long.MAX_VALUE) - .setCacheConfiguration(cacheConfiguration()); - } - - /** - * @return Cache configuration. - */ - protected CacheConfiguration cacheConfiguration() { - return GridAbstractTest.defaultCacheConfiguration() - .setNearConfiguration(null) - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); - } - - /** - * @throws Exception If fails. - */ - @Test - public void testSingleNodeTxMissedRollback() throws Exception { - checkSingleNodeRestart(true, false, true); - } - - /** - * @throws Exception If fails. - */ - @Test - public void testSingleNodeTxMissedRollbackRecoverFromWAL() throws Exception { - checkSingleNodeRestart(true, true, true); - } - - /** - * @throws Exception If fails. - */ - @Test - public void testSingleNodeTxMissedCommit() throws Exception { - checkSingleNodeRestart(false, false, true); - } - - /** - * @throws Exception If fails. - */ - @Test - public void testSingleNodeTxMissedCommitRecoverFromWAL() throws Exception { - checkSingleNodeRestart(false, true, true); - } - - /** - * @throws Exception If fails. - */ - @Test - public void testSingleNodeRollbackedTxRecoverFromWAL() throws Exception { - checkSingleNodeRestart(true, true, false); - } - - /** - * @throws Exception If fails. - */ - @Test - public void testSingleNodeCommitedTxRecoverFromWAL() throws Exception { - checkSingleNodeRestart(false, true, false); - } - - /** - * @param rollBack If {@code True} then Tx will be rolled backup, committed otherwise. - * @param recoverFromWAL If {@code True} then Tx recovery from WAL will be checked, - * binary recovery from latest checkpoint otherwise. - * @param omitTxFinish If {@code True} then unfinished Tx state will be restored as if node fails during commit. - * @throws Exception If fails. - */ - public void checkSingleNodeRestart(boolean rollBack, boolean recoverFromWAL, boolean omitTxFinish) throws Exception { - IgniteEx node = startGrid(0); - - node.cluster().state(ClusterState.ACTIVE); - - IgniteCache cache = node.getOrCreateCache(DEFAULT_CACHE_NAME); - - cache.put(1, 1); - cache.put(2, 1); - - IgniteTransactions txs = node.transactions(); - - IgniteWriteAheadLogManager wal = node.context().cache().context().wal(); - - if (recoverFromWAL) { - //Force checkpoint. See for details: https://issues.apache.org/jira/browse/IGNITE-10187 - node.context().cache().context().database().waitForCheckpoint(null); - - ((GridCacheDatabaseSharedManager)node.context().cache().context().database()).enableCheckpoints(false).get(); - } - - GridTimeoutProcessor.CancelableTask flushTask = - GridTestUtils.getFieldValue(wal, FileWriteAheadLogManager.class, "backgroundFlushSchedule"); - WalStateManager.WALDisableContext wctx = GridTestUtils.getFieldValue(wal, FileWriteAheadLogManager.class, "walDisableContext"); - - // Disable checkpoint and WAL flusher. - node.context().timeout().removeTimeoutObject(flushTask); - - try (Transaction tx = txs.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { - assertEquals((Integer)1, cache.get(1)); - cache.put(2, 2); - - flushTask.onTimeout(); // Flush WAL. - - if (!recoverFromWAL) { - //Force checkpoint, then disable. - node.context().cache().context().database().waitForCheckpoint(null); - - ((GridCacheDatabaseSharedManager)node.context().cache().context().database()).enableCheckpoints(false).get(); - } - - if (omitTxFinish) - GridTestUtils.setFieldValue(wctx, "disableWal", true); // Disable wal. - - if (rollBack) - tx.rollback(); - else - tx.commit(); - } - - stopGrid(0); - - node = startGrid(0); - - node.cluster().state(ClusterState.ACTIVE); - - cache = node.cache(DEFAULT_CACHE_NAME); - - assertEquals((Integer)1, cache.get(1)); - - if (omitTxFinish || rollBack) - assertEquals((Integer)1, cache.get(2)); // Commit\rollback marker were saved neither in WAL nor in checkpoint. - else - assertEquals((Integer)2, cache.get(2)); - - cache.put(2, 3); - - assertEquals((Integer)3, cache.get(2)); - } - - - /** - * @throws Exception If fails. - */ - @Test - public void testLostRollbackOnBackup() throws Exception { - IgniteEx node = startGrid(0); - - startGrid(1); - - node.cluster().state(ClusterState.ACTIVE); - - final CyclicBarrier barrier = new CyclicBarrier(2); - - GridTestUtils.runAsync(new Runnable() { - @Override public void run() { - try { - barrier.await(); - - stopGrid(1); - - barrier.await(); - - IgniteEx g1 = startGrid(1); - g1.resetLostPartitions(Collections.singleton(DEFAULT_CACHE_NAME)); - - barrier.await(); - } - catch (Exception e) { - barrier.reset(); - } - } - }); - - IgniteCache cache = node.getOrCreateCache(DEFAULT_CACHE_NAME); - - Integer key = primaryKey(cache); - - cache.put(key, 0); - - IgniteTransactions txs = node.transactions(); - - try (Transaction tx = txs.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { - assertEquals((Integer)0, cache.get(key)); - - cache.put(key, 1); - - barrier.await(); - - barrier.await(); // Await backup node stop. - - Thread.sleep(1000); - - tx.rollback(); - } - catch (Exception e) { - assertTrue(X.hasCause(e, CacheInvalidStateException.class)); - } - - barrier.await(); - - assertEquals((Integer)0, cache.get(key)); - - cache.put(key, 2); - - assertEquals((Integer)2, cache.get(key)); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccVacuumTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccVacuumTest.java deleted file mode 100644 index 4a8d433c5ef1d..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccVacuumTest.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.CacheWriteSynchronizationMode; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.processors.cache.mvcc.txlog.TxLog; -import org.apache.ignite.internal.util.worker.GridWorker; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.GridTestUtils; -import org.junit.Ignore; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * Vacuum test. - */ -public class CacheMvccVacuumTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testStartStopVacuumInMemory() throws Exception { - Ignite node0 = startGrid(0); - Ignite node1 = startGrid(1); - - node1.createCache(new CacheConfiguration<>("test1") - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - - node1.createCache(new CacheConfiguration<>("test2") - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT)); - - ensureVacuum(node0); - ensureVacuum(node1); - - stopGrid(0); - - ensureNoVacuum(node0); - ensureVacuum(node1); - - stopGrid(1); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testStartStopVacuumPersistence() throws Exception { - persistence = true; - - Ignite node0 = startGrid(0); - Ignite node1 = startGrid(1); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - - node1.cluster().state(ClusterState.ACTIVE); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - - node1.createCache(new CacheConfiguration<>("test1") - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - - IgniteCache cache = node1.createCache(new CacheConfiguration<>("test2") - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT)); - - cache.put(primaryKey(cache), 0); - cache.put(primaryKey(node0.cache("test2")), 0); - - ensureVacuum(node0); - ensureVacuum(node1); - - node1.cluster().state(ClusterState.INACTIVE); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - - node1.cluster().state(ClusterState.ACTIVE); - - ensureVacuum(node0); - ensureVacuum(node1); - - stopGrid(0); - - ensureNoVacuum(node0); - ensureVacuum(node1); - - stopGrid(1); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - - node0 = startGrid(0); - node1 = startGrid(1); - - node1.cluster().state(ClusterState.ACTIVE); - - ensureVacuum(node0); - ensureVacuum(node1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testVacuumNotStartedWithoutMvcc() throws Exception { - IgniteConfiguration cfg = getConfiguration("grid1"); - - Ignite node = startGrid(cfg); - - ensureNoVacuum(node); - - IgniteCache cache = node.createCache( - cacheConfiguration(PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 1, 16)); - - ensureVacuum(node); - - cache.put(0, 0); - - cache.destroy(); - - ensureNoVacuum(node); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8414") - @Test - public void testVacuumNotStartedOnNonBaselineNode() throws Exception { - persistence = true; - - Ignite node0 = startGrid(0); - - node0.cluster().baselineAutoAdjustEnabled(false); - ensureNoVacuum(node0); - - node0.cluster().state(ClusterState.ACTIVE); - - IgniteCache cache = node0.createCache( - cacheConfiguration(PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 1, 16)); - - cache.put(1, 0); - - ensureVacuum(node0); - - Ignite node1 = startGrid(1); - - //TODO IGNITE-8414: Test fails here due to cache context initializes on node join unless IGNITE-8414 is fixed. - ensureNoVacuum(node1); - - node0.cluster().setBaselineTopology(node0.cluster().topologyVersion()); - - ensureVacuum(node0); - ensureVacuum(node1); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8717") - @Test - public void testVacuumNotStartedOnNonBaselineNode2() throws Exception { - persistence = true; - - Ignite node0 = startGrid(0); - Ignite node1 = startGrid(1); - - node0.cluster().baselineAutoAdjustEnabled(false); - node0.cluster().state(ClusterState.ACTIVE); - - IgniteCache cache = node0.createCache( - cacheConfiguration(PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 1, 16)); - - cache.put(primaryKey(cache), 0); - cache.put(primaryKey(node1.cache(DEFAULT_CACHE_NAME)), 0); - - stopGrid(1); - - node0.cluster().setBaselineTopology(Collections.singleton(node0.cluster().node())); - - //TODO IGNITE-8717: Rejoin node after cache destroy leads critical error unless IGNITE-8717 fixed. - node0.cache(DEFAULT_CACHE_NAME).destroy(); - - ensureNoVacuum(node0); - - node1 = startGrid(1); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - - node0.cluster().setBaselineTopology(node0.cluster().topologyVersion()); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testVacuumNotStartedOnNonAffinityNode() throws Exception { - persistence = true; - - Ignite node0 = startGrid(0); - Ignite node1 = startGrid(1); - - node0.cluster().baselineAutoAdjustEnabled(false); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - - node0.cluster().state(ClusterState.ACTIVE); - - IgniteCache cache = node0.createCache( - cacheConfiguration(PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 1, 16) - .setNodeFilter(new NodeFilter(node0.cluster().node().id()))); - - cache.put(1, 0); - - ensureVacuum(node0); - ensureNoVacuum(node1); - - node0.cluster().state(ClusterState.INACTIVE); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - - stopGrid(1); - - ensureNoVacuum(node0); - ensureNoVacuum(node1); - - node0.cluster().state(ClusterState.ACTIVE); - node0.cluster().setBaselineTopology(Collections.singleton(node0.cluster().node())); - - ensureVacuum(node0); - ensureNoVacuum(node1); - - // Check non-baseline node. - node1 = startGrid(1); - - ensureVacuum(node0); - ensureNoVacuum(node1); - - node0.cluster().setBaselineTopology(node0.cluster().topologyVersion()); - - ensureVacuum(node0); - ensureNoVacuum(node1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testVacuumNotStartedWithoutMvccPersistence() throws Exception { - persistence = true; - - IgniteConfiguration cfg = getConfiguration("grid1"); - - Ignite node = startGrid(cfg); - - ensureNoVacuum(node); - - node.cluster().state(ClusterState.ACTIVE); - - ensureNoVacuum(node); - } - - /** - * Ensures vacuum is running on the given node. - * - * @param node Node. - */ - private void ensureVacuum(Ignite node) { - MvccProcessorImpl crd = mvccProcessor(node); - - assertNotNull(crd); - - TxLog txLog = GridTestUtils.getFieldValue(crd, "txLog"); - - assertNotNull("TxLog wasn't initialized.", txLog); - - List vacuumWorkers = GridTestUtils.getFieldValue(crd, "vacuumWorkers"); - - assertNotNull("No vacuum workers was initialized.", vacuumWorkers); - assertFalse("No vacuum workers was initialized.", vacuumWorkers.isEmpty()); - - for (GridWorker w : vacuumWorkers) { - assertFalse(w.isCancelled()); - assertFalse(w.isDone()); - } - } - - /** - * Ensures vacuum is stopped on the given node. - * - * @param node Node. - */ - private void ensureNoVacuum(Ignite node) { - MvccProcessorImpl crd = mvccProcessor(node); - - assertNull("Vacuums workers shouldn't be started.", GridTestUtils.>getFieldValue(crd, "vacuumWorkers")); - - assertNull("TxLog shouldn't exists.", GridTestUtils.getFieldValue(crd, "txLog")); - } - - /** - * Filter specifying on which node the cache should be started. - */ - public static class NodeFilter implements IgnitePredicate { - /** Cache should be created node with certain UUID. */ - public UUID uuid; - - /** - * @param uuid node ID. - */ - public NodeFilter(UUID uuid) { - this.uuid = uuid; - } - - /** {@inheritDoc} */ - @Override public boolean apply(ClusterNode clusterNode) { - return clusterNode.id().equals(uuid); - } - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCachePeekTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCachePeekTest.java deleted file mode 100644 index 7d6d0c5b6d001..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccCachePeekTest.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.concurrent.CountDownLatch; -import java.util.stream.Stream; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.CachePeekMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** */ -public class MvccCachePeekTest extends CacheMvccAbstractTest { - /** */ - private interface ThrowingRunnable { - /** */ - void run() throws Exception; - } - - /** */ - private IgniteCache cache; - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - startGridsMultiThreaded(3); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testPeek() throws Exception { - doWithCache(this::checkPeekSerial); - doWithCache(this::checkPeekDoesNotSeeAbortedVersions); - doWithCache(this::checkPeekDoesNotSeeActiveVersions); - doWithCache(this::checkPeekOnheap); - doWithCache(this::checkPeekNearCache); - } - - /** */ - private void doWithCache(ThrowingRunnable action) throws Exception { - cache = grid(0).getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setBackups(1) - .setCacheMode(cacheMode())); - - try { - action.run(); - } - finally { - cache.destroy(); - } - } - - /** */ - private void checkPeekSerial() throws Exception { - Stream.of(primaryKey(cache), backupKey(cache)).forEach(key -> { - assertNull(cache.localPeek(key)); - - cache.put(key, 1); - - assertEquals(1, cache.localPeek(key)); - - cache.put(key, 2); - - assertEquals(2, cache.localPeek(key)); - }); - } - - /** */ - private void checkPeekDoesNotSeeAbortedVersions() throws Exception { - Integer pk = primaryKey(cache); - - cache.put(pk, 1); - - try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(pk, 2); - - tx.rollback(); - } - - assertEquals(1, cache.localPeek(pk)); - } - - /** */ - private void checkPeekDoesNotSeeActiveVersions() throws Exception { - Integer pk = primaryKey(cache); - - cache.put(pk, 1); - - CountDownLatch writeCompleted = new CountDownLatch(1); - CountDownLatch checkCompleted = new CountDownLatch(1); - - IgniteInternalFuture fut = GridTestUtils.runAsync(() -> { - try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(pk, 2); - - writeCompleted.countDown(); - checkCompleted.await(); - - tx.commit(); - } - - return null; - }); - - writeCompleted.await(); - - assertEquals(1, cache.localPeek(pk)); - - checkCompleted.countDown(); - - fut.get(); - } - - /** */ - private void checkPeekOnheap() throws Exception { - Stream.of(primaryKey(cache), backupKey(cache), nearKey(cache)).forEach(key -> { - cache.put(key, 1); - - assertNull(cache.localPeek(key, CachePeekMode.ONHEAP)); - }); - } - - /** */ - private void checkPeekNearCache() throws Exception { - Stream.of(primaryKey(cache), backupKey(cache), nearKey(cache)).forEach(key -> { - cache.put(key, 1); - - assertNull(cache.localPeek(key, CachePeekMode.NEAR)); - }); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccStructuresOverheadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccStructuresOverheadTest.java deleted file mode 100644 index 4c9367715d23e..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccStructuresOverheadTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.GridTopic; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.cache.mvcc.msg.MvccRecoveryFinishedMessage; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Test; - -/** - * Test checks a collecting unused MVCC structure, that will be able to create GC pressure. - */ -public class MvccStructuresOverheadTest extends GridCommonAbstractTest { - - /** - * Amount of restarts of clients. - */ - private static final int CLIENT_RESTARTS = 10; - - /** - * Is cahce confugured is MVCC or not. - */ - private boolean isMvccCache = false; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - return super.getConfiguration(igniteInstanceName) - .setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME) - .setAtomicityMode(isMvccCache ? - CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT : - CacheAtomicityMode.ATOMIC)); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - stopAllGrids(); - } - - /** - * Starts grid with ATOMIC cache. - * - * @throws Exception If failed. - */ - @Test - public void testWithoutMvcc() throws Exception { - restartClients(); - } - - /** - * Starts grid with WVCC cache. - * - * @throws Exception If failed. - */ - @Test - public void testWithMvcc() throws Exception { - isMvccCache = true; - - restartClients(); - } - - /** - * Starts cluster and restarts several clients over it. - * - * @throws Exception If failed. - */ - private void restartClients() throws Exception { - IgniteEx ignite = startGrid(0); - - AtomicBoolean mvccMessageTranslated = new AtomicBoolean(); - - ignite.context().io().addMessageListener(GridTopic.TOPIC_CACHE_COORDINATOR, (nodeId, msg, plc) -> { - if (msg instanceof MvccRecoveryFinishedMessage) - mvccMessageTranslated.set(true); - }); - - Map recoveryBallotBoxes = U.field(ignite.context().coordinators(), "recoveryBallotBoxes"); - - for (int i = 0; i < CLIENT_RESTARTS; i++) { - IgniteEx client = startClientGrid(1); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - cache.put(i, i); - - client.close(); - - if (isMvccCache) { - assertTrue(GridTestUtils.waitForCondition(mvccMessageTranslated::get, 10_000)); - - assertTrue("Size of recoveryBallotBoxes " + recoveryBallotBoxes.size(), recoveryBallotBoxes.isEmpty()); - - mvccMessageTranslated.compareAndSet(true, false); - } - else { - assertFalse(mvccMessageTranslated.get()); - - assertTrue("Size of recoveryBallotBoxes " + recoveryBallotBoxes.size(), recoveryBallotBoxes.isEmpty()); - } - } - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUnsupportedTxModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUnsupportedTxModesTest.java deleted file mode 100644 index ccb3d6e8c7d5f..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccUnsupportedTxModesTest.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.Collections; -import com.google.common.collect.ImmutableMap; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheEntryProcessor; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionException; -import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Test; - -import static java.util.Collections.singleton; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; -import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE; - -/** */ -public class MvccUnsupportedTxModesTest extends GridCommonAbstractTest { - /** */ - private static IgniteCache cache; - - /** */ - private static final CacheEntryProcessor testEntryProcessor = (entry, arguments) -> null; - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - IgniteEx ign = startGrid(0); - - cache = ign.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT)); - } - - /** */ - @Test - public void testGetAndPutIfAbsent() { - checkOperation(() -> cache.getAndPutIfAbsent(1, 1)); - } - - /** */ - @Test - public void testGetAndPutIfAbsentAsync() { - checkOperation(() -> cache.getAndPutIfAbsentAsync(1, 1)); - } - - /** */ - @Test - public void testGet() { - checkOperation(() -> cache.get(1)); - } - - /** */ - @Test - public void testGetAsync() { - checkOperation(() -> cache.getAsync(1)); - } - - /** */ - @Test - public void testGetEntry() { - checkOperation(() -> cache.getEntry(1)); - } - - /** */ - @Test - public void testGetEntryAsync() { - checkOperation(() -> cache.getEntryAsync(1)); - } - - /** */ - @Test - public void testGetAll() { - checkOperation(() -> cache.getAll(singleton(1))); - } - - /** */ - @Test - public void testGetAllAsync() { - checkOperation(() -> cache.getAllAsync(singleton(1))); - } - - /** */ - @Test - public void testGetEntries() { - checkOperation(() -> cache.getEntries(singleton(1))); - } - - /** */ - @Test - public void testGetEntriesAsync() { - checkOperation(() -> cache.getEntriesAsync(singleton(1))); - } - - /** */ - @Test - public void testContainsKey() { - checkOperation(() -> cache.containsKey(1)); - } - - /** */ - @Test - public void testContainsKeyAsync() { - checkOperation(() -> cache.containsKeyAsync(1)); - } - - /** */ - @Test - public void testContainsKeys() { - checkOperation(() -> cache.containsKeys(singleton(1))); - } - - /** */ - @Test - public void testContainsKeysAsync() { - checkOperation(() -> cache.containsKeysAsync(singleton(1))); - } - - /** */ - @Test - public void testPut() { - checkOperation(() -> cache.put(1, 1)); - } - - /** */ - @Test - public void testPutAsync() { - checkOperation(() -> cache.putAsync(1, 1)); - } - - /** */ - @Test - public void testGetAndPut() { - checkOperation(() -> cache.getAndPut(1, 1)); - } - - /** */ - @Test - public void testGetAndPutAsync() { - checkOperation(() -> cache.getAndPutAsync(1, 1)); - } - - /** */ - @Test - public void testPutAll() { - checkOperation(() -> cache.putAll(ImmutableMap.of(1, 1))); - } - - /** */ - @Test - public void testPutAllAsync() { - checkOperation(() -> cache.putAllAsync(ImmutableMap.of(1, 1))); - } - - /** */ - @Test - public void testPutIfAbsent() { - checkOperation(() -> cache.putIfAbsent(1, 1)); - } - - /** */ - @Test - public void testPutIfAbsentAsync() { - checkOperation(() -> cache.putIfAbsentAsync(1, 1)); - } - - /** */ - @Test - public void testRemove1() { - checkOperation(() -> cache.remove(1)); - } - - /** */ - @Test - public void testRemoveAsync1() { - checkOperation(() -> cache.removeAsync(1)); - } - - /** */ - @Test - public void testRemove2() { - checkOperation(() -> cache.remove(1, 1)); - } - - /** */ - @Test - public void testRemoveAsync2() { - checkOperation(() -> cache.removeAsync(1, 1)); - } - - /** */ - @Test - public void testGetAndRemove() { - checkOperation(() -> cache.getAndRemove(1)); - } - - /** */ - @Test - public void testGetAndRemoveAsync() { - checkOperation(() -> cache.getAndRemoveAsync(1)); - } - - /** */ - @Test - public void testReplace1() { - checkOperation(() -> cache.replace(1, 1, 1)); - } - - /** */ - @Test - public void testReplaceAsync1() { - checkOperation(() -> cache.replaceAsync(1, 1, 1)); - } - - /** */ - @Test - public void testReplace2() { - checkOperation(() -> cache.replace(1, 1)); - } - - /** */ - @Test - public void testReplaceAsync2() { - checkOperation(() -> cache.replaceAsync(1, 1)); - } - - /** */ - @Test - public void testGetAndReplace() { - checkOperation(() -> cache.getAndReplace(1, 1)); - } - - /** */ - @Test - public void testGetAndReplaceAsync() { - checkOperation(() -> cache.getAndReplaceAsync(1, 1)); - } - - /** */ - @Test - public void testRemoveAll1() { - checkOperation(() -> cache.removeAll(singleton(1))); - } - - /** */ - @Test - public void testRemoveAllAsync1() { - checkOperation(() -> cache.removeAllAsync(singleton(1))); - } - - /** */ - @Test - public void testInvoke1() { - checkOperation(() -> cache.invoke(1, testEntryProcessor)); - } - - /** */ - @Test - public void testInvokeAsync1() { - checkOperation(() -> cache.invokeAsync(1, testEntryProcessor)); - } - - /** */ - @Test - public void testInvoke2() { - checkOperation(() -> cache.invoke(1, testEntryProcessor)); - } - - /** */ - @Test - public void testInvokeAsync2() { - checkOperation(() -> cache.invokeAsync(1, testEntryProcessor)); - } - - /** */ - @Test - public void testInvokeAll1() { - checkOperation(() -> cache.invokeAll(singleton(1), testEntryProcessor)); - } - - /** */ - @Test - public void testInvokeAllAsync1() { - checkOperation(() -> cache.invokeAllAsync(singleton(1), testEntryProcessor)); - } - - /** */ - @Test - public void testInvokeAll2() { - checkOperation(() -> cache.invokeAll(singleton(1), testEntryProcessor)); - } - - /** */ - @Test - public void testInvokeAllAsync2() { - checkOperation(() -> cache.invokeAllAsync(singleton(1), testEntryProcessor)); - } - - /** */ - @Test - public void testInvokeAll3() { - checkOperation(() -> cache.invokeAll(Collections.singletonMap(1, testEntryProcessor))); - } - - /** */ - @Test - public void testInvokeAllAsync3() { - checkOperation(() -> cache.invokeAllAsync(Collections.singletonMap(1, testEntryProcessor))); - } - - /** - * @param action Action. - */ - private void checkOperation(Runnable action) { - assertNotSupportedInTx(action, OPTIMISTIC, READ_COMMITTED); - assertNotSupportedInTx(action, OPTIMISTIC, REPEATABLE_READ); - assertNotSupportedInTx(action, OPTIMISTIC, SERIALIZABLE); - - assertSupportedInTx(action, PESSIMISTIC, READ_COMMITTED); - assertSupportedInTx(action, PESSIMISTIC, REPEATABLE_READ); - assertSupportedInTx(action, PESSIMISTIC, SERIALIZABLE); - } - - /** */ - private void assertNotSupportedInTx(Runnable action, TransactionConcurrency conc, TransactionIsolation iso) { - try (Transaction ignored = grid(0).transactions().txStart(conc, iso)) { - action.run(); - - fail("Action failure is expected."); - } - catch (TransactionException e) { - assertEquals("Only pessimistic transactions are supported when MVCC is enabled.", e.getMessage()); - } - } - - /** */ - private void assertSupportedInTx(Runnable action, TransactionConcurrency conc, TransactionIsolation iso) { - try (Transaction tx = grid(0).transactions().txStart(conc, iso)) { - action.run(); - - tx.commit(); - } - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheStartStopWithFreqCheckpointTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheStartStopWithFreqCheckpointTest.java index b6c77577ed397..f75774dc79460 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheStartStopWithFreqCheckpointTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheStartStopWithFreqCheckpointTest.java @@ -39,7 +39,6 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; import org.junit.Test; @@ -88,10 +87,7 @@ private CacheConfiguration cacheConfiguration(int cacheIdx) { .setCacheMode(CacheMode.REPLICATED) .setBackups(0); - if (MvccFeatureChecker.forcedMvcc()) - ccfg.setRebalanceDelay(Long.MAX_VALUE); - else - ccfg.setRebalanceMode(CacheRebalanceMode.NONE); + ccfg.setRebalanceMode(CacheRebalanceMode.NONE); return ccfg; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java index 5d521574703f1..3c9a1d719be0e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTest.java @@ -47,12 +47,10 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionOptimisticException; import org.apache.ignite.transactions.TransactionRollbackException; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; @@ -92,13 +90,6 @@ protected IgnitePdsContinuousRestartTest(boolean cancel) { this.cancel = cancel; } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-11937", MvccFeatureChecker.forcedMvcc()); - - super.beforeTest(); - } - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); @@ -329,10 +320,9 @@ private void checkRebalancingDuringLoad( TransactionOptimisticException.class, TransactionRollbackException.class, ClusterTopologyException.class, - NodeStoppingException.class)) - continue; // Expected types. - - MvccFeatureChecker.assertMvccWriteConflict(e); + NodeStoppingException.class)) { + // Expected types. + } } } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTestWithExpiryPolicy.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTestWithExpiryPolicy.java index 367647ea51fcb..fcbcc5defa20b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTestWithExpiryPolicy.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsContinuousRestartTestWithExpiryPolicy.java @@ -25,7 +25,6 @@ import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.testframework.MvccFeatureChecker; /** * Cause by https://issues.apache.org/jira/browse/IGNITE-5879 @@ -59,13 +58,6 @@ public IgnitePdsContinuousRestartTestWithExpiryPolicy() { return cfg; } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - - super.beforeTest(); - } - /** {@inheritDoc} */ @Override protected boolean validatePartitions() { return false; // Validation is broken with enabled expiration. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java index eb3ed130cb145..6e3af6384aa32 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java @@ -33,7 +33,6 @@ import org.apache.ignite.configuration.WALMode; import org.apache.ignite.internal.processors.database.IgniteDbDynamicCacheSelfTest; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.junit.Test; /** @@ -96,10 +95,7 @@ public void testRestartAndCreate() throws Exception { ccfg1.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg1.setAffinity(new RendezvousAffinityFunction(false, 32)); - if (MvccFeatureChecker.forcedMvcc()) - ccfg1.setRebalanceDelay(Long.MAX_VALUE); - else - ccfg1.setRebalanceMode(CacheRebalanceMode.NONE); + ccfg1.setRebalanceMode(CacheRebalanceMode.NONE); CacheConfiguration ccfg2 = new CacheConfiguration(); @@ -108,11 +104,7 @@ public void testRestartAndCreate() throws Exception { ccfg2.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg2.setAffinity(new RendezvousAffinityFunction(false, 32)); ccfg2.setIndexedTypes(Integer.class, Value.class); - - if (MvccFeatureChecker.forcedMvcc()) - ccfg2.setRebalanceDelay(Long.MAX_VALUE); - else - ccfg2.setRebalanceMode(CacheRebalanceMode.NONE); + ccfg2.setRebalanceMode(CacheRebalanceMode.NONE); ignite.createCache(ccfg1); ignite.createCache(ccfg2); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPartitionsStateRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPartitionsStateRecoveryTest.java index 8bf714f953751..3ac0b86a94275 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPartitionsStateRecoveryTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPartitionsStateRecoveryTest.java @@ -30,10 +30,8 @@ import org.apache.ignite.configuration.WALMode; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; -import org.junit.Assume; import org.junit.Test; /** @@ -67,10 +65,7 @@ public class IgnitePdsPartitionsStateRecoveryTest extends GridCommonAbstractTest .setAffinity(new RendezvousAffinityFunction(false, PARTS_CNT)); // Disable rebalance to prevent owning MOVING partitions. - if (MvccFeatureChecker.forcedMvcc()) - ccfg.setRebalanceDelay(Long.MAX_VALUE); - else - ccfg.setRebalanceMode(CacheRebalanceMode.NONE); + ccfg.setRebalanceMode(CacheRebalanceMode.NONE); cfg.setCacheConfiguration(ccfg); @@ -144,8 +139,6 @@ public void testPartitionsStateConsistencyAfterRecovery() throws Exception { */ @Test public void testPartitionsStateConsistencyAfterRecoveryNoCheckpoints() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10603", MvccFeatureChecker.forcedMvcc()); - IgniteEx ignite = startGrid(0); ignite.cluster().state(ClusterState.ACTIVE); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java index ceadb5031bea3..3373819303820 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsRecoveryAfterFileCorruptionTest.java @@ -54,7 +54,6 @@ import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer; import org.apache.ignite.internal.util.future.GridFinishedFuture; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -80,10 +79,7 @@ public class IgnitePdsRecoveryAfterFileCorruptionTest extends GridCommonAbstract CacheConfiguration ccfg = new CacheConfiguration(cacheName); ccfg.setAffinity(new RendezvousAffinityFunction(true, 1)); - if (MvccFeatureChecker.forcedMvcc()) - ccfg.setRebalanceDelay(Long.MAX_VALUE); - else - ccfg.setRebalanceMode(CacheRebalanceMode.NONE); + ccfg.setRebalanceMode(CacheRebalanceMode.NONE); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java index 5c307884af6be..57a7e36402b27 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java @@ -65,7 +65,6 @@ import org.apache.ignite.spi.IgniteSpiException; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; import org.junit.Test; @@ -844,12 +843,7 @@ private void doLoad(IgniteCache cache, int threadCnt, long dur ThreadLocalRandom rnd = ThreadLocalRandom.current(); do { - try { - cache.put(rnd.nextInt(keysCnt), rnd.nextInt()); - } - catch (Exception ex) { - MvccFeatureChecker.assertMvccWriteConflict(ex); - } + cache.put(rnd.nextInt(keysCnt), rnd.nextInt()); } while (U.currentTimeMillis() < stopTs); }, threadCnt, "load-cache"); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/ClientAffinityAssignmentWithBaselineTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/ClientAffinityAssignmentWithBaselineTest.java index f4e09c09b376b..3e420419728eb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/ClientAffinityAssignmentWithBaselineTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/baseline/ClientAffinityAssignmentWithBaselineTest.java @@ -801,8 +801,7 @@ private void startTxLoadThread( IgniteCache cache = ig.cache(cacheName).withAllowAtomicOpsInTx(); - boolean pessimistic = atomicityMode(cache) == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT || r.nextBoolean(); - + boolean pessimistic = r.nextBoolean(); boolean rollback = r.nextBoolean(); try { @@ -881,9 +880,7 @@ private void startCrossCacheTxLoadThread( IgniteCache cache1 = ig.cache(cacheName1); IgniteCache cache2 = ig.cache(cacheName2); - boolean pessimistic = atomicityMode(cache1) == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT || - atomicityMode(cache2) == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT || r.nextBoolean(); - + boolean pessimistic = r.nextBoolean(); boolean rollback = r.nextBoolean(); try { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteLogicalRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteLogicalRecoveryTest.java index 713448e49f03b..76bfc564ee00f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteLogicalRecoveryTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteLogicalRecoveryTest.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ThreadLocalRandom; import java.util.function.Predicate; @@ -270,19 +269,6 @@ public void testRecoveryOnDynamicallyStartedCaches() throws Exception { doTestWithDynamicCaches(dynamicCaches); } - /** - * - */ - @Test - public void testRecoveryWithMvccCaches() throws Exception { - List dynamicCaches = Lists.newArrayList( - cacheConfiguration(DYNAMIC_CACHE_PREFIX + 0, CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT), - cacheConfiguration(DYNAMIC_CACHE_PREFIX + 1, CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - ); - - doTestWithDynamicCaches(dynamicCaches); - } - /** * @param dynamicCaches Dynamic caches. */ @@ -472,18 +458,10 @@ private void checkNoRebalanceAfterRecovery() { for (final Ignite node : nodes) { TestRecordingCommunicationSpi spi = TestRecordingCommunicationSpi.spi(node); - Set mvccCaches = ((IgniteEx)node).context().cache().cacheGroups().stream() - .flatMap(group -> group.caches().stream()) - .filter(cache -> cache.config().getAtomicityMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - .map(GridCacheContext::groupId) - .collect(Collectors.toSet()); - List rebalancedGroups = spi.recordedMessages(true).stream() .map(msg -> (GridDhtPartitionDemandMessage)msg) .map(GridCacheGroupIdMessage::groupId) .filter(grpId -> grpId != sysCacheGroupId) - //TODO: remove following filter when failover for MVCC will be fixed. - .filter(grpId -> !mvccCaches.contains(grpId)) .distinct() .collect(Collectors.toList()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java index 775838f23d688..7b1b05f14757c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java @@ -39,9 +39,9 @@ import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; + 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; /** * Test partition preload for varios cache modes. @@ -156,22 +156,6 @@ public void testLocalPreloadPartitionClient() throws Exception { assertFalse(grid(0).cache(DEFAULT_CACHE_NAME).localPreloadPartition(0)); } - /** */ - @Test - public void testLocalPreloadPartitionClientMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT).setDataRegionName(MEM); - - startGridsMultiThreaded(GRIDS_CNT); - - IgniteEx client = startClientGrid(CLIENT_GRID_NAME); - - assertNotNull(client.cache(DEFAULT_CACHE_NAME)); - - assertFalse(client.cache(DEFAULT_CACHE_NAME).localPreloadPartition(0)); - assertFalse(grid(0).cache(DEFAULT_CACHE_NAME).localPreloadPartition(0)); - } - - /** */ @Test public void testLocalPreloadPartitionPrimary() throws Exception { @@ -181,15 +165,6 @@ public void testLocalPreloadPartitionPrimary() throws Exception { () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.LOCAL); } - /** */ - @Test - public void testLocalPreloadPartitionPrimaryMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT); - - preloadPartition( - () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.LOCAL); - } - /** */ @Test public void testLocalPreloadPartitionBackup() throws Exception { @@ -199,15 +174,6 @@ public void testLocalPreloadPartitionBackup() throws Exception { () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.LOCAL); } - /** */ - @Test - public void testLocalPreloadPartitionBackupMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT); - - preloadPartition( - () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.LOCAL); - } - /** */ @Test public void testPreloadPartitionInMemoryRemote() throws Exception { @@ -229,27 +195,6 @@ public void testPreloadPartitionInMemoryRemote() throws Exception { } } - /** */ - @Test - public void testPreloadPartitionInMemoryRemoteMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT).setDataRegionName(MEM); - - startGridsMultiThreaded(GRIDS_CNT); - - IgniteEx client = startClientGrid(CLIENT_GRID_NAME); - - assertNotNull(client.cache(DEFAULT_CACHE_NAME)); - - try { - client.cache(DEFAULT_CACHE_NAME).preloadPartition(0); - - fail("Exception is expected"); - } - catch (Exception e) { - log.error("Expected", e); - } - } - /** */ @Test public void testPreloadPartitionInMemoryLocal() throws Exception { @@ -273,29 +218,6 @@ public void testPreloadPartitionInMemoryLocal() throws Exception { } } - /** */ - @Test - public void testPreloadPartitionInMemoryLocalMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT).setDataRegionName(MEM); - - startGridsMultiThreaded(GRIDS_CNT); - - int key = 0; - - Ignite prim = primaryNode(key, DEFAULT_CACHE_NAME); - - int part = prim.affinity(DEFAULT_CACHE_NAME).partition(key); - - try { - prim.cache(DEFAULT_CACHE_NAME).preloadPartition(part); - - fail("Exception is expected"); - } - catch (Exception e) { - log.error("Expected", e); - } - } - /** */ @Test public void testPreloadPartitionTransactionalClientSync() throws Exception { @@ -311,21 +233,6 @@ public void testPreloadPartitionTransactionalClientSync() throws Exception { }, PreloadMode.SYNC); } - /** */ - @Test - public void testPreloadPartitionTransactionalClientSyncMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT); - - preloadPartition(() -> { - try { - return startClientGrid(CLIENT_GRID_NAME); - } - catch (Exception e) { - throw new RuntimeException(e); - } - }, PreloadMode.SYNC); - } - /** */ @Test public void testPreloadPartitionTransactionalClientAsync() throws Exception { @@ -341,21 +248,6 @@ public void testPreloadPartitionTransactionalClientAsync() throws Exception { }, PreloadMode.ASYNC); } - /** */ - @Test - public void testPreloadPartitionTransactionalClientAsyncMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT); - - preloadPartition(() -> { - try { - return startClientGrid(CLIENT_GRID_NAME); - } - catch (Exception e) { - throw new RuntimeException(e); - } - }, PreloadMode.ASYNC); - } - /** */ @Test public void testPreloadPartitionTransactionalNodeFilteredSync() throws Exception { @@ -364,14 +256,6 @@ public void testPreloadPartitionTransactionalNodeFilteredSync() throws Exception preloadPartition(() -> grid(0), PreloadMode.SYNC); } - /** */ - @Test - public void testPreloadPartitionTransactionalNodeFilteredSyncMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT); - - preloadPartition(() -> grid(0), PreloadMode.SYNC); - } - /** */ @Test public void testPreloadPartitionTransactionalNodeFilteredAsync() throws Exception { @@ -397,15 +281,6 @@ public void testPreloadPartitionTransactionalPrimarySync() throws Exception { () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.SYNC); } - /** */ - @Test - public void testPreloadPartitionTransactionalPrimarySyncMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT); - - preloadPartition( - () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.SYNC); - } - /** */ @Test public void testPreloadPartitionTransactionalPrimaryAsync() throws Exception { @@ -415,15 +290,6 @@ public void testPreloadPartitionTransactionalPrimaryAsync() throws Exception { () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.ASYNC); } - /** */ - @Test - public void testPreloadPartitionTransactionalPrimaryAsyncMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT); - - preloadPartition( - () -> G.allGrids().stream().filter(PrimaryNodePredicate.INSTANCE).findFirst().get(), PreloadMode.ASYNC); - } - /** */ @Test public void testPreloadPartitionTransactionalBackupSync() throws Exception { @@ -433,15 +299,6 @@ public void testPreloadPartitionTransactionalBackupSync() throws Exception { () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.SYNC); } - /** */ - @Test - public void testPreloadPartitionTransactionalBackupSyncMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT); - - preloadPartition( - () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.SYNC); - } - /** */ @Test public void testPreloadPartitionTransactionalBackupAsync() throws Exception { @@ -451,15 +308,6 @@ public void testPreloadPartitionTransactionalBackupAsync() throws Exception { () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.ASYNC); } - /** */ - @Test - public void testPreloadPartitionTransactionalBackupAsyncMvcc() throws Exception { - cfgFactory = () -> cacheConfiguration(TRANSACTIONAL_SNAPSHOT); - - preloadPartition( - () -> G.allGrids().stream().filter(BackupNodePredicate.INSTANCE).findFirst().get(), PreloadMode.ASYNC); - } - /** */ @Test public void testPreloadPartitionAtomicClientSync() throws Exception { diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java index a2858a00d39c8..6381b1e693423 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java @@ -41,7 +41,6 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionIsolation; @@ -187,17 +186,10 @@ public void testTransactionsDontHang() throws Exception { TestEntity entity = TestEntity.newTestEntity(locRandom); - while (true) { - try (Transaction tx = g.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(randomKey, entity); + try (Transaction tx = g.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { + cache.put(randomKey, entity); - tx.commit(); - - break; - } - catch (Exception e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } + tx.commit(); } operationCnt.increment(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlExpirationOnDeactivateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlExpirationOnDeactivateTest.java index 26a82def5445a..45359a5e70545 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlExpirationOnDeactivateTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlExpirationOnDeactivateTest.java @@ -44,7 +44,6 @@ import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager; import org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointListener; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -75,8 +74,6 @@ public class IgnitePdsWithTtlExpirationOnDeactivateTest extends GridCommonAbstra /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - super.beforeTest(); cleanPersistenceDir(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest.java index 60539acdf12d8..a0a1ebc72fb93 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest.java @@ -62,10 +62,10 @@ import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; + import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cluster.ClusterState.ACTIVE; @@ -117,8 +117,6 @@ public class IgnitePdsWithTtlTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - super.beforeTest(); cleanPersistenceDir(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest2.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest2.java index f013f18020670..07aae64ce2a5e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest2.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest2.java @@ -29,7 +29,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.failure.FailureContext; import org.apache.ignite.failure.NoOpFailureHandler; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -42,8 +41,6 @@ public class IgnitePdsWithTtlTest2 extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EXPIRATION); - super.beforeTest(); cleanPersistenceDir(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java index 0706a3a8e9c95..f18337e42bfc7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java @@ -36,7 +36,6 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheRebalanceMode; import org.apache.ignite.cluster.ClusterState; import org.apache.ignite.configuration.CacheConfiguration; @@ -56,8 +55,6 @@ import org.apache.ignite.internal.pagemem.wal.record.CheckpointRecord; import org.apache.ignite.internal.pagemem.wal.record.DataEntry; import org.apache.ignite.internal.pagemem.wal.record.DataRecord; -import org.apache.ignite.internal.pagemem.wal.record.MvccDataEntry; -import org.apache.ignite.internal.pagemem.wal.record.MvccDataRecord; import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot; import org.apache.ignite.internal.pagemem.wal.record.WALRecord; import org.apache.ignite.internal.pagemem.wal.record.delta.PartitionMetaStateRecord; @@ -67,7 +64,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheOperation; import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; import org.apache.ignite.internal.processors.cache.KeyCacheObject; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersionImpl; import org.apache.ignite.internal.processors.cache.persistence.DummyPageIO; import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager; import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager; @@ -101,9 +97,6 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom /** Cache name. */ private static final String CACHE_NAME = "cache"; - /** Mvcc cache name. */ - private static final String MVCC_CACHE_NAME = "mvccCache"; - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); @@ -111,11 +104,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME) .setRebalanceMode(CacheRebalanceMode.NONE); - CacheConfiguration mvccCfg = new CacheConfiguration(MVCC_CACHE_NAME) - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - .setRebalanceDelay(Long.MAX_VALUE); - - cfg.setCacheConfiguration(ccfg, mvccCfg); + cfg.setCacheConfiguration(ccfg); cfg.setDataStorageConfiguration( new DataStorageConfiguration() @@ -310,27 +299,19 @@ public void testGetForInitialWrite() throws Exception { */ @Test public void testDataWalEntries() throws Exception { - checkDataWalEntries(false); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testMvccDataWalEntries() throws Exception { - checkDataWalEntries(true); + checkDataWalEntries(); } /** * @throws Exception if failed. */ - private void checkDataWalEntries(boolean mvcc) throws Exception { + private void checkDataWalEntries() throws Exception { IgniteEx ig = startGrid(0); ig.cluster().state(ClusterState.ACTIVE); GridCacheSharedContext sharedCtx = ig.context().cache().context(); - GridCacheContext cctx = sharedCtx.cache().cache(mvcc ? MVCC_CACHE_NAME : CACHE_NAME).context(); + GridCacheContext cctx = sharedCtx.cache().cache(CACHE_NAME).context(); GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager)sharedCtx.database(); IgniteWriteAheadLogManager wal = sharedCtx.wal(); @@ -353,13 +334,9 @@ private void checkDataWalEntries(boolean mvcc) throws Exception { if (op != GridCacheOperation.DELETE) val = cctx.toCacheObject("value-" + i); - entries.add(mvcc ? - new MvccDataEntry(cctx.cacheId(), key, val, op, null, cctx.cache().nextVersion(), - 0L, - cctx.affinity().partition(i), i, new MvccVersionImpl(1000L, 10L, i + 1 /* Non-zero */)) : - new DataEntry(cctx.cacheId(), key, val, op, null, cctx.cache().nextVersion(), - 0L, - cctx.affinity().partition(i), i, DataEntry.EMPTY_FLAGS)); + entries.add(new DataEntry(cctx.cacheId(), key, val, op, null, cctx.cache().nextVersion(), + 0L, + cctx.affinity().partition(i), i, DataEntry.EMPTY_FLAGS)); } UUID cpId = UUID.randomUUID(); @@ -369,7 +346,7 @@ private void checkDataWalEntries(boolean mvcc) throws Exception { wal.flush(start, false); for (DataEntry entry : entries) - wal.log(mvcc ? new MvccDataRecord((MvccDataEntry)entry) : new DataRecord(entry)); + wal.log(new DataRecord(entry)); // Data will not be written to the page store. stopAllGrids(); @@ -379,7 +356,7 @@ private void checkDataWalEntries(boolean mvcc) throws Exception { ig.cluster().state(ClusterState.ACTIVE); sharedCtx = ig.context().cache().context(); - cctx = sharedCtx.cache().cache(mvcc ? MVCC_CACHE_NAME : CACHE_NAME).context(); + cctx = sharedCtx.cache().cache(CACHE_NAME).context(); db = (GridCacheDatabaseSharedManager)sharedCtx.database(); wal = sharedCtx.wal(); @@ -405,10 +382,7 @@ private void checkDataWalEntries(boolean mvcc) throws Exception { while (idx < entries.size()) { IgniteBiTuple dataRecTup = it.next(); - if (!mvcc) - assert dataRecTup.get2() instanceof DataRecord; - else - assert dataRecTup.get2() instanceof MvccDataRecord; + assert dataRecTup.get2() instanceof DataRecord; DataRecord dataRec = (DataRecord)dataRecTup.get2(); @@ -431,13 +405,6 @@ private void checkDataWalEntries(boolean mvcc) throws Exception { assertEquals(entry.nearXidVersion(), readEntry.nearXidVersion()); assertEquals(entry.partitionCounter(), readEntry.partitionCounter()); - if (mvcc) { - assert entry instanceof MvccDataEntry; - assert readEntry instanceof MvccDataEntry; - - assertEquals(((MvccDataEntry)entry).mvccVer(), ((MvccDataEntry)readEntry).mvccVer()); - } - idx++; } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java index bf56dffdf2eba..bf8f9249df208 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java @@ -42,10 +42,8 @@ import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager; import org.apache.ignite.internal.processors.cache.persistence.filename.PdsFoldersResolver; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; -import org.junit.Assume; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -114,9 +112,6 @@ public IgniteNodeStoppedDuringDisableWALTest(NodeStopPoint nodeStopPoint) { */ @Test public void test() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-12040", - MvccFeatureChecker.forcedMvcc() && nodeStopPoint == NodeStopPoint.AFTER_DISABLE_WAL); - testStopNodeWithDisableWAL(nodeStopPoint); stopAllGrids(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java index e73753d518ff8..0e5c6de84e80b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java @@ -42,13 +42,11 @@ import org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager; import org.apache.ignite.internal.util.lang.GridAbsPredicate; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -71,8 +69,6 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10550", MvccFeatureChecker.forcedMvcc()); - super.beforeTest(); stopAllGrids(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java index 4033eb60cbcbc..8e7799e9680d5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java @@ -41,7 +41,6 @@ import org.apache.ignite.internal.util.lang.GridAbsPredicate; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; @@ -128,8 +127,6 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest { */ @Test public void testReservedOnExchange() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - System.setProperty(IGNITE_PDS_WAL_REBALANCE_THRESHOLD, "0"); final int entryCnt = 10_000; @@ -287,8 +284,6 @@ private void printProgress(int k) { */ @Test public void testRemovesArePreloadedIfHistoryIsAvailable() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10551", MvccFeatureChecker.forcedMvcc()); - int entryCnt = 10_000; IgniteEx ig0 = (IgniteEx)startGrids(2); @@ -339,8 +334,6 @@ public void testRemovesArePreloadedIfHistoryIsAvailable() throws Exception { */ @Test public void testNodeIsClearedIfHistoryIsUnavailable() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10551", MvccFeatureChecker.forcedMvcc()); - int entryCnt = 10_000; IgniteEx ig0 = (IgniteEx)startGrids(2); @@ -402,7 +395,6 @@ public void testNodeIsClearedIfHistoryIsUnavailable() throws Exception { */ @Test public void testWalHistoryPartiallyRemoved() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10551", MvccFeatureChecker.forcedMvcc()); Assume.assumeTrue( "https://issues.apache.org/jira/browse/IGNITE-16891", IgniteSystemProperties.getString(IGNITE_DEFAULT_DISK_PAGE_COMPRESSION) == null @@ -448,8 +440,6 @@ public void testWalHistoryPartiallyRemoved() throws Exception { */ @Test public void testNodeLeftDuringExchange() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); - System.setProperty(IGNITE_PDS_WAL_REBALANCE_THRESHOLD, "0"); final int entryCnt = 10_000; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java index 43bde29668759..bfb3635bb3473 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoverySeveralRestartsTest.java @@ -37,7 +37,6 @@ import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -115,9 +114,6 @@ public class IgniteWalRecoverySeveralRestartsTest extends GridCommonAbstractTest */ @Test public void testWalRecoverySeveralRestarts() throws Exception { - if (MvccFeatureChecker.forcedMvcc()) - return; - try { IgniteEx ignite = startGrid(1); @@ -174,9 +170,6 @@ public void testWalRecoverySeveralRestarts() throws Exception { */ @Test public void testWalRecoveryWithDynamicCache() throws Exception { - if (MvccFeatureChecker.forcedMvcc()) - return; - try { IgniteEx ignite = startGrid(1); @@ -231,9 +224,6 @@ public void testWalRecoveryWithDynamicCache() throws Exception { */ @Test public void testWalRecoveryWithDynamicCacheLargeObjects() throws Exception { - if (MvccFeatureChecker.forcedMvcc()) - return; - try { IgniteEx ignite = startGrid(1); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java index af1c8e27f3496..668eee643813b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java @@ -81,7 +81,6 @@ import org.apache.ignite.lang.IgniteInClosure; import org.apache.ignite.logger.NullLogger; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.testframework.wal.record.RecordUtils; @@ -89,7 +88,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.Assert; -import org.junit.Assume; import org.junit.Test; import static java.util.Arrays.fill; @@ -1013,8 +1011,6 @@ public void testRemoveOperationPresentedForDataEntry() throws Exception { */ @Test public void testRemoveOperationPresentedForDataEntryForAtomic() throws Exception { - Assume.assumeFalse(MvccFeatureChecker.forcedMvcc()); - runRemoveOperationTest(CacheAtomicityMode.ATOMIC); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousBatchAckTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousBatchAckTest.java index b0da778106ec2..c8f2fdbd78426 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousBatchAckTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousBatchAckTest.java @@ -41,7 +41,6 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -190,62 +189,6 @@ public void testReplicatedTxWithFilter() throws Exception { checkBackupAcknowledgeMessage(cacheConfiguration(REPLICATED, 1, TRANSACTIONAL, true)); } - // MVCC tests. - - /** - * @throws Exception If failed. - */ - @Test - public void testPartitionMvccTx() throws Exception { - checkBackupAcknowledgeMessage(cacheConfiguration(PARTITIONED, 1, TRANSACTIONAL_SNAPSHOT, false)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPartitionMvccTxWithFilter() throws Exception { - filterOn.set(true); - - checkBackupAcknowledgeMessage(cacheConfiguration(PARTITIONED, 1, TRANSACTIONAL_SNAPSHOT, true)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPartitionMvccTxNoBackup() throws Exception { - checkBackupAcknowledgeMessage(cacheConfiguration(PARTITIONED, 0, TRANSACTIONAL_SNAPSHOT, false)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPartitionMvccTxNoBackupWithFilter() throws Exception { - filterOn.set(true); - - checkBackupAcknowledgeMessage(cacheConfiguration(PARTITIONED, 0, TRANSACTIONAL_SNAPSHOT, true)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testReplicatedMvccTx() throws Exception { - checkBackupAcknowledgeMessage(cacheConfiguration(REPLICATED, 1, TRANSACTIONAL_SNAPSHOT, false)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testReplicatedMvccTxWithFilter() throws Exception { - filterOn.set(true); - - checkBackupAcknowledgeMessage(cacheConfiguration(REPLICATED, 1, TRANSACTIONAL_SNAPSHOT, true)); - } - /** * @param ccfg Cache configuration. * @throws Exception If failed. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverMvccTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverMvccTxSelfTest.java deleted file mode 100644 index f63f836bc6e79..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFailoverMvccTxSelfTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.query.continuous; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.junit.Ignore; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * - */ -public class CacheContinuousQueryAsyncFailoverMvccTxSelfTest extends CacheContinuousQueryFailoverAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Override protected boolean asyncCallback() { - return true; - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7311") - @Test - @Override public void testBackupQueueEvict() throws Exception { - // No-op. - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java index 6dfe55f19d29d..c59a983c3d8ee 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java @@ -42,7 +42,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.tostring.GridToStringInclude; -import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteAsyncCallback; @@ -51,13 +50,11 @@ import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionSerializationException; import org.junit.Test; import static java.util.concurrent.TimeUnit.SECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -115,22 +112,6 @@ public void testNonDeadLockInListenerTxJCacheApi() throws Exception { testNonDeadLockInListener(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL), true, true, true); } - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInListenerMvccTx() throws Exception { - testNonDeadLockInListener(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT), true, true, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInListenerMvccTxJCacheApi() throws Exception { - testNonDeadLockInListener(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT), true, true, true); - } - /** * @throws Exception If failed. */ @@ -211,30 +192,6 @@ public void testNonDeadLockInListenerReplicatedJCacheApi() throws Exception { testNonDeadLockInListener(cacheConfiguration(REPLICATED, 2, TRANSACTIONAL), true, true, true); } - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInListenerMvcc() throws Exception { - testNonDeadLockInListener(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT), true, true, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInListenerReplicatedMvcc() throws Exception { - testNonDeadLockInListener(cacheConfiguration(REPLICATED, 2, TRANSACTIONAL_SNAPSHOT), true, true, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInListenerReplicatedJCacheApiMvcc() throws Exception { - testNonDeadLockInListener(cacheConfiguration(REPLICATED, 2, TRANSACTIONAL_SNAPSHOT), true, true, true); - } - /// /// ASYNC FILTER AND LISTENER. TEST FILTER. /// @@ -255,22 +212,6 @@ public void testNonDeadLockInFilterTxJCacheApi() throws Exception { testNonDeadLockInFilter(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL), true, true, true); } - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInFilterMvccTx() throws Exception { - testNonDeadLockInFilter(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT), true, true, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInFilterMvccTxJCacheApi() throws Exception { - testNonDeadLockInFilter(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT), true, true, true); - } - /** * @throws Exception If failed. */ @@ -327,30 +268,6 @@ public void testNonDeadLockInFilterReplicatedJCacheApi() throws Exception { testNonDeadLockInFilter(cacheConfiguration(REPLICATED, 2, TRANSACTIONAL), true, true, false); } - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInFilterMvcc() throws Exception { - testNonDeadLockInFilter(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT), true, true, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInFilterReplicatedMvcc() throws Exception { - testNonDeadLockInFilter(cacheConfiguration(REPLICATED, 2, TRANSACTIONAL_SNAPSHOT), true, true, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInFilterReplicatedJCacheApiMvcc() throws Exception { - testNonDeadLockInFilter(cacheConfiguration(REPLICATED, 2, TRANSACTIONAL_SNAPSHOT), true, true, false); - } - /// /// ASYNC LISTENER. TEST LISTENER. /// @@ -363,14 +280,6 @@ public void testNonDeadLockInFilterTxSyncFilter() throws Exception { testNonDeadLockInListener(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL), false, true, false); } - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInFilterMvccTxSyncFilter() throws Exception { - testNonDeadLockInListener(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT), false, true, false); - } - /** * @throws Exception If failed. */ @@ -411,22 +320,6 @@ public void testNonDeadLockInFilterReplicatedSyncFilter() throws Exception { testNonDeadLockInListener(cacheConfiguration(REPLICATED, 2, TRANSACTIONAL), false, true, false); } - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInFilterSyncFilterMvcc() throws Exception { - testNonDeadLockInListener(cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT), false, true, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNonDeadLockInFilterReplicatedSyncFilterMvcc() throws Exception { - testNonDeadLockInListener(cacheConfiguration(REPLICATED, 2, TRANSACTIONAL_SNAPSHOT), false, true, false); - } - /** * @param ccfg Cache configuration. * @param asyncFltr Async filter. @@ -491,19 +384,6 @@ else if (val.equals(newVal)) { else if (!val.equals(val0)) return; - // For MVCC mode we need to wait until updated value becomes visible. Usually this is - // several ms to wait - mvcc coordinator need some time to register tx as finished. - if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) { - Object v = null; - - while (v == null && !Thread.currentThread().isInterrupted()) { - v = cache0.get(key); - - if (v == null) - doSleep(50); - } - } - try { assertEquals(val, val0); @@ -518,10 +398,6 @@ else if (!val.equals(val0)) committed = true; } - catch (Exception ex) { - assertTrue(ex.getCause() instanceof TransactionSerializationException); - assertEquals(atomicityMode(cache0), TRANSACTIONAL_SNAPSHOT); - } } } else @@ -675,10 +551,6 @@ else if (!val.equals(val0)) committed = true; } - catch (Exception ex) { - assertTrue(ex.toString(), X.hasCause(ex, TransactionSerializationException.class)); - assertEquals(atomicityMode(cache0), TRANSACTIONAL_SNAPSHOT); - } } } else diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryConcurrentPartitionUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryConcurrentPartitionUpdateTest.java index 888fe417ed8ba..b22beadaff64f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryConcurrentPartitionUpdateTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryConcurrentPartitionUpdateTest.java @@ -23,7 +23,6 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import javax.cache.CacheException; import javax.cache.event.CacheEntryEvent; import javax.cache.event.CacheEntryUpdatedListener; import org.apache.ignite.Ignite; @@ -42,12 +41,10 @@ import org.apache.ignite.testframework.GridTestUtils.SF; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionSerializationException; import org.junit.Test; 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.transactions.TransactionConcurrency.PESSIMISTIC; import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; @@ -79,14 +76,6 @@ public void testConcurrentUpdatePartitionTx() throws Exception { concurrentUpdatePartition(TRANSACTIONAL, false); } - /** - * @throws Exception If failed. - */ - @Test - public void testConcurrentUpdatePartitionMvccTx() throws Exception { - concurrentUpdatePartition(TRANSACTIONAL_SNAPSHOT, false); - } - /** * @throws Exception If failed. */ @@ -103,14 +92,6 @@ public void testConcurrentUpdatePartitionTxCacheGroup() throws Exception { concurrentUpdatePartition(TRANSACTIONAL, true); } - /** - * @throws Exception If failed. - */ - @Test - public void testConcurrentUpdatePartitionMvccTxCacheGroup() throws Exception { - concurrentUpdatePartition(TRANSACTIONAL_SNAPSHOT, true); - } - /** * @param atomicityMode Cache atomicity mode. * @param cacheGrp {@code True} if test cache multiple caches in the same group. @@ -201,10 +182,6 @@ private void concurrentUpdatePartition(CacheAtomicityMode atomicityMode, boolean committed = true; } - catch (CacheException e) { - assertTrue(e.getCause() instanceof TransactionSerializationException); - assertEquals(atomicityMode, TRANSACTIONAL_SNAPSHOT); - } } } } @@ -272,14 +249,6 @@ public void testConcurrentUpdatesAndQueryStartTx() throws Exception { concurrentUpdatesAndQueryStart(TRANSACTIONAL, false); } - /** - * @throws Exception If failed. - */ - @Test - public void testConcurrentUpdatesAndQueryStartMvccTx() throws Exception { - concurrentUpdatesAndQueryStart(TRANSACTIONAL_SNAPSHOT, false); - } - /** * @throws Exception If failed. */ @@ -296,14 +265,6 @@ public void testConcurrentUpdatesAndQueryStartTxCacheGroup() throws Exception { concurrentUpdatesAndQueryStart(TRANSACTIONAL, true); } - /** - * @throws Exception If failed. - */ - @Test - public void testConcurrentUpdatesAndQueryStartMvccTxCacheGroup() throws Exception { - concurrentUpdatesAndQueryStart(TRANSACTIONAL_SNAPSHOT, true); - } - /** * @param atomicityMode Cache atomicity mode. * @param cacheGrp {@code True} if test cache multiple caches in the same group. @@ -393,10 +354,6 @@ private void concurrentUpdatesAndQueryStart(CacheAtomicityMode atomicityMode, bo committed = true; } - catch (CacheException e) { - assertTrue(e.getCause() instanceof TransactionSerializationException); - assertEquals(atomicityMode, TRANSACTIONAL_SNAPSHOT); - } } } } @@ -443,10 +400,6 @@ private void concurrentUpdatesAndQueryStart(CacheAtomicityMode atomicityMode, bo committed = true; } - catch (CacheException e) { - assertTrue(e.getCause() instanceof TransactionSerializationException); - assertEquals(atomicityMode, TRANSACTIONAL_SNAPSHOT); - } } } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java index 50ad61c206ec3..7ddeb00c8d925 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java @@ -45,10 +45,10 @@ import org.apache.ignite.transactions.Transaction; import org.jetbrains.annotations.NotNull; import org.junit.Test; + import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -135,28 +135,6 @@ public void testTransactionPartitionedCache() throws Exception { doTestWithEventsEntries(ccfg); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTransactionReplicatedCache() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(TRANSACTIONAL_SNAPSHOT, REPLICATED); - - doTestWithoutEventsEntries(ccfg); - doTestWithEventsEntries(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTransactionPartitionedCache() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(TRANSACTIONAL_SNAPSHOT, PARTITIONED); - - doTestWithoutEventsEntries(ccfg); - doTestWithEventsEntries(ccfg); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFactoryFilterRandomOperationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFactoryFilterRandomOperationTest.java index 3cedeff364201..f35523de0eb40 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFactoryFilterRandomOperationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFactoryFilterRandomOperationTest.java @@ -64,12 +64,10 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; 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.internal.processors.cache.query.continuous.CacheContinuousQueryFactoryFilterRandomOperationTest.NonSerializableFilter.isAccepted; import static org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryRandomOperationsTest.ContinuousDeploy.CLIENT; import static org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryRandomOperationsTest.ContinuousDeploy.SERVER; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE; @@ -281,11 +279,9 @@ private void randomUpdate( CacheAtomicityMode atomicityMode = atomicityMode(cache); - boolean mvccEnabled = atomicityMode == TRANSACTIONAL_SNAPSHOT; - if (atomicityMode != ATOMIC && rnd.nextBoolean()) { - TransactionConcurrency concurrency = mvccEnabled ? PESSIMISTIC : txRandomConcurrency(rnd); - TransactionIsolation isolation = mvccEnabled ? REPEATABLE_READ : txRandomIsolation(rnd); + TransactionConcurrency concurrency = txRandomConcurrency(rnd); + TransactionIsolation isolation = txRandomIsolation(rnd); tx = ignite.transactions().txStart(concurrency, isolation); } @@ -300,7 +296,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - updatePartitionCounter(cache, key, partCntr, false); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, newVal, oldVal); @@ -315,7 +311,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - updatePartitionCounter(cache, key, partCntr, false); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, newVal, oldVal); @@ -330,8 +326,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - // We don't update part counter if nothing was removed when MVCC enabled. - updatePartitionCounter(cache, key, partCntr, mvccEnabled && !res); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, oldVal, oldVal); @@ -346,8 +341,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - // We don't update part counter if nothing was removed when MVCC enabled. - updatePartitionCounter(cache, key, partCntr, mvccEnabled && res == null); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, oldVal, oldVal); @@ -362,7 +356,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - updatePartitionCounter(cache, key, partCntr, false); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, newVal, oldVal); @@ -379,8 +373,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - // We don't update part counter if nothing was removed when MVCC enabled. - updatePartitionCounter(cache, key, partCntr, mvccEnabled && proc.getOldVal() == null); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, oldVal, oldVal); @@ -396,7 +389,7 @@ private void randomUpdate( tx.commit(); if (oldVal == null) { - updatePartitionCounter(cache, key, partCntr, false); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, newVal, null); @@ -415,7 +408,7 @@ private void randomUpdate( tx.commit(); if (oldVal == null) { - updatePartitionCounter(cache, key, partCntr, false); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, newVal, null); @@ -434,7 +427,7 @@ private void randomUpdate( tx.commit(); if (oldVal != null) { - updatePartitionCounter(cache, key, partCntr, false); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, newVal, oldVal); @@ -453,7 +446,7 @@ private void randomUpdate( tx.commit(); if (oldVal != null) { - updatePartitionCounter(cache, key, partCntr, false); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, newVal, oldVal); @@ -477,7 +470,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - updatePartitionCounter(cache, key, partCntr, false); + updatePartitionCounter(cache, key, partCntr); waitAndCheckEvent(evtsQueues, partCntr, affinity(cache), key, newVal, oldVal); @@ -541,10 +534,8 @@ private TransactionConcurrency txRandomConcurrency(Random rnd) { * @param cache Cache. * @param key Key * @param cntrs Partition counters. - * @param skipUpdCntr Skip update counter flag. */ - private void updatePartitionCounter(IgniteCache cache, Object key, Map cntrs, - boolean skipUpdCntr) { + private void updatePartitionCounter(IgniteCache cache, Object key, Map cntrs) { Affinity aff = cache.unwrap(Ignite.class).affinity(cache.getName()); int part = aff.partition(key); @@ -554,8 +545,7 @@ private void updatePartitionCounter(IgniteCache cache, Object ke if (partCntr == null) partCntr = 0L; - if (!skipUpdCntr) - partCntr++; + partCntr++; cntrs.put(part, partCntr); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java index 96d8df1cbc255..982c78b5573aa 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java @@ -87,7 +87,6 @@ import org.apache.ignite.internal.util.typedef.PAX; import org.apache.ignite.internal.util.typedef.T2; import org.apache.ignite.internal.util.typedef.T3; -import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteAsyncCallback; @@ -103,8 +102,6 @@ import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionRollbackException; -import org.apache.ignite.transactions.TransactionSerializationException; import org.junit.Test; import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -779,14 +776,9 @@ public void testLeftPrimaryAndBackupNodes() throws Exception { boolean updated = false; while (!updated) { - try { - clnCache.put(key, val); + clnCache.put(key, val); - updated = true; - } - catch (Exception ignore) { - assertEquals(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, atomicityMode()); - } + updated = true; } filtered = !filtered; @@ -1759,26 +1751,20 @@ private void failoverStartStopFilter(int backups) throws Exception { boolean updated = false; while (!updated) { - try { - if (processorPut && prevVal != null) { - qryClnCache.invoke(key, new CacheEntryProcessor() { - @Override public Void process(MutableEntry entry, - Object... arguments) throws EntryProcessorException { - entry.setValue(arguments[0]); + if (processorPut && prevVal != null) { + qryClnCache.invoke(key, new CacheEntryProcessor() { + @Override public Void process(MutableEntry entry, + Object... arguments) throws EntryProcessorException { + entry.setValue(arguments[0]); - return null; - } - }, val); - } - else - qryClnCache.put(key, val); - - updated = true; - } - catch (CacheException e) { - assertTrue(X.hasCause(e, TransactionRollbackException.class)); - assertSame(atomicityMode(), CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); + return null; + } + }, val); } + else + qryClnCache.put(key, val); + + updated = true; } processorPut = !processorPut; @@ -2035,15 +2021,9 @@ public void testMultiThreadedFailover() throws Exception { boolean updated = false; while (!updated) { - try { - prevVal = (Integer)qryClnCache.getAndPut(key, val); + prevVal = (Integer)qryClnCache.getAndPut(key, val); - updated = true; - } - catch (CacheException e) { - assertTrue(e.getCause() instanceof TransactionSerializationException); - assertSame(atomicityMode(), CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - } + updated = true; } expEvts.get(threadId).add(new T3<>((Object)key, (Object)val, (Object)prevVal)); @@ -2138,15 +2118,9 @@ public void testMultiThreaded() throws Exception { boolean updated = false; while (!updated) { - try { - cache.put(key, val0); + cache.put(key, val0); - updated = true; - } - catch (CacheException e) { - assertTrue(e.getCause() instanceof TransactionSerializationException); - assertSame(atomicityMode(), CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - } + updated = true; } return null; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxReplicatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxReplicatedSelfTest.java deleted file mode 100644 index d4466c94acbf0..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxReplicatedSelfTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.query.continuous; - -import org.apache.ignite.cache.CacheMode; - -import static org.apache.ignite.cache.CacheMode.REPLICATED; - -/** - * - */ -public class CacheContinuousQueryFailoverMvccTxReplicatedSelfTest extends CacheContinuousQueryFailoverMvccTxSelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return REPLICATED; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxSelfTest.java deleted file mode 100644 index a7c35cfc97b8c..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverMvccTxSelfTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.query.continuous; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.junit.Ignore; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * - */ -public class CacheContinuousQueryFailoverMvccTxSelfTest extends CacheContinuousQueryFailoverAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7311") - @Test - @Override public void testBackupQueueEvict() throws Exception { - // No-op. - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryLostPartitionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryLostPartitionTest.java index d08875e005a66..ff1a419e11e50 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryLostPartitionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryLostPartitionTest.java @@ -36,7 +36,6 @@ import static javax.cache.configuration.FactoryBuilder.factoryOf; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC; @@ -51,9 +50,6 @@ public class CacheContinuousQueryLostPartitionTest extends GridCommonAbstractTes /** Cache name. */ public static final String TX_CACHE_NAME = "tx_test_cache"; - /** Cache name. */ - public static final String MVCC_TX_CACHE_NAME = "mvcc_tx_test_cache"; - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); @@ -80,14 +76,6 @@ public void testTxEvent() throws Exception { testEvent(TX_CACHE_NAME, false); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxEvent() throws Exception { - testEvent(MVCC_TX_CACHE_NAME, false); - } - /** * @throws Exception If failed. */ @@ -104,14 +92,6 @@ public void testTxClientEvent() throws Exception { testEvent(TX_CACHE_NAME, true); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxClientEvent() throws Exception { - testEvent(MVCC_TX_CACHE_NAME, true); - } - /** * @throws Exception If failed. */ @@ -216,7 +196,7 @@ private AllEventListener registerCacheListener(IgniteCache cache(String cacheName) { cfg.setAtomicityMode(ATOMIC); else if (cacheName.equals(TX_CACHE_NAME)) cfg.setAtomicityMode(TRANSACTIONAL); - else - cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); cfg.setRebalanceMode(SYNC); cfg.setWriteSynchronizationMode(PRIMARY_SYNC); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java index a177ec39ce1c1..ca0dde82f68db 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java @@ -56,13 +56,11 @@ import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionSerializationException; import org.jetbrains.annotations.Nullable; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -237,96 +235,6 @@ public void testTxReplicatedPrimary() throws Exception { doTest(ccfg, true); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxTwoBackupsFilter() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT, FULL_SYNC); - - doTest(ccfg, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxTwoBackupsFilterPrimary() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT, PRIMARY_SYNC); - - doTest(ccfg, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxReplicatedFilter() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, 0, TRANSACTIONAL_SNAPSHOT, FULL_SYNC); - - doTest(ccfg, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxTwoBackup() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT, FULL_SYNC); - - doTest(ccfg, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxReplicated() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, 2, TRANSACTIONAL_SNAPSHOT, FULL_SYNC); - - doTest(ccfg, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxReplicatedPrimary() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, 2, TRANSACTIONAL_SNAPSHOT, PRIMARY_SYNC); - - doTest(ccfg, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOneBackupFilter() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 1, TRANSACTIONAL_SNAPSHOT, FULL_SYNC); - - doTest(ccfg, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOneBackupFilterPrimary() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 1, TRANSACTIONAL_SNAPSHOT, PRIMARY_SYNC); - - doTest(ccfg, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOneBackup() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 1, TRANSACTIONAL_SNAPSHOT, FULL_SYNC); - - doTest(ccfg, true); - } - /** * @param ccfg Cache configuration. * @throws Exception If failed. @@ -416,10 +324,6 @@ protected void doTest(final CacheConfiguration ccfg, boolean fromLsnr) throws Ex committed = true; } - catch (Exception e) { - assertTrue(e.getCause() instanceof TransactionSerializationException); - assertEquals(ccfg.getAtomicityMode(), TRANSACTIONAL_SNAPSHOT); - } finally { if (tx != null) tx.close(); @@ -598,11 +502,6 @@ public CacheTestRemoteFilterAsync(String cacheName) { committed = true; } - catch (Exception ex) { - assertTrue(ex.getCause() instanceof TransactionSerializationException); - assertEquals(cache.getConfiguration(CacheConfiguration.class).getAtomicityMode(), - TRANSACTIONAL_SNAPSHOT); - } finally { if (tx != null) tx.close(); @@ -694,11 +593,6 @@ public TestCacheAsyncEventListener(Set> rcvsEvt committed = true; } - catch (Exception ex) { - assertTrue(ex.getCause() instanceof TransactionSerializationException); - assertEquals(cache.getConfiguration(CacheConfiguration.class).getAtomicityMode(), - TRANSACTIONAL_SNAPSHOT); - } finally { if (tx != null) tx.close(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java index 15433f6deebef..e258b434211c0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java @@ -45,7 +45,6 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -194,58 +193,6 @@ public void testTxReplicatedClient() throws Exception { testContinuousQuery(ccfg, true); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTx() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT - ); - - testContinuousQuery(ccfg, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxClient() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT - ); - - testContinuousQuery(ccfg, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxReplicated() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, - 0, - TRANSACTIONAL_SNAPSHOT - ); - - testContinuousQuery(ccfg, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxReplicatedClient() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, - 0, - TRANSACTIONAL_SNAPSHOT - ); - - testContinuousQuery(ccfg, true); - } - /** * @throws Exception If failed. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java index 2a538785ab7a5..c58069386356c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java @@ -29,7 +29,6 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import javax.cache.CacheException; import javax.cache.configuration.FactoryBuilder; import javax.cache.event.CacheEntryEvent; import javax.cache.event.CacheEntryListenerException; @@ -60,12 +59,10 @@ import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionSerializationException; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -162,36 +159,6 @@ public void testTxOnheapWithoutBackupFullSync() throws Exception { doOrderingTest(ccfg, false); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOnheapTwoBackup() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT, FULL_SYNC); - - doOrderingTest(ccfg, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOnheapWithoutBackup() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 0, TRANSACTIONAL_SNAPSHOT, PRIMARY_SYNC); - - doOrderingTest(ccfg, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOnheapWithoutBackupFullSync() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 0, TRANSACTIONAL_SNAPSHOT, FULL_SYNC); - - doOrderingTest(ccfg, false); - } - /** * @throws Exception If failed. */ @@ -284,36 +251,6 @@ public void testTxOnheapAsyncFullSync() throws Exception { doOrderingTest(ccfg, true); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOnheapTwoBackupAsync() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 2, TRANSACTIONAL_SNAPSHOT, PRIMARY_SYNC); - - doOrderingTest(ccfg, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOnheapAsync() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 0, TRANSACTIONAL_SNAPSHOT, PRIMARY_SYNC); - - doOrderingTest(ccfg, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOnheapAsyncFullSync() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 0, TRANSACTIONAL_SNAPSHOT, FULL_SYNC); - - doOrderingTest(ccfg, true); - } - /** * @param ccfg Cache configuration. * @param async Async filter. @@ -421,10 +358,6 @@ protected void doOrderingTest( committed = true; } - catch (CacheException e) { - assertTrue(e.getCause() instanceof TransactionSerializationException); - assertEquals(atomicityMode(cache), TRANSACTIONAL_SNAPSHOT); - } finally { if (tx != null) tx.close(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java index 2b7e54f40a4a3..208f73d199f73 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java @@ -74,7 +74,6 @@ import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Ignore; import org.junit.Test; import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -84,7 +83,6 @@ import static javax.cache.event.EventType.UPDATED; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -331,45 +329,6 @@ public void testTxExplicit() throws Exception { doTestContinuousQuery(ccfg, SERVER); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTx() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, SERVER); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxAllNodes() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, ALL); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxExplicit() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, SERVER); - } - /** * @throws Exception If failed. */ @@ -474,60 +433,6 @@ public void testDoubleRemoveReplicatedTxWithStore() throws Exception { doTestNotModifyOperation(ccfg); } - /** - * @throws Exception If failed. - */ - @Test - public void testDoubleRemoveMvccTx() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestNotModifyOperation(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testDoubleRemoveMvccTxWithStore() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT, - true); - - doTestNotModifyOperation(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testDoubleRemoveReplicatedMvccTx() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, - 0, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestNotModifyOperation(ccfg); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - public void testDoubleRemoveReplicatedMvccTxWithStore() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, - 0, - TRANSACTIONAL_SNAPSHOT, - true); - - doTestNotModifyOperation(ccfg); - } - /** * @throws Exception If failed. */ @@ -942,110 +847,6 @@ public void testTxNoBackupsClient() throws Exception { doTestContinuousQuery(ccfg, CLIENT); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxClient() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, CLIENT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxClientExplicit() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 1, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, CLIENT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxReplicated() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, - 0, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, SERVER); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxReplicatedClient() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(REPLICATED, - 0, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, CLIENT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxNoBackups() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 0, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, SERVER); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxNoBackupsAllNodes() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 0, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, ALL); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxNoBackupsExplicit() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 0, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, SERVER); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxNoBackupsClient() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, - 0, - TRANSACTIONAL_SNAPSHOT, - false); - - doTestContinuousQuery(ccfg, CLIENT); - } - /** * @param ccfg Cache configuration. * @param deploy The place where continuous query will be started. @@ -1212,11 +1013,9 @@ private void randomUpdate( CacheAtomicityMode atomicityMode = atomicityMode(cache); - boolean mvccEnabled = atomicityMode == TRANSACTIONAL_SNAPSHOT; - if (atomicityMode != ATOMIC && rnd.nextBoolean()) { - TransactionConcurrency concurrency = mvccEnabled ? PESSIMISTIC : txRandomConcurrency(rnd); - TransactionIsolation isolation = mvccEnabled ? REPEATABLE_READ : txRandomIsolation(rnd); + TransactionConcurrency concurrency = txRandomConcurrency(rnd); + TransactionIsolation isolation = txRandomIsolation(rnd); tx = ignite.transactions().txStart(concurrency, isolation); } @@ -1231,7 +1030,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, false); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, newVal, oldVal); @@ -1246,7 +1045,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, false); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, newVal, oldVal); @@ -1261,8 +1060,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - // We don't update part counter if nothing was removed when MVCC enabled. - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, mvccEnabled && !res); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, oldVal, oldVal); @@ -1277,8 +1075,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - // We don't update part counter if nothing was removed when MVCC enabled. - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, mvccEnabled && res == null); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, oldVal, oldVal); @@ -1293,7 +1090,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, false); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, newVal, oldVal); @@ -1310,8 +1107,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - // We don't update part counter if nothing was removed when MVCC enabled. - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, mvccEnabled && proc.getOldVal() == null); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, oldVal, oldVal); @@ -1327,7 +1123,7 @@ private void randomUpdate( tx.commit(); if (oldVal == null) { - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, false); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, newVal, null); @@ -1346,7 +1142,7 @@ private void randomUpdate( tx.commit(); if (oldVal == null) { - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, false); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, newVal, null); @@ -1365,7 +1161,7 @@ private void randomUpdate( tx.commit(); if (oldVal != null) { - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, false); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, newVal, oldVal); @@ -1384,7 +1180,7 @@ private void randomUpdate( tx.commit(); if (oldVal != null) { - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, false); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, newVal, oldVal); @@ -1408,7 +1204,7 @@ private void randomUpdate( if (tx != null) tx.commit(); - updatePartitionCounter(cache, key, partCntr, expEvtCntrs, false); + updatePartitionCounter(cache, key, partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), key, newVal, oldVal); @@ -1447,7 +1243,7 @@ private void randomUpdate( tx.commit(); for (Map.Entry e : vals.entrySet()) - updatePartitionCounter(cache, e.getKey(), partCntr, expEvtCntrs, false); + updatePartitionCounter(cache, e.getKey(), partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), vals, expData); @@ -1468,7 +1264,7 @@ private void randomUpdate( tx.commit(); for (Map.Entry e : vals.entrySet()) - updatePartitionCounter(cache, e.getKey(), partCntr, expEvtCntrs, false); + updatePartitionCounter(cache, e.getKey(), partCntr, expEvtCntrs); waitAndCheckEvent(evtsQueues, partCntr, expEvtCntrs, affinity(cache), vals, expData); @@ -1574,10 +1370,9 @@ private TransactionConcurrency txRandomConcurrency(Random rnd) { * @param key Key * @param cntrs Partition counters. * @param evtCntrs Event counters. - * @param skipUpdCntr Skip update counter flag. */ private void updatePartitionCounter(IgniteCache cache, Object key, Map cntrs, - Map evtCntrs, boolean skipUpdCntr) { + Map evtCntrs) { Affinity aff = cache.unwrap(Ignite.class).affinity(cache.getName()); int part = aff.partition(key); @@ -1587,8 +1382,7 @@ private void updatePartitionCounter(IgniteCache cache, Object ke if (partCntr == null) partCntr = 0L; - if (!skipUpdCntr) - partCntr++; + partCntr++; cntrs.put(part, partCntr); evtCntrs.put(key, partCntr); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheEntryProcessorExternalizableFailedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheEntryProcessorExternalizableFailedTest.java index 3b020b8f5c304..75f997073a32b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheEntryProcessorExternalizableFailedTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheEntryProcessorExternalizableFailedTest.java @@ -40,11 +40,9 @@ import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.jetbrains.annotations.NotNull; -import org.junit.Ignore; import org.junit.Test; 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.transactions.TransactionConcurrency.OPTIMISTIC; @@ -467,126 +465,6 @@ public void testPessimisticFullSyncWithNearCache() throws Exception { doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccPessimisticOnePhaseCommit() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PRIMARY_SYNC, 1).setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - - failOnWrite = true; - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccPessimisticOnePhaseCommitWithNearCache() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PRIMARY_SYNC, 1).setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setNearConfiguration(new NearCacheConfiguration<>()); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - - failOnWrite = true; - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccPessimisticOnePhaseCommitFullSync() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(FULL_SYNC, 1).setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - - failOnWrite = true; - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccPessimisticOnePhaseCommitFullSyncWithNearCache() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(FULL_SYNC, 1).setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setNearConfiguration(new NearCacheConfiguration<>()); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - - failOnWrite = true; - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccPessimistic() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PRIMARY_SYNC, 2).setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - - failOnWrite = true; - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccPessimisticWithNearCache() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PRIMARY_SYNC, 2).setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setNearConfiguration(new NearCacheConfiguration<>()); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - - failOnWrite = true; - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMvccPessimisticFullSync() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(FULL_SYNC, 2).setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - - failOnWrite = true; - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccPessimisticFullSyncWithNearCache() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(FULL_SYNC, 2).setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setNearConfiguration(new NearCacheConfiguration<>()); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - - failOnWrite = true; - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - /** * @param ccfg Cache configuration. * @throws Exception If failed. @@ -610,10 +488,7 @@ private void doTestInvokeTest(CacheConfiguration ccfg, TransactionConcurrency tx try { // Explicit tx. for (int i = 0; i < ITERATION_CNT; i++) { - if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) - checkExplicitMvccInvoke(cln, clnCache, txConcurrency, txIsolation); - else - checkExplicitTxInvoke(cln, clnCache, txConcurrency, txIsolation); + checkExplicitTxInvoke(cln, clnCache, txConcurrency, txIsolation); assertNull(cln.transactions().tx()); @@ -627,10 +502,7 @@ private void doTestInvokeTest(CacheConfiguration ccfg, TransactionConcurrency tx // Explicit tx. for (int i = 0; i < ITERATION_CNT; i++) { - if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) - checkExplicitMvccInvoke(cln, clnCache, txConcurrency, txIsolation); - else - checkExplicitTxInvoke(cln, clnCache, txConcurrency, txIsolation); + checkExplicitTxInvoke(cln, clnCache, txConcurrency, txIsolation); assertNull(cln.transactions().tx()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheEntryProcessorNonSerializableTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheEntryProcessorNonSerializableTest.java index 1302122574ca9..277172c8b95ef 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheEntryProcessorNonSerializableTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheEntryProcessorNonSerializableTest.java @@ -33,16 +33,13 @@ import org.apache.ignite.marshaller.jdk.JdkMarshaller; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Ignore; import org.junit.Test; 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.transactions.TransactionConcurrency.OPTIMISTIC; @@ -214,91 +211,6 @@ public void testPessimisticFullSyncWithNearCache() throws Exception { doTestInvokeTest(ccfg, PESSIMISTIC, SERIALIZABLE); } - /** - */ - @Test - public void testMvccPessimisticOnePhaseCommit() { - CacheConfiguration ccfg = cacheConfiguration(PRIMARY_SYNC, 1).setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccPessimisticOnePhaseCommitWithNearCache() { - CacheConfiguration ccfg = cacheConfiguration(PRIMARY_SYNC, 1).setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setNearConfiguration(new NearCacheConfiguration<>()); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - */ - @Test - public void testMvccPessimisticOnePhaseCommitFullSync() { - CacheConfiguration ccfg = cacheConfiguration(FULL_SYNC, 1).setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccPessimisticOnePhaseCommitFullSyncWithNearCache() { - CacheConfiguration ccfg = cacheConfiguration(FULL_SYNC, 1).setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setNearConfiguration(new NearCacheConfiguration<>()); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - */ - @Test - public void testMvccPessimistic() { - CacheConfiguration ccfg = cacheConfiguration(PRIMARY_SYNC, 2).setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccPessimisticWithNearCache() { - CacheConfiguration ccfg = cacheConfiguration(PRIMARY_SYNC, 2).setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setNearConfiguration(new NearCacheConfiguration<>()); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - */ - @Test - public void testMvccPessimisticFullSync() { - CacheConfiguration ccfg = cacheConfiguration(FULL_SYNC, 2).setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - public void testMvccPessimisticFullSyncWithNearCache() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(FULL_SYNC, 2).setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setNearConfiguration(new NearCacheConfiguration<>()); - - doTestInvokeTest(ccfg, PESSIMISTIC, READ_COMMITTED); - - doTestInvokeTest(ccfg, PESSIMISTIC, REPEATABLE_READ); - - doTestInvokeTest(ccfg, PESSIMISTIC, SERIALIZABLE); - } - /** * @throws Exception If failed. */ @@ -420,9 +332,6 @@ public void testOptimisticFullSyncWithNearCache() throws Exception { @SuppressWarnings({"unchecked", "ThrowableNotThrown"}) private void doTestInvokeTest(CacheConfiguration ccfg, TransactionConcurrency txConcurrency, TransactionIsolation txIsolation) { - if (ccfg.getNearConfiguration() != null) - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - IgniteEx cln = grid(getServerNodeCount()); grid(0).createCache(ccfg); @@ -441,10 +350,7 @@ private void doTestInvokeTest(CacheConfiguration ccfg, TransactionConcurrency tx try { // Explicit tx. for (int i = 0; i < ITERATION_CNT; i++) { - if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) - checkMvccInvoke(cln, clnCache, txConcurrency, txIsolation); - else - checkTxInvoke(cln, clnCache, txConcurrency, txIsolation); + checkTxInvoke(cln, clnCache, txConcurrency, txIsolation); assertEquals(EXPECTED_VALUE, clnCache.get(KEY)); } @@ -456,10 +362,7 @@ private void doTestInvokeTest(CacheConfiguration ccfg, TransactionConcurrency tx // Explicit tx. for (int i = 0; i < ITERATION_CNT; i++) { - if (ccfg.getAtomicityMode() == TRANSACTIONAL_SNAPSHOT) - checkMvccInvoke(grid, cache, txConcurrency, txIsolation); - else - checkTxInvoke(grid, cache, txConcurrency, txIsolation); + checkTxInvoke(grid, cache, txConcurrency, txIsolation); assertEquals(EXPECTED_VALUE, cache.get(KEY)); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationNearEnabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationNearEnabledTest.java index 46ff2f3b166b0..a9116f5673fba 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationNearEnabledTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationNearEnabledTest.java @@ -21,8 +21,6 @@ import org.apache.ignite.cache.CacheMode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.NearCacheConfiguration; -import org.junit.Ignore; -import org.junit.Test; /** * @@ -40,18 +38,4 @@ public class CacheKeepBinaryIterationNearEnabledTest extends CacheKeepBinaryIter return ccfg; } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - @Override public void testMvccTxOnHeap() throws Exception { - // No-op. - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7187") - @Test - @Override public void testMvccTxOnHeapLocalEntries() throws Exception { - // No-op. - } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationStoreEnabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationStoreEnabledTest.java index 13da09b99ff87..f98229deeb02d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationStoreEnabledTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationStoreEnabledTest.java @@ -24,8 +24,6 @@ import org.apache.ignite.cache.CacheWriteSynchronizationMode; import org.apache.ignite.cache.store.CacheStoreAdapter; import org.apache.ignite.configuration.CacheConfiguration; -import org.junit.Ignore; -import org.junit.Test; /** * @@ -52,20 +50,6 @@ public class CacheKeepBinaryIterationStoreEnabledTest extends CacheKeepBinaryIte return ccfg; } - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - @Override public void testMvccTxOnHeap() throws Exception { - // No-op - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - @Override public void testMvccTxOnHeapLocalEntries() throws Exception { - // No-op - } - /** * */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java index 9acaf878f7947..b5d379f7da483 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java @@ -36,7 +36,6 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; @@ -92,19 +91,6 @@ public void testTxOnHeap() throws Exception { doTestScanQuery(ccfg, false, false); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOnHeap() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 1, TRANSACTIONAL_SNAPSHOT); - - doTestScanQuery(ccfg, true, true); - doTestScanQuery(ccfg, true, false); - doTestScanQuery(ccfg, false, true); - doTestScanQuery(ccfg, false, false); - } - /** * @throws Exception If failed. */ @@ -131,19 +117,6 @@ public void testTxOnHeapLocalEntries() throws Exception { doTestLocalEntries(ccfg, false, false); } - /** - * @throws Exception If failed. - */ - @Test - public void testMvccTxOnHeapLocalEntries() throws Exception { - CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, 1, TRANSACTIONAL_SNAPSHOT); - - doTestLocalEntries(ccfg, true, true); - doTestLocalEntries(ccfg, true, false); - doTestLocalEntries(ccfg, false, true); - doTestLocalEntries(ccfg, false, false); - } - /** * @param ccfg Cache configuration. */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java index 6a77431701ef5..079869e812a3e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java @@ -79,11 +79,6 @@ public class ClientReconnectContinuousQueryTest extends GridCommonAbstractTest { CacheConfiguration ccfg = defaultCacheConfiguration(); ccfg.setAtomicityMode(atomicityMode()); - - // TODO IGNITE-9530 Remove this clause. - if (atomicityMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - ccfg.setNearConfiguration(null); - cfg.setCacheConfiguration(ccfg); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java index 0fa0540cba060..f54e7396362c1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java @@ -75,11 +75,11 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; import org.junit.Test; + import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheRebalanceMode.ASYNC; @@ -118,15 +118,9 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo cacheCfg.setRebalanceMode(ASYNC); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); cacheCfg.setNearConfiguration(nearConfiguration()); - - if (atomicityMode() != TRANSACTIONAL_SNAPSHOT) { - cacheCfg.setCacheStoreFactory(new StoreFactory()); // TODO IGNITE-8582 enable for tx snapshot. - cacheCfg.setReadThrough(true); // TODO IGNITE-8582 enable for tx snapshot. - cacheCfg.setWriteThrough(true); // TODO IGNITE-8582 enable for tx snapshot. - } - else - cacheCfg.setIndexedTypes(Integer.class, Integer.class); - + cacheCfg.setCacheStoreFactory(new StoreFactory()); + cacheCfg.setReadThrough(true); + cacheCfg.setWriteThrough(true); cfg.setCacheConfiguration(cacheCfg); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java index b63d6be84d261..4e7ed1324dc77 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java @@ -40,7 +40,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; import org.apache.ignite.internal.util.future.GridFutureAdapter; import org.apache.ignite.internal.util.future.IgniteFinishedFutureImpl; import org.apache.ignite.internal.util.future.IgniteFutureImpl; @@ -98,14 +97,6 @@ public void testReplicatedTx() throws Exception { testRegistration(cacheConfiguration(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL, 1)); } - /** - * @throws Exception If failed. - */ - @Test - public void testReplicatedMvccTx() throws Exception { - testRegistration(cacheConfiguration(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, 1)); - } - /** * @throws Exception If failed. */ @@ -130,14 +121,6 @@ public void testRestartPartitionTx() throws Exception { testRestartRegistration(cacheConfiguration(CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL, 2)); } - /** - * @throws Exception If failed. - */ - @Test - public void testRestartPartitionMvccTx() throws Exception { - testRestartRegistration(cacheConfiguration(CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, 2)); - } - /** * @throws Exception If failed. */ @@ -154,14 +137,6 @@ public void testPartitionTx() throws Exception { testRegistration(cacheConfiguration(CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL, 2)); } - /** - * @throws Exception If failed. - */ - @Test - public void testPartitionMvccTx() throws Exception { - testRegistration(cacheConfiguration(CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, 2)); - } - /** * @throws Exception If failed. */ @@ -367,44 +342,17 @@ private IgniteFuture waitForKey(Integer key, final IgniteCache>() { - @Override public void apply(IgniteFuture f) { - String val = f.get(); + cache.getAsync(key).listen(new IgniteInClosure>() { + @Override public void apply(IgniteFuture f) { + String val = f.get(); - if (val != null) { - log.info("Completed by get: " + id); + if (val != null) { + log.info("Completed by get: " + id); - (((GridFutureAdapter)((IgniteFutureImpl)promise).internalFuture())).onDone("by async get"); - } - } - }); - } - else { - // For MVCC caches we need to wait until updated value becomes visible for consequent readers. - // When MVCC transaction completes, it's updates are not visible immediately for the new transactions. - // This is caused by the lag between transaction completes on the node and mvcc coordinator - // removes this transaction from the active list. - GridTestUtils.runAsync(new Runnable() { - @Override public void run() { - String v; - - while (!Thread.currentThread().isInterrupted()) { - v = cache.get(key); - - if (v == null) - doSleep(100); - else { - log.info("Completed by async mvcc get: " + id); - - (((GridFutureAdapter)((IgniteFutureImpl)promise).internalFuture())).onDone("by get"); - - break; - } - } + (((GridFutureAdapter)((IgniteFutureImpl)promise).internalFuture())).onDone("by async get"); } - }); - } + } + }); return promise; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedTxOneNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedTxOneNodeTest.java index 9d5ea1a444ece..7588e9d0cdaf9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedTxOneNodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedTxOneNodeTest.java @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.cache.query.continuous; -import java.util.Iterator; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -50,10 +49,6 @@ public class GridCacheContinuousQueryReplicatedTxOneNodeTest extends GridCommonA cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC); cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); - // TODO IGNITE-9530 Remove this clause. - if (atomicMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - cacheCfg.setNearConfiguration(null); - cfg.setCacheConfiguration(cacheCfg); return cfg; @@ -161,14 +156,7 @@ private void doTestOneNode(boolean loc) throws Exception { for (int i = 0; i < 10; i++) cache.put("key" + i, i); - if (atomicMode() != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - cache.clear(); - else { // TODO IGNITE-7952. Remove "else" clause - do cache.clear() instead of iteration. - for (Iterator it = cache.iterator(); it.hasNext();) { - it.next(); - it.remove(); - } - } + cache.clear(); qry.setLocalListener(new CacheEntryUpdatedListener() { @Override public void onUpdated(Iterable> evts) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java index c14b9a9a54715..b68de89d62fc3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreAbstractTest.java @@ -34,11 +34,9 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.jetbrains.annotations.Nullable; -import org.junit.Before; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -62,12 +60,6 @@ protected GridCacheWriteBehindStoreAbstractTest() { super(true /*start grid. */); } - /** */ - @Before - public void beforeGridCacheWriteBehindStoreAbstractTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { store.resetTimestamp(); @@ -89,8 +81,6 @@ public void beforeGridCacheWriteBehindStoreAbstractTest() { /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - IgniteConfiguration c = super.getConfiguration(); TcpDiscoverySpi disco = new TcpDiscoverySpi(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java index 0658ac503f043..fb36232c006a3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java @@ -32,7 +32,6 @@ import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.processors.cache.GridCacheTestStore; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.junit.Test; @@ -82,11 +81,6 @@ public class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest extends GridC return c; } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { stores = null; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAbstractTest.java index df62339ebfb03..411b5682a074f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAbstractTest.java @@ -28,20 +28,12 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractTest; import org.apache.ignite.internal.util.lang.GridAbsPredicate; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Before; import org.junit.Test; /** * Tests that write behind store is updated if client does not have store. */ public abstract class IgnteCacheClientWriteBehindStoreAbstractTest extends IgniteCacheAbstractTest { - /** */ - @Before - public void beforeCacheStoreListenerRWThroughDisabledTransactionalCacheTest() { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return 3; @@ -59,8 +51,6 @@ public void beforeCacheStoreListenerRWThroughDisabledTransactionalCacheTest() { /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName); ccfg.setWriteBehindEnabled(true); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java index a7c38bb2b926c..a212a567cb7ac 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java @@ -35,8 +35,6 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.util.PageHandler; import org.apache.ignite.internal.processors.cache.tree.SearchRow; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.OWNING; @@ -48,13 +46,6 @@ public class TransactionIntegrityWithPrimaryIndexCorruptionTest extends Abstract /** Corruption enabled flag. */ private static volatile boolean corruptionEnabled; - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10470", MvccFeatureChecker.forcedMvcc()); - - super.beforeTest(); - } - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { corruptionEnabled = false; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOnCachesStopTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOnCachesStopTest.java index 4827025447798..0d60f10aec9fd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOnCachesStopTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOnCachesStopTest.java @@ -52,13 +52,11 @@ import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgniteFutureTimeoutException; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.apache.ignite.transactions.TransactionRollbackException; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; @@ -200,8 +198,6 @@ public void testTxOnCacheStopInMid() throws Exception { */ @Test public void testOptimisticTxMappedOnPMETopology() throws Exception { - Assume.assumeFalse(MvccFeatureChecker.forcedMvcc()); - startGridsMultiThreaded(1); Ignite client = startClientGrid("client"); @@ -264,9 +260,6 @@ private void runTxOnCacheStop( Ignite ig, boolean runConc ) throws Exception { - if ((conc == TransactionConcurrency.OPTIMISTIC) && (MvccFeatureChecker.forcedMvcc())) - return; - if (log.isInfoEnabled()) { log.info("Starting runTxOnCacheStop " + "[concurrency=" + conc + ", isolation=" + iso + ", blockPrepareRequests=" + !runConc + ']'); @@ -343,8 +336,6 @@ private void runTxOnCacheStop( */ @Test public void testOptimisticTransactionsOnCacheDestroy() throws Exception { - Assume.assumeFalse(MvccFeatureChecker.forcedMvcc()); - startGridsMultiThreaded(3); ArrayList clients = new ArrayList<>(); @@ -515,9 +506,6 @@ private IgniteInternalFuture startTxLoad( * @throws Exception If failed. */ private void runCacheStopInMidTx(TransactionConcurrency conc, TransactionIsolation iso, Ignite ig) throws Exception { - if ((conc == TransactionConcurrency.OPTIMISTIC) && (MvccFeatureChecker.forcedMvcc())) - return; - if (log.isInfoEnabled()) log.info("Starting runCacheStopInMidTx [concurrency=" + conc + ", isolation=" + iso + ']'); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java index 99fd542945f80..5caa1a06325b8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncNearCacheTest.java @@ -17,8 +17,6 @@ package org.apache.ignite.internal.processors.cache.transactions; -import org.apache.ignite.testframework.MvccFeatureChecker; - /** * Tests an ability to async rollback near transactions. */ @@ -27,11 +25,4 @@ public class TxRollbackAsyncNearCacheTest extends TxRollbackAsyncTest { @Override protected boolean nearCacheEnabled() { return true; } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - - super.beforeTest(); - } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java index c48ad21db9b42..6c68ed4bac809 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackAsyncTest.java @@ -61,7 +61,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxEnlistRequest; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishRequest; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; import org.apache.ignite.internal.util.future.GridFutureAdapter; @@ -79,13 +78,11 @@ import org.apache.ignite.lang.IgniteUuid; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.apache.ignite.transactions.TransactionRollbackException; -import org.junit.Assume; import org.junit.Test; import static java.lang.Thread.interrupted; @@ -204,8 +201,6 @@ private Ignite startClient() throws Exception { */ @Test public void testRollbackSimple() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7952", MvccFeatureChecker.forcedMvcc()); - startClient(); for (Ignite ignite : G.allGrids()) { @@ -476,8 +471,6 @@ public void testEnlistManyWrite() throws Exception { */ @Test public void testEnlistManyReadOptimistic() throws Exception { - Assume.assumeFalse(MvccFeatureChecker.forcedMvcc()); // Optimistic transactions are not supported by MVCC. - testEnlistMany(false, SERIALIZABLE, OPTIMISTIC); } @@ -486,8 +479,6 @@ public void testEnlistManyReadOptimistic() throws Exception { */ @Test public void testEnlistManyWriteOptimistic() throws Exception { - Assume.assumeFalse(MvccFeatureChecker.forcedMvcc()); // Optimistic transactions are not supported by MVCC. - testEnlistMany(true, SERIALIZABLE, OPTIMISTIC); } @@ -539,9 +530,7 @@ public void testRollbackDelayNearLockRequest() throws Exception { final TestRecordingCommunicationSpi spi = (TestRecordingCommunicationSpi)client.configuration().getCommunicationSpi(); - boolean mvcc = MvccFeatureChecker.forcedMvcc(); - - Class msgCls = mvcc ? GridNearTxEnlistRequest.class : GridNearLockRequest.class; + Class msgCls = GridNearLockRequest.class; spi.blockMessages(msgCls, prim.name()); @@ -668,8 +657,6 @@ public void testMixedAsyncRollbackTypes() throws Exception { for (Ignite ignite : G.allGrids()) perNodeTxs.put(ignite, new ArrayBlockingQueue<>(1000)); - boolean mvcc = MvccFeatureChecker.forcedMvcc(); - IgniteInternalFuture txFut = multithreadedAsync(() -> { while (!stop.get()) { int nodeId = r.nextInt(GRID_CNT + 1); @@ -677,8 +664,8 @@ public void testMixedAsyncRollbackTypes() throws Exception { // Choose random node to start tx on. Ignite node = nodeId == GRID_CNT || nearCacheEnabled() ? client : grid(nodeId); - TransactionConcurrency conc = mvcc ? PESSIMISTIC : TC_VALS[r.nextInt(TC_VALS.length)]; - TransactionIsolation isolation = mvcc ? REPEATABLE_READ : TI_VALS[r.nextInt(TI_VALS.length)]; + TransactionConcurrency conc = TC_VALS[r.nextInt(TC_VALS.length)]; + TransactionIsolation isolation = TI_VALS[r.nextInt(TI_VALS.length)]; // Timeout is necessary otherwise deadlock is possible due to randomness of lock acquisition. long timeout = r.nextInt(50) + 50; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java index 2404c94bfc98a..9b38667e4c41b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java @@ -30,10 +30,8 @@ import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionAlreadyCompletedException; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.apache.ignite.transactions.TransactionRollbackException; @@ -86,10 +84,7 @@ public void testTimeoutSetLocalGuarantee() throws Exception { fail("Should fail prior this line."); } catch (CacheException ex) { - if (MvccFeatureChecker.forcedMvcc()) - assertTrue(ex.toString(), ex.getCause() instanceof TransactionAlreadyCompletedException); - else - assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); + assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); } try (Transaction tx = ignite.transactions().txStart()) { @@ -100,10 +95,7 @@ public void testTimeoutSetLocalGuarantee() throws Exception { fail("Should fail prior this line."); } catch (CacheException ex) { - if (MvccFeatureChecker.forcedMvcc()) - assertTrue(ex.toString(), ex.getCause() instanceof TransactionAlreadyCompletedException); - else - assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); + assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); } } @@ -143,10 +135,7 @@ public void testLabelFilledLocalGuarantee() throws Exception { fail("Should fail prior this line."); } catch (CacheException ex) { - if (MvccFeatureChecker.forcedMvcc()) - assertTrue(ex.toString(), ex.getCause() instanceof TransactionAlreadyCompletedException); - else - assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); + assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); } } @@ -196,10 +185,7 @@ public void testLabelFilledRemoteGuarantee() throws Exception { fail("Should fail prior this line."); } catch (CacheException ex) { - if (MvccFeatureChecker.forcedMvcc()) - assertTrue(ex.toString(), ex.getCause() instanceof TransactionAlreadyCompletedException); - else - assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); + assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); } try (Transaction tx = remote.transactions().txStart()) { @@ -210,10 +196,7 @@ public void testLabelFilledRemoteGuarantee() throws Exception { fail("Should fail prior this line."); } catch (CacheException ex) { - if (MvccFeatureChecker.forcedMvcc()) - assertTrue(ex.toString(), ex.getCause() instanceof TransactionAlreadyCompletedException); - else - assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); + assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); } } @@ -265,10 +248,7 @@ public void testTimeoutSetRemoteGuarantee() throws Exception { fail("Should fail prior this line."); } catch (CacheException ex) { - if (MvccFeatureChecker.forcedMvcc()) - assertTrue(ex.toString(), ex.getCause() instanceof TransactionAlreadyCompletedException); - else - assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); + assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); } try (Transaction tx = remote.transactions().txStart()) { @@ -279,10 +259,7 @@ public void testTimeoutSetRemoteGuarantee() throws Exception { fail("Should fail prior this line."); } catch (CacheException ex) { - if (MvccFeatureChecker.forcedMvcc()) - assertTrue(ex.toString(), ex.getCause() instanceof TransactionAlreadyCompletedException); - else - assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); + assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); } } @@ -335,10 +312,7 @@ public void testRollbackInsideLocalListenerAfterRemoteFilter() throws Exception fail("Should fail prior this line."); } catch (CacheException ex) { - if (MvccFeatureChecker.forcedMvcc()) - assertTrue(ex.toString(), ex.getCause() instanceof TransactionAlreadyCompletedException); - else - assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); + assertTrue(ex.toString(), ex.getCause() instanceof TransactionRollbackException); } assertFalse(rollbackFailed.get()); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java index e39ba2637827f..aa7c09102019e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java @@ -58,14 +58,12 @@ import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionDeadlockException; import org.apache.ignite.transactions.TransactionIsolation; import org.apache.ignite.transactions.TransactionTimeoutException; -import org.junit.Assume; import org.junit.Test; import static java.lang.Thread.sleep; @@ -128,8 +126,6 @@ protected boolean nearCacheEnabled() { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7388", MvccFeatureChecker.forcedMvcc()); - super.beforeTest(); startGridsMultiThreaded(GRID_CNT); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTopologyChangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTopologyChangeTest.java index c43a2a7b81088..eb82374c32ec0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTopologyChangeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTopologyChangeTest.java @@ -32,10 +32,8 @@ import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.TestRecordingCommunicationSpi; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; -import org.junit.Assume; import org.junit.Test; import static java.lang.Thread.yield; @@ -88,9 +86,6 @@ public class TxRollbackOnTopologyChangeTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-9322", MvccFeatureChecker.forcedMvcc()); - //Won't start nodes if the only test mutes. - super.beforeTest(); startGridsMultiThreaded(SRV_CNT); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxStateChangeEventTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxStateChangeEventTest.java index e8eae496b494d..bc88771504d43 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxStateChangeEventTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxStateChangeEventTest.java @@ -30,7 +30,6 @@ import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.GridAbstractTest; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; @@ -125,8 +124,7 @@ private void check(boolean loc) throws Exception { checkCommit(txs, cache); - if (!MvccFeatureChecker.forcedMvcc()) - checkSuspendResume(txs, cache); + checkSuspendResume(txs, cache); checkRollback(txs, cache); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithKeyContentionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithKeyContentionSelfTest.java index ef2d4211c08ea..fcd6516e196ec 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithKeyContentionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithKeyContentionSelfTest.java @@ -44,7 +44,6 @@ import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.WithSystemProperty; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; @@ -218,9 +217,6 @@ public void testOptimisticRepeatableReadCheckContentionTxMetricNear() throws Exc * @throws Exception If failed. */ private void runKeyCollisionsMetric(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception { - if (MvccFeatureChecker.forcedMvcc()) - return; // Not supported. - Ignite ig = startGridsMultiThreaded(3); int contCnt = (int)U.staticField(IgniteTxManager.class, "COLLISIONS_QUEUE_THRESHOLD") * 5; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithSmallTimeoutAndContentionOneKeyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithSmallTimeoutAndContentionOneKeyTest.java index 236ec0eb2e8f8..29a1ef76ff210 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithSmallTimeoutAndContentionOneKeyTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxWithSmallTimeoutAndContentionOneKeyTest.java @@ -38,12 +38,10 @@ import org.apache.ignite.internal.management.cache.PartitionKeyV2; import org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2; import org.apache.ignite.internal.util.typedef.internal.SB; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.testframework.GridTestUtils.runAsync; @@ -108,9 +106,6 @@ public class TxWithSmallTimeoutAndContentionOneKeyTest extends GridCommonAbstrac * @return Random transaction type. */ protected TransactionConcurrency transactionConcurrency() { - if (MvccFeatureChecker.forcedMvcc()) - return PESSIMISTIC; - ThreadLocalRandom random = ThreadLocalRandom.current(); return random.nextBoolean() ? OPTIMISTIC : PESSIMISTIC; @@ -120,9 +115,6 @@ protected TransactionConcurrency transactionConcurrency() { * @return Random transaction isolation level. */ protected TransactionIsolation transactionIsolation() { - if (MvccFeatureChecker.forcedMvcc()) - return REPEATABLE_READ; - ThreadLocalRandom random = ThreadLocalRandom.current(); switch (random.nextInt(3)) { @@ -153,8 +145,6 @@ protected long randomTimeOut() { */ @Test public void test() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10455", MvccFeatureChecker.forcedMvcc()); - startGrids(4); IgniteEx igClient = startClientGrid(getConfiguration("client").setConsistentId("Client")); 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 5fd6bcade7528..1e976c6dc1efb 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 res = new ArrayList<>(); - for (CacheAtomicityMode mode : new CacheAtomicityMode[] {CacheAtomicityMode.TRANSACTIONAL, CacheAtomicityMode.ATOMIC}) + 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 04cb3635aed4b..2d3516598e454 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 res = new ArrayList<>(); - for (CacheAtomicityMode mode : new CacheAtomicityMode[] {CacheAtomicityMode.TRANSACTIONAL, CacheAtomicityMode.ATOMIC}) + 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/database/IgniteDbDynamicCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java index 6c5e9a9cbe312..f9fbdcb07587a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java @@ -30,7 +30,6 @@ import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -95,11 +94,7 @@ public void testCreate() throws Exception { ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg.setAffinity(new RendezvousAffinityFunction(false, 32)); - - if (MvccFeatureChecker.forcedMvcc()) - ccfg.setRebalanceDelay(Long.MAX_VALUE); - else - ccfg.setRebalanceMode(CacheRebalanceMode.NONE); + ccfg.setRebalanceMode(CacheRebalanceMode.NONE); for (int k = 0; k < iterations; k++) { System.out.println("Iteration: " + k); @@ -134,11 +129,7 @@ public void testMultipleDynamicCaches() throws Exception { ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg.setAffinity(new RendezvousAffinityFunction(false, 32)); - - if (MvccFeatureChecker.forcedMvcc()) - ccfg.setRebalanceDelay(Long.MAX_VALUE); - else - ccfg.setRebalanceMode(CacheRebalanceMode.NONE); + ccfg.setRebalanceMode(CacheRebalanceMode.NONE); ccfg.setIndexedTypes(Integer.class, String.class); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetAbstractTest.java index 5e94077ef1eb5..7145deb606f53 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetAbstractTest.java @@ -51,9 +51,7 @@ import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.junit.Assert; -import org.junit.Assume; import org.junit.Test; import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_SEGMENT_SIZE; @@ -556,8 +554,6 @@ public void testPutGetMultipleObjects() throws Exception { */ @Test public void testSizeClear() throws Exception { - Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-7952", MvccFeatureChecker.forcedMvcc()); - final IgniteCache cache = cache(DEFAULT_CACHE_NAME); GridCacheAdapter internalCache = internalCache(cache); @@ -925,7 +921,7 @@ public void testRandomPutGetRemove() throws Exception { long seed = System.currentTimeMillis(); - int iterations = SF.apply(MvccFeatureChecker.forcedMvcc() ? 30_000 : 90_000); + int iterations = SF.apply(90_000); X.println("Seed: " + seed); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetWithCacheStoreTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetWithCacheStoreTest.java index 9f9a6dc6588c5..c2457be8dedfa 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetWithCacheStoreTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetWithCacheStoreTest.java @@ -32,7 +32,6 @@ import org.apache.ignite.configuration.IgniteReflectionFactory; import org.apache.ignite.configuration.WALMode; import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Test; @@ -79,13 +78,6 @@ public class IgniteDbPutGetWithCacheStoreTest extends GridCommonAbstractTest { return cfg; } - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - - super.beforeTest(); - } - /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { cleanPersistenceDir(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccPersistenceSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccPersistenceSelfTest.java deleted file mode 100644 index 9360cab60284e..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccPersistenceSelfTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.datastreamer; - -/** - * - */ -public class DataStreamProcessorMvccPersistenceSelfTest extends DataStreamProcessorMvccSelfTest { - /** {@inheritDoc} */ - @Override public boolean persistenceEnabled() { - return true; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccSelfTest.java deleted file mode 100644 index 14301940d00a4..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorMvccSelfTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.datastreamer; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.junit.Ignore; -import org.junit.Test; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - -/** - * Check DataStreamer with Mvcc enabled. - */ -public class DataStreamProcessorMvccSelfTest extends DataStreamProcessorSelfTest { - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration igniteConfiguration = super.getConfiguration(igniteInstanceName); - - CacheConfiguration[] ccfgs = igniteConfiguration.getCacheConfiguration(); - - if (ccfgs != null) { - for (CacheConfiguration ccfg : ccfgs) - ccfg.setNearConfiguration(null); - } - - assert ccfgs == null || ccfgs.length == 0 || - (ccfgs.length == 1 && ccfgs[0].getAtomicityMode() == TRANSACTIONAL_SNAPSHOT); - - return igniteConfiguration; - } - - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode getCacheAtomicityMode() { - return TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-8582") - @Test - @Override public void testUpdateStore() throws Exception { - super.testUpdateStore(); - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-9321") - @Test - @Override public void testFlushTimeout() throws Exception { - super.testFlushTimeout(); - } - - /** {@inheritDoc} */ - @Test - @Override public void testTryFlush() throws Exception { - super.testTryFlush(); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java index 16552ab6be9fc..ba484477194d4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java @@ -65,10 +65,10 @@ import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.stream.StreamReceiver; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; import org.junit.Test; + import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -184,8 +184,6 @@ protected boolean customKeepBinary() { */ @Test public void testPartitioned() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); - mode = PARTITIONED; checkDataStreamer(); @@ -840,8 +838,6 @@ public void testTryFlush() throws Exception { */ @Test public void testFlushTimeout() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_EVENTS); - mode = PARTITIONED; useCache = true; @@ -896,8 +892,6 @@ public void testFlushTimeout() throws Exception { */ @Test public void testUpdateStore() throws Exception { - MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); - storeMap = new ConcurrentHashMap<>(); try { diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/MvccFeatureChecker.java b/modules/core/src/test/java/org/apache/ignite/testframework/MvccFeatureChecker.java deleted file mode 100644 index 3b6c1edfb5117..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testframework/MvccFeatureChecker.java +++ /dev/null @@ -1,175 +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.testframework; - -import javax.cache.CacheException; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; -import org.apache.ignite.transactions.TransactionSerializationException; -import org.junit.Assume; -import static org.apache.ignite.IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS; -import static org.junit.Assert.fail; - -/** - * Provides checks for features supported when FORCE_MVCC mode is on. - */ -public class MvccFeatureChecker { - /** */ - private static final boolean FORCE_MVCC = - IgniteSystemProperties.getBoolean(IGNITE_FORCE_MVCC_MODE_IN_TESTS, false); - - /** */ - public enum Feature { - /** */ - CACHE_STORE, - - /** */ - NEAR_CACHE, - - /** */ - ENTRY_LOCK, - - /** */ - CACHE_EVENTS, - - /** */ - EVICTION, - - /** */ - EXPIRATION, - - /** */ - METRICS, - - /** */ - INTERCEPTOR - } - - /** - * Fails if feature is not supported. - * - * @param f feature. - * @throws AssertionError If failed. - * @deprecated Use {@link #skipIfNotSupported(Feature)} instead. - */ - @Deprecated - public static void failIfNotSupported(Feature f) { - if (!forcedMvcc()) - return; - - String reason = unsupportedReason(f); - - if (reason != null) - fail(reason); - } - - /** - * Skips test if feature is not supported. - * - * @param f feature. - */ - public static void skipIfNotSupported(Feature f) { - if (!forcedMvcc()) - return; - - String reason = unsupportedReason(f); - - Assume.assumeTrue(reason, reason == null); - } - - /** - * @return {@code True} if Mvcc mode is forced. - */ - public static boolean forcedMvcc() { - return FORCE_MVCC; - } - - /** - * Check if feature is supported. - * - * @param f Feature. - * @return {@code True} if feature is supported, {@code False} otherwise. - */ - public static boolean isSupported(Feature f) { - return unsupportedReason(f) == null; - } - - /** - * Check if Tx mode is supported. - * - * @param conc Transaction concurrency. - * @param iso Transaction isolation. - * @return {@code True} if feature is supported, {@code False} otherwise. - */ - public static boolean isSupported(TransactionConcurrency conc, TransactionIsolation iso) { - return conc == TransactionConcurrency.PESSIMISTIC && - iso == TransactionIsolation.REPEATABLE_READ; - } - - /** - * Checks if given exception was caused by MVCC write conflict. - * - * @param e Exception. - */ - public static void assertMvccWriteConflict(Exception e) { - assert e != null; - - if (e instanceof CacheException && e.getCause() instanceof TransactionSerializationException) - return; - - fail("Unexpected exception: " + X.getFullStackTrace(e)); - } - - /** - * Fails if feature is not supported in Mvcc mode. - * - * @param feature Mvcc feature. - * @throws AssertionError If failed. - */ - private static String unsupportedReason(Feature feature) { - switch (feature) { - case NEAR_CACHE: - return "https://issues.apache.org/jira/browse/IGNITE-7187"; - - case CACHE_STORE: - return "https://issues.apache.org/jira/browse/IGNITE-8582"; - - case ENTRY_LOCK: - return "https://issues.apache.org/jira/browse/IGNITE-9324"; - - case CACHE_EVENTS: - return "https://issues.apache.org/jira/browse/IGNITE-9321"; - - case EVICTION: - return "https://issues.apache.org/jira/browse/IGNITE-7956"; - - case EXPIRATION: - return "https://issues.apache.org/jira/browse/IGNITE-7311"; - - case METRICS: - return "https://issues.apache.org/jira/browse/IGNITE-9224"; - - case INTERCEPTOR: - return "https://issues.apache.org/jira/browse/IGNITE-9323"; - } - - return null; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java index 81e32da185803..d43553d045c82 100755 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java @@ -122,7 +122,6 @@ import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi; import org.apache.ignite.spi.systemview.view.SystemView; import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.config.GridTestProperties; import org.apache.ignite.testframework.configvariations.VariationsTestsConfig; import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger; @@ -166,7 +165,6 @@ import static org.apache.ignite.IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER; import static org.apache.ignite.IgniteSystemProperties.getBoolean; 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.internal.GridKernalState.DISCONNECTED; import static org.apache.ignite.internal.IgnitionEx.gridx; @@ -2191,10 +2189,7 @@ protected FailureHandler getFailureHandler(String igniteInstanceName) { public static CacheConfiguration defaultCacheConfiguration() { CacheConfiguration cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); - if (MvccFeatureChecker.forcedMvcc()) - cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - else - cfg.setAtomicityMode(TRANSACTIONAL).setNearConfiguration(new NearCacheConfiguration<>()); + cfg.setAtomicityMode(TRANSACTIONAL).setNearConfiguration(new NearCacheConfiguration<>()); cfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setEvictionPolicy(null); diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java index 02c4577fdb05a..30a13e5509c93 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java @@ -56,7 +56,6 @@ import org.apache.ignite.IgniteServices; import org.apache.ignite.IgniteSet; import org.apache.ignite.IgniteSnapshot; -import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.IgniteTransactions; import org.apache.ignite.Ignition; import org.apache.ignite.MemoryMetrics; @@ -289,8 +288,7 @@ protected Collection filteredJvmArgs() throws Exception { (marsh != null && arg.startsWith("-D" + IgniteTestResources.MARSH_CLASS_NAME)) || arg.startsWith("--add-opens") || arg.startsWith("--add-exports") || arg.startsWith("--add-modules") || arg.startsWith("--patch-module") || arg.startsWith("--add-reads") || - arg.startsWith("-XX:+IgnoreUnrecognizedVMOptions") || - arg.startsWith(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS)) + arg.startsWith("-XX:+IgnoreUnrecognizedVMOptions")) filteredJvmArgs.add(arg); } diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheTestSuite.java index 3f513f319eb08..bd4e542dd446e 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheTestSuite.java @@ -23,7 +23,6 @@ import java.util.List; import org.apache.ignite.internal.processors.cache.GridCacheAffinityRoutingSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheEntryMemorySizeSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMvccSelfTest; import org.apache.ignite.internal.processors.cache.binary.CacheKeepBinaryWithInterceptorTest; import org.apache.ignite.internal.processors.cache.binary.GridBinaryCacheEntryMemorySizeSelfTest; import org.apache.ignite.internal.processors.cache.binary.datastreaming.DataStreamProcessorBinarySelfTest; @@ -64,8 +63,6 @@ public static List> suite(Collection ignoredTests) { GridTestUtils.addTestIfNeeded(suite, GridCacheEntryMemorySizeSelfTest.class, ignoredTests); // Tests that are not ready to be used with BinaryMarshaller - GridTestUtils.addTestIfNeeded(suite, GridCacheMvccSelfTest.class, ignoredTests); - GridTestUtils.addTestIfNeeded(suite, GridCacheBinariesPartitionedOnlyByteArrayValuesSelfTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, GridCacheBinariesNearPartitionedByteArrayValuesSelfTest.class, ignoredTests); diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java deleted file mode 100644 index 4689006489581..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite.java +++ /dev/null @@ -1,80 +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.testsuites; - -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccClientReconnectTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccClientTopologyTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccClusterRestartTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccConfigurationValidationTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccIteratorWithConcurrentTransactionTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccLocalEntriesWithConcurrentTransactionTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccOperationChecksTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccPartitionedCoordinatorFailoverTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccProcessorLazyStartTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccProcessorTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccRemoteTxOnNearNodeStartTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccReplicatedCoordinatorFailoverTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccScanQueryWithConcurrentTransactionTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSizeWithConcurrentTransactionTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccTransactionsTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccTxFailoverTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccVacuumTest; -import org.apache.ignite.internal.processors.cache.mvcc.MvccCachePeekTest; -import org.apache.ignite.internal.processors.cache.mvcc.MvccStructuresOverheadTest; -import org.apache.ignite.internal.processors.cache.mvcc.MvccUnsupportedTxModesTest; -import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorMvccPersistenceSelfTest; -import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorMvccSelfTest; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** */ -@RunWith(Suite.class) -@Suite.SuiteClasses({ - CacheMvccTransactionsTest.class, - CacheMvccProcessorTest.class, - CacheMvccVacuumTest.class, - CacheMvccConfigurationValidationTest.class, - CacheMvccClientTopologyTest.class, - - DataStreamProcessorMvccSelfTest.class, - DataStreamProcessorMvccPersistenceSelfTest.class, - CacheMvccOperationChecksTest.class, - - CacheMvccRemoteTxOnNearNodeStartTest.class, - - MvccUnsupportedTxModesTest.class, - - MvccCachePeekTest.class, - - // Concurrent ops tests. - CacheMvccIteratorWithConcurrentTransactionTest.class, - CacheMvccLocalEntriesWithConcurrentTransactionTest.class, - CacheMvccScanQueryWithConcurrentTransactionTest.class, - CacheMvccSizeWithConcurrentTransactionTest.class, - - // Failover tests. - CacheMvccTxFailoverTest.class, - CacheMvccClusterRestartTest.class, - CacheMvccPartitionedCoordinatorFailoverTest.class, - CacheMvccReplicatedCoordinatorFailoverTest.class, - CacheMvccProcessorLazyStartTest.class, - CacheMvccClientReconnectTest.class, - MvccStructuresOverheadTest.class -}) -public class IgniteCacheMvccTestSuite { -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite1.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite1.java deleted file mode 100755 index b08c818a2977b..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite1.java +++ /dev/null @@ -1,237 +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.testsuites; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.cache.IgniteCacheEntryProcessorSequentialCallTest; -import org.apache.ignite.cache.IgniteWarmupClosureSelfTest; -import org.apache.ignite.cache.store.CacheStoreReadFromBackupTest; -import org.apache.ignite.cache.store.GridCacheBalancingStoreSelfTest; -import org.apache.ignite.cache.store.GridStoreLoadCacheTest; -import org.apache.ignite.cache.store.StoreResourceInjectionSelfTest; -import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreTest; -import org.apache.ignite.cache.store.jdbc.GridCacheJdbcBlobStoreSelfTest; -import org.apache.ignite.cache.store.jdbc.JdbcTypesDefaultTransformerTest; -import org.apache.ignite.internal.managers.communication.IgniteCommunicationBalanceMultipleConnectionsTest; -import org.apache.ignite.internal.managers.communication.IgniteCommunicationBalancePairedConnectionsTest; -import org.apache.ignite.internal.managers.communication.IgniteCommunicationBalanceTest; -import org.apache.ignite.internal.managers.communication.IgniteCommunicationSslBalanceTest; -import org.apache.ignite.internal.managers.communication.IgniteIoTestMessagesTest; -import org.apache.ignite.internal.managers.communication.IgniteVariousConnectionNumberTest; -import org.apache.ignite.internal.processors.cache.CacheAffinityCallSelfTest; -import org.apache.ignite.internal.processors.cache.CacheDeferredDeleteQueueTest; -import org.apache.ignite.internal.processors.cache.CacheDeferredDeleteSanitySelfTest; -import org.apache.ignite.internal.processors.cache.CacheMvccTxFastFinishTest; -import org.apache.ignite.internal.processors.cache.CacheTxFastFinishTest; -import org.apache.ignite.internal.processors.cache.DataStorageConfigurationValidationTest; -import org.apache.ignite.internal.processors.cache.GridCacheAffinityApiSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheAffinityMapperSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheAffinityRoutingSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheAsyncOperationsLimitSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheConfigurationConsistencySelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheConfigurationValidationSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheLifecycleAwareSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMissingCommitVersionSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMvccManagerSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMvccMultiThreadedUpdateSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMvccPartitionedSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMvccSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheOffHeapAtomicMultiThreadedUpdateSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheOffHeapMultiThreadedUpdateSelfTest; -import org.apache.ignite.internal.processors.cache.GridCachePartitionedLocalStoreSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheReplicatedLocalStoreSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheStopSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheTcpClientDiscoveryMultiThreadedTest; -import org.apache.ignite.internal.processors.cache.GridDataStorageConfigurationConsistencySelfTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicConcurrentUnorderedUpdateAllTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicInvokeTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicNearEnabledInvokeTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicStopBusySelfTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicWithStoreInvokeTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheEntryListenerAtomicReplicatedTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheEntryListenerAtomicTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheEntryProcessorCallTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheManyAsyncOperationsTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheMvccTxInvokeTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheMvccTxNearEnabledInvokeTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheTxInvokeTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheTxNearEnabledInvokeTest; -import org.apache.ignite.internal.processors.cache.IgniteClientAffinityAssignmentSelfTest; -import org.apache.ignite.internal.processors.cache.IgniteIncompleteCacheObjectSelfTest; -import org.apache.ignite.internal.processors.cache.binary.CacheKeepBinaryWithInterceptorTest; -import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCacheAffinityRoutingBinarySelfTest; -import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCacheAtomicPartitionedOnlyBinaryDataStreamerMultiNodeSelfTest; -import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCacheAtomicPartitionedOnlyBinaryDataStreamerMultithreadedSelfTest; -import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCacheAtomicPartitionedOnlyBinaryMultiNodeSelfTest; -import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCacheAtomicPartitionedOnlyBinaryMultithreadedSelfTest; -import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCacheBinariesNearPartitionedByteArrayValuesSelfTest; -import org.apache.ignite.internal.processors.cache.binary.distributed.dht.GridCacheBinariesPartitionedOnlyByteArrayValuesSelfTest; -import org.apache.ignite.internal.processors.cache.context.IgniteCacheAtomicExecutionContextTest; -import org.apache.ignite.internal.processors.cache.context.IgniteCacheContinuousExecutionContextTest; -import org.apache.ignite.internal.processors.cache.context.IgniteCacheIsolatedExecutionContextTest; -import org.apache.ignite.internal.processors.cache.context.IgniteCacheP2PDisableExecutionContextTest; -import org.apache.ignite.internal.processors.cache.context.IgniteCachePrivateExecutionContextTest; -import org.apache.ignite.internal.processors.cache.context.IgniteCacheReplicatedExecutionContextTest; -import org.apache.ignite.internal.processors.cache.context.IgniteCacheSharedExecutionContextTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheAtomicNearUpdateTopologyChangeTest; -import org.apache.ignite.internal.processors.cache.distributed.GridCacheClientModesTcpClientDiscoveryAbstractTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicMessageRecovery10ConnectionsTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicMessageRecoveryPairedConnectionsTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheAtomicMessageRecoveryTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheConnectionRecovery10ConnectionsTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheConnectionRecoveryTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheMessageRecoveryIdleConnectionTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheMessageWriteTimeoutTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAtomicNearCacheSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionsStateValidatorSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionsUpdateCountersAndSizeTest; -import org.apache.ignite.internal.processors.cache.query.continuous.CacheEntryProcessorExternalizableFailedTest; -import org.apache.ignite.internal.processors.cache.query.continuous.CacheEntryProcessorNonSerializableTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** - * Test suite. - */ -@RunWith(DynamicSuite.class) -public class IgniteCacheMvccTestSuite1 { - /** - * @return IgniteCache test suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - Set ignoredTests = new HashSet<>(); - - // Skip classes that already contains Mvcc tests - ignoredTests.add(CacheKeepBinaryWithInterceptorTest.class); - ignoredTests.add(CacheEntryProcessorNonSerializableTest.class); - ignoredTests.add(CacheEntryProcessorExternalizableFailedTest.class); - ignoredTests.add(IgniteCacheEntryProcessorSequentialCallTest.class); - ignoredTests.add(IgniteCacheEntryProcessorCallTest.class); - ignoredTests.add(GridCacheConfigurationConsistencySelfTest.class); - ignoredTests.add(IgniteCacheMessageRecoveryIdleConnectionTest.class); - ignoredTests.add(IgniteCacheConnectionRecoveryTest.class); - ignoredTests.add(IgniteCacheConnectionRecovery10ConnectionsTest.class); - ignoredTests.add(CacheDeferredDeleteSanitySelfTest.class); - ignoredTests.add(CacheDeferredDeleteQueueTest.class); - ignoredTests.add(GridCacheStopSelfTest.class); - ignoredTests.add(GridCacheBinariesNearPartitionedByteArrayValuesSelfTest.class); - ignoredTests.add(GridCacheBinariesPartitionedOnlyByteArrayValuesSelfTest.class); - - // Atomic caches. - ignoredTests.add(IgniteCacheEntryListenerAtomicTest.class); - ignoredTests.add(IgniteCacheEntryListenerAtomicReplicatedTest.class); - ignoredTests.add(IgniteCacheAtomicInvokeTest.class); - ignoredTests.add(IgniteCacheAtomicNearEnabledInvokeTest.class); - ignoredTests.add(IgniteCacheAtomicWithStoreInvokeTest.class); - ignoredTests.add(IgniteCacheAtomicConcurrentUnorderedUpdateAllTest.class); - ignoredTests.add(GridCachePartitionedLocalStoreSelfTest.class); - ignoredTests.add(GridCacheReplicatedLocalStoreSelfTest.class); - ignoredTests.add(CacheStoreReadFromBackupTest.class); - - ignoredTests.add(IgniteCacheAtomicExecutionContextTest.class); - ignoredTests.add(IgniteCacheReplicatedExecutionContextTest.class); - ignoredTests.add(IgniteCacheContinuousExecutionContextTest.class); - ignoredTests.add(IgniteCacheIsolatedExecutionContextTest.class); - ignoredTests.add(IgniteCacheP2PDisableExecutionContextTest.class); - ignoredTests.add(IgniteCachePrivateExecutionContextTest.class); - ignoredTests.add(IgniteCacheSharedExecutionContextTest.class); - - ignoredTests.add(IgniteCacheAtomicStopBusySelfTest.class); - ignoredTests.add(GridCacheAtomicNearCacheSelfTest.class); - ignoredTests.add(CacheAtomicNearUpdateTopologyChangeTest.class); - ignoredTests.add(GridCacheOffHeapAtomicMultiThreadedUpdateSelfTest.class); - ignoredTests.add(IgniteCacheAtomicMessageRecoveryTest.class); - ignoredTests.add(IgniteCacheAtomicMessageRecoveryPairedConnectionsTest.class); - ignoredTests.add(IgniteCacheAtomicMessageRecovery10ConnectionsTest.class); - - ignoredTests.add(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseNearPartitionedAtomic.class); - ignoredTests.add(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseNearReplicatedAtomic.class); - ignoredTests.add(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseClientPartitionedAtomic.class); - ignoredTests.add(GridCacheClientModesTcpClientDiscoveryAbstractTest.CaseClientReplicatedAtomic.class); - - ignoredTests.add(GridCacheAtomicPartitionedOnlyBinaryDataStreamerMultiNodeSelfTest.class); - ignoredTests.add(GridCacheAtomicPartitionedOnlyBinaryDataStreamerMultithreadedSelfTest.class); - ignoredTests.add(GridCacheAtomicPartitionedOnlyBinaryMultiNodeSelfTest.class); - ignoredTests.add(GridCacheAtomicPartitionedOnlyBinaryMultithreadedSelfTest.class); - - // Irrelevant tests. - ignoredTests.add(GridCacheMvccSelfTest.class); // This is about MvccCandidate, but not TxSnapshot. - ignoredTests.add(GridCacheMvccPartitionedSelfTest.class); // This is about MvccCandidate, but not TxSnapshot. - ignoredTests.add(GridCacheMvccManagerSelfTest.class); // This is about MvccCandidate, but not TxSnapshot. - ignoredTests.add(GridCacheMissingCommitVersionSelfTest.class); // Mvcc tx states resides in TxLog. - - // Other non-Tx test. - ignoredTests.add(GridCacheAffinityRoutingSelfTest.class); - ignoredTests.add(GridCacheAffinityRoutingBinarySelfTest.class); - ignoredTests.add(IgniteClientAffinityAssignmentSelfTest.class); - ignoredTests.add(CacheAffinityCallSelfTest.class); - ignoredTests.add(GridCacheAffinityMapperSelfTest.class); - ignoredTests.add(GridCacheAffinityApiSelfTest.class); - - ignoredTests.add(GridCacheConfigurationValidationSelfTest.class); - - ignoredTests.add(GridDataStorageConfigurationConsistencySelfTest.class); - ignoredTests.add(DataStorageConfigurationValidationTest.class); - ignoredTests.add(JdbcTypesDefaultTransformerTest.class); - ignoredTests.add(GridCacheJdbcBlobStoreSelfTest.class); - ignoredTests.add(CacheJdbcPojoStoreTest.class); - ignoredTests.add(GridCacheBalancingStoreSelfTest.class); - ignoredTests.add(GridStoreLoadCacheTest.class); - - ignoredTests.add(IgniteWarmupClosureSelfTest.class); - ignoredTests.add(StoreResourceInjectionSelfTest.class); - ignoredTests.add(GridCacheAsyncOperationsLimitSelfTest.class); - ignoredTests.add(IgniteCacheManyAsyncOperationsTest.class); - ignoredTests.add(GridCacheLifecycleAwareSelfTest.class); - ignoredTests.add(IgniteCacheMessageWriteTimeoutTest.class); - ignoredTests.add(GridCachePartitionsStateValidatorSelfTest.class); - ignoredTests.add(GridCachePartitionsUpdateCountersAndSizeTest.class); - ignoredTests.add(IgniteVariousConnectionNumberTest.class); - ignoredTests.add(IgniteIncompleteCacheObjectSelfTest.class); - - ignoredTests.add(IgniteCommunicationBalanceTest.class); - ignoredTests.add(IgniteCommunicationBalancePairedConnectionsTest.class); - ignoredTests.add(IgniteCommunicationBalanceMultipleConnectionsTest.class); - ignoredTests.add(IgniteCommunicationSslBalanceTest.class); - ignoredTests.add(IgniteIoTestMessagesTest.class); - - ignoredTests.add(GridCacheTcpClientDiscoveryMultiThreadedTest.class); - - // Skip classes which Mvcc implementations are added in this method below. - ignoredTests.add(GridCacheOffHeapMultiThreadedUpdateSelfTest.class); // See GridCacheMvccMultiThreadedUpdateSelfTest. - ignoredTests.add(CacheTxFastFinishTest.class); // See CacheMvccTxFastFinishTest. - ignoredTests.add(IgniteCacheTxInvokeTest.class); // See IgniteCacheMvccTxInvokeTest. - ignoredTests.add(IgniteCacheTxNearEnabledInvokeTest.class); // See IgniteCacheMvccTxNearEnabledInvokeTest. - - List> suite = new ArrayList<>(IgniteBinaryCacheTestSuite.suite(ignoredTests)); - - // Add Mvcc clones. - suite.add(GridCacheMvccMultiThreadedUpdateSelfTest.class); - suite.add(CacheMvccTxFastFinishTest.class); - suite.add(IgniteCacheMvccTxInvokeTest.class); - suite.add(IgniteCacheMvccTxNearEnabledInvokeTest.class); - - return suite; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite2.java deleted file mode 100644 index b6fb69f4734d4..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite2.java +++ /dev/null @@ -1,231 +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.testsuites; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeAffinityBackupFilterSelfTest; -import org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeColocatedBackupFilterSelfTest; -import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionBackupFilterSelfTest; -import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionExcludeNeighborsSelfTest; -import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionFastPowerOfTwoHashSelfTest; -import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunctionStandardHashSelfTest; -import org.apache.ignite.internal.IgniteReflectionFactorySelfTest; -import org.apache.ignite.internal.processors.cache.CacheComparatorTest; -import org.apache.ignite.internal.processors.cache.CacheConfigurationLeakTest; -import org.apache.ignite.internal.processors.cache.CacheEnumOperationsSingleNodeTest; -import org.apache.ignite.internal.processors.cache.CacheEnumOperationsTest; -import org.apache.ignite.internal.processors.cache.CacheExchangeMessageDuplicatedStateTest; -import org.apache.ignite.internal.processors.cache.CacheGroupLocalConfigurationSelfTest; -import org.apache.ignite.internal.processors.cache.CacheOptimisticTransactionsWithFilterSingleServerTest; -import org.apache.ignite.internal.processors.cache.CacheOptimisticTransactionsWithFilterTest; -import org.apache.ignite.internal.processors.cache.GridCacheAtomicMessageCountSelfTest; -import org.apache.ignite.internal.processors.cache.GridCachePartitionedProjectionAffinitySelfTest; -import org.apache.ignite.internal.processors.cache.IgniteAtomicCacheEntryProcessorNodeJoinTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheNoSyncForGetTest; -import org.apache.ignite.internal.processors.cache.IgniteCachePartitionMapUpdateTest; -import org.apache.ignite.internal.processors.cache.IgniteClientCacheStartFailoverTest; -import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheAndNodeStop; -import org.apache.ignite.internal.processors.cache.IgniteNearClientCacheCloseTest; -import org.apache.ignite.internal.processors.cache.IgniteOnePhaseCommitInvokeTest; -import org.apache.ignite.internal.processors.cache.IgniteOnePhaseCommitNearReadersTest; -import org.apache.ignite.internal.processors.cache.MemoryPolicyConfigValidationTest; -import org.apache.ignite.internal.processors.cache.NoPresentCacheInterceptorOnClientTest; -import org.apache.ignite.internal.processors.cache.NonAffinityCoordinatorDynamicStartStopTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTestAllowOverwrite; -import org.apache.ignite.internal.processors.cache.distributed.CachePartitionStateTest; -import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionedNearDisabledTxMultiThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.GridCacheTransformEventSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheClientNodePartitionsExchangeTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheServerNodeConcurrentStart; -import org.apache.ignite.internal.processors.cache.distributed.dht.CachePartitionPartialCountersMapSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedDebugTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedMvccTxSingleThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedOptimisticTransactionSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedTxSingleThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtAtomicEvictionNearReadersSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtEvictionNearReadersSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtPreloadMessageCountTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtPreloadOnheapSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledMetricsSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedSupplyEventsSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedUnloadEventsSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheContainsKeyColocatedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePartitionedBackupNodeFailureRecoveryTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCrossCacheTxNearEnabledSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.IgniteCacheContainsKeyColocatedAtomicSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.IgniteCacheContainsKeyNearAtomicSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEvictionEventSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearMultiNodeSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearReadersSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearClientHitTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearJobExecutionSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearMultiGetSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearTxForceKeyTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedAffinitySelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedAtomicGetAndTransformStoreSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedEvictionSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiThreadedPutGetSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMvccTxMultiThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMvccTxSingleThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMvccTxTimeoutSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedNestedTxTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedTxConcurrentGetTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedTxMultiThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedTxReadTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedTxSingleThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedTxTimeoutSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheRendezvousAffinityClientSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheContainsKeyNearSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.NearCacheMultithreadedUpdateTest; -import org.apache.ignite.internal.processors.cache.distributed.near.NearCacheSyncUpdateTest; -import org.apache.ignite.internal.processors.cache.distributed.near.NoneRebalanceModeSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedJobExecutionTest; -import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicyInitializationTest; -import org.apache.ignite.internal.processors.continuous.IgniteContinuousQueryMetadataUpdateTest; -import org.apache.ignite.internal.processors.continuous.IgniteNoCustomEventsOnNodeStart; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** - * Test suite. - */ -@RunWith(DynamicSuite.class) -public class IgniteCacheMvccTestSuite2 { - /** - * @return IgniteCache test suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - HashSet ignoredTests = new HashSet<>(128); - - // Skip classes that already contains Mvcc tests - ignoredTests.add(GridCacheTransformEventSelfTest.class); - ignoredTests.add(IgniteClientCacheStartFailoverTest.class); - ignoredTests.add(IgniteNearClientCacheCloseTest.class); - ignoredTests.add(IgniteCacheNoSyncForGetTest.class); - ignoredTests.add(CacheEnumOperationsSingleNodeTest.class); - ignoredTests.add(CacheEnumOperationsTest.class); - ignoredTests.add(NearCacheSyncUpdateTest.class); - ignoredTests.add(GridCacheNearMultiGetSelfTest.class); - - // Irrelevant Tx tests. - ignoredTests.add(GridCacheColocatedOptimisticTransactionSelfTest.class); - ignoredTests.add(CacheOptimisticTransactionsWithFilterSingleServerTest.class); - ignoredTests.add(CacheOptimisticTransactionsWithFilterTest.class); - - // Irrelevant Tx tests. - ignoredTests.add(IgniteOnePhaseCommitInvokeTest.class); - ignoredTests.add(IgniteOnePhaseCommitNearReadersTest.class); - ignoredTests.add(GridCacheDhtPreloadOnheapSelfTest.class); - ignoredTests.add(GridCachePartitionedMultiThreadedPutGetSelfTest.class); // On-heap test. - - // Atomic cache tests. - ignoredTests.add(GridCacheAtomicNearMultiNodeSelfTest.class); - ignoredTests.add(GridCacheAtomicNearReadersSelfTest.class); - ignoredTests.add(GridCachePartitionedAtomicGetAndTransformStoreSelfTest.class); - ignoredTests.add(GridCacheAtomicNearEvictionEventSelfTest.class); - ignoredTests.add(GridCacheAtomicMessageCountSelfTest.class); - ignoredTests.add(IgniteAtomicCacheEntryProcessorNodeJoinTest.class); - ignoredTests.add(GridCacheDhtAtomicEvictionNearReadersSelfTest.class); - ignoredTests.add(GridCacheNearClientHitTest.class); - ignoredTests.add(GridCacheNearTxForceKeyTest.class); - ignoredTests.add(CacheLoadingConcurrentGridStartSelfTest.class); - ignoredTests.add(CacheLoadingConcurrentGridStartSelfTestAllowOverwrite.class); - ignoredTests.add(IgniteCachePartitionedBackupNodeFailureRecoveryTest.class); - - // Other non-tx tests. - ignoredTests.add(RendezvousAffinityFunctionExcludeNeighborsSelfTest.class); - ignoredTests.add(RendezvousAffinityFunctionFastPowerOfTwoHashSelfTest.class); - ignoredTests.add(RendezvousAffinityFunctionStandardHashSelfTest.class); - ignoredTests.add(GridCachePartitionedAffinitySelfTest.class); - ignoredTests.add(GridCacheRendezvousAffinityClientSelfTest.class); - ignoredTests.add(GridCachePartitionedProjectionAffinitySelfTest.class); - ignoredTests.add(RendezvousAffinityFunctionBackupFilterSelfTest.class); - ignoredTests.add(ClusterNodeAttributeAffinityBackupFilterSelfTest.class); - ignoredTests.add(ClusterNodeAttributeColocatedBackupFilterSelfTest.class); - ignoredTests.add(NonAffinityCoordinatorDynamicStartStopTest.class); - - ignoredTests.add(NoneRebalanceModeSelfTest.class); - ignoredTests.add(IgniteCachePartitionMapUpdateTest.class); - ignoredTests.add(IgniteCacheClientNodePartitionsExchangeTest.class); - ignoredTests.add(IgniteCacheServerNodeConcurrentStart.class); - - ignoredTests.add(GridCachePartitionedUnloadEventsSelfTest.class); - ignoredTests.add(GridCachePartitionedSupplyEventsSelfTest.class); - - ignoredTests.add(IgniteNoCustomEventsOnNodeStart.class); - ignoredTests.add(CacheExchangeMessageDuplicatedStateTest.class); - ignoredTests.add(IgniteDynamicCacheAndNodeStop.class); - ignoredTests.add(IgniteContinuousQueryMetadataUpdateTest.class); - - ignoredTests.add(GridCacheReplicatedJobExecutionTest.class); - ignoredTests.add(GridCacheNearJobExecutionSelfTest.class); - - ignoredTests.add(CacheConfigurationLeakTest.class); - ignoredTests.add(MemoryPolicyConfigValidationTest.class); - ignoredTests.add(MemoryPolicyInitializationTest.class); - ignoredTests.add(CacheGroupLocalConfigurationSelfTest.class); - - ignoredTests.add(CachePartitionStateTest.class); - ignoredTests.add(CacheComparatorTest.class); - ignoredTests.add(CachePartitionPartialCountersMapSelfTest.class); - ignoredTests.add(IgniteReflectionFactorySelfTest.class); - - // Skip classes which Mvcc implementations are added in this method below. - // TODO IGNITE-10175: refactor these tests (use assume) to support both mvcc and non-mvcc modes after moving to JUnit4/5. - ignoredTests.add(GridCachePartitionedTxSingleThreadedSelfTest.class); // See GridCachePartitionedMvccTxSingleThreadedSelfTest - ignoredTests.add(GridCacheColocatedTxSingleThreadedSelfTest.class); // See GridCacheColocatedMvccTxSingleThreadedSelfTest - ignoredTests.add(GridCachePartitionedTxMultiThreadedSelfTest.class); // See GridCachePartitionedMvccTxMultiThreadedSelfTest - // See GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest - ignoredTests.add(GridCachePartitionedNearDisabledTxMultiThreadedSelfTest.class); - ignoredTests.add(GridCachePartitionedTxTimeoutSelfTest.class); // See GridCachePartitionedMvccTxTimeoutSelfTest - - ignoredTests.add(GridCacheColocatedDebugTest.class); - ignoredTests.add(GridCacheDhtEvictionNearReadersSelfTest.class); - ignoredTests.add(GridCacheDhtPreloadMessageCountTest.class); - ignoredTests.add(NearCacheMultithreadedUpdateTest.class); - ignoredTests.add(GridCachePartitionedEvictionSelfTest.class); - ignoredTests.add(GridCachePartitionedNearDisabledMetricsSelfTest.class); - ignoredTests.add(GridCachePartitionedNestedTxTest.class); - ignoredTests.add(GridCachePartitionedTxConcurrentGetTest.class); - ignoredTests.add(GridCachePartitionedTxReadTest.class); - ignoredTests.add(IgniteCrossCacheTxNearEnabledSelfTest.class); - ignoredTests.add(IgniteCacheContainsKeyColocatedSelfTest.class); - ignoredTests.add(IgniteCacheContainsKeyNearSelfTest.class); - ignoredTests.add(IgniteCacheContainsKeyColocatedAtomicSelfTest.class); - ignoredTests.add(IgniteCacheContainsKeyNearAtomicSelfTest.class); - ignoredTests.add(NoPresentCacheInterceptorOnClientTest.class); - - List> suite = new ArrayList<>(IgniteCacheTestSuite2.suite(ignoredTests)); - - // Add Mvcc clones. - suite.add(GridCachePartitionedMvccTxSingleThreadedSelfTest.class); - suite.add(GridCacheColocatedMvccTxSingleThreadedSelfTest.class); - suite.add(GridCachePartitionedMvccTxMultiThreadedSelfTest.class); - suite.add(GridCachePartitionedNearDisabledMvccTxMultiThreadedSelfTest.class); - suite.add(GridCachePartitionedMvccTxTimeoutSelfTest.class); - - return suite; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite3.java deleted file mode 100644 index 0828a15a43c06..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite3.java +++ /dev/null @@ -1,129 +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.testsuites; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.processors.cache.CacheInterceptorPartitionCounterRandomOperationsTest; -import org.apache.ignite.internal.processors.cache.GridCacheAtomicEntryProcessorDeploymentSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheEntryVersionSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheInterceptorAtomicNearEnabledSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheInterceptorAtomicRebalanceTest; -import org.apache.ignite.internal.processors.cache.GridCacheInterceptorAtomicReplicatedSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheInterceptorAtomicSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheInterceptorAtomicWithStoreReplicatedSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheInterceptorAtomicWithStoreSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheValueBytesPreloadingSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheVersionSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheVersionTopologyChangeTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheGroupsTest; -import org.apache.ignite.internal.processors.cache.binary.GridCacheBinaryAtomicEntryProcessorDeploymentSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheAsyncOperationsTest; -import org.apache.ignite.internal.processors.cache.distributed.GridCacheMixedModeSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheClientOnlySelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteTxReentryColocatedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheValueConsistencyAtomicNearEnabledSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheValueConsistencyAtomicSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearOnlySelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.IgniteTxReentryNearSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedAtomicGetAndTransformStoreSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedMvccTxMultiThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedMvccTxSingleThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedMvccTxTimeoutSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedTxMultiThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedTxSingleThreadedSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedTxTimeoutSelfTest; -import org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStoreMultithreadedSelfTest; -import org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStoreSelfTest; -import org.apache.ignite.internal.processors.cache.store.IgnteCacheClientWriteBehindStoreAtomicTest; -import org.apache.ignite.internal.processors.cache.store.IgnteCacheClientWriteBehindStoreNonCoalescingTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** - * Test suite. - */ -@RunWith(DynamicSuite.class) -public class IgniteCacheMvccTestSuite3 { - /** - * @return IgniteCache test suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - HashSet ignoredTests = new HashSet<>(); - - // Skip classes that already contains Mvcc tests - ignoredTests.add(GridCacheEntryVersionSelfTest.class); - ignoredTests.add(GridCacheVersionTopologyChangeTest.class); - ignoredTests.add(CacheAsyncOperationsTest.class); - ignoredTests.add(CacheInterceptorPartitionCounterRandomOperationsTest.class); - ignoredTests.add(IgniteCacheGroupsTest.class); - - // Atomic caches - ignoredTests.add(GridCacheValueConsistencyAtomicSelfTest.class); - ignoredTests.add(GridCacheValueConsistencyAtomicNearEnabledSelfTest.class); - ignoredTests.add(GridCacheReplicatedAtomicGetAndTransformStoreSelfTest.class); - ignoredTests.add(GridCacheAtomicEntryProcessorDeploymentSelfTest.class); - ignoredTests.add(GridCacheValueBytesPreloadingSelfTest.class); - ignoredTests.add(GridCacheBinaryAtomicEntryProcessorDeploymentSelfTest.class); - - ignoredTests.add(GridCacheClientOnlySelfTest.CasePartitionedAtomic.class); - ignoredTests.add(GridCacheClientOnlySelfTest.CaseReplicatedAtomic.class); - ignoredTests.add(GridCacheNearOnlySelfTest.CasePartitionedAtomic.class); - ignoredTests.add(GridCacheNearOnlySelfTest.CaseReplicatedAtomic.class); - - ignoredTests.add(IgnteCacheClientWriteBehindStoreAtomicTest.class); - ignoredTests.add(IgnteCacheClientWriteBehindStoreNonCoalescingTest.class); - - ignoredTests.add(GridCacheInterceptorAtomicSelfTest.class); - ignoredTests.add(GridCacheInterceptorAtomicNearEnabledSelfTest.class); - ignoredTests.add(GridCacheInterceptorAtomicWithStoreSelfTest.class); - ignoredTests.add(GridCacheInterceptorAtomicReplicatedSelfTest.class); - ignoredTests.add(GridCacheInterceptorAtomicWithStoreReplicatedSelfTest.class); - ignoredTests.add(GridCacheInterceptorAtomicRebalanceTest.class); - - // Irrelevant tx tests - ignoredTests.add(IgniteTxReentryNearSelfTest.class); - ignoredTests.add(IgniteTxReentryColocatedSelfTest.class); - - // Other non-tx tests - ignoredTests.add(GridCacheWriteBehindStoreSelfTest.class); - ignoredTests.add(GridCacheWriteBehindStoreMultithreadedSelfTest.class); - - ignoredTests.add(GridCacheVersionSelfTest.class); - ignoredTests.add(GridCacheMixedModeSelfTest.class); - - // Skip classes which Mvcc implementations are added in this method below. - // TODO IGNITE-10175: refactor these tests (use assume) to support both mvcc and non-mvcc modes after moving to JUnit4/5. - ignoredTests.add(GridCacheReplicatedTxSingleThreadedSelfTest.class); // See GridCacheReplicatedMvccTxSingleThreadedSelfTest - ignoredTests.add(GridCacheReplicatedTxMultiThreadedSelfTest.class); // See GridCacheReplicatedMvccTxMultiThreadedSelfTest - ignoredTests.add(GridCacheReplicatedTxTimeoutSelfTest.class); // See GridCacheReplicatedMvccTxTimeoutSelfTest - - List> suite = new ArrayList<>(IgniteBinaryObjectsCacheTestSuite3.suite(ignoredTests)); - - // Add Mvcc clones. - suite.add(GridCacheReplicatedMvccTxSingleThreadedSelfTest.class); - suite.add(GridCacheReplicatedMvccTxMultiThreadedSelfTest.class); - suite.add(GridCacheReplicatedMvccTxTimeoutSelfTest.class); - - return suite; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite4.java deleted file mode 100644 index 44843e55d2dfe..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite4.java +++ /dev/null @@ -1,183 +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.testsuites; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.cache.store.CacheStoreListenerRWThroughDisabledAtomicCacheTest; -import org.apache.ignite.internal.processors.cache.CacheConnectionLeakStoreTxTest; -import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticReadCommittedSelfTest; -import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticRepeatableReadSelfTest; -import org.apache.ignite.internal.processors.cache.CacheGetEntryOptimisticSerializableSelfTest; -import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticReadCommittedSelfTest; -import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticRepeatableReadSelfTest; -import org.apache.ignite.internal.processors.cache.CacheGetEntryPessimisticSerializableSelfTest; -import org.apache.ignite.internal.processors.cache.CacheGetRemoveSkipStoreTest; -import org.apache.ignite.internal.processors.cache.CacheOffheapMapEntrySelfTest; -import org.apache.ignite.internal.processors.cache.CacheReadThroughAtomicRestartSelfTest; -import org.apache.ignite.internal.processors.cache.CacheReadThroughReplicatedAtomicRestartSelfTest; -import org.apache.ignite.internal.processors.cache.CacheStoreUsageMultinodeDynamicStartAtomicTest; -import org.apache.ignite.internal.processors.cache.CacheStoreUsageMultinodeStaticStartAtomicTest; -import org.apache.ignite.internal.processors.cache.CacheTxNotAllowReadFromBackupTest; -import org.apache.ignite.internal.processors.cache.GridCacheMultinodeUpdateAtomicNearEnabledSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMultinodeUpdateAtomicSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheVersionMultinodeTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicCopyOnReadDisabledTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicNearEnabledStoreValueTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicNearPeekModesTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicPeekModesTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicReplicatedPeekModesTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheAtomicStoreValueTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheConfigurationDefaultTemplateTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheContainsKeyAtomicTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheInvokeReadThroughSingleNodeTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheInvokeReadThroughTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheStartTest; -import org.apache.ignite.internal.processors.cache.IgniteClientCacheInitializationFailTest; -import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheStartNoExchangeTimeoutTest; -import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheStartSelfTest; -import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheStartStopConcurrentTest; -import org.apache.ignite.internal.processors.cache.IgniteDynamicClientCacheStartSelfTest; -import org.apache.ignite.internal.processors.cache.IgniteExchangeFutureHistoryTest; -import org.apache.ignite.internal.processors.cache.IgniteInternalCacheTypesTest; -import org.apache.ignite.internal.processors.cache.IgniteStartCacheInTransactionAtomicSelfTest; -import org.apache.ignite.internal.processors.cache.IgniteSystemCacheOnClientTest; -import org.apache.ignite.internal.processors.cache.MarshallerCacheJobRunNodeRestartTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheDiscoveryDataConcurrentJoinTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheGetFutureHangsSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheGroupsPreloadTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheNoValueClassOnServerNodeTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheResultIsNotNullOnPartitionLossTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheCreatePutTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheFailedUpdateResponseTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheReadFromBackupTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheSingleGetMessageTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCrossCacheMvccTxSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCrossCacheTxSelfTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLoadAllTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLoaderWriterTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNearEnabledNoReadThroughTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNearEnabledNoWriteThroughTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNoLoadPreviousValueTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNoReadThroughTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicNoWriteThroughTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicStoreSessionTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicStoreSessionWriteBehindTest; -import org.apache.ignite.internal.processors.cache.integration.IgniteCacheJdbcBlobStoreNodeRestartTest; -import org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryPartitionedAtomicSelfTest; -import org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryReplicatedAtomicSelfTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** */ -@RunWith(DynamicSuite.class) -public class IgniteCacheMvccTestSuite4 { - /** - * @return IgniteCache test suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - HashSet ignoredTests = new HashSet<>(128); - - // Skip classes that already contains Mvcc tests - ignoredTests.add(GridCacheVersionMultinodeTest.class); - ignoredTests.add(IgniteCacheCreatePutTest.class); - ignoredTests.add(IgniteClientCacheInitializationFailTest.class); - ignoredTests.add(IgniteCacheFailedUpdateResponseTest.class); - ignoredTests.add(CacheGetEntryPessimisticRepeatableReadSelfTest.class); - ignoredTests.add(CacheTxNotAllowReadFromBackupTest.class); - ignoredTests.add(CacheOffheapMapEntrySelfTest.class); - ignoredTests.add(CacheGroupsPreloadTest.class); - ignoredTests.add(CacheConnectionLeakStoreTxTest.class); - ignoredTests.add(IgniteCacheInvokeReadThroughTest.class); - ignoredTests.add(IgniteCacheInvokeReadThroughSingleNodeTest.class); - ignoredTests.add(IgniteDynamicCacheStartSelfTest.class); - ignoredTests.add(IgniteDynamicClientCacheStartSelfTest.class); - ignoredTests.add(IgniteDynamicCacheStartNoExchangeTimeoutTest.class); - ignoredTests.add(IgniteCacheSingleGetMessageTest.class); - ignoredTests.add(IgniteCacheReadFromBackupTest.class); - - // Optimistic tx tests. - ignoredTests.add(CacheGetEntryOptimisticReadCommittedSelfTest.class); - ignoredTests.add(CacheGetEntryOptimisticRepeatableReadSelfTest.class); - ignoredTests.add(CacheGetEntryOptimisticSerializableSelfTest.class); - - // Irrelevant Tx tests. - ignoredTests.add(CacheGetEntryPessimisticReadCommittedSelfTest.class); - ignoredTests.add(CacheGetEntryPessimisticSerializableSelfTest.class); - - // Atomic cache tests. - ignoredTests.add(GridCacheMultinodeUpdateAtomicSelfTest.class); - ignoredTests.add(GridCacheMultinodeUpdateAtomicNearEnabledSelfTest.class); - ignoredTests.add(IgniteCacheAtomicLoadAllTest.class); - ignoredTests.add(IgniteCacheAtomicLoaderWriterTest.class); - ignoredTests.add(IgniteCacheAtomicStoreSessionTest.class); - ignoredTests.add(IgniteCacheAtomicStoreSessionWriteBehindTest.class); - ignoredTests.add(IgniteCacheAtomicNoReadThroughTest.class); - ignoredTests.add(IgniteCacheAtomicNearEnabledNoReadThroughTest.class); - ignoredTests.add(CacheGetRemoveSkipStoreTest.class); - ignoredTests.add(IgniteCacheAtomicNoLoadPreviousValueTest.class); - ignoredTests.add(IgniteCacheAtomicNearEnabledNoLoadPreviousValueTest.class); - ignoredTests.add(IgniteCacheAtomicNoWriteThroughTest.class); - ignoredTests.add(IgniteCacheAtomicNearEnabledNoWriteThroughTest.class); - ignoredTests.add(IgniteCacheAtomicPeekModesTest.class); - ignoredTests.add(IgniteCacheAtomicNearPeekModesTest.class); - ignoredTests.add(IgniteCacheAtomicReplicatedPeekModesTest.class); - ignoredTests.add(IgniteCacheAtomicCopyOnReadDisabledTest.class); - ignoredTests.add(IgniteCacheAtomicStoreValueTest.class); - ignoredTests.add(IgniteCacheAtomicNearEnabledStoreValueTest.class); - ignoredTests.add(CacheStoreListenerRWThroughDisabledAtomicCacheTest.class); - ignoredTests.add(CacheStoreUsageMultinodeStaticStartAtomicTest.class); - ignoredTests.add(CacheStoreUsageMultinodeDynamicStartAtomicTest.class); - ignoredTests.add(IgniteStartCacheInTransactionAtomicSelfTest.class); - ignoredTests.add(CacheReadThroughReplicatedAtomicRestartSelfTest.class); - ignoredTests.add(CacheReadThroughAtomicRestartSelfTest.class); - ignoredTests.add(CacheVersionedEntryPartitionedAtomicSelfTest.class); - ignoredTests.add(CacheGetFutureHangsSelfTest.class); - ignoredTests.add(IgniteCacheContainsKeyAtomicTest.class); - ignoredTests.add(CacheVersionedEntryReplicatedAtomicSelfTest.class); - ignoredTests.add(CacheResultIsNotNullOnPartitionLossTest.class); - - // Other non-tx tests. - ignoredTests.add(IgniteDynamicCacheStartStopConcurrentTest.class); - ignoredTests.add(IgniteCacheConfigurationDefaultTemplateTest.class); - ignoredTests.add(IgniteCacheStartTest.class); - ignoredTests.add(CacheDiscoveryDataConcurrentJoinTest.class); - ignoredTests.add(IgniteCacheJdbcBlobStoreNodeRestartTest.class); - ignoredTests.add(IgniteInternalCacheTypesTest.class); - ignoredTests.add(IgniteExchangeFutureHistoryTest.class); - ignoredTests.add(CacheNoValueClassOnServerNodeTest.class); - ignoredTests.add(IgniteSystemCacheOnClientTest.class); - ignoredTests.add(MarshallerCacheJobRunNodeRestartTest.class); - - // Skip classes which Mvcc implementations are added in this method below. - // TODO IGNITE-10175: refactor these tests (use assume) to support both mvcc and non-mvcc modes after moving to JUnit4/5. - ignoredTests.add(IgniteCrossCacheTxSelfTest.class); - - List> suite = new ArrayList<>(IgniteCacheTestSuite4.suite(ignoredTests)); - - // Add Mvcc clones. - suite.add(IgniteCrossCacheMvccTxSelfTest.class); - - return suite; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite5.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite5.java deleted file mode 100644 index a48dc5c9548cb..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite5.java +++ /dev/null @@ -1,124 +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.testsuites; - -import java.util.HashSet; -import java.util.List; -import org.apache.ignite.GridCacheAffinityBackupsSelfTest; -import org.apache.ignite.IgniteCacheAffinitySelfTest; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.cache.affinity.AffinityClientNodeSelfTest; -import org.apache.ignite.cache.affinity.AffinityDistributionLoggingTest; -import org.apache.ignite.cache.affinity.AffinityHistoryCleanupTest; -import org.apache.ignite.internal.GridCachePartitionExchangeManagerHistSizeTest; -import org.apache.ignite.internal.processors.cache.CacheCreateDestroyClusterReadOnlyModeTest; -import org.apache.ignite.internal.processors.cache.CacheSerializableTransactionsTest; -import org.apache.ignite.internal.processors.cache.ClientSlowDiscoveryTransactionRemapTest; -import org.apache.ignite.internal.processors.cache.ClusterReadOnlyModeTest; -import org.apache.ignite.internal.processors.cache.ClusterStateClientPartitionedSelfTest; -import org.apache.ignite.internal.processors.cache.ClusterStateClientReplicatedSelfTest; -import org.apache.ignite.internal.processors.cache.ClusterStateNoRebalancePartitionedTest; -import org.apache.ignite.internal.processors.cache.ClusterStateNoRebalanceReplicatedTest; -import org.apache.ignite.internal.processors.cache.ClusterStatePartitionedSelfTest; -import org.apache.ignite.internal.processors.cache.ClusterStateReplicatedSelfTest; -import org.apache.ignite.internal.processors.cache.ClusterStateThinClientPartitionedSelfTest; -import org.apache.ignite.internal.processors.cache.ClusterStateThinClientReplicatedSelfTest; -import org.apache.ignite.internal.processors.cache.ConcurrentCacheStartTest; -import org.apache.ignite.internal.processors.cache.EntryVersionConsistencyReadThroughTest; -import org.apache.ignite.internal.processors.cache.IgniteCachePutStackOverflowSelfTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheReadThroughEvictionsVariationsSuite; -import org.apache.ignite.internal.processors.cache.IgniteCacheStoreCollectionTest; -import org.apache.ignite.internal.processors.cache.PartitionsExchangeOnDiscoveryHistoryOverflowTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentNodeJoinValidationTest; -import org.apache.ignite.internal.processors.cache.distributed.GridExchangeFreeCellularSwitchComplexOperationsTest; -import org.apache.ignite.internal.processors.cache.distributed.GridExchangeFreeCellularSwitchIsolationTest; -import org.apache.ignite.internal.processors.cache.distributed.GridExchangeFreeCellularSwitchTxContinuationTest; -import org.apache.ignite.internal.processors.cache.distributed.GridExchangeFreeCellularSwitchTxCountersTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheGroupsPartitionLossPolicySelfTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCachePartitionLossPolicySelfTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheTxIteratorSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.NotMappedPartitionInTxTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.IgniteCacheAtomicProtocolTest; -import org.apache.ignite.internal.processors.cache.distributed.rebalancing.CacheManualRebalancingTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.IgniteCacheSyncRebalanceModeSelfTest; -import org.apache.ignite.internal.processors.cache.store.IgniteCacheWriteBehindNoUpdateSelfTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** - * Test suite. - */ -@RunWith(DynamicSuite.class) -public class IgniteCacheMvccTestSuite5 { - /** - * @return IgniteCache test suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - HashSet ignoredTests = new HashSet<>(128); - - // Skip classes that already contains Mvcc tests - ignoredTests.add(IgniteCacheStoreCollectionTest.class); - ignoredTests.add(EntryVersionConsistencyReadThroughTest.class); - ignoredTests.add(ClusterReadOnlyModeTest.class); - ignoredTests.add(CacheCreateDestroyClusterReadOnlyModeTest.class); - ignoredTests.add(NotMappedPartitionInTxTest.class); - ignoredTests.add(IgniteCacheTxIteratorSelfTest.class); - - // Irrelevant Tx tests. - ignoredTests.add(CacheSerializableTransactionsTest.class); - ignoredTests.add(IgniteCachePutStackOverflowSelfTest.class); - ignoredTests.add(IgniteCacheAtomicProtocolTest.class); - - // Other non-tx tests. - ignoredTests.add(CacheLateAffinityAssignmentNodeJoinValidationTest.class); - ignoredTests.add(IgniteCacheWriteBehindNoUpdateSelfTest.class); - ignoredTests.add(IgniteCacheSyncRebalanceModeSelfTest.class); - ignoredTests.add(ClusterStatePartitionedSelfTest.class); - ignoredTests.add(ClusterStateClientPartitionedSelfTest.class); - ignoredTests.add(ClusterStateThinClientPartitionedSelfTest.class); - ignoredTests.add(ClusterStateNoRebalancePartitionedTest.class); - ignoredTests.add(ClusterStateReplicatedSelfTest.class); - ignoredTests.add(ClusterStateClientReplicatedSelfTest.class); - ignoredTests.add(ClusterStateThinClientReplicatedSelfTest.class); - ignoredTests.add(ClusterStateNoRebalanceReplicatedTest.class); - ignoredTests.add(CacheManualRebalancingTest.class); - ignoredTests.add(GridCacheAffinityBackupsSelfTest.class); - ignoredTests.add(IgniteCacheAffinitySelfTest.class); - ignoredTests.add(AffinityClientNodeSelfTest.class); - ignoredTests.add(AffinityHistoryCleanupTest.class); - ignoredTests.add(AffinityDistributionLoggingTest.class); - ignoredTests.add(PartitionsExchangeOnDiscoveryHistoryOverflowTest.class); - ignoredTests.add(GridCachePartitionExchangeManagerHistSizeTest.class); - ignoredTests.add(ConcurrentCacheStartTest.class); - ignoredTests.add(IgniteCacheReadThroughEvictionsVariationsSuite.class); - ignoredTests.add(ClientSlowDiscoveryTransactionRemapTest.class); - - // Cellular switch can't be performed on MVCC caches, at least at the moment. - ignoredTests.add(GridExchangeFreeCellularSwitchIsolationTest.class); - ignoredTests.add(GridExchangeFreeCellularSwitchComplexOperationsTest.class); - ignoredTests.add(GridExchangeFreeCellularSwitchTxContinuationTest.class); - ignoredTests.add(GridExchangeFreeCellularSwitchTxCountersTest.class); - - ignoredTests.add(IgniteCachePartitionLossPolicySelfTest.class); - ignoredTests.add(IgniteCacheGroupsPartitionLossPolicySelfTest.class); - - return IgniteCacheTestSuite5.suite(ignoredTests); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite6.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite6.java deleted file mode 100644 index a54d65a1cc7e8..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite6.java +++ /dev/null @@ -1,120 +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.testsuites; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.processors.cache.CacheIgniteOutOfMemoryExceptionTest; -import org.apache.ignite.internal.processors.cache.PartitionedAtomicCacheGetsDistributionTest; -import org.apache.ignite.internal.processors.cache.PartitionedMvccTxPessimisticCacheGetsDistributionTest; -import org.apache.ignite.internal.processors.cache.PartitionedTransactionalOptimisticCacheGetsDistributionTest; -import org.apache.ignite.internal.processors.cache.PartitionedTransactionalPessimisticCacheGetsDistributionTest; -import org.apache.ignite.internal.processors.cache.PartitionsExchangeCoordinatorFailoverTest; -import org.apache.ignite.internal.processors.cache.ReplicatedAtomicCacheGetsDistributionTest; -import org.apache.ignite.internal.processors.cache.ReplicatedMvccTxPessimisticCacheGetsDistributionTest; -import org.apache.ignite.internal.processors.cache.ReplicatedTransactionalOptimisticCacheGetsDistributionTest; -import org.apache.ignite.internal.processors.cache.ReplicatedTransactionalPessimisticCacheGetsDistributionTest; -import org.apache.ignite.internal.processors.cache.datastructures.IgniteExchangeLatchManagerCoordinatorFailTest; -import org.apache.ignite.internal.processors.cache.datastructures.IgniteExchangeLatchManagerDiscoHistoryTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheExchangeMergeTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheParallelStartTest; -import org.apache.ignite.internal.processors.cache.distributed.CachePartitionLossWithRestartsTest; -import org.apache.ignite.internal.processors.cache.distributed.ExchangeMergeStaleServerNodesTest; -import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionEvictionDuringReadThroughSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheMultiClientsStartTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteOptimisticTxSuspendResumeTest; -import org.apache.ignite.internal.processors.cache.distributed.OnePhaseCommitAndNodeLeftTest; -import org.apache.ignite.internal.processors.cache.distributed.PartitionsExchangeAwareTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.latch.ExchangeLatchManagerTest; -import org.apache.ignite.internal.processors.cache.transactions.TxOptimisticOnPartitionExchangeTest; -import org.apache.ignite.internal.processors.cache.transactions.TxOptimisticPrepareOnUnstableTopologyTest; -import org.apache.ignite.internal.processors.cache.transactions.TxOptimisticReadThroughTest; -import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTimeoutOnePhaseCommitTest; -import org.apache.ignite.internal.processors.cache.transactions.TxStateChangeEventTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** - * Test suite. - */ -@RunWith(DynamicSuite.class) -public class IgniteCacheMvccTestSuite6 { - /** - * @return IgniteCache test suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - Set ignoredTests = new HashSet<>(); - - // Skip classes that already contains Mvcc tests - ignoredTests.add(TxStateChangeEventTest.class); - - // Atomic cache tests. - ignoredTests.add(ReplicatedAtomicCacheGetsDistributionTest.class); - ignoredTests.add(PartitionedAtomicCacheGetsDistributionTest.class); - ignoredTests.add(GridCachePartitionEvictionDuringReadThroughSelfTest.class); - - // Irrelevant Tx tests. - ignoredTests.add(IgniteOptimisticTxSuspendResumeTest.class); - ignoredTests.add(TxOptimisticPrepareOnUnstableTopologyTest.class); - ignoredTests.add(ReplicatedTransactionalOptimisticCacheGetsDistributionTest.class); - ignoredTests.add(PartitionedTransactionalOptimisticCacheGetsDistributionTest.class); - ignoredTests.add(TxOptimisticOnPartitionExchangeTest.class); - - ignoredTests.add(TxRollbackOnTimeoutOnePhaseCommitTest.class); - - // Other non-tx tests. - ignoredTests.add(CacheExchangeMergeTest.class); - ignoredTests.add(ExchangeMergeStaleServerNodesTest.class); - ignoredTests.add(IgniteExchangeLatchManagerCoordinatorFailTest.class); - ignoredTests.add(IgniteExchangeLatchManagerDiscoHistoryTest.class); - ignoredTests.add(ExchangeLatchManagerTest.class); - ignoredTests.add(PartitionsExchangeCoordinatorFailoverTest.class); - ignoredTests.add(CacheParallelStartTest.class); - ignoredTests.add(IgniteCacheMultiClientsStartTest.class); - ignoredTests.add(CacheIgniteOutOfMemoryExceptionTest.class); - ignoredTests.add(OnePhaseCommitAndNodeLeftTest.class); - - // Skip tests that has Mvcc clones. - // See PartitionedMvccTxPessimisticCacheGetsDistributionTest. - ignoredTests.add(PartitionedTransactionalPessimisticCacheGetsDistributionTest.class); - //See ReplicatedMvccTxPessimisticCacheGetsDistributionTest - ignoredTests.add(ReplicatedTransactionalPessimisticCacheGetsDistributionTest.class); - - // Read-through is not allowed with MVCC and transactional cache. - ignoredTests.add(TxOptimisticReadThroughTest.class); - - // TODO https://issues.apache.org/jira/browse/IGNITE-13051 - ignoredTests.add(CachePartitionLossWithRestartsTest.class); - - List> suite = new ArrayList<>((IgniteCacheTestSuite6.suite(ignoredTests))); - - // Add mvcc versions for skipped tests. - suite.add(PartitionedMvccTxPessimisticCacheGetsDistributionTest.class); - suite.add(ReplicatedMvccTxPessimisticCacheGetsDistributionTest.class); - - // This exchange test is irrelevant to MVCC. - suite.add(PartitionsExchangeAwareTest.class); - - return suite; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite7.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite7.java deleted file mode 100644 index 3c0abd94572f9..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite7.java +++ /dev/null @@ -1,88 +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.testsuites; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.processors.authentication.Authentication1kUsersNodeRestartTest; -import org.apache.ignite.internal.processors.authentication.AuthenticationConfigurationClusterTest; -import org.apache.ignite.internal.processors.authentication.AuthenticationOnNotActiveClusterTest; -import org.apache.ignite.internal.processors.authentication.AuthenticationProcessorNPEOnStartTest; -import org.apache.ignite.internal.processors.authentication.AuthenticationProcessorNodeRestartTest; -import org.apache.ignite.internal.processors.authentication.AuthenticationProcessorSelfTest; -import org.apache.ignite.internal.processors.cache.CacheDataRegionConfigurationTest; -import org.apache.ignite.internal.processors.cache.CacheGroupMetricsTest; -import org.apache.ignite.internal.processors.cache.MvccCacheGroupMetricsTest; -import org.apache.ignite.internal.processors.cache.distributed.Cache64kPartitionsTest; -import org.apache.ignite.internal.processors.cache.distributed.CachePartitionLostAfterSupplierHasLeftTest; -import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRebalancingPartitionCountersMvccTest; -import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRebalancingPartitionCountersTest; -import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRebalancingWithAsyncClearingMvccTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.PageEvictionMultinodeMixedRegionsTest; -import org.apache.ignite.internal.processors.cache.persistence.db.CheckpointBufferDeadlockTest; -import org.apache.ignite.internal.processors.cache.transactions.TxCrossCacheMapOnInvalidTopologyTest; -import org.apache.ignite.internal.processors.cache.transactions.TxCrossCacheRemoteMultiplePartitionReservationTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** */ -@RunWith(DynamicSuite.class) -public class IgniteCacheMvccTestSuite7 { - /** - * @return IgniteCache test suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - HashSet ignoredTests = new HashSet<>(128); - - // Skip classes that already contains Mvcc tests - ignoredTests.add(PageEvictionMultinodeMixedRegionsTest.class); - - // Other non-tx tests. - ignoredTests.add(CheckpointBufferDeadlockTest.class); // - ignoredTests.add(AuthenticationConfigurationClusterTest.class); // - ignoredTests.add(AuthenticationProcessorSelfTest.class); - ignoredTests.add(AuthenticationOnNotActiveClusterTest.class); - ignoredTests.add(AuthenticationProcessorNodeRestartTest.class); - ignoredTests.add(AuthenticationProcessorNPEOnStartTest.class); - ignoredTests.add(Authentication1kUsersNodeRestartTest.class); - ignoredTests.add(CacheDataRegionConfigurationTest.class); - ignoredTests.add(Cache64kPartitionsTest.class); - - // Skip classes which Mvcc implementations are added in this method below. - // TODO IGNITE-10175: refactor these tests (use assume) to support both mvcc and non-mvcc modes after moving to JUnit4/5. - ignoredTests.add(CacheGroupMetricsTest.class); // See MvccCacheGroupMetricsMBeanTest - ignoredTests.add(GridCacheRebalancingPartitionCountersTest.class); // See GridCacheRebalancingPartitionCountersMvccTest - ignoredTests.add(CachePartitionLostAfterSupplierHasLeftTest.class); // Data loss partially works with MVCC. - - // Test logic is not compatible with MVCC style tx locking. - ignoredTests.add(TxCrossCacheMapOnInvalidTopologyTest.class); - ignoredTests.add(TxCrossCacheRemoteMultiplePartitionReservationTest.class); - - List> suite = new ArrayList<>(IgniteCacheTestSuite7.suite(ignoredTests)); - - // Add Mvcc clones. - suite.add(MvccCacheGroupMetricsTest.class); - suite.add(GridCacheRebalancingPartitionCountersMvccTest.class); - suite.add(GridCacheRebalancingWithAsyncClearingMvccTest.class); - - return suite; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite8.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite8.java deleted file mode 100644 index 5b9a176c3b6e0..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite8.java +++ /dev/null @@ -1,124 +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.testsuites; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorNearPartitionedAtomicCacheGroupsTest; -import org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorNearPartitionedAtomicCacheTest; -import org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorPartitionedAtomicCacheGroupsTest; -import org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorPartitionedAtomicCacheTest; -import org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorReplicatedAtomicCacheGroupsTest; -import org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorReplicatedAtomicCacheTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEvictionSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPartitionedMetricsSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPartitionedTckMetricsSelfTestImpl; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheMvccNearEvictionSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearAtomicMetricsSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearEvictionSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.rebalancing.GridCacheRabalancingDelayedPartitionMapExchangeSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheAtomicReplicatedMetricsSelfTest; -import org.apache.ignite.internal.processors.cache.eviction.EvictionPolicyFailureHandlerTest; -import org.apache.ignite.internal.processors.cache.eviction.GridCacheEvictableEntryEqualsSelfTest; -import org.apache.ignite.internal.processors.cache.eviction.fifo.FifoEvictionPolicyFactorySelfTest; -import org.apache.ignite.internal.processors.cache.eviction.fifo.FifoEvictionPolicySelfTest; -import org.apache.ignite.internal.processors.cache.eviction.lru.LruEvictionPolicyFactorySelfTest; -import org.apache.ignite.internal.processors.cache.eviction.lru.LruEvictionPolicySelfTest; -import org.apache.ignite.internal.processors.cache.eviction.lru.LruNearEvictionPolicySelfTest; -import org.apache.ignite.internal.processors.cache.eviction.lru.LruNearOnlyNearEvictionPolicySelfTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.PageEvictionDataStreamerTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.PageEvictionMetricTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.PageEvictionPagesRecyclingAndReusingTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.PageEvictionReadThroughTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.PageEvictionTouchOrderTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.Random2LruNearEnabledPageEvictionMultinodeTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.Random2LruPageEvictionMultinodeTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.Random2LruPageEvictionWithRebalanceTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.RandomLruNearEnabledPageEvictionMultinodeTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.RandomLruPageEvictionMultinodeTest; -import org.apache.ignite.internal.processors.cache.eviction.paged.RandomLruPageEvictionWithRebalanceTest; -import org.apache.ignite.internal.processors.cache.eviction.sorted.SortedEvictionPolicyFactorySelfTest; -import org.apache.ignite.internal.processors.cache.eviction.sorted.SortedEvictionPolicySelfTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** */ -@RunWith(DynamicSuite.class) -public class IgniteCacheMvccTestSuite8 { - /** - * @return IgniteCache test suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - HashSet ignoredTests = new HashSet<>(128); - - // Skip classes that already contains Mvcc tests - ignoredTests.add(LruNearEvictionPolicySelfTest.class); - ignoredTests.add(LruNearOnlyNearEvictionPolicySelfTest.class); - ignoredTests.add(RandomLruPageEvictionMultinodeTest.class); - ignoredTests.add(RandomLruNearEnabledPageEvictionMultinodeTest.class); - ignoredTests.add(PageEvictionDataStreamerTest.class); - ignoredTests.add(Random2LruPageEvictionMultinodeTest.class); - ignoredTests.add(Random2LruNearEnabledPageEvictionMultinodeTest.class); - ignoredTests.add(RandomLruPageEvictionWithRebalanceTest.class); - ignoredTests.add(Random2LruPageEvictionWithRebalanceTest.class); - ignoredTests.add(PageEvictionTouchOrderTest.class); - ignoredTests.add(PageEvictionReadThroughTest.class); - ignoredTests.add(PageEvictionMetricTest.class); - ignoredTests.add(PageEvictionPagesRecyclingAndReusingTest.class); - - // Irrelevant Tx tests. - ignoredTests.add(GridCacheEvictableEntryEqualsSelfTest.class); - - // Atomic cache tests. - ignoredTests.add(GridCacheNearAtomicMetricsSelfTest.class); - ignoredTests.add(GridCacheAtomicReplicatedMetricsSelfTest.class); - ignoredTests.add(GridCacheAtomicPartitionedMetricsSelfTest.class); - ignoredTests.add(GridCacheAtomicPartitionedTckMetricsSelfTestImpl.class); - ignoredTests.add(IgniteTopologyValidatorPartitionedAtomicCacheTest.class); - ignoredTests.add(IgniteTopologyValidatorNearPartitionedAtomicCacheTest.class); - ignoredTests.add(IgniteTopologyValidatorReplicatedAtomicCacheTest.class); - ignoredTests.add(IgniteTopologyValidatorNearPartitionedAtomicCacheGroupsTest.class); - ignoredTests.add(IgniteTopologyValidatorPartitionedAtomicCacheGroupsTest.class); - ignoredTests.add(IgniteTopologyValidatorReplicatedAtomicCacheGroupsTest.class); - - // Other non-tx tests. - ignoredTests.add(FifoEvictionPolicySelfTest.class); - ignoredTests.add(SortedEvictionPolicySelfTest.class); - ignoredTests.add(LruEvictionPolicySelfTest.class); - ignoredTests.add(FifoEvictionPolicyFactorySelfTest.class); - ignoredTests.add(SortedEvictionPolicyFactorySelfTest.class); - ignoredTests.add(LruEvictionPolicyFactorySelfTest.class); - ignoredTests.add(EvictionPolicyFailureHandlerTest.class); - ignoredTests.add(GridCacheAtomicNearEvictionSelfTest.class); - ignoredTests.add(GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.class); - - // Skip classes which Mvcc implementations are added in this method below. - // TODO IGNITE-10175: refactor these tests (use assume) to support both mvcc and non-mvcc modes after moving to JUnit4/5. - ignoredTests.add(GridCacheNearEvictionSelfTest.class); // See GridCacheMvccNearEvictionSelfTest - - List> suite = new ArrayList<>(IgniteCacheTestSuite8.suite(ignoredTests)); - - // Add Mvcc clones. - suite.add(GridCacheMvccNearEvictionSelfTest.class); - - return suite; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java deleted file mode 100644 index c1decfe038036..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java +++ /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. - */ - -package org.apache.ignite.testsuites; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.metric.IoStatisticsCachePersistenceSelfTest; -import org.apache.ignite.internal.metric.IoStatisticsCacheSelfTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheGetCustomCollectionsSelfTest; -import org.apache.ignite.internal.processors.cache.IgniteCacheLoadRebalanceEvictionSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.CacheAtomicPrimarySyncBackPressureTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteCachePrimarySyncTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteTxCachePrimarySyncTest; -import org.apache.ignite.internal.processors.cache.distributed.IgniteTxConcurrentRemoveObjectsTest; -import org.apache.ignite.internal.processors.cache.transactions.TxCrossCachePartitionConsistencyTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateConsistencyHistoryRebalanceTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateConsistencyTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateConsistencyVolatileRebalanceTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateOnePrimaryOneBackupHistoryRebalanceTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateOnePrimaryOneBackupTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateOnePrimaryTwoBackupsFailAllHistoryRebalanceTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateOnePrimaryTwoBackupsFailAllTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateOnePrimaryTwoBackupsHistoryRebalanceTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateOnePrimaryTwoBackupsTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStatePutTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateTwoPrimaryTwoBackupsTest; -import org.apache.ignite.internal.processors.cache.transactions.TxPartitionCounterStateWithFilterTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** - * Test suite. - */ -@RunWith(DynamicSuite.class) -public class IgniteCacheMvccTestSuite9 { - /** - * @return IgniteCache test suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - Collection ignoredTests = new HashSet<>(); - - // Skip classes that already contains Mvcc tests - ignoredTests.add(IgniteTxConcurrentRemoveObjectsTest.class); - - // Non supported modes. - ignoredTests.add(IgniteCachePrimarySyncTest.class); - ignoredTests.add(IgniteTxCachePrimarySyncTest.class); - - // Atomic caches. - ignoredTests.add(CacheAtomicPrimarySyncBackPressureTest.class); - - // Other non-tx tests. - ignoredTests.add(IgniteCacheGetCustomCollectionsSelfTest.class); - ignoredTests.add(IgniteCacheLoadRebalanceEvictionSelfTest.class); - - // Non-mvcc counters and history rebalance. - ignoredTests.add(TxPartitionCounterStateOnePrimaryOneBackupHistoryRebalanceTest.class); - ignoredTests.add(TxPartitionCounterStateOnePrimaryOneBackupTest.class); - ignoredTests.add(TxPartitionCounterStateOnePrimaryTwoBackupsFailAllHistoryRebalanceTest.class); - ignoredTests.add(TxPartitionCounterStateOnePrimaryTwoBackupsFailAllTest.class); - ignoredTests.add(TxPartitionCounterStateOnePrimaryTwoBackupsHistoryRebalanceTest.class); - ignoredTests.add(TxPartitionCounterStateOnePrimaryTwoBackupsTest.class); - ignoredTests.add(TxPartitionCounterStatePutTest.class); - ignoredTests.add(TxPartitionCounterStateTwoPrimaryTwoBackupsTest.class); - ignoredTests.add(TxPartitionCounterStateWithFilterTest.class); - ignoredTests.add(TxPartitionCounterStateConsistencyTest.class); - ignoredTests.add(TxPartitionCounterStateConsistencyHistoryRebalanceTest.class); - ignoredTests.add(TxPartitionCounterStateConsistencyVolatileRebalanceTest.class); - ignoredTests.add(TxCrossCachePartitionConsistencyTest.class); - - // IO statistics. - ignoredTests.add(IoStatisticsCacheSelfTest.class); - ignoredTests.add(IoStatisticsCachePersistenceSelfTest.class); - - return new ArrayList<>(IgniteCacheTestSuite9.suite(ignoredTests)); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java index 8a2359b10be61..868c442d5eda1 100755 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java @@ -52,9 +52,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheConfigurationConsistencySelfTest; import org.apache.ignite.internal.processors.cache.GridCacheConfigurationValidationSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheEntryMemorySizeSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMvccManagerSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMvccPartitionedSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMvccSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheObjectToStringSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheP2PUndeploySelfTest; import org.apache.ignite.internal.processors.cache.GridCacheStoreValueBytesSelfTest; @@ -166,9 +163,6 @@ public static List> suite(Collection ignoredTests) { GridTestUtils.addTestIfNeeded(suite, GridCacheAffinityMapperSelfTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, CacheAffinityCallSelfTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, GridCacheAffinityRoutingSelfTest.class, ignoredTests); - GridTestUtils.addTestIfNeeded(suite, GridCacheMvccSelfTest.class, ignoredTests); - GridTestUtils.addTestIfNeeded(suite, GridCacheMvccPartitionedSelfTest.class, ignoredTests); - GridTestUtils.addTestIfNeeded(suite, GridCacheMvccManagerSelfTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, GridCacheP2PUndeploySelfTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, GridCacheConfigurationValidationSelfTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, GridCacheConfigurationConsistencySelfTest.class, ignoredTests); diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite10.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite10.java index e6e99704fc967..27dbaeccad09a 100755 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite10.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite10.java @@ -52,7 +52,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheLifecycleAwareSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheMissingCommitVersionSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheMixedPartitionExchangeSelfTest; -import org.apache.ignite.internal.processors.cache.GridCacheMvccFlagsTest; import org.apache.ignite.internal.processors.cache.GridCacheNearTxStoreExceptionSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheOffHeapAtomicMultiThreadedUpdateSelfTest; import org.apache.ignite.internal.processors.cache.GridCacheOffHeapMultiThreadedUpdateSelfTest; @@ -202,7 +201,6 @@ public static List> suite(Collection ignoredTests) { GridTestUtils.addTestIfNeeded(suite, GridCacheConcurrentGetCacheOnClientTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, GridCacheLeakTest.class, ignoredTests); - GridTestUtils.addTestIfNeeded(suite, GridCacheMvccFlagsTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, GridCacheReturnValueTransferSelfTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, GridCacheSlowTxWarnTest.class, ignoredTests); GridTestUtils.addTestIfNeeded(suite, GridCacheTtlManagerLoadTest.class, ignoredTests); diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite.java deleted file mode 100644 index 796547e1f9df0..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite.java +++ /dev/null @@ -1,90 +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.testsuites; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsCacheConfigurationFileConsistencyCheckTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsCacheObjectBinaryProcessorOnDiscoveryTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsDestroyCacheTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsDestroyCacheWithoutCheckpointsTest; -import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsDataRegionMetricsTest; -import org.apache.ignite.internal.processors.cache.persistence.db.file.DefaultPageSizeBackwardsCompatibilityTest; -import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsCheckpointSimpleTest; -import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsCheckpointSimulationWithRealCpDisabledTest; -import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsPageReplacementTest; -import org.apache.ignite.internal.processors.cache.persistence.metastorage.IgniteMetaStorageBasicTest; -import org.apache.ignite.internal.processors.cache.persistence.pagemem.BPlusTreePageMemoryImplTest; -import org.apache.ignite.internal.processors.cache.persistence.pagemem.BPlusTreeReuseListPageMemoryImplTest; -import org.apache.ignite.internal.processors.cache.persistence.pagemem.FillFactorMetricTest; -import org.apache.ignite.internal.processors.cache.persistence.pagemem.IndexStoragePageMemoryImplTest; -import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImplNoLoadTest; -import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImplTest; -import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryNoStoreLeakTest; -import org.apache.ignite.internal.processors.cache.persistence.pagemem.PagesWriteThrottleSmokeTest; -import org.apache.ignite.internal.processors.cache.persistence.wal.SegmentedRingByteBufferTest; -import org.apache.ignite.internal.processors.cache.persistence.wal.aware.SegmentAwareTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** */ -@RunWith(DynamicSuite.class) -public class IgnitePdsMvccTestSuite { - /** - * @return Suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - Set ignoredTests = new HashSet<>(); - - // Skip classes that already contains Mvcc tests. - ignoredTests.add(IgnitePdsCheckpointSimulationWithRealCpDisabledTest.class); - - // Atomic tests. - ignoredTests.add(IgnitePdsDataRegionMetricsTest.class); - - // Non-relevant tests. - ignoredTests.add(IgnitePdsCacheConfigurationFileConsistencyCheckTest.class); - ignoredTests.add(DefaultPageSizeBackwardsCompatibilityTest.class); - ignoredTests.add(IgniteMetaStorageBasicTest.class); - - ignoredTests.add(IgnitePdsPageReplacementTest.class); - - ignoredTests.add(PageMemoryImplNoLoadTest.class); - ignoredTests.add(PageMemoryNoStoreLeakTest.class); - ignoredTests.add(IndexStoragePageMemoryImplTest.class); - ignoredTests.add(PageMemoryImplTest.class); - ignoredTests.add(BPlusTreePageMemoryImplTest.class); - ignoredTests.add(BPlusTreeReuseListPageMemoryImplTest.class); - ignoredTests.add(SegmentedRingByteBufferTest.class); - ignoredTests.add(PagesWriteThrottleSmokeTest.class); - ignoredTests.add(FillFactorMetricTest.class); - ignoredTests.add(IgnitePdsCacheObjectBinaryProcessorOnDiscoveryTest.class); - ignoredTests.add(SegmentAwareTest.class); - - ignoredTests.add(IgnitePdsDestroyCacheTest.class); - ignoredTests.add(IgnitePdsDestroyCacheWithoutCheckpointsTest.class); - ignoredTests.add(IgnitePdsCheckpointSimpleTest.class); - - return new ArrayList<>(IgnitePdsTestSuite.suite(ignoredTests)); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite2.java deleted file mode 100644 index 3c923197beb7d..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite2.java +++ /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. - */ - -package org.apache.ignite.testsuites; - -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.processors.cache.persistence.IgniteDataStorageMetricsSelfTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsExchangeDuringCheckpointTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsPageSizesTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePersistentStoreDataStructuresTest; -import org.apache.ignite.internal.processors.cache.persistence.LocalWalModeNoChangeDuringRebalanceOnNonNodeAssignTest; -import org.apache.ignite.internal.processors.cache.persistence.baseline.IgniteAbsentEvictionNodeOutOfBaselineTest; -import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsReserveWalSegmentsTest; -import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsReserveWalSegmentsWithCompactionTest; -import org.apache.ignite.internal.processors.cache.persistence.db.IgniteShutdownOnSupplyMessageFailureTest; -import org.apache.ignite.internal.processors.cache.persistence.db.filename.IgniteUidAsConsistentIdMigrationTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.FsyncWalRolloverDoesNotBlockTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWALTailIsReachedDuringIterationOverArchiveTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalFormatFileFailoverTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalIteratorExceptionDuringReadTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalIteratorSwitchSegmentTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalRebalanceLoggingTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalSerializerVersionTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalCompactionNoArchiverTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalCompactionSwitchOnTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalCompactionTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalRolloverTypesTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.crc.IgniteDataIntegrityTests; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.crc.IgniteFsyncReplayWalIteratorInvalidCrcTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.crc.IgnitePureJavaCrcCompatibility; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.crc.IgniteReplayWalIteratorInvalidCrcTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.crc.IgniteStandaloneWalIteratorInvalidCrcTest; -import org.apache.ignite.internal.processors.cache.persistence.wal.reader.StandaloneWalRecordsIteratorTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** */ -@RunWith(DynamicSuite.class) -public class IgnitePdsMvccTestSuite2 { - /** - * @return Suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - Collection ignoredTests = new HashSet<>(); - - // TODO IGNITE-7384: include test when implemented. - ignoredTests.add(IgniteShutdownOnSupplyMessageFailureTest.class); - - // Classes that are contained mvcc test already. - ignoredTests.add(LocalWalModeNoChangeDuringRebalanceOnNonNodeAssignTest.class); - - // Atomic caches - ignoredTests.add(IgnitePersistentStoreDataStructuresTest.class); - - // Skip irrelevant test - ignoredTests.add(IgniteDataIntegrityTests.class); - ignoredTests.add(IgniteStandaloneWalIteratorInvalidCrcTest.class); - ignoredTests.add(IgniteReplayWalIteratorInvalidCrcTest.class); - ignoredTests.add(IgniteFsyncReplayWalIteratorInvalidCrcTest.class); - ignoredTests.add(IgnitePureJavaCrcCompatibility.class); - ignoredTests.add(IgniteAbsentEvictionNodeOutOfBaselineTest.class); - - ignoredTests.add(IgnitePdsPageSizesTest.class); - ignoredTests.add(IgniteDataStorageMetricsSelfTest.class); - ignoredTests.add(IgniteWalFormatFileFailoverTest.class); - ignoredTests.add(IgnitePdsExchangeDuringCheckpointTest.class); - ignoredTests.add(IgnitePdsReserveWalSegmentsTest.class); - ignoredTests.add(IgnitePdsReserveWalSegmentsWithCompactionTest.class); - - ignoredTests.add(IgniteUidAsConsistentIdMigrationTest.class); - ignoredTests.add(IgniteWalSerializerVersionTest.class); - ignoredTests.add(WalCompactionTest.class); - ignoredTests.add(WalCompactionNoArchiverTest.class); - ignoredTests.add(WalCompactionSwitchOnTest.class); - ignoredTests.add(IgniteWalIteratorSwitchSegmentTest.class); - ignoredTests.add(IgniteWalIteratorExceptionDuringReadTest.class); - ignoredTests.add(StandaloneWalRecordsIteratorTest.class); - ignoredTests.add(IgniteWALTailIsReachedDuringIterationOverArchiveTest.class); - ignoredTests.add(WalRolloverTypesTest.class); - ignoredTests.add(IgniteWalRebalanceLoggingTest.class); - ignoredTests.add(FsyncWalRolloverDoesNotBlockTest.class); - - return IgnitePdsTestSuite2.suite(ignoredTests); - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite3.java deleted file mode 100644 index ce30db82c2899..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite3.java +++ /dev/null @@ -1,47 +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.testsuites; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.processors.cache.persistence.EagerTtlTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** - * Mvcc version of {@link IgnitePdsTestSuite3}. - */ -@RunWith(DynamicSuite.class) -public class IgnitePdsMvccTestSuite3 { - /** - * @return IgniteCache test suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - HashSet ignoredTests = new HashSet<>(); - - // Following classes will be skipped in this suite. - ignoredTests.add(EagerTtlTest.class); - - List> suite = new ArrayList<>(IgnitePdsTestSuite3.suite(ignoredTests)); - - return suite; - } -} diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite4.java deleted file mode 100644 index 865694223b5cc..0000000000000 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsMvccTestSuite4.java +++ /dev/null @@ -1,85 +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.testsuites; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import org.apache.ignite.IgniteSystemProperties; -import org.apache.ignite.internal.processors.cache.expiry.ActivationOnExpirationTimeoutTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsCacheEntriesExpirationTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsContinuousRestartTestWithSharedGroupAndIndexes; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsDefragmentationEncryptionTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsDefragmentationRandomLruEvictionTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsDefragmentationTest; -import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsTaskCancelingTest; -import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPartitionPreloadTest; -import org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManagerTest; -import org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.SharedPageLockTrackerTest; -import org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.dumpprocessors.ToFileDumpProcessorTest; -import org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.dumpprocessors.ToStringDumpHelperTest; -import org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.log.HeapArrayLockLogTest; -import org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.log.OffHeapLockLogTest; -import org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.stack.HeapArrayLockStackTest; -import org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.stack.OffHeapLockStackTest; -import org.apache.ignite.internal.processors.cache.persistence.file.FileDownloaderTest; -import org.apache.ignite.testframework.junits.DynamicSuite; -import org.junit.runner.RunWith; - -/** - * Mvcc variant of {@link IgnitePdsTestSuite4}. - */ -@RunWith(DynamicSuite.class) -public class IgnitePdsMvccTestSuite4 { - /** - * @return Suite. - */ - public static List> suite() { - System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, "true"); - - Set ignoredTests = new HashSet<>(); - - // Skip classes that already contains Mvcc tests - ignoredTests.add(IgnitePdsPartitionPreloadTest.class); - - // Skip irrelevant test - ignoredTests.add(FileDownloaderTest.class); - ignoredTests.add(IgnitePdsTaskCancelingTest.class); - - // TODO https://issues.apache.org/jira/browse/IGNITE-11937 - ignoredTests.add(IgnitePdsContinuousRestartTestWithSharedGroupAndIndexes.class); - - // Skip page lock tracker tests for MVCC suite. - ignoredTests.add(PageLockTrackerManagerTest.class); - ignoredTests.add(SharedPageLockTrackerTest.class); - ignoredTests.add(ToFileDumpProcessorTest.class); - ignoredTests.add(ToStringDumpHelperTest.class); - ignoredTests.add(HeapArrayLockLogTest.class); - ignoredTests.add(HeapArrayLockStackTest.class); - ignoredTests.add(OffHeapLockLogTest.class); - ignoredTests.add(OffHeapLockStackTest.class); - ignoredTests.add(IgnitePdsCacheEntriesExpirationTest.class); - ignoredTests.add(ActivationOnExpirationTimeoutTest.class); - - // Defragmentation. - ignoredTests.add(IgnitePdsDefragmentationTest.class); - ignoredTests.add(IgnitePdsDefragmentationRandomLruEvictionTest.class); - ignoredTests.add(IgnitePdsDefragmentationEncryptionTest.class); - - return IgnitePdsTestSuite4.suite(ignoredTests); - } -} 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 6fd93d544e5df..7c84d3bce047b 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 @@ private static void processExtraParam(String name, String val, GridSqlCreateTabl 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/GridCacheSqlDdlClusterReadOnlyModeTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSqlDdlClusterReadOnlyModeTest.java index c50e36ca6b5a6..79813e762b9cb 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSqlDdlClusterReadOnlyModeTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSqlDdlClusterReadOnlyModeTest.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.List; import org.apache.ignite.Ignite; -import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.cluster.ClusterState; import org.apache.ignite.configuration.CacheConfiguration; @@ -106,11 +105,6 @@ public void testAlterTableAllowed() { for (CacheConfiguration cfg : cacheConfigurations()) { String cacheName = cfg.getName(); - if (cfg.getAtomicityMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) { - // Drop column doesn't support in MVCC mode. - continue; - } - for (Ignite node : G.allGrids()) { String selectSql = "select city from " + tableName(cacheName); 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 c281187c605a9..13f7b8b3c9e06 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,11 +48,7 @@ public static Iterable params() { CacheMode[] cacheModes = new CacheMode[] {CacheMode.PARTITIONED, CacheMode.REPLICATED}; - CacheAtomicityMode[] atomicityModes = new CacheAtomicityMode[] { - CacheAtomicityMode.ATOMIC, - CacheAtomicityMode.TRANSACTIONAL, - CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT - }; + CacheAtomicityMode[] atomicityModes = CacheAtomicityMode._values(); List res = new ArrayList<>(); @@ -60,11 +56,7 @@ public static Iterable params() { for (CacheMode cacheMode : cacheModes) { for (CacheAtomicityMode atomicityMode : atomicityModes) { res.add(new Object[] {true, node, cacheMode, atomicityMode}); - - // For TRANSACTIONAL_SNAPSHOT near caches is forbidden. - if (atomicityMode != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - res.add(new Object[] {false, node, cacheMode, atomicityMode}); - + res.add(new Object[] {false, node, cacheMode, atomicityMode}); } } } @@ -104,15 +96,14 @@ public static Iterable params() { CacheConfiguration ccfg = testCacheConfiguration(POI_CACHE_NAME, cacheMode, atomicityMode); - if (hasNear && atomicityMode != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) + if (hasNear) ccfg.setNearConfiguration(new NearCacheConfiguration<>()); node().getOrCreateCache(ccfg); awaitCacheOnClient(grid(IDX_CLI_NEAR_ONLY), POI_CACHE_NAME); - if (atomicityMode != CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - grid(IDX_CLI_NEAR_ONLY).getOrCreateNearCache(POI_CACHE_NAME, new NearCacheConfiguration<>()); + grid(IDX_CLI_NEAR_ONLY).getOrCreateNearCache(POI_CACHE_NAME, new NearCacheConfiguration<>()); } /** {@inheritDoc} */ 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 61a52e0e5d33c..4fef8834e8e7a 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,11 +78,7 @@ public class DynamicEnableIndexingConcurrentSelfTest extends DynamicEnableIndexi public static Iterable params() { CacheMode[] cacheModes = new CacheMode[] {CacheMode.PARTITIONED, CacheMode.REPLICATED}; - CacheAtomicityMode[] atomicityModes = new CacheAtomicityMode[] { - CacheAtomicityMode.ATOMIC, - CacheAtomicityMode.TRANSACTIONAL, - CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT - }; + CacheAtomicityMode[] atomicityModes = CacheAtomicityMode._values(); List res = new ArrayList<>(); for (CacheMode cacheMode : cacheModes) { diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java index 293938049141b..c0a877807dae4 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java @@ -774,8 +774,7 @@ public void testEmptyAtomicity() { @Test public void testInvalidAtomicity() { assertCreateTableWithParamsThrows("atomicity=InvalidValue", - "Invalid value of \"ATOMICITY\" parameter (should be either TRANSACTIONAL, ATOMIC, " + - "TRANSACTIONAL_SNAPSHOT): InvalidValue"); + "Invalid value of \"ATOMICITY\" parameter (should be either TRANSACTIONAL, ATOMIC): InvalidValue"); } /** diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/MvccEmptyTransactionSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/MvccEmptyTransactionSelfTest.java deleted file mode 100644 index ea524d575ad7a..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/MvccEmptyTransactionSelfTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.index; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.Statement; -import java.util.List; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.Ignition; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -/** - * Test for empty transaction while is then enlisted with real value. - */ -public class MvccEmptyTransactionSelfTest extends AbstractIndexingCommonTest { - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** - * @throws Exception If failed. - */ - @SuppressWarnings("unchecked") - @Test - public void testEmptyTransaction() throws Exception { - Ignition.start(config("srv", false)); - - Ignite cli = Ignition.start(config("cli", true)); - - try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1:10801")) { - try (Statement stmt = conn.createStatement()) { - stmt.execute("CREATE TABLE person (id BIGINT PRIMARY KEY, name VARCHAR) " + - "WITH \"atomicity=TRANSACTIONAL_SNAPSHOT, cache_name=PERSON_CACHE\""); - } - } - - IgniteCache cache = cli.cache("PERSON_CACHE"); - - try (Transaction tx = cli.transactions().txStart()) { - // This will cause empty near TX to be created and then rolled back. - cache.query(new SqlFieldsQuery("UPDATE person SET name=?").setArgs("Petr")).getAll(); - - // One more time. - cache.query(new SqlFieldsQuery("UPDATE person SET name=?").setArgs("Petr")).getAll(); - - // Normal transaction is created, and several updates are performed. - cache.query(new SqlFieldsQuery("INSERT INTO person VALUES (?, ?)").setArgs(1, "Ivan")).getAll(); - cache.query(new SqlFieldsQuery("UPDATE person SET name=?").setArgs("Sergey")).getAll(); - - // Another update with empty response. - cache.query(new SqlFieldsQuery("UPDATE person SET name=? WHERE name=?").setArgs("Vasiliy", "Ivan")).getAll(); - - // One more normal update. - cache.query(new SqlFieldsQuery("UPDATE person SET name=?").setArgs("Vsevolod")).getAll(); - - tx.commit(); - } - - List> res = cache.query(new SqlFieldsQuery("SELECT name FROM person")).getAll(); - - assert res.size() == 1; - assert res.get(0).size() == 1; - - assertEquals("Vsevolod", (String)res.get(0).get(0)); - } - - /** - * Create config. - * - * @param name Name. - * @param client Client flag. - * @return Config. - */ - private static IgniteConfiguration config(String name, boolean client) { - IgniteConfiguration cfg = new IgniteConfiguration(); - - cfg.setIgniteInstanceName(name); - cfg.setClientMode(client); - - return cfg; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsWithMvccDisabledSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsSelfTest.java similarity index 96% rename from modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsWithMvccDisabledSelfTest.java rename to modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsSelfTest.java index b396c7c2e7f3b..83c213b99dee3 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsWithMvccDisabledSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionCommandsSelfTest.java @@ -25,7 +25,7 @@ /** * */ -public class SqlTransactionCommandsWithMvccDisabledSelfTest extends AbstractSchemaSelfTest { +public class SqlTransactionCommandsSelfTest extends AbstractSchemaSelfTest { /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsCommandsWithMvccEnabledSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsCommandsWithMvccEnabledSelfTest.java deleted file mode 100644 index 171a64179d99f..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsCommandsWithMvccEnabledSelfTest.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.index; - -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Callable; -import javax.cache.processor.EntryProcessor; -import javax.cache.processor.EntryProcessorException; -import javax.cache.processor.MutableEntry; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cache.CacheEntryProcessor; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy; -import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; -import org.apache.ignite.internal.processors.query.QueryUtils; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteFuture; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionState; -import org.junit.Ignore; -import org.junit.Test; - -/** - * Tests to check behavior regarding transactions started via SQL. - */ -public class SqlTransactionsCommandsWithMvccEnabledSelfTest extends AbstractSchemaSelfTest { - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - startGrid(commonConfiguration(0)); - - super.execute(node(), "CREATE TABLE INTS(k int primary key, v int) WITH \"wrap_value=false,cache_name=ints," + - "atomicity=transactional_snapshot\""); - } - - /** - * Test that BEGIN opens a transaction. - */ - @Test - public void testBegin() { - execute(node(), "BEGIN"); - - assertTxPresent(); - - assertTxState(tx(), TransactionState.ACTIVE); - } - - /** - * Test that COMMIT commits a transaction. - */ - @Test - public void testCommit() { - execute(node(), "BEGIN WORK"); - - assertTxPresent(); - - Transaction tx = tx(); - - assertTxState(tx, TransactionState.ACTIVE); - - execute(node(), "COMMIT TRANSACTION"); - - assertTxState(tx, TransactionState.COMMITTED); - - assertSqlTxNotPresent(); - } - - /** - * Test that COMMIT without a transaction yields nothing. - */ - @Test - public void testCommitNoTransaction() { - execute(node(), "COMMIT"); - } - - /** - * Test that ROLLBACK without a transaction yields nothing. - */ - @Test - public void testRollbackNoTransaction() { - execute(node(), "ROLLBACK"); - } - - /** - * Test that ROLLBACK rolls back a transaction. - */ - @Test - public void testRollback() { - execute(node(), "BEGIN TRANSACTION"); - - assertTxPresent(); - - Transaction tx = tx(); - - assertTxState(tx, TransactionState.ACTIVE); - - execute(node(), "ROLLBACK TRANSACTION"); - - assertTxState(tx, TransactionState.ROLLED_BACK); - - assertSqlTxNotPresent(); - } - - /** - * Test that attempting to perform various SQL operations within non SQL transaction yields an exception. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-11357") - @Test - public void testSqlOperationsWithinNonSqlTransaction() { - assertSqlOperationWithinNonSqlTransactionThrows("COMMIT"); - - assertSqlOperationWithinNonSqlTransactionThrows("ROLLBACK"); - - assertSqlOperationWithinNonSqlTransactionThrows("SELECT * from ints"); - - assertSqlOperationWithinNonSqlTransactionThrows("DELETE from ints"); - - assertSqlOperationWithinNonSqlTransactionThrows("INSERT INTO ints(k, v) values(10, 15)"); - - assertSqlOperationWithinNonSqlTransactionThrows("MERGE INTO ints(k, v) values(10, 15)"); - - assertSqlOperationWithinNonSqlTransactionThrows("UPDATE ints SET v = 100 WHERE k = 5"); - - assertSqlOperationWithinNonSqlTransactionThrows("create index idx on ints(v)"); - - assertSqlOperationWithinNonSqlTransactionThrows("CREATE TABLE T(k int primary key, v int)"); - } - - /** - * Check that trying to run given SQL statement both locally and in distributed mode yields an exception - * if transaction already has been marked as being of SQL type. - * @param sql SQL statement. - */ - private void assertSqlOperationWithinNonSqlTransactionThrows(final String sql) { - try (Transaction ignored = node().transactions().txStart()) { - node().cache("ints").put(1, 1); - - assertSqlException(new Runnable() { - @Override public void run() { - execute(node(), sql); - } - }, IgniteQueryErrorCode.TRANSACTION_TYPE_MISMATCH); - } - - try (Transaction ignored = node().transactions().txStart()) { - node().cache("ints").put(1, 1); - - assertSqlException(new Runnable() { - @Override public void run() { - node().cache("ints").query(new SqlFieldsQuery(sql).setLocal(true)).getAll(); - } - }, IgniteQueryErrorCode.TRANSACTION_TYPE_MISMATCH); - } - } - - /** - * Test that attempting to perform a cache API operation from within an SQL transaction fails. - */ - private void checkCacheOperationThrows(final String opName, final Object... args) { - execute(node(), "BEGIN"); - - try { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Object call() throws Exception { - try { - // We need to detect types based on arguments due to multiple overloads. - Class[] types; - - if (F.isEmpty(args)) - types = (Class[])X.EMPTY_OBJECT_ARRAY; - else { - types = new Class[args.length]; - - for (int i = 0; i < args.length; i++) - types[i] = argTypeForObject(args[i]); - } - - Object res = U.invoke(GatewayProtectedCacheProxy.class, node().cache("ints"), - opName, types, args); - - if (opName.endsWith("Async")) - ((IgniteFuture)res).get(); - } - catch (IgniteCheckedException e) { - if (e.getCause() != null) { - try { - if (e.getCause().getCause() != null) - throw (Exception)e.getCause().getCause(); - else - fail(); - } - catch (IgniteException e1) { - // Some public API methods don't have IgniteCheckedException on their signature - // and thus may wrap it into an IgniteException. - if (e1.getCause() != null) - throw (Exception)e1.getCause(); - else - fail(); - } - } - else - fail(); - } - - return null; - } - }, UnsupportedOperationException.class, - "operations are not supported on transactional caches when MVCC is enabled."); - } - finally { - try { - execute(node(), "ROLLBACK"); - } - catch (Throwable e) { - // No-op. - } - } - } - - /** - * - */ - private static Class argTypeForObject(Object arg) { - if (arg instanceof Set) - return Set.class; - else if (arg instanceof Map) - return Map.class; - else if (arg.getClass().getName().startsWith("java.lang.")) - return Object.class; - else if (arg instanceof CacheEntryProcessor) - return CacheEntryProcessor.class; - else if (arg instanceof EntryProcessor) - return EntryProcessor.class; - else - return arg.getClass(); - } - - /** */ - private static final EntryProcessor ENTRY_PROC = - new EntryProcessor() { - @Override public Object process(MutableEntry entry, Object... arguments) - throws EntryProcessorException { - return null; - } - }; - - /** */ - private static final CacheEntryProcessor CACHE_ENTRY_PROC = - new CacheEntryProcessor() { - @Override public Object process(MutableEntry entry, Object... arguments) - throws EntryProcessorException { - return null; - } - }; - - /** - * @return Node. - */ - private IgniteEx node() { - return grid(0); - } - - /** - * @return Currently open transaction. - */ - private Transaction tx() { - return node().transactions().tx(); - } - - /** - * Check that there's an open transaction with SQL flag. - */ - private void assertTxPresent() { - assertNotNull(tx()); - } - - /** {@inheritDoc} */ - @Override protected List> execute(Ignite node, String sql) { - return node.cache("ints").query(new SqlFieldsQuery(sql).setSchema(QueryUtils.DFLT_SCHEMA)).getAll(); - } - - /** - * Check that there's no open transaction. - */ - private void assertSqlTxNotPresent() { - assertNull(tx()); - } - - /** - * Check transaction state. - */ - private static void assertTxState(Transaction tx, TransactionState state) { - assertEquals(state, tx.state()); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsSelfTest.java deleted file mode 100644 index 058c17d8ca75b..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlTransactionsSelfTest.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.index; - -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Callable; -import javax.cache.processor.EntryProcessor; -import javax.cache.processor.EntryProcessorException; -import javax.cache.processor.MutableEntry; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteException; -import org.apache.ignite.cache.CacheEntryProcessor; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy; -import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; -import org.apache.ignite.internal.processors.query.QueryUtils; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteFuture; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionState; -import org.junit.Ignore; -import org.junit.Test; - -/** - * Tests to check behavior regarding transactions started via SQL. - */ -@Ignore("https://issues.apache.org/jira/browse/IGNITE-13723") -public class SqlTransactionsSelfTest extends AbstractSchemaSelfTest { - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - startGrid(commonConfiguration(0)); - - super.execute(node(), "CREATE TABLE INTS(k int primary key, v int) WITH \"wrap_value=false,cache_name=ints," + - "atomicity=transactional_snapshot\""); - } - - /** - * Test that BEGIN opens a transaction. - */ - @Test - public void testBegin() { - execute(node(), "BEGIN"); - - assertTxPresent(); - - assertTxState(tx(), TransactionState.ACTIVE); - } - - /** - * Test that COMMIT commits a transaction. - */ - @Test - public void testCommit() { - execute(node(), "BEGIN WORK"); - - assertTxPresent(); - - Transaction tx = tx(); - - assertTxState(tx, TransactionState.ACTIVE); - - execute(node(), "COMMIT TRANSACTION"); - - assertTxState(tx, TransactionState.COMMITTED); - - assertSqlTxNotPresent(); - } - - /** - * Test that COMMIT without a transaction yields nothing. - */ - @Test - public void testCommitNoTransaction() { - execute(node(), "COMMIT"); - } - - /** - * Test that ROLLBACK without a transaction yields nothing. - */ - @Test - public void testRollbackNoTransaction() { - execute(node(), "ROLLBACK"); - } - - /** - * Test that ROLLBACK rolls back a transaction. - */ - @Test - public void testRollback() { - execute(node(), "BEGIN TRANSACTION"); - - assertTxPresent(); - - Transaction tx = tx(); - - assertTxState(tx, TransactionState.ACTIVE); - - execute(node(), "ROLLBACK TRANSACTION"); - - assertTxState(tx, TransactionState.ROLLED_BACK); - - assertSqlTxNotPresent(); - } - - /** - * Test that attempting to perform various SQL operations within non SQL transaction yields an exception. - */ - @Test - public void testSqlOperationsWithinNonSqlTransaction() { - assertSqlOperationWithinNonSqlTransactionThrows("COMMIT"); - - assertSqlOperationWithinNonSqlTransactionThrows("ROLLBACK"); - - assertSqlOperationWithinNonSqlTransactionThrows("SELECT * from ints"); - - assertSqlOperationWithinNonSqlTransactionThrows("DELETE from ints"); - - assertSqlOperationWithinNonSqlTransactionThrows("INSERT INTO ints(k, v) values(10, 15)"); - - assertSqlOperationWithinNonSqlTransactionThrows("MERGE INTO ints(k, v) values(10, 15)"); - - assertSqlOperationWithinNonSqlTransactionThrows("UPDATE ints SET v = 100 WHERE k = 5"); - - assertSqlOperationWithinNonSqlTransactionThrows("create index idx on ints(v)"); - - assertSqlOperationWithinNonSqlTransactionThrows("CREATE TABLE T(k int primary key, v int)"); - } - - /** - * Check that trying to run given SQL statement both locally and in distributed mode yields an exception - * if transaction already has been marked as being of SQL type. - * @param sql SQL statement. - */ - private void assertSqlOperationWithinNonSqlTransactionThrows(final String sql) { - try (Transaction ignored = node().transactions().txStart()) { - node().cache("ints").put(1, 1); - - assertSqlException(new Runnable() { - @Override public void run() { - execute(node(), sql); - } - }, IgniteQueryErrorCode.TRANSACTION_TYPE_MISMATCH); - } - - try (Transaction ignored = node().transactions().txStart()) { - node().cache("ints").put(1, 1); - - assertSqlException(new Runnable() { - @Override public void run() { - node().cache("ints").query(new SqlFieldsQuery(sql).setLocal(true)).getAll(); - } - }, IgniteQueryErrorCode.TRANSACTION_TYPE_MISMATCH); - } - } - - /** - * Test that attempting to perform a cache API operation from within an SQL transaction fails. - */ - private void checkCacheOperationThrows(final String opName, final Object... args) { - execute(node(), "BEGIN"); - - try { - GridTestUtils.assertThrows(null, new Callable() { - @Override public Object call() throws Exception { - try { - // We need to detect types based on arguments due to multiple overloads. - Class[] types; - - if (F.isEmpty(args)) - types = (Class[])X.EMPTY_OBJECT_ARRAY; - else { - types = new Class[args.length]; - - for (int i = 0; i < args.length; i++) - types[i] = argTypeForObject(args[i]); - } - - Object res = U.invoke(GatewayProtectedCacheProxy.class, node().cache("ints"), - opName, types, args); - - if (opName.endsWith("Async")) - ((IgniteFuture)res).get(); - } - catch (IgniteCheckedException e) { - if (e.getCause() != null) { - try { - if (e.getCause().getCause() != null) - throw (Exception)e.getCause().getCause(); - else - fail(); - } - catch (IgniteException e1) { - // Some public API methods don't have IgniteCheckedException on their signature - // and thus may wrap it into an IgniteException. - if (e1.getCause() != null) - throw (Exception)e1.getCause(); - else - fail(); - } - } - else - fail(); - } - - return null; - } - }, IgniteCheckedException.class, - "SQL queries and cache operations may not be used in the same transaction."); - } - finally { - try { - execute(node(), "ROLLBACK"); - } - catch (Throwable e) { - // No-op. - } - } - } - - /** - * - */ - private static Class argTypeForObject(Object arg) { - if (arg instanceof Set) - return Set.class; - else if (arg instanceof Map) - return Map.class; - else if (arg.getClass().getName().startsWith("java.lang.")) - return Object.class; - else if (arg instanceof CacheEntryProcessor) - return CacheEntryProcessor.class; - else if (arg instanceof EntryProcessor) - return EntryProcessor.class; - else - return arg.getClass(); - } - - /** - * Test that attempting to perform a cache PUT operation from within an SQL transaction fails. - */ - @Test - public void testCacheOperationsFromSqlTransaction() { - checkCacheOperationThrows("get", 1); - - checkCacheOperationThrows("getAsync", 1); - - checkCacheOperationThrows("getEntry", 1); - - checkCacheOperationThrows("getEntryAsync", 1); - - checkCacheOperationThrows("getAndPut", 1, 1); - - checkCacheOperationThrows("getAndPutAsync", 1, 1); - - checkCacheOperationThrows("getAndPutIfAbsent", 1, 1); - - checkCacheOperationThrows("getAndPutIfAbsentAsync", 1, 1); - - checkCacheOperationThrows("getAndReplace", 1, 1); - - checkCacheOperationThrows("getAndReplaceAsync", 1, 1); - - checkCacheOperationThrows("getAndRemove", 1); - - checkCacheOperationThrows("getAndRemoveAsync", 1); - - checkCacheOperationThrows("containsKey", 1); - - checkCacheOperationThrows("containsKeyAsync", 1); - - checkCacheOperationThrows("put", 1, 1); - - checkCacheOperationThrows("putAsync", 1, 1); - - checkCacheOperationThrows("putIfAbsent", 1, 1); - - checkCacheOperationThrows("putIfAbsentAsync", 1, 1); - - checkCacheOperationThrows("remove", 1); - - checkCacheOperationThrows("removeAsync", 1); - - checkCacheOperationThrows("remove", 1, 1); - - checkCacheOperationThrows("removeAsync", 1, 1); - - checkCacheOperationThrows("replace", 1, 1); - - checkCacheOperationThrows("replaceAsync", 1, 1); - - checkCacheOperationThrows("replace", 1, 1, 1); - - checkCacheOperationThrows("replaceAsync", 1, 1, 1); - - checkCacheOperationThrows("getAll", new HashSet<>(Arrays.asList(1, 2))); - - checkCacheOperationThrows("containsKeys", new HashSet<>(Arrays.asList(1, 2))); - - checkCacheOperationThrows("getEntries", new HashSet<>(Arrays.asList(1, 2))); - - checkCacheOperationThrows("putAll", Collections.singletonMap(1, 1)); - - checkCacheOperationThrows("removeAll", new HashSet<>(Arrays.asList(1, 2))); - - checkCacheOperationThrows("getAllAsync", new HashSet<>(Arrays.asList(1, 2))); - - checkCacheOperationThrows("containsKeysAsync", new HashSet<>(Arrays.asList(1, 2))); - - checkCacheOperationThrows("getEntriesAsync", new HashSet<>(Arrays.asList(1, 2))); - - checkCacheOperationThrows("putAllAsync", Collections.singletonMap(1, 1)); - - checkCacheOperationThrows("removeAllAsync", new HashSet<>(Arrays.asList(1, 2))); - - checkCacheOperationThrows("invoke", 1, ENTRY_PROC, X.EMPTY_OBJECT_ARRAY); - - checkCacheOperationThrows("invoke", 1, CACHE_ENTRY_PROC, X.EMPTY_OBJECT_ARRAY); - - checkCacheOperationThrows("invokeAsync", 1, ENTRY_PROC, X.EMPTY_OBJECT_ARRAY); - - checkCacheOperationThrows("invokeAsync", 1, CACHE_ENTRY_PROC, X.EMPTY_OBJECT_ARRAY); - - checkCacheOperationThrows("invokeAll", Collections.singletonMap(1, CACHE_ENTRY_PROC), X.EMPTY_OBJECT_ARRAY); - - checkCacheOperationThrows("invokeAll", Collections.singleton(1), CACHE_ENTRY_PROC, X.EMPTY_OBJECT_ARRAY); - - checkCacheOperationThrows("invokeAll", Collections.singleton(1), ENTRY_PROC, X.EMPTY_OBJECT_ARRAY); - - checkCacheOperationThrows("invokeAllAsync", Collections.singletonMap(1, CACHE_ENTRY_PROC), - X.EMPTY_OBJECT_ARRAY); - - checkCacheOperationThrows("invokeAllAsync", Collections.singleton(1), CACHE_ENTRY_PROC, X.EMPTY_OBJECT_ARRAY); - - checkCacheOperationThrows("invokeAllAsync", Collections.singleton(1), ENTRY_PROC, X.EMPTY_OBJECT_ARRAY); - } - - /** */ - private static final EntryProcessor ENTRY_PROC = - new EntryProcessor() { - @Override public Object process(MutableEntry entry, Object... arguments) - throws EntryProcessorException { - return null; - } - }; - - /** */ - private static final CacheEntryProcessor CACHE_ENTRY_PROC = - new CacheEntryProcessor() { - @Override public Object process(MutableEntry entry, Object... arguments) - throws EntryProcessorException { - return null; - } - }; - - /** - * @return Node. - */ - private IgniteEx node() { - return grid(0); - } - - /** - * @return Currently open transaction. - */ - private Transaction tx() { - return node().transactions().tx(); - } - - /** - * Check that there's an open transaction with SQL flag. - */ - private void assertTxPresent() { - assertNotNull(tx()); - } - - /** {@inheritDoc} */ - @Override protected List> execute(Ignite node, String sql) { - return node.cache("ints").query(new SqlFieldsQuery(sql).setSchema(QueryUtils.DFLT_SCHEMA)).getAll(); - } - - /** - * Check that there's no open transaction. - */ - private void assertSqlTxNotPresent() { - assertNull(tx()); - } - - /** - * Check transaction state. - */ - private static void assertTxState(Transaction tx, TransactionState state) { - assertEquals(state, tx.state()); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractContinuousQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractContinuousQuerySelfTest.java deleted file mode 100644 index 7421ac79ca11c..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractContinuousQuerySelfTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAbstractSelfTest; -import org.junit.Ignore; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - -/** - * - */ -public abstract class CacheMvccAbstractContinuousQuerySelfTest extends GridCacheContinuousQueryAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 2; - } - - /** {@inheritDoc} */ - @Override protected NearCacheConfiguration nearConfiguration() { - return null; - } - - /** {@inheritDoc} */ - @Test - @Override public void testInternalKey() throws Exception { - // No-op. - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7311") - @Test - @Override public void testExpired() throws Exception { - // No-op. - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7954") - @Test - @Override public void testLoadCache() throws Exception { - // No-op. - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-9321") - @Test - @Override public void testEvents() throws Exception { - // No-op. - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractSqlContinuousQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractSqlContinuousQuerySelfTest.java deleted file mode 100644 index c228e1931a318..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractSqlContinuousQuerySelfTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.query.SqlFieldsQuery; - -/** - * Base class for MVCC continuous queries. - */ -public abstract class CacheMvccAbstractSqlContinuousQuerySelfTest extends CacheMvccAbstractContinuousQuerySelfTest { - /** {@inheritDoc} */ - @Override protected void cachePut(IgniteCache cache, Integer key, Integer val) { - cache.query(new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key + ',' + val + ')')).getAll(); - } - - /** {@inheritDoc} */ - @Override protected void cacheRemove(IgniteCache cache, Integer key) { - cache.query(new SqlFieldsQuery("DELETE FROM Integer WHERE _key=" + key)).getAll(); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractSqlCoordinatorFailoverTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractSqlCoordinatorFailoverTest.java deleted file mode 100644 index 732bfd861b578..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractSqlCoordinatorFailoverTest.java +++ /dev/null @@ -1,395 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.concurrent.Callable; -import java.util.concurrent.Semaphore; -import java.util.concurrent.TimeUnit; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheServerNotFoundException; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.IgniteNodeAttributes; -import org.apache.ignite.internal.TestRecordingCommunicationSpi; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse; -import org.apache.ignite.lang.IgnitePredicate; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.junit.Ignore; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SCAN; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.DML; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Mvcc SQL API coordinator failover test. - */ -public abstract class CacheMvccAbstractSqlCoordinatorFailoverTest extends CacheMvccAbstractBasicCoordinatorFailoverTest { - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSql_Server_Backups0_CoordinatorFails() throws Exception { - accountsTxReadAll(2, 1, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, DML, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-11311") - @Test - public void testAccountsTxSql_SingleNode_CoordinatorFails_Persistence() throws Exception { - persistence = true; - - accountsTxReadAll(1, 0, 0, 1, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, DML, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups0_RestartCoordinator_ScanDml() throws Exception { - putAllGetAll(RestartMode.RESTART_CRD, 2, 1, 0, 64, - new InitIndexing(Integer.class, Integer.class), SCAN, DML); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10767") - @Test - public void testPutAllGetAll_SingleNode_RestartCoordinator_ScanDml_Persistence() throws Exception { - persistence = true; - - putAllGetAll(RestartMode.RESTART_CRD, 1, 0, 0, 1, - new InitIndexing(Integer.class, Integer.class), SCAN, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups0_RestartCoordinator_SqlDml() throws Exception { - putAllGetAll(RestartMode.RESTART_CRD, 2, 1, 0, DFLT_PARTITION_COUNT, - new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_SingleNode_RestartCoordinator_SqlDml_Persistence() throws Exception { - persistence = true; - - putAllGetAll(RestartMode.RESTART_CRD, 1, 0, 0, 1, - new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_ClientServer_Backups0_Sql_Persistence() throws Exception { - persistence = true; - - updateNObjectsTest(5, 2, 0, 0, 64, DFLT_TEST_TIME, - new InitIndexing(Integer.class, Integer.class), SQL, DML, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_SingleNode_Sql_Persistence() throws Exception { - updateNObjectsTest(3, 1, 0, 0, 1, DFLT_TEST_TIME, - new InitIndexing(Integer.class, Integer.class), SQL, DML, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCoordinatorFailureSimplePessimisticTxSql() throws Exception { - coordinatorFailureSimple(PESSIMISTIC, REPEATABLE_READ, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTxInProgressCoordinatorChangeSimple_Readonly() throws Exception { - txInProgressCoordinatorChangeSimple(PESSIMISTIC, REPEATABLE_READ, - new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testReadInProgressCoordinatorFailsSimple_FromClient() throws Exception { - readInProgressCoordinatorFailsSimple(true, new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCoordinatorChangeActiveQueryClientFails_Simple() throws Exception { - checkCoordinatorChangeActiveQueryClientFails_Simple(new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCoordinatorChangeActiveQueryClientFails_SimpleScan() throws Exception { - checkCoordinatorChangeActiveQueryClientFails_Simple(new InitIndexing(Integer.class, Integer.class), SCAN, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTxReadAfterCoordinatorChangeDirectOrder() throws Exception { - testTxReadAfterCoordinatorChange(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTxReadAfterCoordinatorChangeReverseOrder() throws Exception { - testTxReadAfterCoordinatorChange(false); - } - - /** */ - private void testTxReadAfterCoordinatorChange(boolean directOrder) throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class).setNodeFilter(new CoordinatorNodeFilter()); - - MvccProcessorImpl.coordinatorAssignClosure(new CoordinatorAssignClosure()); - - IgniteEx node = startGrid(0); - - nodeAttr = CRD_ATTR; - - startGrid(1); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - cache.put(1, 1); - - Semaphore sem = new Semaphore(0); - - IgniteInternalFuture future = GridTestUtils.runAsync(() -> { - IgniteCache cache0 = node.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - Integer res = cache0.get(1); - - sem.release(); - - // wait for coordinator change. - assertTrue(sem.tryAcquire(2, getTestTimeout(), TimeUnit.MILLISECONDS)); - - assertEquals(res, cache0.get(1)); - } - catch (Exception e) { - throw new RuntimeException(e); - } - }); - - assertTrue(sem.tryAcquire(getTestTimeout(), TimeUnit.MILLISECONDS)); - - if (directOrder) - stopGrid(1); - - MvccProcessorImpl prc = mvccProcessor(startGrid(2)); - - if (!directOrder) - stopGrid(1); - - awaitPartitionMapExchange(); - - MvccCoordinator crd = prc.currentCoordinator(); - - assert crd.local() && crd.initialized(); - - cache.put(1, 2); - cache.put(1, 3); - - sem.release(2); - - future.get(getTestTimeout()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testStartLastServerFails() throws Exception { - testSpi = true; - - startGrids(3); - - CacheConfiguration cfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - cfg.setNodeFilter(new TestNodeFilter(getTestIgniteInstanceName(1))); - - Ignite srv1 = ignite(1); - - srv1.createCache(cfg); - - client = true; - - final Ignite c = startGrid(3); - - client = false; - - TestRecordingCommunicationSpi.spi(srv1).blockMessages(GridDhtAffinityAssignmentResponse.class, c.name()); - - IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - c.cache(DEFAULT_CACHE_NAME); - - return null; - } - }, "start-cache"); - - assertFalse(fut.isDone()); - - stopGrid(1); - - fut.get(); - - final IgniteCache clientCache = c.cache(DEFAULT_CACHE_NAME); - - for (int i = 0; i < 10; i++) { - final int k = i; - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - clientCache.get(k); - - return null; - } - }, CacheServerNotFoundException.class, null); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - clientCache.put(k, k); - - return null; - } - }, CacheServerNotFoundException.class, null); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - clientCache.remove(k); - - return null; - } - }, CacheServerNotFoundException.class, null); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - clientCache.query(new SqlFieldsQuery("SELECT * FROM INTEGER")).getAll(); - - return null; - } - }, CacheServerNotFoundException.class, "Failed to find data nodes for cache"); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - clientCache.query(new SqlFieldsQuery("SELECT * FROM INTEGER ORDER BY _val")).getAll(); - - return null; - } - }, CacheServerNotFoundException.class, "Failed to find data nodes for cache"); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - clientCache.query(new SqlFieldsQuery("DELETE FROM Integer WHERE 1 = 1")).getAll(); - - return null; - } - }, CacheServerNotFoundException.class, "Failed to find data nodes for cache"); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - clientCache.query(new SqlFieldsQuery("INSERT INTO Integer (_key, _val) VALUES (1, 2)")).getAll(); - - return null; - } - }, CacheServerNotFoundException.class, "Failed to get primary node"); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - clientCache.query( - new SqlFieldsQuery("UPDATE Integer SET _val=42 WHERE _key IN (SELECT DISTINCT _val FROM INTEGER)") - ).getAll(); - - return null; - } - }, CacheServerNotFoundException.class, "Failed to find data nodes for cache"); - } - - startGrid(1); - - awaitPartitionMapExchange(); - - for (int i = 0; i < 100; i++) { - assertNull(clientCache.get(i)); - - clientCache.put(i, i); - - assertEquals(i, clientCache.get(i)); - } - } - - /** - * - */ - private static class TestNodeFilter implements IgnitePredicate { - /** */ - private final String includeName; - - /** - * @param includeName Node to include. - */ - public TestNodeFilter(String includeName) { - this.includeName = includeName; - } - - /** {@inheritDoc} */ - @Override public boolean apply(ClusterNode node) { - return includeName.equals(node.attribute(IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME)); - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBackupsAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBackupsAbstractTest.java deleted file mode 100644 index b807f898ea5b5..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBackupsAbstractTest.java +++ /dev/null @@ -1,822 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.cache.affinity.Affinity; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.TestRecordingCommunicationSpi; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; -import org.apache.ignite.internal.processors.cache.KeyCacheObject; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxQueryEnlistResponse; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessage; -import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; -import org.apache.ignite.internal.processors.cache.tree.mvcc.data.MvccDataRow; -import org.apache.ignite.internal.util.lang.GridCursor; -import org.apache.ignite.lang.IgniteBiInClosure; -import org.apache.ignite.lang.IgniteBiTuple; -import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.transactions.Transaction; -import org.junit.Ignore; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.DML; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; -import static org.junit.Assert.assertArrayEquals; - -/** - * Backups tests. - */ -@SuppressWarnings("unchecked") -public abstract class CacheMvccBackupsAbstractTest extends CacheMvccAbstractTest { - /** Test timeout. */ - private final long txLongTimeout = getTestTimeout() / 4; - - /** - * Tests backup consistency. - * - * @throws Exception If fails. - */ - @Test - public void testBackupsCoherenceSimple() throws Exception { - disableScheduledVacuum = true; - - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, 10) - .setIndexedTypes(Integer.class, Integer.class); - - final int KEYS_CNT = 5_000; - assert KEYS_CNT % 2 == 0; - - startGrids(3); - - Ignite node0 = grid(0); - Ignite node1 = grid(1); - Ignite node2 = grid(2); - - client = true; - - Ignite client = startGrid(); - - awaitPartitionMapExchange(); - - IgniteCache clientCache = client.cache(DEFAULT_CACHE_NAME); - IgniteCache cache0 = node0.cache(DEFAULT_CACHE_NAME); - IgniteCache cache1 = node1.cache(DEFAULT_CACHE_NAME); - IgniteCache cache2 = node2.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(txLongTimeout); - - for (int i = 0; i < KEYS_CNT / 2; i += 2) { - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (" - + i + ',' + i * 2 + "), (" + (i + 1) + ',' + (i + 1) * 2 + ')'); - - clientCache.query(qry).getAll(); - } - - tx.commit(); - } - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(txLongTimeout); - - for (int i = 0; i < 10; i++) { - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE from Integer WHERE _key = " + i); - - clientCache.query(qry).getAll(); - } - - for (int i = 10; i < KEYS_CNT + 1; i++) { - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE Integer SET _val=" + i * 10 + " WHERE _key = " + i); - - clientCache.query(qry).getAll(); - } - - tx.commit(); - } - - Map> vers0 = allVersions(cache0); - - List res0 = getAll(cache0, "Integer"); - - stopGrid(0); - - awaitPartitionMapExchange(); - - Map> vers1 = allVersions(cache1); - - assertVersionsEquals(vers0, vers1); - - List res1 = getAll(cache1, "Integer"); - - assertEqualsCollections(res0, res1); - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(txLongTimeout); - - for (int i = 10; i < 20; i++) { - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE from Integer WHERE _key = " + i); - - clientCache.query(qry).getAll(); - } - - for (int i = 20; i < KEYS_CNT + 1; i++) { - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE Integer SET _val=" + i * 100 + " WHERE _key = " + i); - - clientCache.query(qry).getAll(); - } - - tx.commit(); - } - - vers1 = allVersions(cache1); - - res1 = getAll(cache2, "Integer"); - - stopGrid(1); - - awaitPartitionMapExchange(); - - Map> vers2 = allVersions(cache2); - - assertVersionsEquals(vers1, vers2); - - List res2 = getAll(cache2, "Integer"); - - assertEqualsCollections(res1, res2); - } - - /** - * Checks cache backups consistency with large queries. - * - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10104") - @Test - public void testBackupsCoherenceWithLargeOperations() throws Exception { - disableScheduledVacuum = true; - - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 1, 10) - .setIndexedTypes(Integer.class, Integer.class); - - final int KEYS_CNT = 5_000; - assert KEYS_CNT % 2 == 0; - - startGrids(2); - - Ignite node1 = grid(0); - Ignite node2 = grid(1); - - client = true; - - Ignite client = startGrid(); - - awaitPartitionMapExchange(); - - IgniteCache clientCache = client.cache(DEFAULT_CACHE_NAME); - IgniteCache cache1 = node1.cache(DEFAULT_CACHE_NAME); - IgniteCache cache2 = node2.cache(DEFAULT_CACHE_NAME); - - StringBuilder insert = new StringBuilder("INSERT INTO Integer (_key, _val) values "); - - boolean first = true; - - for (int key = 0; key < KEYS_CNT; key++) { - if (!first) - insert.append(','); - else - first = false; - - insert.append('(').append(key).append(',').append(key * 10).append(')'); - } - - String qryStr = insert.toString(); - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(txLongTimeout); - - SqlFieldsQuery qry = new SqlFieldsQuery(qryStr); - - clientCache.query(qry).getAll(); - - tx.commit(); - } - - qryStr = "SELECT * FROM Integer WHERE _key >= " + KEYS_CNT / 2 + " FOR UPDATE"; - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(txLongTimeout); - - SqlFieldsQuery qry = new SqlFieldsQuery(qryStr); - - clientCache.query(qry).getAll(); - - tx.commit(); - } - - qryStr = "DELETE FROM Integer WHERE _key >= " + KEYS_CNT / 2; - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(txLongTimeout); - - SqlFieldsQuery qry = new SqlFieldsQuery(qryStr); - - clientCache.query(qry).getAll(); - - tx.commit(); - } - - Map> cache1Vers = allVersions(cache1); - - List res1 = getAll(cache1, "Integer"); - - stopGrid(0); - - awaitPartitionMapExchange(); - - Map> cache2Vers = allVersions(cache2); - - assertVersionsEquals(cache1Vers, cache2Vers); - - List res2 = getAll(cache2, "Integer"); - - assertEqualsCollections(res1, res2); - } - - /** - * Checks cache backups consistency with in-flight batches overflow. - * - * @throws Exception If failed. - */ - @Test - public void testBackupsCoherenceWithInFlightBatchesOverflow() throws Exception { - testSpi = true; - - disableScheduledVacuum = true; - - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 1, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - final int KEYS_CNT = 30_000; - assert KEYS_CNT % 2 == 0; - - startGrids(2); - - Ignite node1 = grid(0); - Ignite node2 = grid(1); - - client = true; - - Ignite client = startGrid(); - - awaitPartitionMapExchange(); - - IgniteCache clientCache = client.cache(DEFAULT_CACHE_NAME); - IgniteCache cache1 = node1.cache(DEFAULT_CACHE_NAME); - IgniteCache cache2 = node2.cache(DEFAULT_CACHE_NAME); - - AtomicInteger keyGen = new AtomicInteger(); - Affinity affinity = affinity(clientCache); - - ClusterNode cNode1 = ((IgniteEx)node1).localNode(); - ClusterNode cNode2 = ((IgniteEx)node2).localNode(); - - StringBuilder insert = new StringBuilder("INSERT INTO Integer (_key, _val) values "); - - for (int i = 0; i < KEYS_CNT; i++) { - if (i > 0) - insert.append(','); - - // To make big batches in near results future. - Integer key = i < KEYS_CNT / 2 ? keyForNode(affinity, keyGen, cNode1) : keyForNode(affinity, keyGen, cNode2); - - assert key != null; - - insert.append('(').append(key).append(',').append(key * 10).append(')'); - } - - String qryStr = insert.toString(); - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(txLongTimeout); - - SqlFieldsQuery qry = new SqlFieldsQuery(qryStr); - - clientCache.query(qry).getAll(); - - tx.commit(); - } - - // Add a delay to simulate batches overflow. - TestRecordingCommunicationSpi spi1 = TestRecordingCommunicationSpi.spi(node1); - TestRecordingCommunicationSpi spi2 = TestRecordingCommunicationSpi.spi(node2); - - spi1.closure(new IgniteBiInClosure() { - @Override public void apply(ClusterNode node, Message msg) { - if (msg instanceof GridDhtTxQueryEnlistResponse) - doSleep(100); - } - }); - - spi2.closure(new IgniteBiInClosure() { - @Override public void apply(ClusterNode node, Message msg) { - if (msg instanceof GridDhtTxQueryEnlistResponse) - doSleep(100); - } - }); - - qryStr = "DELETE FROM Integer WHERE _key >= " + 10; - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(txLongTimeout); - - SqlFieldsQuery qry = new SqlFieldsQuery(qryStr); - - clientCache.query(qry).getAll(); - - tx.commit(); - } - - Map> cache1Vers = allVersions(cache1); - - List res1 = getAll(cache1, "Integer"); - - stopGrid(0); - - awaitPartitionMapExchange(); - - Map> cache2Vers = allVersions(cache2); - - assertVersionsEquals(cache1Vers, cache2Vers); - - List res2 = getAll(cache2, "Integer"); - - assertEqualsCollections(res1, res2); - } - - /** - * Tests concurrent updates backups coherence. - * - * @throws Exception If failed. - */ - @Test - public void testBackupsCoherenceWithConcurrentUpdates2ServersNoClients() throws Exception { - checkBackupsCoherenceWithConcurrentUpdates(2, 0); - } - - /** - * Tests concurrent updates backups coherence. - * - * @throws Exception If failed. - */ - @Test - public void testBackupsCoherenceWithConcurrentUpdates4ServersNoClients() throws Exception { - checkBackupsCoherenceWithConcurrentUpdates(4, 0); - } - - /** - * Tests concurrent updates backups coherence. - * - * @throws Exception If failed. - */ - @Test - public void testBackupsCoherenceWithConcurrentUpdates3Servers1Client() throws Exception { - checkBackupsCoherenceWithConcurrentUpdates(3, 1); - } - - /** - * Tests concurrent updates backups coherence. - * - * @throws Exception If failed. - */ - @Test - public void testBackupsCoherenceWithConcurrentUpdates5Servers2Clients() throws Exception { - checkBackupsCoherenceWithConcurrentUpdates(5, 2); - } - - /** - * Tests concurrent updates backups coherence. - * - * @throws Exception If failed. - */ - private void checkBackupsCoherenceWithConcurrentUpdates(int srvs, int clients) throws Exception { - assert srvs > 1; - - disableScheduledVacuum = true; - - accountsTxReadAll(srvs, clients, srvs - 1, DFLT_PARTITION_COUNT, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, DML, 5_000, null); - - for (int i = 0; i < srvs - 1; i++) { - Ignite node1 = grid(i); - - IgniteCache cache1 = node1.cache(DEFAULT_CACHE_NAME); - - Map> vers1 = allVersions(cache1); - - List res1 = getAll(cache1, "MvccTestAccount"); - - stopGrid(i); - - awaitPartitionMapExchange(); - - Ignite node2 = grid(i + 1); - - IgniteCache cache2 = node2.cache(DEFAULT_CACHE_NAME); - - Map> vers2 = allVersions(cache2); - - assertVersionsEquals(vers1, vers2); - - List res2 = getAll(cache2, "MvccTestAccount"); - - assertEqualsCollections(res1, res2); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNoForceKeyRequestDelayedRebalanceNoVacuum() throws Exception { - disableScheduledVacuum = true; - - doTestRebalanceNodeAdd(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNoForceKeyRequestDelayedRebalance() throws Exception { - doTestRebalanceNodeAdd(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNoForceKeyRequestNoVacuum() throws Exception { - disableScheduledVacuum = true; - - doTestRebalanceNodeAdd(false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testNoForceKeyRequest() throws Exception { - doTestRebalanceNodeAdd(false); - } - - /** - * @throws Exception If failed. - */ - private void doTestRebalanceNodeAdd(boolean delayRebalance) throws Exception { - testSpi = true; - - final Ignite node1 = startGrid(0); - - final IgniteCache cache = node1.createCache( - cacheConfiguration(cacheMode(), FULL_SYNC, 1, 16) - .setIndexedTypes(Integer.class, Integer.class)); - - try (Transaction tx = node1.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values " + - "(1,1),(2,2),(3,3),(4,4),(5,5)"); - - cache.query(qry).getAll(); - - tx.commit(); - } - - TestRecordingCommunicationSpi spi = TestRecordingCommunicationSpi.spi(node1); - - // Check for a force key request. - spi.closure(new IgniteBiInClosure() { - @Override public void apply(ClusterNode node, Message msg) { - if (delayRebalance && msg instanceof GridDhtPartitionSupplyMessage) - doSleep(500); - - if (msg instanceof GridDhtForceKeysResponse) - fail("Force key request"); - } - }); - - final Ignite node2 = startGrid(1); - - TestRecordingCommunicationSpi.spi(node2).closure( - new IgniteBiInClosure() { - @Override public void apply(ClusterNode node, Message msg) { - if (msg instanceof GridDhtForceKeysRequest) - fail("Force key request"); - } - } - ); - - IgniteCache cache2 = node2.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = node2.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE FROM Integer WHERE _key IN " + - "(1,2,3,4,5)"); - - cache2.query(qry).getAll(); - - tx.commit(); - } - - awaitPartitionMapExchange(); - - doSleep(2000); - - stopGrid(1); - - try (Transaction tx = node1.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values " + - "(1,1),(2,2),(3,3),(4,4),(5,5)"); - - cache.query(qry).getAll(); - - tx.commit(); - } - - doSleep(1000); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRebalanceNodeLeaveClient() throws Exception { - doTestRebalanceNodeLeave(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRebalanceNodeLeaveServer() throws Exception { - doTestRebalanceNodeLeave(false); - } - - /** - * @throws Exception If failed. - */ - public void doTestRebalanceNodeLeave(boolean startClient) throws Exception { - testSpi = true; - disableScheduledVacuum = true; - - startGridsMultiThreaded(4); - - client = true; - - final Ignite node = startClient ? startGrid(4) : grid(0); - - final IgniteCache cache = node.createCache( - cacheConfiguration(cacheMode(), FULL_SYNC, 2, 16) - .setIndexedTypes(Integer.class, Integer.class)); - - List keys = new ArrayList<>(); - - for (int i = 0; i < 4; i++) - keys.addAll(primaryKeys(grid(i).cache(DEFAULT_CACHE_NAME), 2)); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - StringBuilder sb = new StringBuilder("INSERT INTO Integer (_key, _val) values "); - - for (int i = 0; i < keys.size(); i++) { - if (i > 0) - sb.append(", "); - - sb.append("(" + keys.get(i) + ", " + keys.get(i) + ")"); - } - - SqlFieldsQuery qry = new SqlFieldsQuery(sb.toString()); - - cache.query(qry).getAll(); - - tx.commit(); - } - - stopGrid(3); - - awaitPartitionMapExchange(); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE Integer SET _val = 10*_key"); - - cache.query(qry).getAll(); - - tx.commit(); - } - - awaitPartitionMapExchange(); - - for (Integer key : keys) { - List vers = null; - - for (int i = 0; i < 3; i++) { - ClusterNode n = grid(i).cluster().localNode(); - - if (node.affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(n, key)) { - - List vers0 = allKeyVersions(grid(i).cache(DEFAULT_CACHE_NAME), key); - - if (vers != null) - assertKeyVersionsEquals(vers, vers0); - - vers = vers0; - } - } - } - } - - /** - * Retrieves all versions of all keys from cache. - * - * @param cache Cache. - * @return {@link Map} of keys to its versions. - * @throws IgniteCheckedException If failed. - */ - private Map> allVersions(IgniteCache cache) throws IgniteCheckedException { - IgniteCacheProxy cache0 = (IgniteCacheProxy)cache; - GridCacheContext cctx = cache0.context(); - - assert cctx.mvccEnabled(); - - Map> vers = new HashMap<>(); - - for (Object e : cache) { - IgniteBiTuple entry = (IgniteBiTuple)e; - - KeyCacheObject key = cctx.toCacheKeyObject(entry.getKey()); - - GridCursor cur = cctx.offheap().mvccAllVersionsCursor(cctx, key, null); - - List rows = new ArrayList<>(); - - while (cur.next()) { - CacheDataRow row = cur.get(); - - rows.add(row); - } - - vers.put(key, rows); - } - - return vers; - } - - /** - * @param cache Cache. - * @param key Key. - * @return Collection of versioned rows. - * @throws IgniteCheckedException if failed. - */ - private List allKeyVersions(IgniteCache cache, Object key) throws IgniteCheckedException { - IgniteCacheProxy cache0 = (IgniteCacheProxy)cache; - GridCacheContext cctx = cache0.context(); - - KeyCacheObject key0 = cctx.toCacheKeyObject(key); - - GridCursor cur = cctx.offheap().mvccAllVersionsCursor(cctx, key0, null); - - List rows = new ArrayList<>(); - - while (cur.next()) { - CacheDataRow row = cur.get(); - - rows.add(row); - } - - return rows; - } - - /** - * Checks stored versions equality. - * - * @param left Keys versions to compare. - * @param right Keys versions to compare. - * @throws IgniteCheckedException If failed. - */ - private void assertVersionsEquals(Map> left, - Map> right) throws IgniteCheckedException { - assertNotNull(left); - assertNotNull(right); - - assertTrue(!left.isEmpty()); - assertTrue(!right.isEmpty()); - - assertEqualsCollections(left.keySet(), right.keySet()); - - for (KeyCacheObject key : right.keySet()) { - List leftRows = left.get(key); - List rightRows = right.get(key); - - assertKeyVersionsEquals(leftRows, rightRows); - } - } - - /** - * - * @param leftRows Left rows. - * @param rightRows Right rows. - * @throws IgniteCheckedException If failed. - */ - private void assertKeyVersionsEquals(List leftRows, List rightRows) - throws IgniteCheckedException { - - assertNotNull(leftRows); - assertNotNull(rightRows); - - assertEquals("leftRows=" + leftRows + ", rightRows=" + rightRows, leftRows.size(), rightRows.size()); - - for (int i = 0; i < leftRows.size(); i++) { - CacheDataRow leftRow = leftRows.get(i); - CacheDataRow rightRow = rightRows.get(i); - - assertNotNull(leftRow); - assertNotNull(rightRow); - - assertTrue(leftRow instanceof MvccDataRow); - assertTrue(rightRow instanceof MvccDataRow); - - leftRow.key().valueBytes(null); - - assertEquals(leftRow.expireTime(), rightRow.expireTime()); - assertEquals(leftRow.partition(), rightRow.partition()); - assertArrayEquals(leftRow.value().valueBytes(null), rightRow.value().valueBytes(null)); - assertEquals(leftRow.version(), rightRow.version()); - assertEquals(leftRow.cacheId(), rightRow.cacheId()); - assertEquals(leftRow.hash(), rightRow.hash()); - assertEquals(leftRow.key(), rightRow.key()); - assertTrue(MvccUtils.compare(leftRow, rightRow.mvccVersion()) == 0); - assertTrue(MvccUtils.compareNewVersion(leftRow, rightRow.newMvccVersion()) == 0); - assertEquals(leftRow.newMvccCoordinatorVersion(), rightRow.newMvccCoordinatorVersion()); - assertEquals(leftRow.newMvccCounter(), rightRow.newMvccCounter()); - assertEquals(leftRow.newMvccOperationCounter(), rightRow.newMvccOperationCounter()); - } - } - - /** - * Retrieves all table rows from local node. - * @param cache Cache. - * @param tblName Table name. - * @return All table rows. - */ - private List getAll(IgniteCache cache, String tblName) { - List res = cache.query(new SqlFieldsQuery("SELECT * FROM " + tblName)).getAll(); - - Collections.sort(res, new Comparator() { - @Override public int compare(Object o1, Object o2) { - List l1 = (List)o1; - List l2 = (List)o2; - - int res = ((Comparable)l1.get(0)).compareTo((Comparable)l2.get(0)); - - if (res == 0 && l1.size() > 1) - return ((Comparable)l1.get(1)).compareTo((Comparable)l2.get(1)); - else - return res; - - } - }); - - return res; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBasicContinuousQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBasicContinuousQueryTest.java deleted file mode 100644 index 4ac592fa5f5be..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBasicContinuousQueryTest.java +++ /dev/null @@ -1,618 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicInteger; -import javax.cache.Cache; -import javax.cache.CacheException; -import javax.cache.event.CacheEntryEvent; -import javax.cache.event.CacheEntryUpdatedListener; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.affinity.Affinity; -import org.apache.ignite.cache.query.ContinuousQuery; -import org.apache.ignite.cache.query.QueryCursor; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.TestRecordingCommunicationSpi; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest; -import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition; -import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager; -import org.apache.ignite.internal.processors.continuous.GridContinuousMessage; -import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor; -import org.apache.ignite.internal.util.lang.GridAbsPredicate; -import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.internal.util.typedef.PA; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteBiPredicate; -import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static java.util.concurrent.TimeUnit.SECONDS; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.processors.cache.mvcc.MvccCachingManager.TX_SIZE_THRESHOLD; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; -import static org.apache.ignite.transactions.TransactionState.PREPARING; -import static org.apache.ignite.transactions.TransactionState.ROLLED_BACK; - -/** - * Basic continuous queries test with enabled mvcc. - */ -public class CacheMvccBasicContinuousQueryTest extends CacheMvccAbstractTest { - /** */ - private static final long LATCH_TIMEOUT = 5000; - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - // Wait for all routines are unregistered - GridTestUtils.waitForCondition(new PA() { - @Override public boolean apply() { - for (Ignite node : G.allGrids()) { - GridContinuousProcessor proc = ((IgniteEx)node).context().continuous(); - - if (((Map)U.field(proc, "rmtInfos")).size() > 0) - return false; - } - - return true; - } - }, 3000); - - for (Ignite node : G.allGrids()) { - GridContinuousProcessor proc = ((IgniteEx)node).context().continuous(); - - assertEquals(0, ((Map)U.field(proc, "locInfos")).size()); - assertEquals(0, ((Map)U.field(proc, "rmtInfos")).size()); - assertEquals(0, ((Map)U.field(proc, "startFuts")).size()); - assertEquals(0, ((Map)U.field(proc, "stopFuts")).size()); - assertEquals(0, ((Map)U.field(proc, "bufCheckThreads")).size()); - - CacheContinuousQueryManager mgr = - ((IgniteEx)node).context().cache().internalCache(DEFAULT_CACHE_NAME).context().continuousQueries(); - - assertEquals(0, ((Map)U.field(mgr, "lsnrs")).size()); - - MvccCachingManager cachingMgr = ((IgniteEx)node).context().cache().context().mvccCaching(); - - assertEquals(0, ((Map)U.field(cachingMgr, "enlistCache")).size()); - assertEquals(0, ((Map)U.field(cachingMgr, "cntrs")).size()); - } - - super.afterTest(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAllEntries() throws Exception { - Ignite node = startGrids(3); - - final IgniteCache cache = node.createCache( - cacheConfiguration(cacheMode(), FULL_SYNC, 1, 2) - .setCacheMode(CacheMode.REPLICATED) - .setIndexedTypes(Integer.class, Integer.class)); - - ContinuousQuery qry = new ContinuousQuery<>(); - - final Map> map = new HashMap<>(); - final CountDownLatch latch = new CountDownLatch(5); - - qry.setLocalListener(new CacheEntryUpdatedListener() { - @Override public void onUpdated(Iterable> evts) { - for (CacheEntryEvent e : evts) { - synchronized (map) { - List vals = map.get(e.getKey()); - - if (vals == null) { - vals = new ArrayList<>(); - - map.put(e.getKey(), vals); - } - - vals.add(e.getValue()); - } - - latch.countDown(); - } - } - }); - - try (QueryCursor> ignored = cache.query(qry)) { - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - String dml = "INSERT INTO Integer (_key, _val) values (1,1),(2,2)"; - - cache.query(new SqlFieldsQuery(dml)).getAll(); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - String dml1 = "MERGE INTO Integer (_key, _val) values (3,3)"; - - cache.query(new SqlFieldsQuery(dml1)).getAll(); - - String dml2 = "DELETE FROM Integer WHERE _key = 2"; - - cache.query(new SqlFieldsQuery(dml2)).getAll(); - - String dml3 = "UPDATE Integer SET _val = 10 WHERE _key = 1"; - - cache.query(new SqlFieldsQuery(dml3)).getAll(); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - String dml = "INSERT INTO Integer (_key, _val) values (4,4),(5,5)"; - - cache.query(new SqlFieldsQuery(dml)).getAll(); - - tx.rollback(); - } - - assert latch.await(LATCH_TIMEOUT, MILLISECONDS); - - assertEquals(3, map.size()); - - List vals = map.get(1); - - assertNotNull(vals); - assertEquals(2, vals.size()); - assertEquals(1, (int)vals.get(0)); - assertEquals(10, (int)vals.get(1)); - - vals = map.get(2); - - assertNotNull(vals); - assertEquals(2, vals.size()); - assertEquals(2, (int)vals.get(0)); - assertEquals(2, (int)vals.get(1)); - - vals = map.get(3); - - assertNotNull(vals); - assertEquals(1, vals.size()); - assertEquals(3, (int)vals.get(0)); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCachingMaxSize() throws Exception { - Ignite node = startGrids(1); - - final IgniteCache cache = node.createCache( - cacheConfiguration(cacheMode(), FULL_SYNC, 1, 2) - .setCacheMode(CacheMode.PARTITIONED) - .setIndexedTypes(Integer.class, Integer.class)); - - ContinuousQuery qry = new ContinuousQuery<>(); - - qry.setLocalListener(new CacheEntryUpdatedListener() { - @Override public void onUpdated(Iterable> evts) { - // No-op. - } - }); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Object call() throws Exception { - try (QueryCursor> ignored = cache.query(qry)) { - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int i = 0; i < TX_SIZE_THRESHOLD + 1; i++) - cache.query(new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (" + i + ", 1)")).getAll(); - - tx.commit(); - } - } - - return null; - } - }, CacheException.class, "Transaction is too large. Consider reducing transaction size"); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateCountersGapClosedSimplePartitioned() throws Exception { - checkUpdateCountersGapIsProcessedSimple(CacheMode.PARTITIONED); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateCountersGapClosedSimpleReplicated() throws Exception { - checkUpdateCountersGapIsProcessedSimple(CacheMode.REPLICATED); - } - - /** - * @throws Exception if failed. - */ - private void checkUpdateCountersGapIsProcessedSimple(CacheMode cacheMode) throws Exception { - testSpi = true; - - final int srvCnt = 4; - - final int backups = srvCnt - 1; - - startGridsMultiThreaded(srvCnt); - - client = true; - - IgniteEx nearNode = startGrid(srvCnt); - - IgniteCache cache = nearNode.createCache( - cacheConfiguration(cacheMode, FULL_SYNC, backups, srvCnt) - .setIndexedTypes(Integer.class, Integer.class)); - - IgniteEx primary = grid(0); - - List keys = primaryKeys(primary.cache(DEFAULT_CACHE_NAME), 3); - - ContinuousQuery qry = new ContinuousQuery<>(); - - List arrivedEvts = new ArrayList<>(); - - CountDownLatch latch = new CountDownLatch(2); - - qry.setLocalListener(new CacheEntryUpdatedListener() { - @Override public void onUpdated(Iterable> evts) { - for (CacheEntryEvent e : evts) { - arrivedEvts.add(e); - - latch.countDown(); - } - } - }); - - QueryCursor> cur = nearNode.cache(DEFAULT_CACHE_NAME).query(qry); - - // Initial value. - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(keys.get(0))).getAll(); - - // prevent first transaction prepare on backups - TestRecordingCommunicationSpi spi = TestRecordingCommunicationSpi.spi(primary); - - final AtomicInteger dhtPrepMsgLimiter = new AtomicInteger(); - - spi.blockMessages(new IgniteBiPredicate() { - @Override public boolean apply(ClusterNode node, Message msg) { - if (msg instanceof GridDhtTxPrepareRequest) - return dhtPrepMsgLimiter.getAndIncrement() < backups; - - if (msg instanceof GridContinuousMessage) - return true; - - return false; - } - }); - - // First tx. Expect it will be prepared only on the primary node and GridDhtTxPrepareRequests to remotes - // will be swallowed. - Transaction txA = nearNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ); - - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(keys.get(1))).getAll(); - - txA.commitAsync(); - - // Wait until first tx changes it's status to PREPARING. - GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - boolean preparing = nearNode.context() - .cache() - .context() - .tm() - .activeTransactions() - .stream() - .allMatch(tx -> tx.state() == PREPARING); - - boolean allPrepsSwallowed = dhtPrepMsgLimiter.get() == backups; - - return preparing && allPrepsSwallowed; - } - }, 3_000); - - // Second tx. - GridTestUtils.runAsync(() -> { - try (Transaction txB = nearNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(keys.get(2))); - - txB.commit(); - } - }).get(); - - long primaryUpdCntr = getUpdateCounter(primary, keys.get(0)); - - assertEquals(3, primaryUpdCntr); // There were three updates: init, first and second. - - // drop primary - stopGrid(primary.name()); - - // Wait all txs are rolled back. - GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - boolean allRolledBack = true; - - for (int i = 1; i < srvCnt; i++) { - boolean rolledBack = - grid(i).context().cache().context().tm().activeTransactions().stream().allMatch(tx -> tx.state() == ROLLED_BACK); - - allRolledBack &= rolledBack; - } - - return allRolledBack; - } - }, 3_000); - - for (int i = 1; i < srvCnt; i++) { - IgniteCache backupCache = grid(i).cache(DEFAULT_CACHE_NAME); - - int size = backupCache.query(new SqlFieldsQuery("select * from Integer")).getAll().size(); - - long backupCntr = getUpdateCounter(grid(i), keys.get(0)); - - assertEquals(2, size); - assertEquals(primaryUpdCntr, backupCntr); - } - - assertTrue(latch.await(3, SECONDS)); - - assertEquals(2, arrivedEvts.size()); - assertEquals(keys.get(0), arrivedEvts.get(0).getKey()); - assertEquals(keys.get(2), arrivedEvts.get(1).getKey()); - - cur.close(); - nearNode.close(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateCountersGapClosedPartitioned() throws Exception { - checkUpdateCountersGapsClosed(CacheMode.PARTITIONED); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateCountersGapClosedReplicated() throws Exception { - checkUpdateCountersGapsClosed(CacheMode.REPLICATED); - } - - /** - * @throws Exception If failed. - */ - private void checkUpdateCountersGapsClosed(CacheMode cacheMode) throws Exception { - testSpi = true; - - int srvCnt = 4; - - startGridsMultiThreaded(srvCnt); - - IgniteEx nearNode = grid(srvCnt - 1); - - IgniteCache cache = nearNode.createCache( - cacheConfiguration(cacheMode, FULL_SYNC, srvCnt - 1, srvCnt) - .setIndexedTypes(Integer.class, Integer.class)); - - IgniteEx primary = grid(0); - - Affinity aff = nearNode.affinity(cache.getName()); - - int[] nearBackupParts = aff.backupPartitions(nearNode.localNode()); - - int[] primaryParts = aff.primaryPartitions(primary.localNode()); - - Collection nearSet = new HashSet<>(); - - for (int part : nearBackupParts) - nearSet.add(part); - - Collection primarySet = new HashSet<>(); - - for (int part : primaryParts) - primarySet.add(part); - - // We need backup partitions on the near node. - nearSet.retainAll(primarySet); - - List keys = singlePartKeys(primary.cache(DEFAULT_CACHE_NAME), 20, nearSet.iterator().next()); - - int range = 3; - - ContinuousQuery qry = new ContinuousQuery<>(); - - List arrivedEvts = new ArrayList<>(); - - CountDownLatch latch = new CountDownLatch(range * 2); - - qry.setLocalListener(new CacheEntryUpdatedListener() { - @Override public void onUpdated(Iterable> evts) { - for (CacheEntryEvent e : evts) { - arrivedEvts.add(e); - - latch.countDown(); - } - } - }); - - QueryCursor> cur = nearNode.cache(DEFAULT_CACHE_NAME).query(qry); - - // prevent first transaction prepare on backups - TestRecordingCommunicationSpi spi = TestRecordingCommunicationSpi.spi(primary); - - spi.blockMessages(new IgniteBiPredicate() { - private final AtomicInteger limiter = new AtomicInteger(); - - @Override public boolean apply(ClusterNode node, Message msg) { - if (msg instanceof GridDhtTxPrepareRequest) - return limiter.getAndIncrement() < srvCnt - 1; - - return false; - } - }); - - Transaction txA = primary.transactions().txStart(PESSIMISTIC, REPEATABLE_READ); - - for (int i = 0; i < range; i++) - primary.cache(DEFAULT_CACHE_NAME).put(keys.get(i), 2); - - txA.commitAsync(); - - GridTestUtils.runAsync(() -> { - try (Transaction tx = primary.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int i = range; i < range * 2; i++) - primary.cache(DEFAULT_CACHE_NAME).put(keys.get(i), 1); - - tx.commit(); - } - }).get(); - - GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - return primary.context().cache().context().tm().activeTransactions().stream().allMatch(tx -> tx.state() == PREPARING); - } - }, 3_000); - - GridTestUtils.runAsync(() -> { - try (Transaction txB = primary.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - for (int i = range * 2; i < range * 3; i++) - primary.cache(DEFAULT_CACHE_NAME).put(keys.get(i), 3); - - txB.commit(); - } - }).get(); - - long primaryUpdCntr = getUpdateCounter(primary, keys.get(0)); - - assertEquals(range * 3, primaryUpdCntr); - - // drop primary - stopGrid(primary.name()); - - // Wait all txs are rolled back. - GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - boolean allRolledBack = true; - - for (int i = 1; i < srvCnt; i++) { - boolean rolledBack = - grid(i).context().cache().context().tm().activeTransactions().stream().allMatch(tx -> tx.state() == ROLLED_BACK); - - allRolledBack &= rolledBack; - } - - return allRolledBack; - } - }, 3_000); - - for (int i = 1; i < srvCnt; i++) { - IgniteCache backupCache = grid(i).cache(DEFAULT_CACHE_NAME); - - int size = backupCache.query(new SqlFieldsQuery("select * from Integer")).getAll().size(); - - long backupCntr = getUpdateCounter(grid(i), keys.get(0)); - - assertEquals(range * 2, size); - assertEquals(primaryUpdCntr, backupCntr); - } - - assertTrue(latch.await(5, SECONDS)); - - assertEquals(range * 2, arrivedEvts.size()); - - cur.close(); - } - - /** - * @param primaryCache Cache. - * @param size Number of keys. - * @return Keys belong to a given part. - * @throws Exception If failed. - */ - private List singlePartKeys(IgniteCache primaryCache, int size, int part) throws Exception { - Ignite ignite = primaryCache.unwrap(Ignite.class); - - List res = new ArrayList<>(); - - final Affinity aff = ignite.affinity(primaryCache.getName()); - - final ClusterNode node = ignite.cluster().localNode(); - - assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - return aff.primaryPartitions(node).length > 0; - } - }, 5000)); - - int cnt = 0; - - for (int key = 0; key < aff.partitions() * size * 10; key++) { - if (aff.partition(key) == part) { - res.add(key); - - if (++cnt == size) - break; - } - } - - assertEquals(size, res.size()); - - return res; - } - - /** - * @param node Node. - * @param key Key. - * @return Extracts update counter of partition which key belongs to. - */ - private long getUpdateCounter(IgniteEx node, Integer key) { - int partId = node.cachex(DEFAULT_CACHE_NAME).context().affinity().partition(key); - - GridDhtLocalPartition part = node.cachex(DEFAULT_CACHE_NAME).context().dht().topology().localPartition(partId); - - assert part != null; - - return part.updateCounter(); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBulkLoadTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBulkLoadTest.java deleted file mode 100644 index 2d3263474b79b..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBulkLoadTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.io.File; -import java.io.Serializable; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.List; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.junit.Test; - -import static java.util.Arrays.asList; -import static java.util.Collections.singletonList; - -/** - * - */ -public class CacheMvccBulkLoadTest extends CacheMvccAbstractTest { - /** */ - private IgniteCache sqlNexus; - - /** */ - private Statement stmt; - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - Ignite ignite = startGrid(0); - sqlNexus = ignite.getOrCreateCache(new CacheConfiguration<>("sqlNexus").setSqlSchema("PUBLIC")); - sqlNexus.query(q("" + - "create table person(" + - " id int not null primary key," + - " name varchar not null" + - ") with \"atomicity=transactional_snapshot\"" - )); - stmt = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1").createStatement(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCopyStoresData() throws Exception { - String csvFilePath = new File(getClass().getResource("mvcc_person.csv").toURI()).getAbsolutePath(); - stmt.executeUpdate("copy from '" + csvFilePath + "' into person (id, name) format csv"); - - List> rows = sqlNexus.query(q("select * from person")).getAll(); - - List> exp = asList( - asList(1, "John"), - asList(2, "Jack") - ); - assertEquals(exp, rows); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCopyDoesNotOverwrite() throws Exception { - sqlNexus.query(q("insert into person values(1, 'Old')")); - String csvFilePath = new File(getClass().getResource("mvcc_person.csv").toURI()).getAbsolutePath(); - stmt.executeUpdate("copy from '" + csvFilePath + "' into person (id, name) format csv"); - - List> rows = sqlNexus.query(q("select * from person")).getAll(); - - List> exp = asList( - asList(1, "Old"), - asList(2, "Jack") - ); - assertEquals(exp, rows); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCopyLeavesPartialResultsInCaseOfFailure() throws Exception { - String csvFilePath = new File(getClass().getResource("mvcc_person_broken.csv").toURI()).getAbsolutePath(); - try { - stmt.executeUpdate("copy from '" + csvFilePath + "' into person (id, name) format csv"); - fail(); - } - catch (SQLException ignored) { - // assert exception is thrown - } - - List> rows = sqlNexus.query(q("select * from person")).getAll(); - - List> exp = singletonList( - asList(1, "John") - ); - assertEquals(exp, rows); - } - - /** */ - private static SqlFieldsQuery q(String sql) { - return new SqlFieldsQuery(sql); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClientReconnectContinuousQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClientReconnectContinuousQueryTest.java deleted file mode 100644 index 33e09602b6f04..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClientReconnectContinuousQueryTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.internal.processors.cache.query.continuous.ClientReconnectContinuousQueryTest; - -/** - * - */ -public class CacheMvccClientReconnectContinuousQueryTest extends ClientReconnectContinuousQueryTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryBackupQueueTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryBackupQueueTest.java deleted file mode 100644 index 3a598a2ca3cee..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryBackupQueueTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.internal.processors.cache.query.continuous.IgniteCacheContinuousQueryBackupQueueTest; - -/** - * - */ -public class CacheMvccContinuousQueryBackupQueueTest extends IgniteCacheContinuousQueryBackupQueueTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryClientReconnectTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryClientReconnectTest.java deleted file mode 100644 index 7ebc0b1c5ec18..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryClientReconnectTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.internal.processors.cache.query.continuous.IgniteCacheContinuousQueryClientReconnectTest; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - -/** - * Mvcc CQ client reconnect test. - */ -public class CacheMvccContinuousQueryClientReconnectTest extends IgniteCacheContinuousQueryClientReconnectTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicMode() { - return TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Test - @Override public void testReconnectClient() throws Exception { - super.testReconnectClient(); - } - - /** {@inheritDoc} */ - @Test - @Override public void testReconnectClientAndLeftRouter() throws Exception { - super.testReconnectClientAndLeftRouter(); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryClientTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryClientTest.java deleted file mode 100644 index 5c6c7a8b0f815..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryClientTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.internal.processors.cache.query.continuous.IgniteCacheContinuousQueryClientTest; - -/** - * Mvcc CQ client test. - */ -public class CacheMvccContinuousQueryClientTest extends IgniteCacheContinuousQueryClientTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryImmutableEntryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryImmutableEntryTest.java deleted file mode 100644 index bef9c70998161..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryImmutableEntryTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.internal.processors.cache.query.continuous.IgniteCacheContinuousQueryImmutableEntryTest; - -/** - * - */ -public class CacheMvccContinuousQueryImmutableEntryTest extends IgniteCacheContinuousQueryImmutableEntryTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryMultiNodesFilteringTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryMultiNodesFilteringTest.java deleted file mode 100644 index 714e83410ef8d..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryMultiNodesFilteringTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryMultiNodesFilteringTest; - -/** - * - */ -public class CacheMvccContinuousQueryMultiNodesFilteringTest extends GridCacheContinuousQueryMultiNodesFilteringTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryPartitionedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryPartitionedSelfTest.java deleted file mode 100644 index 0e0febef4574f..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryPartitionedSelfTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -/** - * Mvcc continuous query test for partitioned cache. - */ -public class CacheMvccContinuousQueryPartitionedSelfTest extends CacheMvccAbstractContinuousQuerySelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryPartitionedTxOneNodeTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryPartitionedTxOneNodeTest.java deleted file mode 100644 index 795932e26546c..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryPartitionedTxOneNodeTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryReplicatedTxOneNodeTest; - -/** - * Mvcc continuous query test for one node. - */ -public class CacheMvccContinuousQueryPartitionedTxOneNodeTest extends GridCacheContinuousQueryReplicatedTxOneNodeTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryReplicatedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryReplicatedSelfTest.java deleted file mode 100644 index c9adbf95183ad..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryReplicatedSelfTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -/** - * Mvcc continuous query test for replicated cache. - */ -public class CacheMvccContinuousQueryReplicatedSelfTest extends CacheMvccAbstractContinuousQuerySelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.REPLICATED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryReplicatedTxOneNodeTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryReplicatedTxOneNodeTest.java deleted file mode 100644 index d522ee9b9af9d..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousQueryReplicatedTxOneNodeTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryReplicatedTxOneNodeTest; - -/** - * Mvcc continuous query test for one node. - */ -public class CacheMvccContinuousQueryReplicatedTxOneNodeTest extends GridCacheContinuousQueryReplicatedTxOneNodeTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.REPLICATED; - } -} - diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousWithTransformerClientSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousWithTransformerClientSelfTest.java deleted file mode 100644 index bb86d0646a248..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousWithTransformerClientSelfTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousWithTransformerClientSelfTest; -import org.junit.Ignore; -import org.junit.Test; - -/** - * - */ -public class CacheMvccContinuousWithTransformerClientSelfTest extends CacheContinuousWithTransformerClientSelfTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7311") - @Test - @Override public void testExpired() throws Exception { - // No-op. - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousWithTransformerPartitionedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousWithTransformerPartitionedSelfTest.java deleted file mode 100644 index 55c2acf35bb51..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousWithTransformerPartitionedSelfTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousWithTransformerReplicatedSelfTest; -import org.junit.Ignore; -import org.junit.Test; - -/** - * - */ -public class CacheMvccContinuousWithTransformerPartitionedSelfTest extends CacheContinuousWithTransformerReplicatedSelfTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7311") - @Test - @Override public void testExpired() throws Exception { - // No-op. - } -} - diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousWithTransformerReplicatedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousWithTransformerReplicatedSelfTest.java deleted file mode 100644 index 6f25b089672a7..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccContinuousWithTransformerReplicatedSelfTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousWithTransformerReplicatedSelfTest; -import org.junit.Ignore; -import org.junit.Test; - -/** - * - */ -public class CacheMvccContinuousWithTransformerReplicatedSelfTest - extends CacheContinuousWithTransformerReplicatedSelfTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-7311") - @Test - @Override public void testExpired() throws Exception { - // No-op. - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccDmlSimpleTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccDmlSimpleTest.java deleted file mode 100644 index 05f47dd30cf66..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccDmlSimpleTest.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import javax.cache.CacheException; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.transactions.TransactionDuplicateKeyException; -import org.junit.Test; - -import static java.util.Arrays.asList; - -/** - * - */ -public class CacheMvccDmlSimpleTest extends CacheMvccAbstractTest { - /** */ - private IgniteCache cache; - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - cache = startGrid(0).getOrCreateCache( - new CacheConfiguration<>("test") - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - .setSqlSchema("PUBLIC") - .setIndexedTypes(Integer.class, Integer.class) - ); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testInsert() throws Exception { - int cnt = update("insert into Integer(_key, _val) values(1, 1),(2, 2)"); - - assertEquals(2, cnt); - - assertEquals(asSet(asList(1, 1), asList(2, 2)), query("select * from Integer")); - - try { - update("insert into Integer(_key, _val) values(3, 3),(1, 1)"); - } - catch (CacheException e) { - assertTrue(e.getCause() instanceof TransactionDuplicateKeyException); - assertTrue(e.getMessage().startsWith("Duplicate key during INSERT [")); - } - - assertEquals(asSet(asList(1, 1), asList(2, 2)), query("select * from Integer")); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testMerge() throws Exception { - { - int cnt = update("merge into Integer(_key, _val) values(1, 1),(2, 2)"); - - assertEquals(2, cnt); - assertEquals(asSet(asList(1, 1), asList(2, 2)), query("select * from Integer")); - } - - { - int cnt = update("merge into Integer(_key, _val) values(3, 3),(1, 1)"); - - assertEquals(2, cnt); - assertEquals(asSet(asList(1, 1), asList(2, 2), asList(3, 3)), query("select * from Integer")); - } - } - - /** - * @throws Exception if failed. - */ - @Test - public void testUpdate() throws Exception { - { - int cnt = update("update Integer set _val = 42 where _key = 42"); - - assertEquals(0, cnt); - assertTrue(query("select * from Integer").isEmpty()); - } - - update("insert into Integer(_key, _val) values(1, 1),(2, 2)"); - - { - int cnt = update("update Integer set _val = 42 where _key = 42"); - - assertEquals(0, cnt); - assertEquals(asSet(asList(1, 1), asList(2, 2)), query("select * from Integer")); - } - - { - int cnt = update("update Integer set _val = 42 where _key >= 42"); - - assertEquals(0, cnt); - assertEquals(asSet(asList(1, 1), asList(2, 2)), query("select * from Integer")); - } - - { - int cnt = update("update Integer set _val = 11 where _key = 1"); - - assertEquals(1, cnt); - assertEquals(asSet(asList(1, 11), asList(2, 2)), query("select * from Integer")); - } - - { - int cnt = update("update Integer set _val = 12 where _key <= 2"); - - assertEquals(asSet(asList(1, 12), asList(2, 12)), query("select * from Integer")); - assertEquals(2, cnt); - } - } - - /** - * @throws Exception if failed. - */ - @Test - public void testDelete() throws Exception { - { - int cnt = update("delete from Integer where _key = 42"); - - assertEquals(0, cnt); - } - - update("insert into Integer(_key, _val) values(1, 1),(2, 2)"); - - { - int cnt = update("delete from Integer where _key = 42"); - - assertEquals(0, cnt); - assertEquals(asSet(asList(1, 1), asList(2, 2)), query("select * from Integer")); - } - - { - int cnt = update("delete from Integer where _key >= 42"); - - assertEquals(0, cnt); - assertEquals(asSet(asList(1, 1), asList(2, 2)), query("select * from Integer")); - } - - { - int cnt = update("delete from Integer where _key = 1"); - - assertEquals(1, cnt); - assertEquals(asSet(asList(2, 2)), query("select * from Integer")); - } - - { - int cnt = update("delete from Integer where _key <= 2"); - - assertTrue(query("select * from Integer").isEmpty()); - assertEquals(1, cnt); - } - } - - /** - * @param q Query. - * @return Row set. - */ - private Set> query(String q) { - return new HashSet<>(cache.query(new SqlFieldsQuery(q)).getAll()); - } - - /** - * @param q Query. - * @return Updated rows count. - */ - private int update(String q) { - return Integer.parseInt(cache.query(new SqlFieldsQuery(q)).getAll().get(0).get(0).toString()); - } - - /** */ - private Set> asSet(List... ls) { - return new HashSet<>(asList(ls)); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccIteratorWithConcurrentJdbcTransactionTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccIteratorWithConcurrentJdbcTransactionTest.java deleted file mode 100644 index 235d87fcaccdb..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccIteratorWithConcurrentJdbcTransactionTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -/** - * - */ -public class CacheMvccIteratorWithConcurrentJdbcTransactionTest extends CacheMvccIteratorWithConcurrentTransactionTest { - /** {@inheritDoc} */ - @Override boolean jdbcTx() { - return true; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccLocalEntriesWithConcurrentJdbcTransactionTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccLocalEntriesWithConcurrentJdbcTransactionTest.java deleted file mode 100644 index 97c062f2aa796..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccLocalEntriesWithConcurrentJdbcTransactionTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -/** - * - */ -public class CacheMvccLocalEntriesWithConcurrentJdbcTransactionTest extends - CacheMvccLocalEntriesWithConcurrentTransactionTest { - /** {@inheritDoc} */ - @Override boolean jdbcTx() { - return true; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedBackupsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedBackupsTest.java deleted file mode 100644 index 71d832c1e2b14..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedBackupsTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** */ -public class CacheMvccPartitionedBackupsTest extends CacheMvccBackupsAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlCoordinatorFailoverTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlCoordinatorFailoverTest.java deleted file mode 100644 index b30ec9811fe56..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlCoordinatorFailoverTest.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; -import org.junit.Ignore; -import org.junit.Test; - -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SCAN; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.DML; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * SQL Mvcc coordinator failover test for partitioned caches. - */ -public class CacheMvccPartitionedSqlCoordinatorFailoverTest extends CacheMvccAbstractSqlCoordinatorFailoverTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSql_ClientServer_Backups2_CoordinatorFails() throws Exception { - accountsTxReadAll(4, 2, 2, DFLT_PARTITION_COUNT, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, DML, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSql_Server_Backups1_CoordinatorFails_Persistence() throws Exception { - persistence = true; - - accountsTxReadAll(2, 0, 1, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, DML, DFLT_TEST_TIME, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups3_RestartCoordinator_ScanDml() throws Exception { - putAllGetAll(RestartMode.RESTART_CRD, 5, 2, 3, DFLT_PARTITION_COUNT, - new InitIndexing(Integer.class, Integer.class), SCAN, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups1_RestartCoordinator_ScanDml_Persistence() throws Exception { - persistence = true; - - putAllGetAll(RestartMode.RESTART_CRD, 2, 1, 2, DFLT_PARTITION_COUNT, - new InitIndexing(Integer.class, Integer.class), SCAN, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups2_RestartCoordinator_SqlDml_Persistence() throws Exception { - persistence = true; - - putAllGetAll(RestartMode.RESTART_CRD, 4, 2, 2, 64, - new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups1_RestartCoordinator_SqlDml() throws Exception { - putAllGetAll(RestartMode.RESTART_CRD, 2, 1, 1, 64, - new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10693") - @Test - public void testPutAllGetAll_ClientServer_Backups1_RestartRandomSrv_SqlDml() throws Exception { - putAllGetAll(RestartMode.RESTART_RND_SRV, 3, 1, 1, DFLT_PARTITION_COUNT, - new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10693") - @Test - public void testPutAllGetAll_ClientServer_Backups2_RestartRandomSrv_SqlDml() throws Exception { - putAllGetAll(RestartMode.RESTART_RND_SRV, 4, 1, 2, DFLT_PARTITION_COUNT, - new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10693") - @Test - public void testPutAllGetAll_Server_Backups2_RestartRandomSrv_SqlDml() throws Exception { - putAllGetAll(RestartMode.RESTART_RND_SRV, 4, 0, 2, DFLT_PARTITION_COUNT, - new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_Server_Backups1_SinglePartition_RestartRandomSrv_SqlDml() throws Exception { - putAllGetAll(RestartMode.RESTART_RND_SRV, 4, 0, 1, 1, - new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testPutAllGetAll_ClientServer_Backups1_SinglePartition_RestartRandomSrv_SqlDml() throws Exception { - putAllGetAll(RestartMode.RESTART_RND_SRV, 3, 1, 1, 1, - new InitIndexing(Integer.class, Integer.class), SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_ClientServer_Backups2_Sql() throws Exception { - updateNObjectsTest(7, 3, 2, 2, DFLT_PARTITION_COUNT, DFLT_TEST_TIME, - new InitIndexing(Integer.class, Integer.class), SQL, DML, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdate_N_Objects_ClientServer_Backups1_Sql_Persistence() throws Exception { - persistence = true; - - updateNObjectsTest(10, 2, 1, 1, DFLT_PARTITION_COUNT, DFLT_TEST_TIME, - new InitIndexing(Integer.class, Integer.class), SQL, DML, RestartMode.RESTART_CRD); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSqlReadInProgressCoordinatorFails() throws Exception { - readInProgressCoordinatorFails( - false, - false, - PESSIMISTIC, - REPEATABLE_READ, - SQL, - DML, - new InitIndexing(Integer.class, Integer.class) - ); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSqlReadInsideTxInProgressCoordinatorFails() throws Exception { - readInProgressCoordinatorFails(false, true, PESSIMISTIC, REPEATABLE_READ, SQL, DML, new InitIndexing(Integer.class, Integer.class)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSqlReadInProgressCoordinatorFails_ReadDelay() throws Exception { - readInProgressCoordinatorFails(true, false, PESSIMISTIC, REPEATABLE_READ, SQL, DML, new InitIndexing(Integer.class, Integer.class)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSqlReadInsideTxInProgressCoordinatorFails_ReadDelay() throws Exception { - readInProgressCoordinatorFails(true, true, PESSIMISTIC, REPEATABLE_READ, SQL, DML, new InitIndexing(Integer.class, Integer.class)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testReadInProgressCoordinatorFailsSimple_FromServer() throws Exception { - readInProgressCoordinatorFailsSimple(false, new InitIndexing(Integer.class, Integer.class), SQL, DML); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlQueriesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlQueriesTest.java deleted file mode 100644 index 6bca3c20881a0..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlQueriesTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** */ -public class CacheMvccPartitionedSqlQueriesTest extends CacheMvccSqlQueriesAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlTxQueriesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlTxQueriesTest.java deleted file mode 100644 index 02f091d74dff4..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlTxQueriesTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** */ -public class CacheMvccPartitionedSqlTxQueriesTest extends CacheMvccSqlTxQueriesAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlTxQueriesWithReducerTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlTxQueriesWithReducerTest.java deleted file mode 100644 index 0f7d24b2b6b48..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccPartitionedSqlTxQueriesWithReducerTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import org.apache.ignite.Ignite; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cluster.ClusterTopologyException; -import org.apache.ignite.internal.TestRecordingCommunicationSpi; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage; -import org.apache.ignite.internal.util.typedef.X; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; - -/** */ -public class CacheMvccPartitionedSqlTxQueriesWithReducerTest extends CacheMvccSqlTxQueriesWithReducerAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryUpdateOnUnstableTopologyDoesNotCauseDeadlock() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class); - - testSpi = true; - - Ignite updateNode = startGrids(3); - - CountDownLatch latch = new CountDownLatch(1); - - TestRecordingCommunicationSpi spi = TestRecordingCommunicationSpi.spi(grid(1)); - - spi.blockMessages((node, msg) -> { - if (msg instanceof GridDhtPartitionsSingleMessage) { - latch.countDown(); - - return true; - } - - return false; - }); - - CompletableFuture.runAsync(() -> stopGrid(2)); - - assertTrue(latch.await(TX_TIMEOUT, TimeUnit.MILLISECONDS)); - - CompletableFuture queryFut = CompletableFuture.runAsync(() -> updateNode - .cache(DEFAULT_CACHE_NAME) - .query(new SqlFieldsQuery("INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) VALUES (1,1),(2,2),(3,3)")) - .getAll()); - - Thread.sleep(300); - - spi.stopBlock(); - - try { - queryFut.get(TX_TIMEOUT, TimeUnit.MILLISECONDS); - } - catch (Exception e) { - assertTrue(X.hasCause(e, ClusterTopologyException.class)); - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedBackupsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedBackupsTest.java deleted file mode 100644 index 02de0a346f304..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedBackupsTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -import static org.apache.ignite.cache.CacheMode.REPLICATED; - -/** */ -public class CacheMvccReplicatedBackupsTest extends CacheMvccBackupsAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return REPLICATED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlCoordinatorFailoverTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlCoordinatorFailoverTest.java deleted file mode 100644 index 2f72bcea7fe32..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlCoordinatorFailoverTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -/** - * SQL Mvcc coordinator failover test for replicated caches. - */ -public class CacheMvccReplicatedSqlCoordinatorFailoverTest extends CacheMvccAbstractSqlCoordinatorFailoverTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.REPLICATED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlQueriesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlQueriesTest.java deleted file mode 100644 index 35228797b6e83..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlQueriesTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -import static org.apache.ignite.cache.CacheMode.REPLICATED; - -/** */ -public class CacheMvccReplicatedSqlQueriesTest extends CacheMvccSqlQueriesAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return REPLICATED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlTxQueriesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlTxQueriesTest.java deleted file mode 100644 index d9555ef76a4f6..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlTxQueriesTest.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.List; -import java.util.Random; -import java.util.concurrent.ThreadLocalRandom; -import javax.cache.Cache; -import org.apache.ignite.Ignite; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.query.GridQueryProcessor; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.cache.CacheMode.REPLICATED; -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** */ -public class CacheMvccReplicatedSqlTxQueriesTest extends CacheMvccSqlTxQueriesAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return REPLICATED; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - ccfgs = null; - ccfg = null; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testReplicatedJoinPartitionedClient() throws Exception { - checkReplicatedJoinPartitioned(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testReplicatedJoinPartitionedServer() throws Exception { - checkReplicatedJoinPartitioned(false); - } - - /** - * @throws Exception If failed. - */ - private void checkReplicatedJoinPartitioned(boolean client) throws Exception { - ccfgs = new CacheConfiguration[] { - cacheConfiguration(REPLICATED, FULL_SYNC, 0, DFLT_PARTITION_COUNT) - .setName("int") - .setIndexedTypes(Integer.class, Integer.class), - cacheConfiguration(PARTITIONED, FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, - CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class), - cacheConfiguration(REPLICATED, FULL_SYNC, 0, DFLT_PARTITION_COUNT) - .setName("target") - .setIndexedTypes(Integer.class, Integer.class) - }; - - startGridsMultiThreaded(3); - - this.client = true; - - startGrid(3); - - Ignite node = client ? grid(3) : grid(0); - - List> r; - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - r = runSql(node, "INSERT INTO \"int\".Integer(_key, _val) VALUES (1,1), (2,2), (3,3)"); - - assertEquals(3L, r.get(0).get(0)); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - r = runSql(node, "INSERT INTO \"default\".MvccTestSqlIndexValue(_key, idxVal1) " + - "VALUES (1,10), (2, 20), (3, 30)"); - - assertEquals(3L, r.get(0).get(0)); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - r = runSql(node, "INSERT INTO \"target\".Integer(_key, _val) " + - "SELECT a._key, a.idxVal1*b._val FROM \"default\".MvccTestSqlIndexValue a " + - "JOIN \"int\".Integer b ON a._key = b._key"); - - assertEquals(3L, r.get(0).get(0)); - - tx.commit(); - } - - for (int n = 0; n < 3; ++n) { - node = grid(n); - - r = runSqlLocal(node, "SELECT _key, _val FROM \"target\".Integer ORDER BY _key"); - - assertEquals(3L, r.size()); - - assertEquals(1, r.get(0).get(0)); - assertEquals(2, r.get(1).get(0)); - assertEquals(3, r.get(2).get(0)); - - assertEquals(10, r.get(0).get(1)); - assertEquals(40, r.get(1).get(1)); - assertEquals(90, r.get(2).get(1)); - } - } - - /** - * - * @throws Exception If failed. - */ - @Test - public void testReplicatedAndPartitionedUpdateSingleTransaction() throws Exception { - ccfgs = new CacheConfiguration[] { - cacheConfiguration(REPLICATED, FULL_SYNC, 0, DFLT_PARTITION_COUNT) - .setName("rep") - .setIndexedTypes(Integer.class, Integer.class), - cacheConfiguration(PARTITIONED, FULL_SYNC, 0, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class) - .setName("part"), - }; - - startGridsMultiThreaded(3); - - client = true; - - startGrid(3); - - Random rnd = ThreadLocalRandom.current(); - - Ignite node = grid(rnd.nextInt(4)); - - List> r; - - Cache repCache = node.cache("rep"); - - repCache.put(1, 1); - repCache.put(2, 2); - repCache.put(3, 3); - - Cache partCache = node.cache("part"); - - partCache.put(1, new MvccTestSqlIndexValue(1)); - partCache.put(2, new MvccTestSqlIndexValue(2)); - partCache.put(3, new MvccTestSqlIndexValue(3)); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - r = runSql(node, "UPDATE \"rep\".Integer SET _val = _key * 10"); - - assertEquals(3L, r.get(0).get(0)); - - r = runSql(node, "UPDATE \"part\".MvccTestSqlIndexValue SET idxVal1 = _key * 10"); - - assertEquals(3L, r.get(0).get(0)); - - tx.commit(); - } - - r = runSql(node, "SELECT COUNT(1) FROM \"rep\".Integer r JOIN \"part\".MvccTestSqlIndexValue p" + - " ON r._key = p._key WHERE r._val = p.idxVal1"); - - assertEquals(3L, r.get(0).get(0)); - - for (int n = 0; n < 3; ++n) { - node = grid(n); - - r = runSqlLocal(node, "SELECT _key, _val FROM \"rep\".Integer ORDER BY _key"); - - assertEquals(3L, r.size()); - - assertEquals(1, r.get(0).get(0)); - assertEquals(2, r.get(1).get(0)); - assertEquals(3, r.get(2).get(0)); - - assertEquals(10, r.get(0).get(1)); - assertEquals(20, r.get(1).get(1)); - assertEquals(30, r.get(2).get(1)); - } - } - - /** - * Run query. - * - * @param node Node. - * @param sqlText Query. - * @return Results. - */ - private List> runSql(Ignite node, String sqlText) { - GridQueryProcessor qryProc = ((IgniteEx)node).context().query(); - - return qryProc.querySqlFields(new SqlFieldsQuery(sqlText), false).getAll(); - } - - /** - * Run query locally. - * - * @param node Node. - * @param sqlText Query. - * @return Results. - */ - private List> runSqlLocal(Ignite node, String sqlText) { - GridQueryProcessor qryProc = ((IgniteEx)node).context().query(); - - return qryProc.querySqlFields(new SqlFieldsQuery(sqlText).setLocal(true), false).getAll(); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlTxQueriesWithReducerTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlTxQueriesWithReducerTest.java deleted file mode 100644 index 9268c08ca189d..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedSqlTxQueriesWithReducerTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -import static org.apache.ignite.cache.CacheMode.REPLICATED; - -/** */ -public class CacheMvccReplicatedSqlTxQueriesWithReducerTest extends CacheMvccSqlTxQueriesWithReducerAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return REPLICATED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccScanQueryWithConcurrentJdbcTransactionTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccScanQueryWithConcurrentJdbcTransactionTest.java deleted file mode 100644 index 7272def94632f..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccScanQueryWithConcurrentJdbcTransactionTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -/** - * - */ -public class CacheMvccScanQueryWithConcurrentJdbcTransactionTest extends - CacheMvccScanQueryWithConcurrentTransactionTest { - /** {@inheritDoc} */ - @Override boolean jdbcTx() { - return true; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryBasicTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryBasicTest.java deleted file mode 100644 index ad6f4e219ddab..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryBasicTest.java +++ /dev/null @@ -1,792 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Random; -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import javax.cache.CacheException; -import org.apache.ignite.Ignite; -import org.apache.ignite.Ignition; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.FieldsQueryCursor; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.util.typedef.T2; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.cache.CacheMode.REPLICATED; -import static org.apache.ignite.internal.processors.cache.index.AbstractSchemaSelfTest.connect; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * - */ -@RunWith(Parameterized.class) -public class CacheMvccSelectForUpdateQueryBasicTest extends CacheMvccAbstractTest { - /** */ - private static final int CACHE_SIZE = 100; - - /** */ - private static Random RAND = new Random(); - - /** */ - @Parameterized.Parameter(0) - public CacheMode cacheMode; - - /** */ - @Parameterized.Parameter(1) - public int backups; - - /** */ - @Parameterized.Parameter(2) - public boolean fromClient; - - /** */ - @Parameterized.Parameter(3) - public boolean segmented; - - /** - * @return Test parameters. - */ - @Parameterized.Parameters(name = "cacheMode={0}, backups={1}, fromClient={2}, segmented={3}") - public static Collection parameters() { - return Arrays.asList(new Object[][] { - // cacheMode, backups, from client, segmented - {REPLICATED, 0, true, false}, - {REPLICATED, 0, false, false}, - {PARTITIONED, 0, true, false}, - {PARTITIONED, 0, false, true}, - {PARTITIONED, 1, true, true}, - {PARTITIONED, 1, false, false}, - {PARTITIONED, 2, true, false}, - }); - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return null; - } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - cleanPersistenceDir(); - - startGridsMultiThreaded(3); - - client = true; - - startGrid(3); - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - super.afterTestsStopped(); - - super.afterTest(); // Check mvcc state and stop nodes - } - - /** {@inheritDoc} */ - @Override public void afterTest() throws Exception { - verifyOldVersionsCleaned(); - - verifyCoordinatorInternalState(); - - grid(3).destroyCache("SQL_PUBLIC_PERSON"); - } - - /** {@inheritDoc} */ - @Override public void beforeTest() throws Exception { - Ignite client = grid(3); - - CacheConfiguration dummyCfg = new CacheConfiguration<>("dummy") - .setSqlSchema("PUBLIC").setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); - - // Create dummy cache as entry point. - client.getOrCreateCache(dummyCfg); - - String templateName = String.valueOf(cacheMode) + backups + fromClient + segmented; - - CacheConfiguration ccfg = new CacheConfiguration<>(templateName); - - ccfg.setCacheMode(cacheMode); - ccfg.setBackups(backups); - - if (segmented) - ccfg.setQueryParallelism(4); - - client.addCacheConfiguration(ccfg); - - // Create MVCC table and cache. - runSql(client, "CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, salary INT) " + - "WITH \"ATOMICITY=TRANSACTIONAL_SNAPSHOT, TEMPLATE=" + templateName + "\"", false); - - runSql(client, "CREATE INDEX salaryIdx ON person(salary)", false); - - // Populate MVCC cache. Salaries 0, 10, 20, 30,..., 990. - for (int i = 0; i < CACHE_SIZE; i++) - runSql(client, "INSERT INTO person (id, name, salary) VALUES (" - + i + ", 'name" + i + "', " + i * 10 + ")", false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSingleLock() throws Exception { - Ignite node = getNode(); - - String sql = "SELECT id, name FROM person WHERE salary = 100"; - String sqlForUpdate = sql + " FOR UPDATE"; - - // Check SELECT FOR UPDATE. - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - List> res = runSql(node, sqlForUpdate, false).getAll(); - - assertEquals(1, res.size()); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - int key = (Integer)r.get(0); - - assertEquals(10, key); - - keys.add(key); - } - - checkLocks(keys); - - tx.commit(); - } - - checkLocks(Collections.emptyList()); - - // Check cached statement works in the same way. - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - List> res = runSql(node, sqlForUpdate, false).getAll(); - - assertEquals(1, res.size()); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - int key = (Integer)r.get(0); - - assertEquals(10, key); - - keys.add(key); - } - - checkLocks(keys); - - tx.rollback(); - - checkLocks(Collections.emptyList()); - } - - // Check cached statement doesn't lock keys without tx. - { - List> res = runSql(node, sqlForUpdate, false).getAll(); - - assertEquals(1, res.size()); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - int key = (Integer)r.get(0); - - assertEquals(10, key); - - keys.add(key); - } - - checkLocks(Collections.emptyList()); - } - - // Check cached statement locks keys in tx. - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - List> res = runSql(node, sqlForUpdate, false).getAll(); - - assertEquals(1, res.size()); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - int key = (Integer)r.get(0); - - assertEquals(10, key); - - keys.add(key); - } - - // Run dummy DML. - runSql(node, "UPDATE Person SET name='test' WHERE id=" + keys.get(0), false).getAll(); - - checkLocks(keys); - - tx.commit(); - } - - checkLocks(Collections.emptyList()); - - // Check SFU and non-SFU selects are cached separately. - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - List> res = runSql(node, sql, false).getAll(); - - assertEquals(1, res.size()); - - for (List r : res) - assertEquals(2, r.size()); - - checkLocks(Collections.emptyList()); - - tx.commit(); - } - - // Check SFU and non-SFU selects are cached separately. - { - List> res = runSql(node, sql, false).getAll(); - - assertEquals(1, res.size()); - - for (List r : res) - assertEquals(2, r.size()); - - checkLocks(Collections.emptyList()); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSelectForUpdateLocal() throws Exception { - checkSelectForUpdate(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSelectForUpdateDistributed() throws Exception { - checkSelectForUpdate(false); - } - - /** - * @throws Exception If failed. - */ - private void checkSelectForUpdate(boolean loc) throws Exception { - Ignite node = loc ? grid(0) : getNode(); - - String sql = "SELECT name, id FROM person WHERE MOD(salary, 3) = 0 ORDER BY id"; - String sqlForUpdate = sql + " FOR UPDATE"; - - // Check statement doesn't lock keys without tx. - { - List> res = runSql(node, sqlForUpdate, loc).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() >= CACHE_SIZE / 4 && res.size() <= CACHE_SIZE / 2); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - keys.add((Integer)r.get(1)); - } - - checkLocks(Collections.emptyList()); - } - - // Check SELECT FOR UPDATE. - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - List> res = runSql(node, sqlForUpdate, loc).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() >= CACHE_SIZE / 4 && res.size() <= CACHE_SIZE / 2); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - keys.add((Integer)r.get(1)); - } - - // Run dummy DML. - runSql(node, "UPDATE Person SET name='test' WHERE id=" + keys.get(0), loc).getAll(); - - checkLocks(keys); - - tx.rollback(); - - checkLocks(Collections.emptyList()); - } - - // Check cached statement doesn't lock keys without tx. - { - List> res = runSql(node, sqlForUpdate, loc).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() >= CACHE_SIZE / 4 && res.size() <= CACHE_SIZE / 2); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - keys.add((Integer)r.get(1)); - } - - checkLocks(Collections.emptyList()); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - List> res = runSql(node, sqlForUpdate, loc).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() >= CACHE_SIZE / 4 && res.size() <= CACHE_SIZE / 2); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - keys.add((Integer)r.get(1)); - } - - // Run dummy DML. - runSql(node, "UPDATE Person SET name='test' WHERE id=" + keys.get(0), loc).getAll(); - - checkLocks(keys); - - tx.rollback(); - - checkLocks(Collections.emptyList()); - } - - // Check SFU and non-SFU selects are cached separately. - { - List> res = runSql(node, sql, loc).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() >= CACHE_SIZE / 4 && res.size() <= CACHE_SIZE / 2); - - for (List r : res) - assertEquals(2, r.size()); - - checkLocks(Collections.emptyList()); - } - - // Check SFU and non-SFU selects are cached separately. - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - List> res = runSql(node, sql, loc).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() >= CACHE_SIZE / 4 && res.size() <= CACHE_SIZE / 2); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - keys.add((Integer)r.get(1)); - } - - checkLocks(Collections.emptyList()); - - tx.rollback(); - } - - checkLocks(Collections.emptyList()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testJdbcAutoCommitFalseStartsTx() throws Exception { - Ignite node = getNode(); - - try (Connection c = connect((IgniteEx)node)) { - c.setAutoCommit(false); - - String sql = "SELECT name, id FROM person WHERE MOD(salary, 3) = 0 ORDER BY id"; - String sqlForUpdate = sql + " FOR UPDATE"; - - List keys = runJdbcSql(c, sqlForUpdate, 2, 2); - - assertTrue(keys.size() >= CACHE_SIZE / 4 && keys.size() <= CACHE_SIZE / 2); - - checkLocks(keys); - - runJdbcSql(c, sql, 2, 2); - - checkLocks(keys); - - runJdbcSql(c, "COMMIT", -1, -1); - - checkLocks(Collections.emptyList()); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testJdbcAutoCommitTrueKeysLocked() throws Exception { - Ignite node = getNode(); - - try (Connection c = connect((IgniteEx)node)) { - c.setAutoCommit(true); - - runJdbcSql(c, "BEGIN", -1, -1); - - String sql = "SELECT name, id FROM person WHERE MOD(salary, 3) = 0 ORDER BY id"; - String sqlForUpdate = sql + " FOR UPDATE"; - - List keys = runJdbcSql(c, sqlForUpdate, 2, 2); - - assertTrue(keys.size() >= CACHE_SIZE / 4 && keys.size() <= CACHE_SIZE / 2); - - checkLocks(keys); - - runJdbcSql(c, sql, 2, 2); - - checkLocks(keys); - - runJdbcSql(c, "COMMIT", -1, -1); - - checkLocks(Collections.emptyList()); - - // Should not be locked because we are out of tx. - runJdbcSql(c, sqlForUpdate, 2, 2); - - checkLocks(Collections.emptyList()); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSelectForUpdateLocalWithArgs() throws Exception { - checkSelectForUpdateWithArgs(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSelectForUpdateDistributedWithArgs() throws Exception { - checkSelectForUpdateWithArgs(false); - } - - /** - * @throws Exception If failed. - */ - private void checkSelectForUpdateWithArgs(boolean loc) throws Exception { - Ignite node = loc ? grid(0) : getNode(); - - String sql = "SELECT name, id FROM person WHERE salary >= ? AND salary < ? ORDER BY id"; - String sqlForUpdate = sql + " FOR UPDATE"; - - // Check cached statement doesn't lock keys without tx. - { - List> res = runSql(node, sqlForUpdate, loc, 0, 200).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() == 20); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - keys.add((Integer)r.get(1)); - } - - checkLocks(Collections.emptyList()); - } - - // Check SELECT FOR UPDATE. - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - List> res = runSql(node, sqlForUpdate, loc, 0, 200).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() == 20); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - keys.add((Integer)r.get(1)); - } - - // Run dummy DML. - runSql(node, "UPDATE Person SET name='test' WHERE id=" + keys.get(0), loc).getAll(); - - checkLocks(keys); - - tx.rollback(); - - checkLocks(Collections.emptyList()); - } - - // Check cached statement doesn't lock keys without tx. - { - List> res = runSql(node, sqlForUpdate, loc, 0, 200).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() == 20); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - keys.add((Integer)r.get(1)); - } - - checkLocks(Collections.emptyList()); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - List> res = runSql(node, sqlForUpdate, loc, 0, 200).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() == 20); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - keys.add((Integer)r.get(1)); - } - - // Run dummy DML. - runSql(node, "UPDATE Person SET name='test' WHERE id=" + keys.get(0), loc).getAll(); - - checkLocks(keys); - - tx.rollback(); - - checkLocks(Collections.emptyList()); - } - - // Check SFU and non-SFU selects are cached separately. - { - List> res = runSql(node, sql, loc, 0, 200).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() == 20); - - for (List r : res) - assertEquals(2, r.size()); - - checkLocks(Collections.emptyList()); - } - - // Check SFU and non-SFU selects are cached separately. - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - List> res = runSql(node, sql, loc, 0, 200).getAll(); - - // Every third row should be fetched in distributed case. - assertTrue(loc ? !res.isEmpty() : res.size() == 20); - - List keys = new ArrayList<>(); - - for (List r : res) { - assertEquals(2, r.size()); - - keys.add((Integer)r.get(1)); - } - - checkLocks(Collections.emptyList()); - - tx.rollback(); - } - - checkLocks(Collections.emptyList()); - } - - /** - * Check that an attempt to get a lock on any key from given list fails by timeout. - * - * @param lockedKeys Keys to check. - * @throws Exception if failed. - */ - @SuppressWarnings({"unchecked"}) - private void checkLocks(List lockedKeys) throws Exception { - List allKeys = IntStream.range(0, CACHE_SIZE).boxed().collect(Collectors.toList()); - List nonLockedKeys = new ArrayList<>(allKeys); - - nonLockedKeys.removeAll(lockedKeys); - - List nodes = Ignition.allGrids(); - - Ignite node = nodes.get(RAND.nextInt(nodes.size())); - - List> calls = new ArrayList<>(); - - for (int key : allKeys) { - calls.add(new T2<>(key, GridTestUtils.runAsync(new Callable() { - /** {@inheritDoc} */ - @Override public Void call() { - try (Transaction tx = node.transactions().txStart(TransactionConcurrency.PESSIMISTIC, - TransactionIsolation.REPEATABLE_READ)) { - - // TODO uncomment to reproduce "https://issues.apache.org/jira/browse/IGNITE-11349" -// if (RAND.nextBoolean()) { -// node.cache("dummy").query(new SqlFieldsQuery("update person" + -// " set name='check' where id = " + key) -// .setTimeout(1, TimeUnit.SECONDS)) -// .getAll(); -// } -// else { - node.cache("dummy").query(new SqlFieldsQuery("SELECT * FROM person WHERE id=" + key + - " FOR UPDATE") - .setTimeout(1, TimeUnit.SECONDS)) - .getAll(); -// } - - tx.rollback(); - - return null; - } - } - }))); - } - - for (T2 pair : calls) { - if (nonLockedKeys.contains(pair.getKey())) { - try { - pair.getValue().get(TX_TIMEOUT); - } - catch (Exception e) { - if (e.getMessage() != null && e.getMessage().contains("Failed to acquire lock within provided timeout")) - throw new Exception("Key is locked, though it shouldn't be. Key: " + pair.getKey(), e); - - throw e; - } - } - else { - try { - pair.getValue().get(); - - fail("Key is not locked: " + pair.getKey()); - } - catch (Exception e) { - CacheException e0 = X.cause(e, CacheException.class); - - assert e0 != null; - - assert e0.getMessage() != null && - e0.getMessage().contains("Failed to acquire lock within provided timeout") : - X.getFullStackTrace(e); - } - } - } - } - - /** - * @return Node to run query from. - */ - private Ignite getNode() { - Ignite node = fromClient ? grid(3) : grid(RAND.nextInt(2)); - - assert fromClient == node.cluster().localNode().isClient(); - - return node; - } - - /** - * @param node Node. - * @param sql Sql string. - * @return Result. - */ - private FieldsQueryCursor> runSql(Ignite node, String sql, boolean local, Object... args) { - return node.cache("dummy").query(new SqlFieldsQuery(sql).setLocal(local).setArgs(args)); - } - - /** - * @param c Connection. - * @param sql Sql string. - * @param keyIdx Index of key field in result set. - * @param colCnt Expected columns count in result set. - */ - private List runJdbcSql(Connection c, String sql, int keyIdx, int colCnt) throws SQLException { - try (Statement stmt = c.createStatement()) { - stmt.execute(sql); - - ResultSet rs = stmt.getResultSet(); - - if (rs == null) { - assertEquals(keyIdx, -1); - - return null; - } - - List res = new ArrayList<>(); - - while (rs.next()) { - assertEquals(colCnt, rs.getMetaData().getColumnCount()); - - res.add(rs.getInt(keyIdx)); - } - - return res; - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryTest.java deleted file mode 100644 index 7bd570b61d439..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryTest.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.sql.Connection; -import java.util.List; -import java.util.concurrent.Callable; -import org.apache.ignite.Ignite; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.query.IgniteSQLException; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Test; - -import static org.apache.ignite.internal.processors.cache.index.AbstractSchemaSelfTest.connect; -import static org.apache.ignite.internal.processors.cache.index.AbstractSchemaSelfTest.execute; - -/** - * Test for {@code SELECT FOR UPDATE} queries. - */ -public class CacheMvccSelectForUpdateQueryTest extends GridCommonAbstractTest { - /** */ - private static final int CACHE_SIZE = 10; - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override protected void beforeTestsStarted() throws Exception { - Ignite grid = startGridsMultiThreaded(2); - - try (Connection c = connect((IgniteEx)grid)) { - c.setAutoCommit(false); - - execute(c, "create table person (id int primary key, firstName varchar, lastName varchar) " + - "with \"atomicity=transactional_snapshot,cache_name=Person\""); - - execute(c, "create table person_nonMvcc (id int primary key, firstName varchar, lastName varchar) " + - "with \"atomicity=transactional,cache_name=Person_nonMvcc\""); - - try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC, - TransactionIsolation.REPEATABLE_READ)) { - - for (int i = 1; i <= CACHE_SIZE; i++) { - execute(c, "insert into person(id, firstName, lastName) " + - "values(" + i + ",'firstName" + i + "','lastName" + i + "')"); - } - - tx.commit(); - } - } - } - - /** - * - */ - @Test - public void testSelectForUpdateWithUnion() { - assertQueryThrows("select id from person union select 1 for update", - "SELECT UNION FOR UPDATE is not supported."); - } - - /** - * - */ - @Test - public void testSelectForUpdateWithMultipleStatements() { - assertQueryThrows("select id from person for update; select firstName from person for update", - "Multiple statements queries are not supported"); - } - - /** - * - */ - @Test - public void testSelectForUpdateWithJoin() { - assertQueryThrows("select p1.id from person p1 join person p2 on p1.id = p2.id for update", - "SELECT FOR UPDATE with joins is not supported."); - } - - /** - * - */ - @Test - public void testSelectForUpdateWithLimit() { - assertQueryThrows("select id from person limit 0,5 for update", - "LIMIT/OFFSET clauses are not supported for SELECT FOR UPDATE."); - } - - /** - * - */ - @Test - public void testSelectForUpdateWithOffset() { - assertQueryThrows("select id from person offset 10 for update", - "LIMIT/OFFSET clauses are not supported for SELECT FOR UPDATE."); - } - - /** - * - */ - @Test - public void testSelectForUpdateWithDistinct() { - assertQueryThrows("select distinct firstName from PERSON for update", - "DISTINCT clause is not supported for SELECT FOR UPDATE."); - } - - /** - * - */ - @Test - public void testSelectForUpdateWithSubQuery() { - assertQueryThrows("select id, firstName from PERSON where id = (SELECT COUNT(*) FROM person) for update", - "Sub queries are not supported for SELECT FOR UPDATE."); - } - - /** - * - */ - @Test - public void testSelectForUpdateNonMvccCache() { - assertQueryThrows("select id, firstName from person_nonMvcc for update", - "SELECT FOR UPDATE query requires transactional cache with MVCC enabled."); - } - - /** - * - */ - @Test - public void testSelectForUpdateWithGroupings() { - assertQueryThrows("select count(*) from person for update", - "SELECT FOR UPDATE with aggregates and/or GROUP BY is not supported."); - - assertQueryThrows("select lastName, count(*) from person group by lastName for update", - "SELECT FOR UPDATE with aggregates and/or GROUP BY is not supported."); - } - - /** - * Test that query throws exception with expected message. - * @param qry SQL. - * @param exMsg Expected message. - */ - private void assertQueryThrows(String qry, String exMsg) { - assertQueryThrows(qry, exMsg, false); - - assertQueryThrows(qry, exMsg, true); - } - - /** - * Test that query throws exception with expected message. - * @param qry SQL. - * @param exMsg Expected message. - * @param loc Local query flag. - */ - @SuppressWarnings("ThrowableNotThrown") - private void assertQueryThrows(String qry, String exMsg, boolean loc) { - Ignite node = grid(0); - - GridTestUtils.assertThrows(null, new Callable() { - @Override public Object call() { - List r = node.cache("Person").query(new SqlFieldsQuery(qry).setLocal(loc)).getAll(); - - return r; - } - }, IgniteSQLException.class, exMsg); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeTest.java deleted file mode 100644 index 764f55035404f..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeTest.java +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ForkJoinPool; -import java.util.concurrent.Future; -import java.util.concurrent.ThreadLocalRandom; -import java.util.function.Consumer; -import java.util.stream.IntStream; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteDataStreamer; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.affinity.Affinity; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.query.IgniteSQLException; -import org.apache.ignite.transactions.TransactionDuplicateKeyException; -import org.junit.Test; - -import static org.apache.ignite.cache.CachePeekMode.BACKUP; - -/** - * - */ -public class CacheMvccSizeTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** */ - private void checkSizeModificationByOperation(String sql, boolean commit, int expSizeDelta) throws Exception { - checkSizeModificationByOperation(c -> {}, cache -> cache.query(q(sql)).getAll(), commit, expSizeDelta); - } - - /** */ - private void checkSizeModificationByOperation(String initSql, String sql, boolean commit, - int expSizeDelta) throws Exception { - checkSizeModificationByOperation( - cache -> cache.query(q(initSql)).getAll(), - cache -> cache.query(q(sql)).getAll(), - commit, - expSizeDelta); - } - - /** */ - private void checkSizeModificationByOperation(Consumer> inTx, boolean commit, - int expSizeDelta) throws Exception { - checkSizeModificationByOperation(c -> {}, inTx, commit, expSizeDelta); - } - - /** */ - private void checkSizeModificationByOperation(Consumer> beforeTx, - Consumer> inTx, boolean commit, int expSizeDelta) throws Exception { - IgniteCache tbl0 = grid(0).cache("person"); - - tbl0.query(q("delete from person")); - - beforeTx.accept(tbl0); - - int initSize = tbl0.size(); - - tbl0.query(q("begin")); - - inTx.accept(tbl0); - - // size is not changed before commit - assertEquals(0, tbl0.size() - initSize); - - if (commit) - tbl0.query(q("commit")); - else - tbl0.query(q("rollback")); - - assertEquals(expSizeDelta, tbl0.size() - initSize); - assertEquals(tbl0.size(), table(grid(1)).size()); - - assertEquals(tbl0.size(), tbl0.size(BACKUP)); - assertEquals(tbl0.size(), table(grid(1)).size(BACKUP)); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testSql() throws Exception { - startGridsMultiThreaded(2); - - createTable(grid(0)); - - checkSizeModificationByOperation("insert into person values(1, 'a')", true, 1); - - checkSizeModificationByOperation("insert into person values(1, 'a')", false, 0); - - checkSizeModificationByOperation( - personTbl -> personTbl.query(q("insert into person values(1, 'a')")), - personTbl -> { - try { - personTbl.query(q("insert into person values(1, 'a')")); - } - catch (Exception e) { - if (e.getCause() instanceof TransactionDuplicateKeyException) - assertTrue(e.getMessage().startsWith("Duplicate key during INSERT [")); - else { - e.printStackTrace(); - - fail("Unexpected exceptions"); - } - } - }, - false, 0); - - checkSizeModificationByOperation("merge into person(id, name) values(1, 'a')", true, 1); - - checkSizeModificationByOperation("merge into person(id, name) values(1, 'a')", false, 0); - - checkSizeModificationByOperation( - "insert into person values(1, 'a')", "merge into person(id, name) values(1, 'b')", true, 0); - - checkSizeModificationByOperation("update person set name = 'b' where id = 1", true, 0); - - checkSizeModificationByOperation( - "insert into person values(1, 'a')", "update person set name = 'b' where id = 1", true, 0); - - checkSizeModificationByOperation( - "insert into person values(1, 'a')", "delete from person where id = 1", true, -1); - - checkSizeModificationByOperation( - "insert into person values(1, 'a')", "delete from person where id = 1", false, 0); - - checkSizeModificationByOperation("delete from person where id = 1", true, 0); - - checkSizeModificationByOperation( - "insert into person values(1, 'a')", "select * from person", true, 0); - - checkSizeModificationByOperation("select * from person", true, 0); - - checkSizeModificationByOperation( - "insert into person values(1, 'a')", "select * from person where id = 1 for update", true, 0); - - checkSizeModificationByOperation("select * from person where id = 1 for update", true, 0); - - checkSizeModificationByOperation(personTbl -> { - personTbl.query(q("insert into person values(1, 'a')")); - - personTbl.query(q("insert into person values(%d, 'b')", keyInSamePartition(grid(0), "person", 1))); - - personTbl.query(q("insert into person values(%d, 'c')", keyInDifferentPartition(grid(0), "person", 1))); - }, true, 3); - - checkSizeModificationByOperation(personTbl -> { - personTbl.query(q("insert into person values(1, 'a')")); - - personTbl.query(q("delete from person where id = 1")); - }, true, 0); - - checkSizeModificationByOperation(personTbl -> { - personTbl.query(q("insert into person values(1, 'a')")); - - personTbl.query(q("delete from person where id = 1")); - - personTbl.query(q("insert into person values(1, 'a')")); - }, true, 1); - - checkSizeModificationByOperation( - personTbl -> personTbl.query(q("insert into person values(1, 'a')")), - personTbl -> { - personTbl.query(q("delete from person where id = 1")); - - personTbl.query(q("insert into person values(1, 'a')")); - }, true, 0); - - checkSizeModificationByOperation(personTbl -> { - personTbl.query(q("merge into person(id, name) values(1, 'a')")); - - personTbl.query(q("delete from person where id = 1")); - }, true, 0); - - checkSizeModificationByOperation(personTbl -> { - personTbl.query(q("merge into person(id, name) values(1, 'a')")); - - personTbl.query(q("delete from person where id = 1")); - - personTbl.query(q("merge into person(id, name) values(1, 'a')")); - }, true, 1); - - checkSizeModificationByOperation( - personTbl -> personTbl.query(q("merge into person(id, name) values(1, 'a')")), - personTbl -> { - personTbl.query(q("delete from person where id = 1")); - - personTbl.query(q("merge into person(id, name) values(1, 'a')")); - }, true, 0); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testInsertDeleteConcurrent() throws Exception { - startGridsMultiThreaded(2); - - IgniteCache tbl0 = createTable(grid(0)); - - SqlFieldsQuery insert = new SqlFieldsQuery("insert into person(id, name) values(?, 'a')"); - - SqlFieldsQuery delete = new SqlFieldsQuery("delete from person where id = ?"); - - CompletableFuture insertFut = CompletableFuture.supplyAsync(() -> { - int cnt = 0; - - for (int i = 0; i < 1000; i++) - cnt += update(insert.setArgs(ThreadLocalRandom.current().nextInt(10)), tbl0); - - return cnt; - }); - - CompletableFuture deleteFut = CompletableFuture.supplyAsync(() -> { - int cnt = 0; - - for (int i = 0; i < 1000; i++) - cnt += update(delete.setArgs(ThreadLocalRandom.current().nextInt(10)), tbl0); - - return cnt; - }); - - int expSize = insertFut.join() - deleteFut.join(); - - assertEquals(expSize, tbl0.size()); - assertEquals(expSize, table(grid(1)).size()); - - assertEquals(expSize, tbl0.size(BACKUP)); - assertEquals(expSize, table(grid(1)).size(BACKUP)); - } - - /** */ - private int update(SqlFieldsQuery qry, IgniteCache cache) { - try { - return Integer.parseInt(cache.query(qry).getAll().get(0).get(0).toString()); - } - catch (Exception e) { - return 0; - } - } - - /** - * @throws Exception if failed. - */ - @Test - public void testWriteConflictDoesNotChangeSize() throws Exception { - startGridsMultiThreaded(2); - - IgniteCache tbl0 = createTable(grid(0)); - - tbl0.query(q("insert into person values(1, 'a')")); - - tbl0.query(q("begin")); - - tbl0.query(q("delete from person where id = 1")); - - CompletableFuture conflictingStarted = new CompletableFuture<>(); - - CompletableFuture fut = CompletableFuture.runAsync(() -> { - tbl0.query(q("begin")); - - try { - tbl0.query(q("select * from person")).getAll(); - conflictingStarted.complete(null); - - tbl0.query(q("merge into person(id, name) values(1, 'b')")); - } - finally { - tbl0.query(q("commit")); - } - }); - - conflictingStarted.join(); - tbl0.query(q("commit")); - - try { - fut.join(); - } - catch (Exception e) { - if (e.getCause().getCause() instanceof IgniteSQLException) - assertTrue(e.getMessage().contains("Failed to finish transaction because it has been rolled back")); - else { - e.printStackTrace(); - - fail("Unexpected exception"); - } - } - - assertEquals(0, tbl0.size()); - assertEquals(0, table(grid(1)).size()); - - assertEquals(0, tbl0.size(BACKUP)); - assertEquals(0, table(grid(1)).size(BACKUP)); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testDeleteChangesSizeAfterUnlock() throws Exception { - startGridsMultiThreaded(2); - - IgniteCache tbl0 = createTable(grid(0)); - - tbl0.query(q("insert into person values(1, 'a')")); - - tbl0.query(q("begin")); - - tbl0.query(q("select * from person where id = 1 for update")).getAll(); - - CompletableFuture asyncThread = new CompletableFuture<>(); - - CompletableFuture fut = CompletableFuture.runAsync(() -> { - tbl0.query(q("begin")); - - try { - tbl0.query(q("select * from person")).getAll(); - - asyncThread.complete(Thread.currentThread()); - tbl0.query(q("delete from person where id = 1")); - } - finally { - tbl0.query(q("commit")); - } - }); - - Thread concThread = asyncThread.join(); - - // wait until concurrent thread blocks awaiting entry mvcc lock release - while (concThread.getState() == Thread.State.RUNNABLE && !Thread.currentThread().isInterrupted()); - - tbl0.query(q("commit")); - - fut.join(); - - assertEquals(0, tbl0.size()); - assertEquals(0, table(grid(1)).size()); - - assertEquals(0, tbl0.size(BACKUP)); - assertEquals(0, table(grid(1)).size(BACKUP)); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testDataStreamerModifiesReplicatedCacheSize() throws Exception { - startGridsMultiThreaded(2); - - IgniteEx ignite = grid(0); - - ignite.createCache( - new CacheConfiguration<>("test") - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) - .setCacheMode(CacheMode.REPLICATED) - ); - - try (IgniteDataStreamer streamer = ignite.dataStreamer("test")) { - streamer.addData(1, "a"); - - streamer.addData(keyInDifferentPartition(ignite, "test", 1), "b"); - } - - assertEquals(2, ignite.cache("test").size()); - - assertEquals(1, grid(0).cache("test").localSize()); - assertEquals(1, grid(0).cache("test").localSize(BACKUP)); - - assertEquals(1, grid(1).cache("test").localSize()); - assertEquals(1, grid(1).cache("test").localSize(BACKUP)); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testSizeIsConsistentAfterRebalance() throws Exception { - IgniteEx ignite = startGrid(0); - - IgniteCache tbl = createTable(ignite); - - for (int i = 0; i < 100; i++) - tbl.query(q("insert into person values(?, ?)").setArgs(i, i)); - - startGrid(1); - - awaitPartitionMapExchange(); - - IgniteCache tbl0 = grid(0).cache("person"); - IgniteCache tbl1 = grid(1).cache("person"); - - assert tbl0.localSize() != 0 && tbl1.localSize() != 0; - - assertEquals(100, tbl1.size()); - assertEquals(100, tbl0.localSize() + tbl1.localSize()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSizeIsConsistentAfterRebalanceDuringInsert() throws Exception { - IgniteEx ignite = startGrid(0); - - IgniteCache tbl = createTable(ignite); - - Future f = null; - - for (int i = 0; i < 100; i++) { - if (i == 50) - f = ForkJoinPool.commonPool().submit(() -> startGrid(1)); - - tbl.query(q("insert into person values(?, ?)").setArgs(i, i)); - } - - f.get(); - - awaitPartitionMapExchange(); - - IgniteCache tbl0 = grid(0).cache("person"); - IgniteCache tbl1 = grid(1).cache("person"); - - assert tbl0.localSize() != 0 && tbl1.localSize() != 0; - - assertEquals(100, tbl1.size()); - assertEquals(100, tbl0.localSize() + tbl1.localSize()); - } - - /** */ - private static IgniteCache table(IgniteEx ignite) { - assert ignite.cachex("person").configuration().getAtomicityMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - assert ignite.cachex("person").configuration().getCacheMode() == CacheMode.REPLICATED; - - return ignite.cache("person"); - } - - /** */ - private static IgniteCache createTable(IgniteEx ignite) { - IgniteCache sqlNexus = ignite.getOrCreateCache(new CacheConfiguration<>("sqlNexus").setSqlSchema("PUBLIC")); - - sqlNexus.query(q("" + - "create table person(" + - " id int primary key," + - " name varchar" + - ") with \"atomicity=transactional_snapshot,template=replicated,cache_name=person\"")); - - return table(ignite); - } - - /** */ - private static SqlFieldsQuery q(String fSql, Object... args) { - return new SqlFieldsQuery(String.format(fSql, args)); - } - - /** */ - private static int keyInSamePartition(Ignite ignite, String cacheName, int key) { - Affinity affinity = ignite.affinity(cacheName); - - return IntStream.iterate(key + 1, i -> i + 1) - .filter(i -> affinity.partition(i) == affinity.partition(key)) - .findFirst().getAsInt(); - } - - /** */ - private static int keyInDifferentPartition(Ignite ignite, String cacheName, int key) { - Affinity affinity = ignite.affinity(cacheName); - - return IntStream.iterate(key + 1, i -> i + 1) - .filter(i -> affinity.partition(i) != affinity.partition(key)) - .findFirst().getAsInt(); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeWithConcurrentJdbcTransactionTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeWithConcurrentJdbcTransactionTest.java deleted file mode 100644 index 437195f205fe2..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSizeWithConcurrentJdbcTransactionTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -/** - * - */ -public class CacheMvccSizeWithConcurrentJdbcTransactionTest extends CacheMvccSizeWithConcurrentTransactionTest { - /** {@inheritDoc} */ - @Override boolean jdbcTx() { - return true; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlConfigurationValidationTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlConfigurationValidationTest.java deleted file mode 100644 index 63251f9de194a..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlConfigurationValidationTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.concurrent.Callable; -import javax.cache.CacheException; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Configuration validation for SQL configured caches. - */ -public class CacheMvccSqlConfigurationValidationTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCacheGroupAtomicityModeMismatch1() throws Exception { - Ignite node = startGrid(); - - node.getOrCreateCache(DEFAULT_CACHE_NAME) - .query(new SqlFieldsQuery("CREATE TABLE City (id int primary key, name varchar, population int) WITH " + - "\"atomicity=transactional_snapshot,cache_group=group1,template=partitioned,backups=3,cache_name=City\"")) - .getAll();; - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Object call() throws Exception { - node.cache(DEFAULT_CACHE_NAME) - .query(new SqlFieldsQuery("CREATE TABLE Person (id int primary key, name varchar) WITH " + - "\"atomicity=transactional,cache_group=group1,template=partitioned,backups=3,cache_name=Person\"")) - .getAll(); - - return null; - } - }, CacheException.class, "Atomicity mode mismatch for caches related to the same group"); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCacheGroupAtomicityModeMismatch2() throws Exception { - Ignite node = startGrid(); - - node.getOrCreateCache(DEFAULT_CACHE_NAME) - .query(new SqlFieldsQuery("CREATE TABLE City (id int primary key, name varchar, population int) WITH " + - "\"atomicity=transactional,cache_group=group1,template=partitioned,backups=3,cache_name=City\"")); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Object call() throws Exception { - node.cache(DEFAULT_CACHE_NAME) - .query(new SqlFieldsQuery("CREATE TABLE Person (id int primary key, name varchar) WITH " + - "\"atomicity=transactional_snapshot,cache_group=group1,template=partitioned,backups=3,cache_name=Person\"")) - .getAll(); - - return null; - } - }, CacheException.class, "Atomicity mode mismatch for caches related to the same group"); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testTxDifferentMvccSettingsTransactional() throws Exception { - ccfg = defaultCacheConfiguration().setSqlSchema("PUBLIC"); - Ignite node = startGrid(); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - cache.query(new SqlFieldsQuery("CREATE TABLE Person (id int primary key, name varchar) WITH " + - "\"atomicity=transactional_snapshot,template=partitioned,backups=1\"")).getAll(); - - cache.query(new SqlFieldsQuery("CREATE TABLE City (id int primary key, name varchar, population int) WITH " + - "\"atomicity=transactional,template=partitioned,backups=3\"")).getAll(); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Object call() throws Exception { - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.query(new SqlFieldsQuery("SELECT * FROM Person, City")).getAll(); - - tx.commit(); - } - - return null; - } - }, CacheException.class, "Caches with transactional_snapshot atomicity mode cannot participate in the same transaction"); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlContinuousQueryPartitionedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlContinuousQueryPartitionedSelfTest.java deleted file mode 100644 index cef553e654877..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlContinuousQueryPartitionedSelfTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -/** - * Mvcc continuous query test for partitioned SQL cache. - */ -public class CacheMvccSqlContinuousQueryPartitionedSelfTest extends CacheMvccAbstractSqlContinuousQuerySelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } -} - diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlContinuousQueryReplicatedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlContinuousQueryReplicatedSelfTest.java deleted file mode 100644 index 948e6e17733f9..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlContinuousQueryReplicatedSelfTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import org.apache.ignite.cache.CacheMode; - -/** - * Mvcc continuous query test for replicated SQL cache. - */ -public class CacheMvccSqlContinuousQueryReplicatedSelfTest extends CacheMvccAbstractSqlContinuousQuerySelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.REPLICATED; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlLockTimeoutTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlLockTimeoutTest.java deleted file mode 100644 index f1b5946cd4f8d..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlLockTimeoutTest.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.UnaryOperator; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.TransactionConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.cache.CacheMode.REPLICATED; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** */ -public class CacheMvccSqlLockTimeoutTest extends CacheMvccAbstractTest { - /** */ - private static final int TIMEOUT_MILLIS = 200; - - /** */ - private UnaryOperator cfgCustomizer = UnaryOperator.identity(); - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - throw new RuntimeException("Is not used in current test"); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - return cfgCustomizer.apply(super.getConfiguration(gridName)); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testLockTimeoutsForPartitionedCache() throws Exception { - checkLockTimeouts(partitionedCacheConfig()); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testLockTimeoutsForReplicatedCache() throws Exception { - checkLockTimeouts(replicatedCacheConfig()); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testLockTimeoutsAfterDefaultTxTimeoutForPartitionedCache() throws Exception { - checkLockTimeoutsAfterDefaultTxTimeout(partitionedCacheConfig()); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testLockTimeoutsAfterDefaultTxTimeoutForReplicatedCache() throws Exception { - checkLockTimeoutsAfterDefaultTxTimeout(replicatedCacheConfig()); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testConcurrentForPartitionedCache() throws Exception { - checkTimeoutsConcurrent(partitionedCacheConfig()); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testConcurrentForReplicatedCache() throws Exception { - checkTimeoutsConcurrent(replicatedCacheConfig()); - } - - /** */ - private CacheConfiguration partitionedCacheConfig() { - return baseCacheConfig() - .setCacheMode(PARTITIONED) - .setBackups(1); - } - - /** */ - private CacheConfiguration replicatedCacheConfig() { - return baseCacheConfig().setCacheMode(REPLICATED); - } - - /** */ - private CacheConfiguration baseCacheConfig() { - return new CacheConfiguration<>("test") - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) - .setSqlSchema("PUBLIC") - .setIndexedTypes(Integer.class, Integer.class); - } - - /** */ - private void checkLockTimeouts(CacheConfiguration ccfg) throws Exception { - startGridsMultiThreaded(2); - - IgniteEx ignite = grid(0); - - ignite.createCache(ccfg); - - AtomicInteger keyCntr = new AtomicInteger(); - - int nearKey = keyForNode(ignite.affinity("test"), keyCntr, ignite.localNode()); - int otherKey = keyForNode(ignite.affinity("test"), keyCntr, grid(1).localNode()); - - TimeoutChecker timeoutChecker = new TimeoutChecker(ignite, "test"); - - timeoutChecker.checkScenario(TimeoutMode.STMT, TxStartMode.EXPLICIT, nearKey); - - timeoutChecker.checkScenario(TimeoutMode.STMT, TxStartMode.EXPLICIT, otherKey); - - timeoutChecker.checkScenario(TimeoutMode.STMT, TxStartMode.IMPLICIT, nearKey); - - timeoutChecker.checkScenario(TimeoutMode.STMT, TxStartMode.IMPLICIT, otherKey); - - // explicit tx timeout has no sense for implicit transaction - timeoutChecker.checkScenario(TimeoutMode.TX, TxStartMode.EXPLICIT, nearKey); - - timeoutChecker.checkScenario(TimeoutMode.TX, TxStartMode.EXPLICIT, otherKey); - } - - /** */ - private void checkLockTimeoutsAfterDefaultTxTimeout(CacheConfiguration ccfg) throws Exception { - cfgCustomizer = cfg -> - cfg.setTransactionConfiguration(new TransactionConfiguration().setDefaultTxTimeout(TIMEOUT_MILLIS)); - - startGridsMultiThreaded(2); - - IgniteEx ignite = grid(0); - - ignite.createCache(ccfg); - - AtomicInteger keyCntr = new AtomicInteger(); - - int nearKey = keyForNode(ignite.affinity("test"), keyCntr, ignite.localNode()); - int otherKey = keyForNode(ignite.affinity("test"), keyCntr, grid(1).localNode()); - - TimeoutChecker timeoutChecker = new TimeoutChecker(ignite, "test"); - - timeoutChecker.checkScenario(TimeoutMode.TX_DEFAULT, TxStartMode.EXPLICIT, nearKey); - - timeoutChecker.checkScenario(TimeoutMode.TX_DEFAULT, TxStartMode.EXPLICIT, otherKey); - - timeoutChecker.checkScenario(TimeoutMode.TX_DEFAULT, TxStartMode.IMPLICIT, nearKey); - - timeoutChecker.checkScenario(TimeoutMode.TX_DEFAULT, TxStartMode.IMPLICIT, otherKey); - } - - /** */ - private static class TimeoutChecker { - /** */ - final IgniteEx ignite; - - /** */ - final String cacheName; - - /** */ - TimeoutChecker(IgniteEx ignite, String cacheName) { - this.ignite = ignite; - this.cacheName = cacheName; - } - - /** */ - void checkScenario(TimeoutMode timeoutMode, TxStartMode txStartMode, int key) throws Exception { - // 999 is used as bound to enforce query execution with obtaining cursor before enlist - assert key <= 999; - - try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, 60_000, 1)) { - ignite.cache(cacheName).query(new SqlFieldsQuery("merge into Integer(_key, _val) values(?, 1)") - .setArgs(key)); - - tx.commit(); - } - - ensureTimeIsOut("insert into Integer(_key, _val) values(?, 42)", key, timeoutMode, txStartMode); - ensureTimeIsOut("merge into Integer(_key, _val) values(?, 42)", key, timeoutMode, txStartMode); - ensureTimeIsOut("update Integer set _val = 42 where _key = ?", key, timeoutMode, txStartMode); - ensureTimeIsOut("update Integer set _val = 42 where _key = ? or _key > 999", key, timeoutMode, txStartMode); - ensureTimeIsOut("delete from Integer where _key = ?", key, timeoutMode, txStartMode); - ensureTimeIsOut("delete from Integer where _key = ? or _key > 999", key, timeoutMode, txStartMode); - - // SELECT ... FOR UPDATE locking entries has no meaning for implicit transaction - if (txStartMode != TxStartMode.IMPLICIT) { - ensureTimeIsOut("select * from Integer where _key = ? for update", key, timeoutMode, txStartMode); - ensureTimeIsOut( - "select * from Integer where _key = ? or _key > 999 for update", key, timeoutMode, txStartMode); - } - } - - /** */ - void ensureTimeIsOut(String sql, int key, TimeoutMode timeoutMode, TxStartMode txStartMode) throws Exception { - assert txStartMode == TxStartMode.EXPLICIT || timeoutMode != TimeoutMode.TX; - - IgniteCache cache = ignite.cache(cacheName); - - int oldVal = (Integer)cache - .query(new SqlFieldsQuery("select _val from Integer where _key = ?").setArgs(key)) - .getAll().get(0).get(0); - - try (Transaction tx1 = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, 6_000, 1)) { - cache.query(new SqlFieldsQuery("update Integer set _val = 42 where _key = ?").setArgs(key)); - - try { - CompletableFuture.runAsync(() -> { - SqlFieldsQuery qry = new SqlFieldsQuery(sql).setArgs(key); - - try (Transaction tx2 = txStartMode == TxStartMode.EXPLICIT ? startTx(timeoutMode) : null) { - if (timeoutMode == TimeoutMode.STMT) - qry.setTimeout(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); - - cache.query(qry).getAll(); - - if (tx2 != null) - tx2.commit(); - } - finally { - ignite.context().cache().context().tm().resetContext(); - } - }).get(); - - fail("Timeout exception should be thrown"); - } - catch (ExecutionException e) { - assertTrue(msgContains(e, "Failed to acquire lock within provided timeout for transaction") - || msgContains(e, "Failed to finish transaction because it has been rolled back")); - } - - // assert that outer tx has not timed out - cache.query(new SqlFieldsQuery("update Integer set _val = 42 where _key = ?").setArgs(key)); - - tx1.rollback(); - } - - int newVal = (Integer)cache - .query(new SqlFieldsQuery("select _val from Integer where _key = ?").setArgs(key)) - .getAll().get(0).get(0); - - assertEquals(oldVal, newVal); - } - - /** */ - private Transaction startTx(TimeoutMode timeoutMode) { - return timeoutMode == TimeoutMode.TX - ? ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, TIMEOUT_MILLIS, 1) - : ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ); - } - } - - /** */ - private static boolean msgContains(Throwable e, String str) { - return e.getMessage() != null && e.getMessage().contains(str); - } - - /** */ - private enum TimeoutMode { - /** */ - TX, - /** */ - TX_DEFAULT, - /** */ - STMT - } - - /** */ - private enum TxStartMode { - /** */ - EXPLICIT, - /** */ - IMPLICIT - } - - /** */ - private void checkTimeoutsConcurrent(CacheConfiguration ccfg) throws Exception { - startGridsMultiThreaded(2); - - IgniteEx ignite = grid(0); - - IgniteCache cache = ignite.createCache(ccfg); - - AtomicInteger keyCntr = new AtomicInteger(); - - List keys = new ArrayList<>(); - - for (int i = 0; i < 5; i++) - keys.add(keyForNode(grid(0).affinity("test"), keyCntr, ignite.localNode())); - - for (int i = 0; i < 5; i++) - keys.add(keyForNode(grid(1).affinity("test"), keyCntr, ignite.localNode())); - - CompletableFuture.allOf( - CompletableFuture.runAsync(() -> mergeInRandomOrder(ignite, cache, keys)), - CompletableFuture.runAsync(() -> mergeInRandomOrder(ignite, cache, keys)), - CompletableFuture.runAsync(() -> mergeInRandomOrder(ignite, cache, keys)) - ).join(); - } - - /** */ - private void mergeInRandomOrder(IgniteEx ignite, IgniteCache cache, List keys) { - List keys0 = new ArrayList<>(keys); - - for (int i = 0; i < 100; i++) { - Collections.shuffle(keys0); - - try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("merge into Integer(_key, _val) values(?, ?)") - .setTimeout(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); - - int op = 0; - - for (Integer key : keys0) - cache.query(qry.setArgs(key, op++)); - - tx.commit(); - } - catch (Exception e) { - assertTrue(msgContains(e, "Failed to acquire lock within provided timeout for transaction") - || msgContains(e, "Cannot serialize transaction due to write conflict")); - } - finally { - ignite.context().cache().context().tm().resetContext(); - } - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesAbstractTest.java deleted file mode 100644 index 6d7a8ec46141a..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesAbstractTest.java +++ /dev/null @@ -1,1659 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.atomic.AtomicBoolean; -import javax.cache.CacheException; -import javax.cache.processor.MutableEntry; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.cache.CacheEntryProcessor; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cache.query.SqlQuery; -import org.apache.ignite.cache.query.annotations.QuerySqlField; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.util.lang.GridInClosure3; -import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteInClosure; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL_SUM; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.PUT; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * - */ -@SuppressWarnings("unchecked") -public abstract class CacheMvccSqlQueriesAbstractTest extends CacheMvccAbstractTest { - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSql_SingleNode_SinglePartition() throws Exception { - accountsTxReadAll(1, 0, 0, 1, - new InitIndexing(Integer.class, MvccTestAccount.class), false, SQL, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSql_WithRemoves_SingleNode_SinglePartition() throws Exception { - accountsTxReadAll(1, 0, 0, 1, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSql_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), false, SQL, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSql_SingleNode_Persistence() throws Exception { - persistence = true; - - testAccountsTxSql_SingleNode(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSumSql_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), false, SQL_SUM, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSql_WithRemoves_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSql_WithRemoves_SingleNode_Persistence() throws Exception { - persistence = true; - - testAccountsTxSql_WithRemoves_SingleNode(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxSql_ClientServer_Backups2() throws Exception { - accountsTxReadAll(4, 2, 2, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), false, SQL, PUT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateSingleValue_SingleNode() throws Exception { - updateSingleValue(true, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateSingleValue_LocalQuery_SingleNode() throws Exception { - updateSingleValue(true, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateSingleValue_ClientServer() throws Exception { - updateSingleValue(false, false); - } - - /** - * @param singleNode {@code True} for test with single node. - * @param locQry Local query flag. - * @throws Exception If failed. - */ - private void updateSingleValue(boolean singleNode, final boolean locQry) throws Exception { - final int VALS = 100; - - final int writers = 4; - - final int readers = 4; - - final int INC_BY = 110; - - final IgniteInClosure> init = new IgniteInClosure>() { - @Override public void apply(IgniteCache cache) { - Map vals = new HashMap<>(); - - for (int i = 0; i < VALS; i++) - vals.put(i, new MvccTestSqlIndexValue(i)); - - cache.putAll(vals); - } - }; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int cnt = 0; - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - try { - Integer key = rnd.nextInt(VALS); - - while (true) { - try { - cache.cache.invoke(key, new CacheEntryProcessor() { - @Override public Object process(MutableEntry e, - Object... args) { - Integer key = e.getKey(); - - MvccTestSqlIndexValue val = e.getValue(); - - int newIdxVal; - - if (val.idxVal1 < INC_BY) { - assertEquals(key.intValue(), val.idxVal1); - - newIdxVal = val.idxVal1 + INC_BY; - } - else { - assertEquals(INC_BY + key, val.idxVal1); - - newIdxVal = key; - } - - e.setValue(new MvccTestSqlIndexValue(newIdxVal)); - - return null; - } - }); - - break; - } - catch (CacheException e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } - } - } - finally { - cache.readUnlock(); - } - } - - info("Writer finished, updates: " + cnt); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - List fieldsQrys = new ArrayList<>(); - - fieldsQrys.add( - new SqlFieldsQuery("select _key, idxVal1 from MvccTestSqlIndexValue where idxVal1=?").setLocal(locQry)); - - fieldsQrys.add( - new SqlFieldsQuery("select _key, idxVal1 from MvccTestSqlIndexValue where idxVal1=? or idxVal1=?").setLocal(locQry) - ); - - fieldsQrys.add(new SqlFieldsQuery("select _key, idxVal1 from MvccTestSqlIndexValue where _key=?").setLocal(locQry)); - - List> sqlQrys = new ArrayList<>(); - - sqlQrys.add(new SqlQuery(MvccTestSqlIndexValue.class, "idxVal1=?").setLocal(locQry)); - - sqlQrys.add( - new SqlQuery(MvccTestSqlIndexValue.class, "idxVal1=? or idxVal1=?").setLocal(locQry) - ); - - sqlQrys.add(new SqlQuery(MvccTestSqlIndexValue.class, "_key=?").setLocal(locQry)); - - while (!stop.get()) { - Integer key = rnd.nextInt(VALS); - - int qryIdx = rnd.nextInt(3); - - TestCache cache = randomCache(caches, rnd); - - List> res; - - try { - if (rnd.nextBoolean()) { - SqlFieldsQuery qry = fieldsQrys.get(qryIdx); - - if (qryIdx == 1) - qry.setArgs(key, key + INC_BY); - else - qry.setArgs(key); - - res = cache.cache.query(qry).getAll(); - } - else { - SqlQuery qry = sqlQrys.get(qryIdx); - - if (qryIdx == 1) - qry.setArgs(key, key + INC_BY); - else - qry.setArgs(key); - - res = new ArrayList<>(); - - for (IgniteCache.Entry e : cache.cache.query(qry).getAll()) { - List row = new ArrayList<>(2); - - row.add(e.getKey()); - row.add(e.getValue().idxVal1); - - res.add(row); - } - } - } - finally { - cache.readUnlock(); - } - - assertTrue(qryIdx == 0 || !res.isEmpty()); - - if (!res.isEmpty()) { - assertEquals(1, res.size()); - - List resVals = res.get(0); - - Integer key0 = (Integer)resVals.get(0); - Integer val0 = (Integer)resVals.get(1); - - assertEquals(key, key0); - assertTrue(val0.equals(key) || val0.equals(key + INC_BY)); - } - } - - if (idx == 0) { - SqlFieldsQuery qry = new SqlFieldsQuery("select _key, idxVal1 from MvccTestSqlIndexValue"); - - TestCache cache = randomCache(caches, rnd); - - List> res; - - try { - res = cache.cache.query(qry).getAll(); - } - finally { - cache.readUnlock(); - } - - assertEquals(VALS, res.size()); - - for (List vals : res) - info("Value: " + vals); - } - } - }; - - int srvs; - int clients; - - if (singleNode) { - srvs = 1; - clients = 0; - } - else { - srvs = 4; - clients = 2; - } - - readWriteTest( - null, - srvs, - clients, - 0, - DFLT_PARTITION_COUNT, - writers, - readers, - DFLT_TEST_TIME, - new InitIndexing(Integer.class, MvccTestSqlIndexValue.class), - init, - writer, - reader); - - for (Ignite node : G.allGrids()) - checkActiveQueriesCleanup(node); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testJoinTransactional_SingleNode() throws Exception { - joinTransactional(true, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testJoinTransactional_ClientServer() throws Exception { - joinTransactional(false, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testJoinTransactional_DistributedJoins_ClientServer() throws Exception { - joinTransactional(false, true); - } - - /** - * @param singleNode {@code True} for test with single node. - * @param distributedJoin {@code True} to test distributed joins. - * @throws Exception If failed. - */ - private void joinTransactional(boolean singleNode, final boolean distributedJoin) throws Exception { - final int KEYS = 100; - - final int writers = 4; - - final int readers = 4; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int cnt = 0; - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - try { - while (true) { - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - Integer key = rnd.nextInt(KEYS); - - JoinTestChildKey childKey = new JoinTestChildKey(key); - - JoinTestChild child = (JoinTestChild)cache.cache.get(childKey); - - if (child == null) { - int parentKey = distributedJoin ? key + 100 : key; - - child = new JoinTestChild(parentKey); - - cache.cache.put(childKey, child); - - JoinTestParent parent = new JoinTestParent(parentKey); - - cache.cache.put(new JoinTestParentKey(parentKey), parent); - } - else { - cache.cache.remove(childKey); - - cache.cache.remove(new JoinTestParentKey(child.parentId)); - } - - tx.commit(); - - break; - } - catch (CacheException e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } - } - - cnt++; - } - finally { - cache.readUnlock(); - } - } - - info("Writer finished, updates: " + cnt); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - List qrys = new ArrayList<>(); - - qrys.add(new SqlFieldsQuery("select c.parentId, p.id from " + - "JoinTestChild c left outer join JoinTestParent p on (c.parentId = p.id)"). - setDistributedJoins(distributedJoin)); - - qrys.add(new SqlFieldsQuery("select c.parentId, p.id from " + - "JoinTestChild c left outer join JoinTestParent p on (c.parentId = p.id) where p.id = 10"). - setDistributedJoins(distributedJoin)); - - qrys.add(new SqlFieldsQuery("select c.parentId, p.id from " + - "JoinTestChild c left outer join JoinTestParent p on (c.parentId = p.id) where p.id != 10"). - setDistributedJoins(distributedJoin)); - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - try { - for (SqlFieldsQuery qry : qrys) { - List> res = cache.cache.query(qry).getAll(); - - if (!res.isEmpty()) { - for (List resRow : res) { - Integer parentId = (Integer)resRow.get(1); - - assertNotNull(parentId); - } - } - } - } - finally { - cache.readUnlock(); - } - } - - if (idx == 0) { - TestCache cache = randomCache(caches, rnd); - - try { - List> res = cache.cache.query(qrys.get(0)).getAll(); - - info("Reader finished, result: " + res); - } - finally { - cache.readUnlock(); - } - } - } - }; - - int srvs; - int clients; - - if (singleNode) { - srvs = 1; - clients = 0; - } - else { - srvs = 4; - clients = 2; - } - - readWriteTest( - null, - srvs, - clients, - 0, - DFLT_PARTITION_COUNT, - writers, - readers, - DFLT_TEST_TIME, - new InitIndexing(JoinTestParentKey.class, JoinTestParent.class, - JoinTestChildKey.class, JoinTestChild.class), - null, - writer, - reader); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testJoinTransactional_DistributedJoins_ClientServer2() throws Exception { - final int KEYS = 100; - - final int writers = 1; - - final int readers = 4; - - final int CHILDREN_CNT = 10; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int cnt = 0; - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - try { - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - Integer key = rnd.nextInt(KEYS); - - JoinTestParentKey parentKey = new JoinTestParentKey(key); - - JoinTestParent parent = (JoinTestParent)cache.cache.get(parentKey); - - if (parent == null) { - for (int i = 0; i < CHILDREN_CNT; i++) - cache.cache.put(new JoinTestChildKey(key * 10_000 + i), new JoinTestChild(key)); - - cache.cache.put(parentKey, new JoinTestParent(key)); - } - else { - for (int i = 0; i < CHILDREN_CNT; i++) - cache.cache.remove(new JoinTestChildKey(key * 10_000 + i)); - - cache.cache.remove(parentKey); - } - - tx.commit(); - } - - cnt++; - } - finally { - cache.readUnlock(); - } - } - - info("Writer finished, updates: " + cnt); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - SqlFieldsQuery qry = new SqlFieldsQuery("select c.parentId, p.id from " + - "JoinTestChild c left outer join JoinTestParent p on (c.parentId = p.id) where p.id=?"). - setDistributedJoins(true); - - int cnt = 0; - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - qry.setArgs(rnd.nextInt(KEYS)); - - try { - List> res = cache.cache.query(qry).getAll(); - - if (!res.isEmpty()) - assertEquals(CHILDREN_CNT, res.size()); - - cnt++; - } - finally { - cache.readUnlock(); - } - } - - info("Reader finished, read count: " + cnt); - } - }; - - readWriteTest( - null, - 4, - 2, - 0, - DFLT_PARTITION_COUNT, - writers, - readers, - DFLT_TEST_TIME, - new InitIndexing(JoinTestParentKey.class, JoinTestParent.class, - JoinTestChildKey.class, JoinTestChild.class), - null, - writer, - reader); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testDistributedJoinSimple() throws Exception { - startGridsMultiThreaded(4); - - Ignite srv0 = ignite(0); - - int[] backups = {0, 1, 2}; - - for (int b : backups) { - IgniteCache cache = srv0.createCache( - cacheConfiguration(cacheMode(), FULL_SYNC, b, DFLT_PARTITION_COUNT). - setIndexedTypes(JoinTestParentKey.class, JoinTestParent.class, JoinTestChildKey.class, JoinTestChild.class)); - - int cntr = 0; - - int expCnt = 0; - - for (int i = 0; i < 10; i++) { - JoinTestParentKey parentKey = new JoinTestParentKey(i); - - cache.put(parentKey, new JoinTestParent(i)); - - for (int c = 0; c < i; c++) { - JoinTestChildKey childKey = new JoinTestChildKey(cntr++); - - cache.put(childKey, new JoinTestChild(i)); - - expCnt++; - } - } - - SqlFieldsQuery qry = new SqlFieldsQuery("select c.parentId, p.id from " + - "JoinTestChild c join JoinTestParent p on (c.parentId = p.id)"). - setDistributedJoins(true); - - Map resMap = new HashMap<>(); - - List> res = cache.query(qry).getAll(); - - assertEquals(expCnt, res.size()); - - for (List resRow : res) { - Integer parentId = (Integer)resRow.get(0); - - Integer cnt = resMap.get(parentId); - - if (cnt == null) - resMap.put(parentId, 1); - else - resMap.put(parentId, cnt + 1); - } - - for (int i = 1; i < 10; i++) - assertEquals(i, (Object)resMap.get(i)); - - srv0.destroyCache(cache.getName()); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCacheRecreate() throws Exception { - cacheRecreate(new InitIndexing(Integer.class, MvccTestAccount.class)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCacheRecreateChangeIndexedType() throws Exception { - Ignite srv0 = startGrid(0); - - final int PARTS = 64; - - { - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, PARTS). - setIndexedTypes(Integer.class, MvccTestAccount.class); - - IgniteCache cache = (IgniteCache)srv0.createCache(ccfg); - - for (int k = 0; k < PARTS * 2; k++) { - assertNull(cache.get(k)); - - int vals = k % 3 + 1; - - for (int v = 0; v < vals; v++) - cache.put(k, new MvccTestAccount(v, 1)); - - assertEquals(vals - 1, cache.get(k).val); - } - - assertEquals(PARTS * 2, cache.query(new SqlQuery<>(MvccTestAccount.class, "true")).getAll().size()); - - srv0.destroyCache(cache.getName()); - } - - { - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, PARTS). - setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class); - - IgniteCache cache = (IgniteCache)srv0.createCache(ccfg); - - for (int k = 0; k < PARTS * 2; k++) { - assertNull(cache.get(k)); - - int vals = k % 3 + 1; - - for (int v = 0; v < vals; v++) - cache.put(k, new MvccTestSqlIndexValue(v)); - - assertEquals(vals - 1, cache.get(k).idxVal1); - } - - assertEquals(PARTS * 2, cache.query(new SqlQuery<>(MvccTestSqlIndexValue.class, "true")).getAll().size()); - - srv0.destroyCache(cache.getName()); - } - - { - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, PARTS). - setIndexedTypes(Long.class, Long.class); - - IgniteCache cache = (IgniteCache)srv0.createCache(ccfg); - - for (int k = 0; k < PARTS * 2; k++) { - assertNull(cache.get((long)k)); - - int vals = k % 3 + 1; - - for (int v = 0; v < vals; v++) - cache.put((long)k, (long)v); - - assertEquals((long)(vals - 1), (Object)cache.get((long)k)); - } - - assertEquals(PARTS * 2, cache.query(new SqlQuery<>(Long.class, "true")).getAll().size()); - - srv0.destroyCache(cache.getName()); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testChangeValueType1() throws Exception { - Ignite srv0 = startGrid(0); - - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT). - setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class, Integer.class, Integer.class); - - IgniteCache cache = srv0.createCache(ccfg); - - cache.put(1, new MvccTestSqlIndexValue(1)); - cache.put(1, new MvccTestSqlIndexValue(2)); - - checkSingleResult(cache, new SqlFieldsQuery("select idxVal1 from MvccTestSqlIndexValue"), 2); - - cache.put(1, 1); - - assertEquals(0, cache.query(new SqlFieldsQuery("select idxVal1 from MvccTestSqlIndexValue")).getAll().size()); - - checkSingleResult(cache, new SqlFieldsQuery("select _val from Integer"), 1); - - cache.put(1, 2); - - checkSingleResult(cache, new SqlFieldsQuery("select _val from Integer"), 2); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testChangeValueType2() throws Exception { - Ignite srv0 = startGrid(0); - - CacheConfiguration ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT). - setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class, Integer.class, Integer.class); - - IgniteCache cache = srv0.createCache(ccfg); - - cache.put(1, new MvccTestSqlIndexValue(1)); - cache.put(1, new MvccTestSqlIndexValue(2)); - - checkSingleResult(cache, new SqlFieldsQuery("select idxVal1 from MvccTestSqlIndexValue"), 2); - - cache.remove(1); - - assertEquals(0, cache.query(new SqlFieldsQuery("select idxVal1 from MvccTestSqlIndexValue")).getAll().size()); - - cache.put(1, 1); - - assertEquals(0, cache.query(new SqlFieldsQuery("select idxVal1 from MvccTestSqlIndexValue")).getAll().size()); - - checkSingleResult(cache, new SqlFieldsQuery("select _val from Integer"), 1); - - cache.put(1, 2); - - checkSingleResult(cache, new SqlFieldsQuery("select _val from Integer"), 2); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCountTransactional_SingleNode() throws Exception { - countTransactional(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testCountTransactional_ClientServer() throws Exception { - countTransactional(false); - } - - /** - * @param singleNode {@code True} for test with single node. - * @throws Exception If failed. - */ - private void countTransactional(boolean singleNode) throws Exception { - final int writers = 4; - - final int readers = 4; - - final int THREAD_KEY_RANGE = 100; - - final int VAL_RANGE = 10; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int min = idx * THREAD_KEY_RANGE; - int max = min + THREAD_KEY_RANGE; - - info("Thread range [min=" + min + ", max=" + max + ']'); - - int cnt = 0; - - Set keys = new LinkedHashSet<>(); - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - try { - // Add or remove 10 keys. - if (!keys.isEmpty() && (keys.size() == THREAD_KEY_RANGE || rnd.nextInt(3) == 0)) { - Set rmvKeys = new HashSet<>(); - - for (Integer key : keys) { - rmvKeys.add(key); - - if (rmvKeys.size() == 10) - break; - } - - assertEquals(10, rmvKeys.size()); - - cache.cache.removeAll(rmvKeys); - - keys.removeAll(rmvKeys); - } - else { - TreeMap map = new TreeMap<>(); - - while (map.size() != 10) { - Integer key = rnd.nextInt(min, max); - - if (keys.add(key)) - map.put(key, new MvccTestSqlIndexValue(rnd.nextInt(VAL_RANGE))); - } - - assertEquals(10, map.size()); - - cache.cache.putAll(map); - } - } - finally { - cache.readUnlock(); - } - } - - info("Writer finished, updates: " + cnt); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - List qrys = new ArrayList<>(); - - qrys.add(new SqlFieldsQuery("select count(*) from MvccTestSqlIndexValue")); - - qrys.add(new SqlFieldsQuery( - "select count(*) from MvccTestSqlIndexValue where idxVal1 >= 0 and idxVal1 <= " + VAL_RANGE)); - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - try { - for (SqlFieldsQuery qry : qrys) { - List> res = cache.cache.query(qry).getAll(); - - assertEquals(1, res.size()); - - Long cnt = (Long)res.get(0).get(0); - - assertTrue(cnt % 10 == 0); - } - } - finally { - cache.readUnlock(); - } - } - } - }; - - int srvs; - int clients; - - if (singleNode) { - srvs = 1; - clients = 0; - } - else { - srvs = 4; - clients = 2; - } - - readWriteTest( - null, - srvs, - clients, - 0, - DFLT_PARTITION_COUNT, - writers, - readers, - DFLT_TEST_TIME, - new InitIndexing(Integer.class, MvccTestSqlIndexValue.class), - null, - writer, - reader); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMaxMinTransactional_SingleNode() throws Exception { - maxMinTransactional(true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testMaxMinTransactional_ClientServer() throws Exception { - maxMinTransactional(false); - } - - /** - * @param singleNode {@code True} for test with single node. - * @throws Exception If failed. - */ - private void maxMinTransactional(boolean singleNode) throws Exception { - final int writers = 1; - - final int readers = 1; - - final int THREAD_OPS = 10; - - final int OP_RANGE = 10; - - final int THREAD_KEY_RANGE = OP_RANGE * THREAD_OPS; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - int min = idx * THREAD_KEY_RANGE; - - info("Thread range [start=" + min + ']'); - - int cnt = 0; - - boolean add = true; - - int op = 0; - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - try { - int startKey = min + op * OP_RANGE; - - if (add) { - Map vals = new HashMap<>(); - - for (int i = 0; i < 10; i++) { - Integer key = startKey + i + 1; - - vals.put(key, new MvccTestSqlIndexValue(key)); - } - - cache.cache.putAll(vals); - - // info("put " + vals.keySet()); - } - else { - Set rmvKeys = new HashSet<>(); - - for (int i = 0; i < 10; i++) - rmvKeys.add(startKey + i + 1); - - cache.cache.removeAll(rmvKeys); - - // info("remove " + rmvKeys); - } - - if (++op == THREAD_OPS) { - add = !add; - - op = 0; - } - } - finally { - cache.readUnlock(); - } - } - - info("Writer finished, updates: " + cnt); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - List maxQrys = new ArrayList<>(); - List minQrys = new ArrayList<>(); - - maxQrys.add(new SqlFieldsQuery("select max(idxVal1) from MvccTestSqlIndexValue")); - maxQrys.add(new SqlFieldsQuery("select max(idxVal1) from MvccTestSqlIndexValue where idxVal1 >= 0")); - - minQrys.add(new SqlFieldsQuery("select min(idxVal1) from MvccTestSqlIndexValue")); - minQrys.add(new SqlFieldsQuery("select min(idxVal1) from MvccTestSqlIndexValue where idxVal1 >= 0")); - - while (!stop.get()) { - TestCache cache = randomCache(caches, rnd); - - try { - for (SqlFieldsQuery qry : maxQrys) { - List> res = cache.cache.query(qry).getAll(); - - assertEquals(1, res.size()); - - Integer m = (Integer)res.get(0).get(0); - - assertTrue(m == null || m % 10 == 0); - } - - for (SqlFieldsQuery qry : minQrys) { - List> res = cache.cache.query(qry).getAll(); - - assertEquals(1, res.size()); - - Integer m = (Integer)res.get(0).get(0); - - assertTrue(m == null || m % 10 == 1); - } - } - finally { - cache.readUnlock(); - } - } - } - }; - - int srvs; - int clients; - - if (singleNode) { - srvs = 1; - clients = 0; - } - else { - srvs = 4; - clients = 2; - } - - readWriteTest( - null, - srvs, - clients, - 0, - DFLT_PARTITION_COUNT, - writers, - readers, - DFLT_TEST_TIME, - new InitIndexing(Integer.class, MvccTestSqlIndexValue.class), - null, - writer, - reader); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSqlQueriesWithMvcc() throws Exception { - Ignite srv0 = startGrid(0); - - IgniteCache cache = (IgniteCache)srv0.createCache( - cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT). - setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class)); - - for (int i = 0; i < 10; i++) - cache.put(i, new MvccTestSqlIndexValue(i)); - - sqlQueriesWithMvcc(cache, true); - - sqlQueriesWithMvcc(cache, false); - - // TODO IGNITE-8031 -// startGrid(1); -// -// awaitPartitionMapExchange(); -// -// sqlQueriesWithMvcc(cache, false); - } - - /** - * @param cache Cache. - * @param loc Local query flag. - */ - private void sqlQueriesWithMvcc(IgniteCache cache, boolean loc) { - assertEquals(10, - cache.query(new SqlQuery<>(MvccTestSqlIndexValue.class, "true").setLocal(loc)).getAll().size()); - - assertEquals(10, - cache.query(new SqlFieldsQuery("select idxVal1 from MvccTestSqlIndexValue").setLocal(loc)).getAll().size()); - - assertEquals(10, - cache.query(new SqlFieldsQuery("" + - "select (select count (*) from MvccTestSqlIndexValue where idxVal1 = t1.idxVal1) as c1," + - " (select 0 from dual) as c2" + - " from MvccTestSqlIndexValue as t1" + - " join (select * from MvccTestSqlIndexValue) as t2 on t1.idxVal1 = t2.idxVal1").setLocal(loc)).getAll().size()); - - checkSingleResult(cache, - new SqlFieldsQuery("select max(idxVal1) from MvccTestSqlIndexValue").setLocal(loc), 9); - - checkSingleResult(cache, - new SqlFieldsQuery("select max(idxVal1) from MvccTestSqlIndexValue where idxVal1 > 0").setLocal(loc), 9); - - checkSingleResult(cache, - new SqlFieldsQuery("select max(idxVal1) from MvccTestSqlIndexValue where idxVal1 < 5").setLocal(loc), 4); - - checkSingleResult(cache, - new SqlFieldsQuery("select min(idxVal1) from MvccTestSqlIndexValue").setLocal(loc), 0); - - checkSingleResult(cache, - new SqlFieldsQuery("select min(idxVal1) from MvccTestSqlIndexValue where idxVal1 < 100").setLocal(loc), 0); - - checkSingleResult(cache, - new SqlFieldsQuery("select min(idxVal1) from MvccTestSqlIndexValue where idxVal1 < 5").setLocal(loc), 0); - - checkSingleResult(cache, - new SqlFieldsQuery("select min(idxVal1) from MvccTestSqlIndexValue where idxVal1 > 5").setLocal(loc), 6); - - checkSingleResult(cache, - new SqlFieldsQuery("select count(*) from MvccTestSqlIndexValue").setLocal(loc), 10L); - - checkSingleResult(cache, - new SqlFieldsQuery("select count(*) from MvccTestSqlIndexValue where idxVal1 >= 0").setLocal(loc), 10L); - - checkSingleResult(cache, - new SqlFieldsQuery("select count(*) from MvccTestSqlIndexValue where idxVal1 >= 0 and idxVal1 < 100").setLocal(loc), 10L); - - checkSingleResult(cache, - new SqlFieldsQuery("select count(*) from MvccTestSqlIndexValue where idxVal1 >0 and idxVal1 < 5").setLocal(loc), 4L); - - checkSingleResult(cache, - new SqlFieldsQuery("select count(*) from MvccTestSqlIndexValue where idxVal1 >= 1").setLocal(loc), 9L); - - checkSingleResult(cache, - new SqlFieldsQuery("select count(*) from MvccTestSqlIndexValue where idxVal1 > 100").setLocal(loc), 0L); - - checkSingleResult(cache, - new SqlFieldsQuery("select count(*) from MvccTestSqlIndexValue where idxVal1 = 1").setLocal(loc), 1L); - } - - /** - * @param cache Cache. - * @param qry Query. - * @param exp Expected value. - */ - private void checkSingleResult(IgniteCache cache, SqlFieldsQuery qry, Object exp) { - List> res = cache.query(qry).getAll(); - - assertEquals(1, res.size()); - - List row = res.get(0); - - assertEquals(1, row.size()); - - assertEquals(exp, row.get(0)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSqlSimple() throws Exception { - startGrid(0); - - for (int i = 0; i < 4; i++) - sqlSimple(i * 512); - - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - for (int i = 0; i < 5; i++) - sqlSimple(rnd.nextInt(2048)); - } - - /** - * @param inlineSize Inline size. - * @throws Exception If failed. - */ - private void sqlSimple(int inlineSize) throws Exception { - Ignite srv0 = ignite(0); - - IgniteCache cache = (IgniteCache)srv0.createCache( - cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT). - setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class). - setSqlIndexMaxInlineSize(inlineSize)); - - Map expVals = new HashMap<>(); - - checkValues(expVals, cache); - - cache.put(1, new MvccTestSqlIndexValue(1)); - expVals.put(1, 1); - - checkValues(expVals, cache); - - cache.put(1, new MvccTestSqlIndexValue(2)); - expVals.put(1, 2); - - checkValues(expVals, cache); - - cache.put(2, new MvccTestSqlIndexValue(1)); - expVals.put(2, 1); - cache.put(3, new MvccTestSqlIndexValue(1)); - expVals.put(3, 1); - cache.put(4, new MvccTestSqlIndexValue(1)); - expVals.put(4, 1); - - checkValues(expVals, cache); - - cache.remove(1); - expVals.remove(1); - - checkValues(expVals, cache); - - checkNoValue(1, cache); - - cache.put(1, new MvccTestSqlIndexValue(10)); - expVals.put(1, 10); - - checkValues(expVals, cache); - - checkActiveQueriesCleanup(srv0); - - srv0.destroyCache(cache.getName()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSqlSimplePutRemoveRandom() throws Exception { - startGrid(0); - - testSqlSimplePutRemoveRandom(0); - - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - for (int i = 0; i < 3; i++) - testSqlSimplePutRemoveRandom(rnd.nextInt(2048)); - } - - /** - * @param inlineSize Inline size. - * @throws Exception If failed. - */ - private void testSqlSimplePutRemoveRandom(int inlineSize) throws Exception { - Ignite srv0 = grid(0); - - IgniteCache cache = (IgniteCache)srv0.createCache( - cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT). - setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class). - setSqlIndexMaxInlineSize(inlineSize)); - - Map expVals = new HashMap<>(); - - final int KEYS = 100; - final int VALS = 10; - - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - long stopTime = System.currentTimeMillis() + 5_000; - - for (int i = 0; i < 100_000; i++) { - Integer key = rnd.nextInt(KEYS); - - if (rnd.nextInt(5) == 0) { - cache.remove(key); - - expVals.remove(key); - } - else { - Integer val = rnd.nextInt(VALS); - - cache.put(key, new MvccTestSqlIndexValue(val)); - - expVals.put(key, val); - } - - checkValues(expVals, cache); - - if (System.currentTimeMillis() > stopTime) { - info("Stop test, iteration: " + i); - - break; - } - } - - for (int i = 0; i < KEYS; i++) { - if (!expVals.containsKey(i)) - checkNoValue(i, cache); - } - - checkActiveQueriesCleanup(srv0); - - srv0.destroyCache(cache.getName()); - } - - /** - * @param key Key. - * @param cache Cache. - */ - private void checkNoValue(Object key, IgniteCache cache) { - SqlQuery qry; - - qry = new SqlQuery<>(MvccTestSqlIndexValue.class, "_key = ?"); - - qry.setArgs(key); - - List> res = cache.query(qry).getAll(); - - assertTrue(res.isEmpty()); - } - - /** - * @param expVals Expected values. - * @param cache Cache. - */ - private void checkValues(Map expVals, IgniteCache cache) { - SqlFieldsQuery cntQry = new SqlFieldsQuery("select count(*) from MvccTestSqlIndexValue"); - - Long cnt = (Long)cache.query(cntQry).getAll().get(0).get(0); - - assertEquals((long)expVals.size(), (Object)cnt); - - SqlQuery qry; - - qry = new SqlQuery<>(MvccTestSqlIndexValue.class, "true"); - - Map vals = new HashMap<>(); - - for (IgniteCache.Entry e : cache.query(qry).getAll()) - assertNull(vals.put(e.getKey(), e.getValue().idxVal1)); - - assertEquals(expVals, vals); - - qry = new SqlQuery<>(MvccTestSqlIndexValue.class, "_key >= 0"); - - vals = new HashMap<>(); - - for (IgniteCache.Entry e : cache.query(qry).getAll()) - assertNull(vals.put(e.getKey(), e.getValue().idxVal1)); - - assertEquals(expVals, vals); - - qry = new SqlQuery<>(MvccTestSqlIndexValue.class, "idxVal1 >= 0"); - - vals = new HashMap<>(); - - for (IgniteCache.Entry e : cache.query(qry).getAll()) - assertNull(vals.put(e.getKey(), e.getValue().idxVal1)); - - assertEquals(expVals, vals); - - Map> expIdxVals = new HashMap<>(); - - for (Map.Entry e : expVals.entrySet()) { - qry = new SqlQuery<>(MvccTestSqlIndexValue.class, "_key = ?"); - - qry.setArgs(e.getKey()); - - List> res = cache.query(qry).getAll(); - - assertEquals(1, res.size()); - assertEquals(e.getKey(), res.get(0).getKey()); - assertEquals(e.getValue(), (Integer)res.get(0).getValue().idxVal1); - - SqlFieldsQuery fieldsQry = new SqlFieldsQuery("select _key, idxVal1 from MvccTestSqlIndexValue where _key=?"); - fieldsQry.setArgs(e.getKey()); - - List> fieldsRes = cache.query(fieldsQry).getAll(); - - assertEquals(1, fieldsRes.size()); - assertEquals(e.getKey(), fieldsRes.get(0).get(0)); - assertEquals(e.getValue(), fieldsRes.get(0).get(1)); - - Integer val = e.getValue(); - - Set keys = expIdxVals.get(val); - - if (keys == null) - expIdxVals.put(val, keys = new HashSet<>()); - - assertTrue(keys.add(e.getKey())); - } - - for (Map.Entry> expE : expIdxVals.entrySet()) { - qry = new SqlQuery<>(MvccTestSqlIndexValue.class, "idxVal1 = ?"); - qry.setArgs(expE.getKey()); - - vals = new HashMap<>(); - - for (IgniteCache.Entry e : cache.query(qry).getAll()) { - assertNull(vals.put(e.getKey(), e.getValue().idxVal1)); - - assertEquals(expE.getKey(), (Integer)e.getValue().idxVal1); - - assertTrue(expE.getValue().contains(e.getKey())); - } - - assertEquals(expE.getValue().size(), vals.size()); - } - } - - /** - * - */ - static class JoinTestParentKey implements Serializable { - /** */ - private int key; - - /** - * @param key Key. - */ - JoinTestParentKey(int key) { - this.key = key; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (o == null || getClass() != o.getClass()) - return false; - - JoinTestParentKey that = (JoinTestParentKey)o; - - return key == that.key; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return key; - } - } - - /** - * - */ - static class JoinTestParent { - /** */ - @QuerySqlField(index = true) - private int id; - - /** - * @param id ID. - */ - JoinTestParent(int id) { - this.id = id; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(JoinTestParent.class, this); - } - } - - /** - * - */ - static class JoinTestChildKey implements Serializable { - /** */ - @QuerySqlField(index = true) - private int key; - - /** - * @param key Key. - */ - JoinTestChildKey(int key) { - this.key = key; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - - if (o == null || getClass() != o.getClass()) - return false; - - JoinTestChildKey that = (JoinTestChildKey)o; - - return key == that.key; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return key; - } - } - - /** - * - */ - static class JoinTestChild { - /** */ - @QuerySqlField(index = true) - private int parentId; - - /** - * @param parentId Parent ID. - */ - JoinTestChild(int parentId) { - this.parentId = parentId; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(JoinTestChild.class, this); - } - } - - /** - * - */ - static class MvccTestSqlIndexValue implements Serializable { - /** */ - @QuerySqlField(index = true) - private int idxVal1; - - /** - * @param idxVal1 Indexed value 1. - */ - MvccTestSqlIndexValue(int idxVal1) { - this.idxVal1 = idxVal1; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(MvccTestSqlIndexValue.class, this); - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxModesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxModesTest.java deleted file mode 100644 index dd831cdc5069e..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxModesTest.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.concurrent.Callable; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; -import org.apache.ignite.transactions.TransactionUnsupportedConcurrencyException; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; -import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE; - -/** - * - */ -public class CacheMvccSqlTxModesTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return PARTITIONED; - } - - /** - * @throws Exception If failed - */ - @Test - public void testSqlTransactionModesNoMvcc() throws Exception { - IgniteEx node = startGrid(0); - - IgniteCache nonMvccCache = node.createCache(new CacheConfiguration<>("no-mvcc-cache") - .setAtomicityMode(TRANSACTIONAL).setIndexedTypes(Integer.class, Integer.class)); - - nonMvccCache.put(1, 1); - - for (TransactionConcurrency conc : TransactionConcurrency.values()) { - for (TransactionIsolation iso : TransactionIsolation.values()) { - try (Transaction tx = node.transactions().txStart(conc, iso)) { - nonMvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - tx.commit(); - } - catch (Throwable t) { - log.error("Transaction failed: concurrency=" + conc + ", isolation=" + iso, t); - - throw t; - } - } - } - } - - /** - * @throws Exception If failed - */ - @Test - public void testSqlTransactionModesMvcc() throws Exception { - IgniteEx node = startGrid(0); - - IgniteCache mvccCache = node.createCache(new CacheConfiguration<>("mvcc-cache") - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT).setIndexedTypes(Integer.class, Integer.class)); - - mvccCache.put(1, 1); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - try (Transaction tx = node.transactions().txStart(OPTIMISTIC, READ_COMMITTED)) { - mvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - tx.commit(); - } - - return null; - } - }, TransactionUnsupportedConcurrencyException.class, "Only pessimistic transactions are supported when MVCC is enabled"); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - try (Transaction tx = node.transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { - mvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - tx.commit(); - } - - return null; - } - }, TransactionUnsupportedConcurrencyException.class, "Only pessimistic transactions are supported when MVCC is enabled"); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Void call() throws Exception { - try (Transaction tx = node.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) { - mvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - tx.commit(); - } - - return null; - } - }, TransactionUnsupportedConcurrencyException.class, "Only pessimistic transactions are supported when MVCC is enabled"); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, READ_COMMITTED)) { - mvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - mvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, SERIALIZABLE)) { - mvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - tx.commit(); - } - } - - /** - * @throws Exception If failed - */ - @Test - public void testConsequentMvccNonMvccOperations() throws Exception { - IgniteEx node = startGrid(0); - - IgniteCache mvccCache = node.createCache(new CacheConfiguration<>("mvcc-cache") - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT).setIndexedTypes(Integer.class, Integer.class)); - - IgniteCache nonMvccCache = node.createCache(new CacheConfiguration<>("no-mvcc-cache") - .setAtomicityMode(TRANSACTIONAL).setIndexedTypes(Integer.class, Integer.class)); - - nonMvccCache.put(1, 1); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - mvccCache.query(new SqlFieldsQuery("INSERT INTO Integer (_key, _val) VALUES (3,3)")).getAll(); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - nonMvccCache.put(2, 2); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - mvccCache.query(new SqlFieldsQuery("INSERT INTO Integer (_key, _val) VALUES (5,5)")).getAll(); - - tx.commit(); - } - - nonMvccCache.put(6, 6); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - mvccCache.query(new SqlFieldsQuery("INSERT INTO Integer (_key, _val) VALUES (7,7)")).getAll(); - - tx.commit(); - } - } - - /** - * @throws Exception If failed - */ - @Test - public void testConsequentMvccNonMvccMixedOperations() throws Exception { - IgniteEx node = startGrid(0); - - IgniteCache mvccCache = node.createCache(new CacheConfiguration<>("mvcc-cache") - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT).setIndexedTypes(Integer.class, Integer.class)); - - IgniteCache nonMvccCache = node.createCache(new CacheConfiguration<>("no-mvcc-cache") - .setAtomicityMode(TRANSACTIONAL).setIndexedTypes(Integer.class, Integer.class)); - - nonMvccCache.query(new SqlFieldsQuery("INSERT INTO Integer (_key, _val) VALUES (1,1)")).getAll(); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - nonMvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - mvccCache.put(2, 2); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - nonMvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - mvccCache.query(new SqlFieldsQuery("INSERT INTO Integer (_key, _val) VALUES (3,3)")).getAll(); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - mvccCache.put(4, 4); - - nonMvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - tx.commit(); - } - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - mvccCache.query(new SqlFieldsQuery("INSERT INTO Integer (_key, _val) VALUES (5,5)")).getAll(); - - nonMvccCache.query(new SqlFieldsQuery("SELECT * FROM Integer")).getAll(); - - tx.commit(); - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java deleted file mode 100644 index 19e6514fef33c..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesAbstractTest.java +++ /dev/null @@ -1,2108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Random; -import java.util.concurrent.Callable; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.Phaser; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; -import javax.cache.Cache; -import javax.cache.CacheException; -import javax.cache.processor.EntryProcessor; -import javax.cache.processor.EntryProcessorException; -import javax.cache.processor.MutableEntry; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.cache.affinity.Affinity; -import org.apache.ignite.cache.query.FieldsQueryCursor; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cache.query.annotations.QuerySqlField; -import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.TransactionConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; -import org.apache.ignite.internal.processors.cache.KeyCacheObject; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; -import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; -import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter; -import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; -import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx; -import org.apache.ignite.internal.processors.query.IgniteSQLException; -import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException; -import org.apache.ignite.internal.util.future.GridCompoundFuture; -import org.apache.ignite.internal.util.lang.GridCursor; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.lang.IgniteBiTuple; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionDuplicateKeyException; -import org.apache.ignite.transactions.TransactionSerializationException; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL_SUM; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.DML; -import static org.apache.ignite.testframework.GridTestUtils.runAsync; -import static org.apache.ignite.testframework.GridTestUtils.runMultiThreaded; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Tests for transactional SQL. - */ -public abstract class CacheMvccSqlTxQueriesAbstractTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - return super.getConfiguration(gridName) - .setTransactionConfiguration(new TransactionConfiguration().setDeadlockTimeout(0)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_SingleNode_SinglePartition() throws Exception { - accountsTxReadAll(1, 0, 0, 1, - new InitIndexing(Integer.class, MvccTestAccount.class), false, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_WithRemoves_SingleNode_SinglePartition() throws Exception { - accountsTxReadAll(1, 0, 0, 1, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), false, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_SingleNode_Persistence() throws Exception { - persistence = true; - - testAccountsTxDmlSql_SingleNode(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSumSql_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), false, SQL_SUM, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSumSql_WithRemoves_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL_SUM, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSumSql_WithRemoves__ClientServer_Backups0() throws Exception { - accountsTxReadAll(4, 2, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL_SUM, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSumSql_ClientServer_Backups2() throws Exception { - accountsTxReadAll(4, 2, 2, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL_SUM, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_WithRemoves_SingleNode() throws Exception { - accountsTxReadAll(1, 0, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_WithRemoves_SingleNode_Persistence() throws Exception { - persistence = true; - - testAccountsTxDmlSql_WithRemoves_SingleNode(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_ClientServer_Backups0() throws Exception { - accountsTxReadAll(4, 2, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), false, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_WithRemoves_ClientServer_Backups0() throws Exception { - accountsTxReadAll(4, 2, 0, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_WithRemoves_ClientServer_Backups0_Persistence() throws Exception { - persistence = true; - - testAccountsTxDmlSql_WithRemoves_ClientServer_Backups0(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_ClientServer_Backups1() throws Exception { - accountsTxReadAll(3, 0, 1, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), false, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_WithRemoves_ClientServer_Backups1() throws Exception { - accountsTxReadAll(4, 2, 1, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_WithRemoves_ClientServer_Backups1_Persistence() throws Exception { - persistence = true; - - testAccountsTxDmlSql_WithRemoves_ClientServer_Backups1(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_ClientServer_Backups2() throws Exception { - accountsTxReadAll(4, 2, 2, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), false, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_WithRemoves_ClientServer_Backups2() throws Exception { - accountsTxReadAll(4, 2, 2, 64, - new InitIndexing(Integer.class, MvccTestAccount.class), true, SQL, DML); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testAccountsTxDmlSql_ClientServer_Backups2_Persistence() throws Exception { - persistence = true; - - testAccountsTxDmlSql_ClientServer_Backups2(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testParsingErrorHasNoSideEffect() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, 4) - .setIndexedTypes(Integer.class, Integer.class); - - IgniteEx node = startGrid(0); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1),(2,2),(3,3)"); - - try { - try (FieldsQueryCursor> cur = cache.query(qry)) { - fail("We should not get there."); - } - } - catch (CacheException ex) { - IgniteSQLException cause = X.cause(ex, IgniteSQLException.class); - - assertNotNull(cause); - assertEquals(IgniteQueryErrorCode.PARSING, cause.statusCode()); - - assertFalse(tx.isRollbackOnly()); - } - - qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (4,4),(5,5),(6,6)"); - - try (FieldsQueryCursor> cur = cache.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertNull(cache.get(1)); - assertNull(cache.get(2)); - assertNull(cache.get(3)); - assertEquals(4, cache.get(4)); - assertEquals(5, cache.get(5)); - assertEquals(6, cache.get(6)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertStaticCache() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)"); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (4,4),(5,5),(6,6)"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - - assertEquals(4, cache.get(4)); - assertEquals(5, cache.get(5)); - assertEquals(6, cache.get(6)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertStaticCacheImplicit() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)") - .setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryDeleteStaticCache() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)") - .setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - qry = new SqlFieldsQuery("DELETE FROM Integer WHERE 1 = 1"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertNull(cache.get(1)); - assertNull(cache.get(2)); - assertNull(cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryFastDeleteStaticCache() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)") - .setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - qry = new SqlFieldsQuery("DELETE FROM Integer WHERE _key = 1"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertNull(cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryFastUpdateStaticCache() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)") - .setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - qry = new SqlFieldsQuery("UPDATE Integer SET _val = 8 WHERE _key = 1"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertEquals(8, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryFastDeleteObjectStaticCache() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new MvccTestSqlIndexValue(1), - 2, new MvccTestSqlIndexValue(2), - 3, new MvccTestSqlIndexValue(3))); - - assertEquals(new MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new MvccTestSqlIndexValue(3), cache.get(3)); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE FROM MvccTestSqlIndexValue WHERE _key = 1"); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertNull(cache.get(1)); - assertEquals(new MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new MvccTestSqlIndexValue(3), cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryFastUpdateObjectStaticCache() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new MvccTestSqlIndexValue(1), - 2, new MvccTestSqlIndexValue(2), - 3, new MvccTestSqlIndexValue(3))); - - assertEquals(new MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new MvccTestSqlIndexValue(3), cache.get(3)); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE MvccTestSqlIndexValue SET idxVal1 = 8 WHERE _key = 1"); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertEquals(new MvccTestSqlIndexValue(8), cache.get(1)); - assertEquals(new MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new MvccTestSqlIndexValue(3), cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryDeleteStaticCacheImplicit() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap(1, 1, 2, 2, 3, 3)); - - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE FROM Integer WHERE 1 = 1") - .setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - assertNull(cache.get(1)); - assertNull(cache.get(2)); - assertNull(cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryUpdateStaticCache() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap(1, 1, 2, 2, 3, 3)); - - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE Integer SET _val = (_key * 10)"); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertEquals(10, cache.get(1)); - assertEquals(20, cache.get(2)); - assertEquals(30, cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryUpdateStaticCacheImplicit() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap(1, 1, 2, 2, 3, 3)); - - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE Integer SET _val = (_key * 10)") - .setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - assertEquals(10, cache.get(1)); - assertEquals(20, cache.get(2)); - assertEquals(30, cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryDeadlockWithTxTimeout() throws Exception { - checkQueryDeadlock(TimeoutMode.TX); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryDeadlockWithStmtTimeout() throws Exception { - checkQueryDeadlock(TimeoutMode.STMT); - } - - /** */ - private enum TimeoutMode { - /** */ - TX, - /** */ - STMT - } - - /** */ - private void checkQueryDeadlock(TimeoutMode timeoutMode) throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(2); - - client = true; - - startGridsMultiThreaded(2, 2); - - final CyclicBarrier barrier = new CyclicBarrier(2); - final AtomicInteger idx = new AtomicInteger(); - final AtomicReference ex = new AtomicReference<>(); - - multithreaded(new Runnable() { - @Override public void run() { - int id = idx.getAndIncrement(); - - IgniteEx node = grid(id); - - try { - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - if (timeoutMode == TimeoutMode.TX) - tx.timeout(TX_TIMEOUT); - - IgniteCache cache0 = node.cache(DEFAULT_CACHE_NAME); - - String qry1 = "INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)"; - String qry2 = "INSERT INTO Integer (_key, _val) values (4,4),(5,5),(6,6)"; - - SqlFieldsQuery qry = new SqlFieldsQuery((id % 2) == 0 ? qry1 : qry2); - - if (timeoutMode == TimeoutMode.STMT) - qry.setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - cur.getAll(); - } - - barrier.await(); - - qry = new SqlFieldsQuery((id % 2) == 0 ? qry2 : qry1); - - if (timeoutMode == TimeoutMode.STMT) - qry.setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - cur.getAll(); - } - - tx.commit(); - } - } - catch (Exception e) { - onException(ex, e); - } - } - }, 2); - - Exception ex0 = ex.get(); - - assertNotNull(ex0); - - if (!X.hasCause(ex0, IgniteTxTimeoutCheckedException.class)) - throw ex0; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryDeadlockImplicit() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 0, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(2); - - final Phaser phaser = new Phaser(2); - final AtomicReference ex = new AtomicReference<>(); - - GridTestUtils.runAsync(new Runnable() { - @Override public void run() { - IgniteEx node = grid(0); - - try { - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - IgniteCache cache0 = node.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - cur.getAll(); - } - - awaitPhase(phaser, 2); - - tx.commit(); - } - } - catch (Exception e) { - onException(ex, e); - } - finally { - phaser.arrive(); - } - } - }); - - phaser.arriveAndAwaitAdvance(); - - IgniteEx node = grid(1); - - IgniteCache cache0 = node.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)") - .setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - cur.getAll(); - } - catch (Exception e) { - phaser.arrive(); - - onException(ex, e); - } - - phaser.arriveAndAwaitAdvance(); - - Exception ex0 = ex.get(); - - assertNotNull(ex0); - - if (!X.hasCause(ex0, IgniteTxTimeoutCheckedException.class)) - throw ex0; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertClient() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGrid(0); - - client = true; - - startGrid(1); - - awaitPartitionMapExchange(); - - Ignite checkNode = grid(0); - Ignite updateNode = grid(1); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)"); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (4,4),(5,5),(6,6)"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - - assertEquals(4, cache.get(4)); - assertEquals(5, cache.get(5)); - assertEquals(6, cache.get(6)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertClientImplicit() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGrid(0); - - client = true; - - startGrid(1); - - awaitPartitionMapExchange(); - - Ignite checkNode = grid(0); - Ignite updateNode = grid(1); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)") - .setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertSubquery() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class, Integer.class, MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - awaitPartitionMapExchange(); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new MvccTestSqlIndexValue(1), - 2, new MvccTestSqlIndexValue(2), - 3, new MvccTestSqlIndexValue(3))); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val)" + - " SELECT _key * 10, idxVal1 FROM MvccTestSqlIndexValue"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertEquals(1, cache0.get(10)); - assertEquals(2, cache0.get(20)); - assertEquals(3, cache0.get(30)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertSubqueryImplicit() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class, Integer.class, MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - awaitPartitionMapExchange(); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new MvccTestSqlIndexValue(1), - 2, new MvccTestSqlIndexValue(2), - 3, new MvccTestSqlIndexValue(3))); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val)" + - " SELECT _key * 10, idxVal1 FROM MvccTestSqlIndexValue") - .setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - assertEquals(1, cache0.get(10)); - assertEquals(2, cache0.get(20)); - assertEquals(3, cache0.get(30)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryUpdateSubquery() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class, Integer.class, MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - awaitPartitionMapExchange(); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new MvccTestSqlIndexValue(1), - 2, new MvccTestSqlIndexValue(2), - 3, new MvccTestSqlIndexValue(3))); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE MvccTestSqlIndexValue AS t " + - "SET (idxVal1) = (SELECT idxVal1*10 FROM MvccTestSqlIndexValue WHERE t._key = _key)"); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertEquals(10, ((MvccTestSqlIndexValue)cache.get(1)).idxVal1); - assertEquals(20, ((MvccTestSqlIndexValue)cache.get(2)).idxVal1); - assertEquals(30, ((MvccTestSqlIndexValue)cache.get(3)).idxVal1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryUpdateSubqueryImplicit() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class, Integer.class, MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - awaitPartitionMapExchange(); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new MvccTestSqlIndexValue(1), - 2, new MvccTestSqlIndexValue(2), - 3, new MvccTestSqlIndexValue(3))); - - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE MvccTestSqlIndexValue AS t " + - "SET (idxVal1) = (SELECT idxVal1*10 FROM MvccTestSqlIndexValue WHERE t._key = _key)") - .setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - assertEquals(10, ((MvccTestSqlIndexValue)cache.get(1)).idxVal1); - assertEquals(20, ((MvccTestSqlIndexValue)cache.get(2)).idxVal1); - assertEquals(30, ((MvccTestSqlIndexValue)cache.get(3)).idxVal1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertMultithread() throws Exception { - // Reopen https://issues.apache.org/jira/browse/IGNITE-10764 if test starts failing with timeout - final int THREAD_CNT = 8; - final int BATCH_SIZE = 1000; - final int ROUNDS = 10; - - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(2); - - client = true; - - startGridsMultiThreaded(2, 2); - - final AtomicInteger seq = new AtomicInteger(); - - multithreaded(new Runnable() { - @Override public void run() { - for (int r = 0; r < ROUNDS; r++) { - StringBuilder bldr = new StringBuilder("INSERT INTO Integer (_key, _val) values "); - - int start = seq.getAndAdd(BATCH_SIZE); - - for (int i = start, end = start + BATCH_SIZE; i < end; i++) { - if (i != start) - bldr.append(','); - - bldr - .append('(') - .append(i) - .append(',') - .append(i) - .append(')'); - } - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - // no tx timeout here, deadlocks should not happen because all keys are unique - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery(bldr.toString()).setPageSize(100); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals((long)BATCH_SIZE, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - for (int i = start, end = start + BATCH_SIZE; i < end; i++) - assertEquals(i, cache.get(i)); - } - - } - }, THREAD_CNT); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertUpdateMultithread() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(2); - - final Phaser phaser = new Phaser(2); - final AtomicReference ex = new AtomicReference<>(); - - GridCompoundFuture fut = new GridCompoundFuture(); - - fut.add(multithreadedAsync(new Runnable() { - @Override public void run() { - IgniteEx node = grid(0); - - try { - while (true) { - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - IgniteCache cache0 = node.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - cur.getAll(); - } - - awaitPhase(phaser, 2); - - qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (4,4),(5,5),(6,6)"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - cur.getAll(); - } - - tx.commit(); - - break; - } - catch (CacheException e) { - MvccFeatureChecker.assertMvccWriteConflict(e); - } - } - } - catch (Exception e) { - onException(ex, e); - } - } - }, 1)); - - fut.add(multithreadedAsync(new Runnable() { - @Override public void run() { - IgniteEx node = grid(1); - - try { - phaser.arriveAndAwaitAdvance(); - - while (true) { - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - IgniteCache cache0 = node.cache(DEFAULT_CACHE_NAME); - - cache0.invokeAllAsync(F.asSet(1, 2, 3, 4, 5, 6), new EntryProcessor() { - @Override public Void process(MutableEntry entry, - Object... arguments) throws EntryProcessorException { - entry.setValue(entry.getValue() * 10); - - return null; - } - }); - - phaser.arrive(); - - tx.commit(); - - break; - } - catch (Exception e) { - assertTrue(e instanceof TransactionSerializationException); - } - } - } - catch (Exception e) { - onException(ex, e); - } - } - }, 1)); - - try { - fut.markInitialized(); - - fut.get(TX_TIMEOUT); - } - catch (IgniteCheckedException e) { - onException(ex, e); - } - finally { - phaser.forceTermination(); - } - - Exception ex0 = ex.get(); - - if (ex0 != null) - throw ex0; - - IgniteCache cache = grid(0).cache(DEFAULT_CACHE_NAME); - - assertEquals(10, cache.get(1)); - assertEquals(20, cache.get(2)); - assertEquals(30, cache.get(3)); - assertEquals(40, cache.get(4)); - assertEquals(50, cache.get(5)); - assertEquals(60, cache.get(6)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertVersionConflict() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(2); - - IgniteCache cache = grid(0).cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1)"); - - try (FieldsQueryCursor> cur = cache.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - final CyclicBarrier barrier = new CyclicBarrier(2); - final AtomicReference ex = new AtomicReference<>(); - - runMultiThreaded(new Runnable() { - @Override public void run() { - IgniteEx node = grid(0); - - try { - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - barrier.await(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = node.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry; - - synchronized (barrier) { - qry = new SqlFieldsQuery("SELECT * FROM Integer"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(1, cur.getAll().size()); - } - } - - barrier.await(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - qry = new SqlFieldsQuery("UPDATE Integer SET _val = (_key * 10)"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - } - catch (Exception e) { - onException(ex, e); - } - } - }, 2, "tx-thread"); - - MvccFeatureChecker.assertMvccWriteConflict(ex.get()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testInsertAndFastDeleteWithoutVersionConflict() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(2); - - IgniteCache cache0 = grid(0).cache(DEFAULT_CACHE_NAME); - - try (Transaction tx1 = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - // obtain tx version - cache0.query(new SqlFieldsQuery("select * from Integer where _key = 1")); - - runAsync(() -> { - cache0.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(1, 1)); - }).get(); - - cache0.query(new SqlFieldsQuery("delete from Integer where _key = ?").setArgs(1)); - - tx1.commit(); - } - catch (Exception e) { - e.printStackTrace(); - - fail("Exception is not expected here"); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testInsertAndFastUpdateWithoutVersionConflict() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(2); - - IgniteCache cache0 = grid(0).cache(DEFAULT_CACHE_NAME); - - try (Transaction tx1 = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - // obtain tx version - cache0.query(new SqlFieldsQuery("select * from Integer where _key = 1")); - - runAsync(() -> { - cache0.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(1, 1)); - }).get(); - - cache0.query(new SqlFieldsQuery("update Integer set _val = ? where _key = ?").setArgs(1, 1)); - - tx1.commit(); - } - catch (Exception e) { - e.printStackTrace(); - - fail("Exception is not expected here"); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testInsertFastUpdateConcurrent() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(2); - - IgniteCache cache0 = grid(0).cache(DEFAULT_CACHE_NAME); - - try { - for (int i = 0; i < 100; i++) { - int key = i; - CompletableFuture.allOf( - CompletableFuture.runAsync(() -> { - cache0.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(key, key)); - }), - CompletableFuture.runAsync(() -> { - cache0.query(new SqlFieldsQuery("update Integer set _val = ? where _key = ?").setArgs(key, key)); - }) - ).get(); - } - } - catch (Exception e) { - e.printStackTrace(); - - fail("Exception is not expected here"); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertRollback() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)"); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (4,4),(5,5),(6,6)"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.rollback(); - } - - for (int i = 1; i <= 6; i++) - assertTrue(cache.query(new SqlFieldsQuery("SELECT * FROM Integer WHERE _key = 1")).getAll().isEmpty()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertUpdateSameKeys() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - final Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)"); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - qry = new SqlFieldsQuery("UPDATE Integer SET _val = (_key * 10)"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - cur.getAll(); - } - - tx.commit(); - } - - assertEquals(10, cache.get(1)); - assertEquals(20, cache.get(2)); - assertEquals(30, cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryInsertUpdateSameKeysInSameOperation() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - final Ignite updateNode = grid(rnd.nextInt(4)); - - GridTestUtils.assertThrows(null, new Callable() { - @Override public Object call() throws Exception { - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(1,2),(1,3)"); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - cache0.query(qry).getAll(); - - tx.commit(); - } - - return null; - } - }, TransactionDuplicateKeyException.class, "Duplicate key during INSERT [key=KeyCacheObjectImpl"); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryPendingUpdates() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - final Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)"); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - try (FieldsQueryCursor> cur = cache0.query(qry.setSql("UPDATE Integer SET _val = (_key * 10)"))) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - for (List row : cache0.query(qry.setSql("SELECT _key, _val FROM Integer")).getAll()) { - assertEquals((Integer)row.get(0) * 10, row.get(1)); - } - - try (FieldsQueryCursor> cur = cache0.query(qry.setSql("UPDATE Integer SET _val = 15 where _key = 2"))) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - for (List row : cache0.query(qry.setSql("SELECT _key, _val FROM Integer")).getAll()) { - if ((Integer)row.get(0) == 2) - assertEquals(15, row.get(1)); - else - assertEquals((Integer)row.get(0) * 10, row.get(1)); - } - - GridTestUtils.runAsync(new Runnable() { - @Override public void run() { - SqlFieldsQuery qry = new SqlFieldsQuery("SELECT _key, _val FROM Integer"); - - assertTrue(cache.query(qry).getAll().isEmpty()); - } - }).get(TX_TIMEOUT); - - cache0.query(qry.setSql("DELETE FROM Integer")).getAll(); - - assertTrue(cache0.query(qry.setSql("SELECT _key, _val FROM Integer")).getAll().isEmpty()); - - assertEquals( - 3L, - cache0.query(qry.setSql("INSERT INTO Integer (_key, _val) values (1,1),(2,2),(3,3)")).getAll().iterator().next().get(0) - ); - - tx.commit(); - } - - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testSelectProducesTransaction() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite node = grid(rnd.nextInt(4)); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) values (1,1),(2,2),(3,3)"); - - try (FieldsQueryCursor> cur = cache.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - SqlFieldsQueryEx qryEx = new SqlFieldsQueryEx("SELECT * FROM MvccTestSqlIndexValue", true); - - qryEx.setAutoCommit(false); - - try (FieldsQueryCursor> cur = cache.query(qryEx)) { - assertEquals(3, cur.getAll().size()); - } - - try (GridNearTxLocal tx = cache.unwrap(IgniteEx.class).context().cache().context().tm().userTx()) { - assertNotNull(tx); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableRead() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - IgniteCache cache = grid(rnd.nextInt(4)).cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache.query( - new SqlFieldsQuery("INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) values (1,1),(2,2),(3,3)"))) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - Ignite node = grid(rnd.nextInt(4)); - IgniteCache cache0 = node.cache(DEFAULT_CACHE_NAME); - SqlFieldsQuery qry = new SqlFieldsQuery("SELECT * FROM MvccTestSqlIndexValue"); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3, cur.getAll().size()); - } - - runAsync(new Runnable() { - @Override public void run() { - IgniteCache cache = grid(ThreadLocalRandom.current().nextInt(4)) - .cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache.query( - new SqlFieldsQuery("INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) values (4,4),(5,5),(6,6)"))) { - assertEquals(3L, cur.iterator().next().get(0)); - } - } - }).get(TX_TIMEOUT); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3, cur.getAll().size()); - } - } - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(6, cur.getAll().size()); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateExplicitPartitionsWithoutReducer() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, 10) - .setIndexedTypes(Integer.class, Integer.class); - - Ignite ignite = startGridsMultiThreaded(4); - - awaitPartitionMapExchange(); - - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); - - Affinity affinity = internalCache0(cache).affinity(); - - int keysCnt = 10, retryCnt = 0; - - Integer test = 0; - - Map vals = new LinkedHashMap<>(); - - while (vals.size() < keysCnt) { - int partition = affinity.partition(test); - - if (partition == 1 || partition == 2) - vals.put(test, 0); - else - assertTrue("Maximum retry number exceeded", ++retryCnt < 1000); - - test++; - } - - cache.putAll(vals); - - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE Integer set _val=2").setPartitions(1, 2); - - List> all = cache.query(qry).getAll(); - - assertEquals(Long.valueOf(keysCnt), all.stream().findFirst().orElseThrow(AssertionError::new).get(0)); - - List> rows = cache.query(new SqlFieldsQuery("SELECT _val FROM Integer")).getAll(); - - assertEquals(keysCnt, rows.size()); - assertTrue(rows.stream().map(r -> r.get(0)).map(Integer.class::cast).allMatch(v -> v == 2)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateExplicitPartitionsWithReducer() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, 10) - .setIndexedTypes(Integer.class, Integer.class); - - Ignite ignite = startGridsMultiThreaded(4); - - awaitPartitionMapExchange(); - - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); - - Affinity affinity = internalCache0(cache).affinity(); - - int keysCnt = 10, retryCnt = 0; - - Integer test = 0; - - Map vals = new LinkedHashMap<>(); - - while (vals.size() < keysCnt) { - int partition = affinity.partition(test); - - if (partition == 1 || partition == 2) - vals.put(test, 0); - else - assertTrue("Maximum retry number exceeded", ++retryCnt < 1000); - - test++; - } - - cache.putAll(vals); - - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE Integer set _val=(SELECT 2 FROM DUAL)").setPartitions(1, 2); - - List> all = cache.query(qry).getAll(); - - assertEquals(Long.valueOf(keysCnt), all.stream().findFirst().orElseThrow(AssertionError::new).get(0)); - - List> rows = cache.query(new SqlFieldsQuery("SELECT _val FROM Integer")).getAll(); - - assertEquals(keysCnt, rows.size()); - assertTrue(rows.stream().map(r -> r.get(0)).map(Integer.class::cast).allMatch(v -> v == 2)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testFastInsertUpdateConcurrent() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - Ignite ignite = startGridsMultiThreaded(4); - - IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME); - - for (int i = 0; i < 1000; i++) { - int key = i; - CompletableFuture.allOf( - CompletableFuture.runAsync(() -> { - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(key, key)); - }), - CompletableFuture.runAsync(() -> { - cache.query(new SqlFieldsQuery("update Integer set _val = ? where _key = ?").setArgs(key, key)); - }) - ).join(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testIterator() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGrid(getConfiguration("grid").setMvccVacuumFrequency(Integer.MAX_VALUE)); - - Ignite client = startClientGrid(getConfiguration("client")); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - cache.put(1, 1); - cache.put(2, 2); - cache.put(3, 3); - cache.put(4, 4); - - List> res; - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - res = cache.query(new SqlFieldsQuery("UPDATE Integer SET _val = CASE _key " + - "WHEN 1 THEN 10 WHEN 2 THEN 20 ELSE 30 END")).getAll(); - - assertEquals(4L, res.get(0).get(0)); - - tx.rollback(); - } - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - res = cache.query(new SqlFieldsQuery("UPDATE Integer SET _val = CASE _val " + - "WHEN 1 THEN 10 WHEN 2 THEN 20 ELSE 30 END")).getAll(); - - assertEquals(4L, res.get(0).get(0)); - - res = cache.query(new SqlFieldsQuery("UPDATE Integer SET _val = CASE _val " + - "WHEN 10 THEN 100 WHEN 20 THEN 200 ELSE 300 END")).getAll(); - - assertEquals(4L, res.get(0).get(0)); - - res = cache.query(new SqlFieldsQuery("DELETE FROM Integer WHERE _key = 4")).getAll(); - - assertEquals(1L, res.get(0).get(0)); - - tx.commit(); - } - - IgniteCache cache0 = client.cache(DEFAULT_CACHE_NAME); - - Iterator> it = cache0.iterator(); - - Map map = new HashMap<>(); - - while (it.hasNext()) { - Cache.Entry e = it.next(); - - assertNull("duplicate key returned from iterator", map.putIfAbsent(e.getKey(), e.getValue())); - } - - assertEquals(3, map.size()); - - assertEquals(100, map.get(1).intValue()); - assertEquals(200, map.get(2).intValue()); - assertEquals(300, map.get(3).intValue()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testHints() throws Exception { - persistence = true; - - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - Ignite node = startGrid(getConfiguration("grid").setMvccVacuumFrequency(100)); - - node.cluster().state(ClusterState.ACTIVE); - - Ignite client = startClientGrid(getConfiguration("client")); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - List> res; - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - res = cache.query(new SqlFieldsQuery("INSERT INTO Integer (_key, _val) " + - "VALUES (1, 1), (2, 2), (3, 3), (4, 4)")).getAll(); - - assertEquals(4L, res.get(0).get(0)); - - tx.commit(); - } - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - res = cache.query(new SqlFieldsQuery("UPDATE Integer SET _val = CASE _key " + - "WHEN 1 THEN 10 WHEN 2 THEN 20 ELSE 30 END")).getAll(); - - assertEquals(4L, res.get(0).get(0)); - - tx.rollback(); - } - - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - res = cache.query(new SqlFieldsQuery("UPDATE Integer SET _val = CASE _val " + - "WHEN 1 THEN 10 WHEN 2 THEN 20 ELSE 30 END")).getAll(); - - assertEquals(4L, res.get(0).get(0)); - - res = cache.query(new SqlFieldsQuery("UPDATE Integer SET _val = CASE _val " + - "WHEN 10 THEN 100 WHEN 20 THEN 200 ELSE 300 END")).getAll(); - - assertEquals(4L, res.get(0).get(0)); - - res = cache.query(new SqlFieldsQuery("DELETE FROM Integer WHERE _key = 4")).getAll(); - - assertEquals(1L, res.get(0).get(0)); - - tx.commit(); - } - - mvccProcessor(node).runVacuum().get(TX_TIMEOUT); - - checkAllVersionsHints(node.cache(DEFAULT_CACHE_NAME)); - } - - /** */ - private void checkAllVersionsHints(IgniteCache cache) throws IgniteCheckedException { - IgniteCacheProxy cache0 = (IgniteCacheProxy)cache; - GridCacheContext cctx = cache0.context(); - - assert cctx.mvccEnabled(); - - for (Object e : cache) { - IgniteBiTuple entry = (IgniteBiTuple)e; - - KeyCacheObject key = cctx.toCacheKeyObject(entry.getKey()); - - GridCursor cur = cctx.offheap().mvccAllVersionsCursor(cctx, key, CacheDataRowAdapter.RowData.LINK_WITH_HEADER); - - while (cur.next()) { - CacheDataRow row = cur.get(); - - assertTrue(row.mvccTxState() != 0); - } - } - } - - /** - * @param ex Exception holder. - * @param e Exception. - */ - private void onException(AtomicReference ex, T e) { - if (!ex.compareAndSet(null, e)) - ex.get().addSuppressed(e); - } - - /** - * @param phaser Phaser. - * @param phase Phase to wait for. - */ - private void awaitPhase(Phaser phaser, int phase) { - int p; - do { - p = phaser.arriveAndAwaitAdvance(); - } - while (p < phase && p >= 0 /* check termination */ ); - } - - /** - * - */ - static class MvccTestSqlIndexValue implements Serializable { - /** */ - @QuerySqlField(index = true) - private int idxVal1; - - /** - * @param idxVal1 Indexed value 1. - */ - MvccTestSqlIndexValue(int idxVal1) { - this.idxVal1 = idxVal1; - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - MvccTestSqlIndexValue value = (MvccTestSqlIndexValue)o; - return idxVal1 == value.idxVal1; - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return Objects.hash(idxVal1); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(MvccTestSqlIndexValue.class, this); - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesWithReducerAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesWithReducerAbstractTest.java deleted file mode 100644 index 8174eb3e08aab..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlTxQueriesWithReducerAbstractTest.java +++ /dev/null @@ -1,879 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.concurrent.Callable; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.query.FieldsQueryCursor; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.TransactionConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.MvccFeatureChecker; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionDuplicateKeyException; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause; -import static org.apache.ignite.testframework.GridTestUtils.runMultiThreaded; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Tests for transactional SQL. - */ -public abstract class CacheMvccSqlTxQueriesWithReducerAbstractTest extends CacheMvccAbstractTest { - /** */ - private static final int TIMEOUT = 3000; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - return super.getConfiguration(gridName) - .setTransactionConfiguration(new TransactionConfiguration().setDeadlockTimeout(0)); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - ccfgs = null; - ccfg = null; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerInsert() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = - checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), - 2, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), - 3, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3))); - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TIMEOUT); - - String sqlText = "INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) " + - "SELECT DISTINCT _key + 3, idxVal1 + 3 FROM MvccTestSqlIndexValue"; - - SqlFieldsQuery qry = new SqlFieldsQuery(sqlText); - - qry.setDistributedJoins(true); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(4), cache.get(4)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(5), cache.get(5)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(6), cache.get(6)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerInsertDuplicateKey() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = - checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), - 2, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), - 3, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3))); - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TIMEOUT); - - String sqlText = "INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) " + - "SELECT DISTINCT _key, idxVal1 FROM MvccTestSqlIndexValue"; - - SqlFieldsQuery qry = new SqlFieldsQuery(sqlText); - - qry.setDistributedJoins(true); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Object call() { - return cache0.query(qry); - } - }, TransactionDuplicateKeyException.class, "Duplicate key during INSERT"); - - tx.rollback(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerMerge() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = - checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), - 2, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), - 3, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3))); - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TIMEOUT); - - String sqlText = "MERGE INTO MvccTestSqlIndexValue (_key, idxVal1) " + - "SELECT DISTINCT _key * 2, idxVal1 FROM MvccTestSqlIndexValue"; - - SqlFieldsQuery qry = new SqlFieldsQuery(sqlText); - - qry.setDistributedJoins(true); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), cache.get(4)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(6)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerMultiBatchPerNodeServer() throws Exception { - checkMultiBatchPerNode(false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerMultiBatchPerNodeClient() throws Exception { - checkMultiBatchPerNode(true); - } - - /** - * @throws Exception If failed. - */ - private void checkMultiBatchPerNode(boolean client) throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class); - - Ignite checkNode; - Ignite updateNode; - - Random rnd = ThreadLocalRandom.current(); - - if (client) { - startGridsMultiThreaded(3); - - updateNode = grid(rnd.nextInt(3)); - - this.client = true; - - checkNode = startGrid(4); - } - else { - startGridsMultiThreaded(4); - - checkNode = grid(rnd.nextInt(4)); - updateNode = grid(rnd.nextInt(4)); - } - - IgniteCache cache = - checkNode.cache(DEFAULT_CACHE_NAME); - - final int count = 6; - - Map vals = new HashMap<>(count); - - for (int idx = 1; idx <= count; ++idx) - vals.put(idx, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(idx)); - - cache.putAll(vals); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TIMEOUT); - - String sqlText = "INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) " + - "SELECT DISTINCT _key + 6, idxVal1 + 6 FROM MvccTestSqlIndexValue"; - - SqlFieldsQuery qry = new SqlFieldsQuery(sqlText); - - qry.setDistributedJoins(true); - qry.setPageSize(1); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals((long)count, cur.iterator().next().get(0)); - } - - tx.commit(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerDelete() throws Exception { - ccfgs = new CacheConfiguration[] { - cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setName("int") - .setIndexedTypes(Integer.class, Integer.class), - cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, - CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class), - }; - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache("int"); - - cache.putAll(F.asMap(1, 1, 3, 3, 5, 5)); - - final int count = 6; - - Map vals = new HashMap<>(count); - - for (int idx = 1; idx <= count; ++idx) - vals.put(idx, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(idx)); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - cache0.putAll(vals); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TIMEOUT); - - String sqlText = "DELETE FROM MvccTestSqlIndexValue t " + - "WHERE EXISTS (SELECT 1 FROM \"int\".Integer WHERE t._key = _key)"; - - SqlFieldsQuery qry = new SqlFieldsQuery(sqlText); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerUpdate() throws Exception { - ccfgs = new CacheConfiguration[] { - cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setName("int") - .setIndexedTypes(Integer.class, Integer.class), - cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, - CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class), - }; - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache("int"); - - cache.putAll(F.asMap(1, 5, 3, 1, 5, 3)); - - final int count = 6; - - Map vals = new HashMap<>(count); - - for (int idx = 1; idx <= count; ++idx) - vals.put(idx, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(idx)); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - cache0.putAll(vals); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TIMEOUT); - - String sqlText = "UPDATE MvccTestSqlIndexValue t SET idxVal1=" + - "(SELECT _val FROM \"int\".Integer WHERE t._key = _key)" + - " WHERE EXISTS (SELECT 1 FROM \"int\".Integer WHERE t._key = _key)"; - - SqlFieldsQuery qry = new SqlFieldsQuery(sqlText); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerImplicitTxInsert() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = - checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), - 2, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), - 3, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3))); - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - - String sqlText = "INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) " + - "SELECT DISTINCT _key + 3, idxVal1 + 3 FROM MvccTestSqlIndexValue"; - - SqlFieldsQuery qry = new SqlFieldsQuery(sqlText); - - qry.setTimeout(TX_TIMEOUT, TimeUnit.MILLISECONDS); - - qry.setDistributedJoins(true); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(4), cache.get(4)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(5), cache.get(5)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(6), cache.get(6)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerRollbackInsert() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = - checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), - 2, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), - 3, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3))); - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - - try (Transaction tx = updateNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TIMEOUT); - - String sqlText = "INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) " + - "SELECT DISTINCT _key + 3, idxVal1 + 3 FROM MvccTestSqlIndexValue"; - - SqlFieldsQuery qry = new SqlFieldsQuery(sqlText); - - qry.setDistributedJoins(true); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - tx.rollback(); - } - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), sqlGet(1, cache).get(0).get(0)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), sqlGet(2, cache).get(0).get(0)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), sqlGet(3, cache).get(0).get(0)); - assertTrue(sqlGet(4, cache).isEmpty()); - assertTrue(sqlGet(5, cache).isEmpty()); - assertTrue(sqlGet(6, cache).isEmpty()); - } - - /** - * @param key Key. - * @param cache Cache. - * @return Result. - */ - private List sqlGet(int key, IgniteCache cache) { - return cache.query(new SqlFieldsQuery("SELECT _val from MvccTestSqlIndexValue WHERE _key=" + key)).getAll(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerDeadlockInsertWithTxTimeout() throws Exception { - checkQueryReducerDeadlockInsert(TimeoutMode.TX); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerDeadlockInsertWithStmtTimeout() throws Exception { - checkQueryReducerDeadlockInsert(TimeoutMode.STMT); - } - - /** */ - private enum TimeoutMode { - /** */ - TX, - /** */ - STMT - } - - /** */ - public void checkQueryReducerDeadlockInsert(TimeoutMode timeoutMode) throws Exception { - ccfgs = new CacheConfiguration[] { - cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setName("int") - .setIndexedTypes(Integer.class, Integer.class), - cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class), - }; - - startGridsMultiThreaded(2); - - client = true; - - startGridsMultiThreaded(2, 2); - - Ignite checkNode = grid(2); - - IgniteCache cache = checkNode.cache("int"); - - HashMap vals = new HashMap<>(100); - - for (int idx = 0; idx < 100; ++idx) - vals.put(idx, idx); - - cache.putAll(vals); - - final CyclicBarrier barrier = new CyclicBarrier(2); - final AtomicInteger idx = new AtomicInteger(2); - final AtomicReference ex = new AtomicReference<>(); - - multithreaded(new Runnable() { - @Override public void run() { - int id = idx.getAndIncrement(); - - IgniteEx node = grid(id); - - try { - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - if (timeoutMode == TimeoutMode.TX) - tx.timeout(TIMEOUT); - - String sqlText = "INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) " + - "SELECT DISTINCT _key, _val FROM \"int\".Integer ORDER BY _key"; - - String sqlAsc = sqlText + " ASC"; - String sqlDesc = sqlText + " DESC"; - - SqlFieldsQuery qry = new SqlFieldsQuery((id % 2) == 0 ? sqlAsc : sqlDesc); - - if (timeoutMode == TimeoutMode.STMT) - qry.setTimeout(TIMEOUT, TimeUnit.MILLISECONDS); - - IgniteCache cache0 = node.cache(DEFAULT_CACHE_NAME); - - cache0.query(qry).getAll(); - - barrier.await(); - - qry = new SqlFieldsQuery((id % 2) == 0 ? sqlDesc : sqlAsc); - - if (timeoutMode == TimeoutMode.STMT) - qry.setTimeout(TIMEOUT, TimeUnit.MILLISECONDS); - - cache0.query(qry).getAll(); - - tx.commit(); - } - } - catch (Exception e) { - onException(ex, e); - } - } - }, 2); - - Exception ex0 = ex.get(); - - assertNotNull(ex0); - - assertThrowsWithCause(() -> { - throw ex0; - }, IgniteTxTimeoutCheckedException.class); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerInsertVersionConflict() throws Exception { - ccfgs = new CacheConfiguration[] { - cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setName("int") - .setIndexedTypes(Integer.class, Integer.class), - cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, - CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class), - }; - - startGridsMultiThreaded(2); - - client = true; - - final Ignite checkNode = startGrid(2); - - IgniteCache cache = checkNode.cache("int"); - - HashMap vals = new HashMap<>(100); - - for (int idx = 0; idx < 10; ++idx) - vals.put(idx, idx); - - cache.putAll(vals); - - awaitPartitionMapExchange(); - - IgniteCache cache0 = checkNode.cache(DEFAULT_CACHE_NAME); - - cache0.query(new SqlFieldsQuery("INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) " + - "SELECT _key, _val FROM \"int\".Integer")).getAll(); - - final CyclicBarrier barrier = new CyclicBarrier(2); - final AtomicReference ex = new AtomicReference<>(); - - runMultiThreaded(new Runnable() { - @Override public void run() { - try { - try (Transaction tx = checkNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - barrier.await(); - - SqlFieldsQuery qry = new SqlFieldsQuery("SELECT * FROM MvccTestSqlIndexValue"); - - cache0.query(qry).getAll(); - - barrier.await(); - - String sqlText = "UPDATE MvccTestSqlIndexValue t SET idxVal1=" + - "(SELECT _val FROM \"int\".Integer WHERE _key >= 5 AND _key <= 5 ORDER BY _key) WHERE _key = 5"; - - qry = new SqlFieldsQuery(sqlText); - - cache0.query(qry).getAll(); - - tx.commit(); - } - } - catch (Exception e) { - onException(ex, e); - } - } - }, 2, "tx-thread"); - - MvccFeatureChecker.assertMvccWriteConflict(ex.get()); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerInsertValues() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite node = grid(rnd.nextInt(4)); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO MvccTestSqlIndexValue (_key, idxVal1)" + - " values (1,?),(2,?),(3,?)"); - - qry.setArgs(1, 2, 3); - - try (FieldsQueryCursor> cur = cache.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - - qry = new SqlFieldsQuery("INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) values (4,4)"); - - try (FieldsQueryCursor> cur = cache.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(4), cache.get(4)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerMergeValues() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite node = grid(rnd.nextInt(4)); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - cache.put(1, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1)); - cache.put(3, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3)); - - SqlFieldsQuery qry = new SqlFieldsQuery("MERGE INTO MvccTestSqlIndexValue (_key, idxVal1)" + - " values (1,?),(2,?),(3,?)"); - - qry.setArgs(1, 4, 6); - - try (FieldsQueryCursor> cur = cache.query(qry)) { - assertEquals(3L, cur.iterator().next().get(0)); - } - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(4), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(6), cache.get(3)); - - qry = new SqlFieldsQuery("MERGE INTO MvccTestSqlIndexValue (_key, idxVal1) values (4,4)"); - - try (FieldsQueryCursor> cur = cache.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(4), cache.get(4)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerFastUpdate() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap(1, 1, 2, 2, 3, 3)); - - assertEquals(1, cache.get(1)); - assertEquals(2, cache.get(2)); - assertEquals(3, cache.get(3)); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE Integer SET _val = 8 WHERE _key = ?").setArgs(1); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - qry = new SqlFieldsQuery("UPDATE Integer SET _val = 9 WHERE _key = 2"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - assertEquals(8, cache.get(1)); - assertEquals(9, cache.get(2)); - assertEquals(3, cache.get(3)); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testQueryReducerFastDelete() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue.class); - - startGridsMultiThreaded(4); - - Random rnd = ThreadLocalRandom.current(); - - Ignite checkNode = grid(rnd.nextInt(4)); - Ignite updateNode = grid(rnd.nextInt(4)); - - IgniteCache cache = checkNode.cache(DEFAULT_CACHE_NAME); - - cache.putAll(F.asMap( - 1, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), - 2, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), - 3, new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3))); - - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(1), cache.get(1)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(2), cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - - IgniteCache cache0 = updateNode.cache(DEFAULT_CACHE_NAME); - - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE FROM MvccTestSqlIndexValue WHERE _key = ?") - .setArgs(1); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - qry = new SqlFieldsQuery("DELETE FROM MvccTestSqlIndexValue WHERE _key = 2"); - - try (FieldsQueryCursor> cur = cache0.query(qry)) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - assertNull(cache.get(1)); - assertNull(cache.get(2)); - assertEquals(new CacheMvccSqlTxQueriesAbstractTest.MvccTestSqlIndexValue(3), cache.get(3)); - } - - /** - * @param ex Exception holder. - * @param e Exception. - */ - private void onException(AtomicReference ex, Exception e) { - if (!ex.compareAndSet(null, e)) - ex.get().addSuppressed(e); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlUpdateCountersTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlUpdateCountersTest.java deleted file mode 100644 index 8513d93bac19b..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlUpdateCountersTest.java +++ /dev/null @@ -1,562 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.affinity.Affinity; -import org.apache.ignite.cache.query.FieldsQueryCursor; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; -import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition; -import org.apache.ignite.internal.util.lang.GridInClosure3; -import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.lang.IgniteInClosure; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Test for MVCC caches update counters behaviour. - */ -@SuppressWarnings("unchecked") -public class CacheMvccSqlUpdateCountersTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateCountersInsertSimple() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - Ignite node = startGridsMultiThreaded(3); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - Affinity aff = affinity(cache); - - Integer key1 = 1; - - int part1 = aff.partition(key1); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (" + key1 + ",1)"); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 1); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("UPDATE Integer SET _val=2 WHERE _key=" + key1); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 2); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateCountersDoubleUpdate() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - Ignite node = startGridsMultiThreaded(3); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - Affinity aff = affinity(cache); - - int key1 = 1; - - int part1 = aff.partition(key1); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (" + key1 + ",1)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("UPDATE Integer SET _val=2 WHERE _key=" + key1); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 1); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ",1)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("UPDATE Integer SET _val=2 WHERE _key=" + key1); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 2); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateCountersRollback() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT) - .setIndexedTypes(Integer.class, Integer.class); - - Ignite node = startGridsMultiThreaded(3); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - Affinity aff = affinity(cache); - - int key1 = 1; - - int part1 = aff.partition(key1); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (" + key1 + ",1)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("UPDATE Integer SET _val=2 WHERE _key=" + key1); - - cache.query(qry).getAll(); - - tx.rollback(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 0); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ",1)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("UPDATE Integer SET _val=2 WHERE _key=" + key1); - - cache.query(qry).getAll(); - - tx.rollback(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 0); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testDeleteOwnKey() throws Exception { - ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, 1) - .setCacheMode(CacheMode.REPLICATED) - .setIndexedTypes(Integer.class, Integer.class); - - Ignite node = startGridsMultiThreaded(1); - - IgniteCache cache = node.cache(DEFAULT_CACHE_NAME); - - Affinity aff = affinity(cache); - - int key1 = 1; - - int part1 = aff.partition(key1); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (" + key1 + ",1)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ",2)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ",3)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("DELETE FROM Integer WHERE _key=" + key1); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ",4)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ",5)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("DELETE FROM Integer WHERE _key=" + key1); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 0); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ",1)"); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 1); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE FROM Integer WHERE _key=" + key1); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 2); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE FROM Integer WHERE _key=" + key1); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 2); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO Integer (_key, _val) values (" + key1 + ", 2)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("DELETE FROM Integer WHERE _key=" + key1); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ", 3)"); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 3); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE FROM Integer WHERE _key=" + key1); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ",5)"); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("DELETE FROM Integer WHERE _key=" + key1); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 4); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ",6)"); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 5); - - try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE FROM Integer WHERE _key=" + key1); - - cache.query(qry).getAll(); - - qry = new SqlFieldsQuery("MERGE INTO Integer (_key, _val) values (" + key1 + ",7)"); - - cache.query(qry).getAll(); - - tx.commit(); - } - - checkUpdateCounters(DEFAULT_CACHE_NAME, part1, 6); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateCountersMultithreaded() throws Exception { - final int writers = 4; - - final int readers = 0; - - int parts = 8; - - int keys = 20; - - final Map tracker = new ConcurrentHashMap<>(); - - for (int i = 0; i < keys; i++) - tracker.put(i, new AtomicLong(1)); - - final IgniteInClosure> init = new IgniteInClosure>() { - @Override public void apply(IgniteCache cache) { - final IgniteTransactions txs = cache.unwrap(Ignite.class).transactions(); - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO MvccTestAccount(_key, val, updateCnt) VALUES " + - "(?, 0, 1)"); - - for (int i = 0; i < keys; i++) { - try (FieldsQueryCursor> cur = cache.query(qry.setArgs(i))) { - assertEquals(1L, cur.iterator().next().get(0)); - } - - tx.commit(); - } - } - } - }; - - GridInClosure3, AtomicBoolean> writer = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - Map acc = new HashMap<>(); - - int v = 0; - - while (!stop.get()) { - int cnt = rnd.nextInt(keys / 3); - - if (cnt == 0) - cnt = 2; - - // Generate key set to be changed in tx. - while (acc.size() < cnt) - acc.put(rnd.nextInt(cnt), new AtomicLong()); - - TestCache cache = randomCache(caches, rnd); - - boolean success = true; - - try { - IgniteTransactions txs = cache.cache.unwrap(Ignite.class).transactions(); - - try (Transaction tx = txs.txStart(PESSIMISTIC, REPEATABLE_READ)) { - Map allVals = readAllByMode(cache.cache, tracker.keySet(), SQL, ACCOUNT_CODEC); - - boolean rmv = allVals.size() > keys * 2 / 3; - - for (Map.Entry e : acc.entrySet()) { - int key = e.getKey(); - - AtomicLong accCntr = e.getValue(); - - boolean exists = allVals.containsKey(key); - - int delta = 0; - - boolean createdInTx = false; - - if (rmv && rnd.nextBoolean()) { - if (exists) - delta = 1; - - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE FROM MvccTestAccount WHERE _key=" + key); - - cache.cache.query(qry).getAll(); - } - else { - delta = 1; - - if (!exists) - createdInTx = true; - - SqlFieldsQuery qry = new SqlFieldsQuery("MERGE INTO MvccTestAccount " + - "(_key, val, updateCnt) VALUES (" + key + ", " + rnd.nextInt(100) + ", 1)"); - - cache.cache.query(qry).getAll(); - } - - if (rnd.nextBoolean()) { - if (createdInTx) - delta = 0; // Do not count cases when key created and removed in the same tx. - - SqlFieldsQuery qry = new SqlFieldsQuery("DELETE FROM MvccTestAccount WHERE _key=" + key); - - cache.cache.query(qry).getAll(); - } - else { - delta = 1; - - SqlFieldsQuery qry = new SqlFieldsQuery("MERGE INTO MvccTestAccount " + - "(_key, val, updateCnt) VALUES (" + key + ", " + rnd.nextInt(100) + ", 1)"); - - cache.cache.query(qry).getAll(); - } - - accCntr.addAndGet(delta); - } - - tx.commit(); - } - } - catch (Exception e) { - handleTxException(e); - - success = false; - - int r = 0; - - for (Map.Entry en : acc.entrySet()) { - if (((IgniteCacheProxy)cache.cache).context().affinity().partition(en.getKey()) == 0) - r += en.getValue().intValue(); - } - } - finally { - cache.readUnlock(); - - if (success) { - v++; - - for (Map.Entry e : acc.entrySet()) { - int k = e.getKey(); - long updCntr = e.getValue().get(); - - tracker.get(k).addAndGet(updCntr); - } - - int r = 0; - - for (Map.Entry en : acc.entrySet()) { - if (((IgniteCacheProxy)cache.cache).context().affinity().partition(en.getKey()) == 0) - r += en.getValue().intValue(); - } - } - - acc.clear(); - } - } - - info("Writer done, updates: " + v); - } - }; - - GridInClosure3, AtomicBoolean> reader = - new GridInClosure3, AtomicBoolean>() { - @Override public void apply(Integer idx, List caches, AtomicBoolean stop) { - // No-op. - } - }; - - readWriteTest( - null, - 4, - 1, - 2, - parts, - writers, - readers, - DFLT_TEST_TIME, - new InitIndexing(Integer.class, MvccTestAccount.class), - init, - writer, - reader); - - Map updPerParts = new HashMap<>(parts); - - Affinity aff = grid(1).cachex(DEFAULT_CACHE_NAME).affinity(); - - for (Map.Entry e : tracker.entrySet()) { - int k = e.getKey(); - long updCntr = e.getValue().get(); - - int p = aff.partition(k); - - AtomicLong cntr = updPerParts.get(p); - - if (cntr == null) { - cntr = new AtomicLong(); - - updPerParts.putIfAbsent(p, cntr); - } - - cntr.addAndGet(updCntr); - } - - for (Map.Entry e : updPerParts.entrySet()) - checkUpdateCounters(DEFAULT_CACHE_NAME, e.getKey(), e.getValue().get()); - } - - /** - * Checks update counter value on all nodes. - * - * @param cacheName Cache name. - * @param p Part number. - * @param val Expected partition counter value. - */ - private void checkUpdateCounters(String cacheName, int p, long val) { - for (Ignite node : G.allGrids()) { - if (!node.configuration().isClientMode()) { - IgniteCacheProxy cache = (IgniteCacheProxy)node.cache(cacheName); - - GridDhtLocalPartition part = cache.context().topology().localPartition(p); - - if (!cache.context().mvccEnabled() || part == null) - continue; - - assertEquals("part=" + p, val, part.updateCounter()); - } - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccStreamingInsertTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccStreamingInsertTest.java deleted file mode 100644 index bdc111f385ff7..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccStreamingInsertTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.util.List; -import java.util.Properties; -import java.util.concurrent.TimeUnit; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteJdbcDriver; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.junit.Test; - -import static java.util.Arrays.asList; - -/** - * - */ -public class CacheMvccStreamingInsertTest extends CacheMvccAbstractTest { - /** */ - private IgniteCache sqlNexus; - - /** */ - private Connection conn; - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - super.beforeTest(); - - Ignite ignite = startGrid(0); - sqlNexus = ignite.getOrCreateCache(new CacheConfiguration<>("sqlNexus").setSqlSchema("PUBLIC")); - sqlNexus.query(q("" + - "create table person(" + - " id int not null primary key," + - " name varchar not null" + - ") with \"atomicity=transactional_snapshot\"" - )); - - Properties props = new Properties(); - props.setProperty(IgniteJdbcDriver.PROP_STREAMING, "true"); - conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1", props); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testStreamingInsertWithoutOverwrite() throws Exception { - conn.createStatement().execute("SET STREAMING 1 BATCH_SIZE 2 ALLOW_OVERWRITE 0 " + - " PER_NODE_BUFFER_SIZE 1000 FLUSH_FREQUENCY 100"); - sqlNexus.query(q("insert into person values(1, 'ivan')")); - - PreparedStatement batchStmt = conn.prepareStatement("insert into person values(?, ?)"); - batchStmt.setInt(1, 1); - batchStmt.setString(2, "foo"); - batchStmt.addBatch(); - batchStmt.setInt(1, 2); - batchStmt.setString(2, "bar"); - batchStmt.addBatch(); - TimeUnit.MILLISECONDS.sleep(500); - - List> rows = sqlNexus.query(q("select * from person")).getAll(); - List> exp = asList( - asList(1, "ivan"), - asList(2, "bar") - ); - assertEquals(exp, rows); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testUpdateWithOverwrite() throws Exception { - conn.createStatement().execute("SET STREAMING 1 BATCH_SIZE 2 ALLOW_OVERWRITE 1 " + - " PER_NODE_BUFFER_SIZE 1000 FLUSH_FREQUENCY 100"); - sqlNexus.query(q("insert into person values(1, 'ivan')")); - - PreparedStatement batchStmt = conn.prepareStatement("insert into person values(?, ?)"); - batchStmt.setInt(1, 1); - batchStmt.setString(2, "foo"); - batchStmt.addBatch(); - batchStmt.setInt(1, 2); - batchStmt.setString(2, "bar"); - batchStmt.addBatch(); - TimeUnit.MILLISECONDS.sleep(500); - - List> rows = sqlNexus.query(q("select * from person")).getAll(); - List> exp = asList( - asList(1, "foo"), - asList(2, "bar") - ); - assertEquals(exp, rows); - } - - /** */ - private static SqlFieldsQuery q(String sql) { - return new SqlFieldsQuery(sql); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTxNodeMappingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTxNodeMappingTest.java deleted file mode 100644 index 7c851d5c14e26..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTxNodeMappingTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Sets; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.affinity.Affinity; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; -import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; -import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** - * Test checks that transactions started on nodes collect all nodes participating in distributed transaction. - */ -public class CacheMvccTxNodeMappingTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - throw new RuntimeException("Is not supposed to be used"); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testAllTxNodesAreTrackedCli() throws Exception { - checkAllTxNodesAreTracked(false); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testAllTxNodesAreTrackedSrv() throws Exception { - checkAllTxNodesAreTracked(true); - } - - /** - * @param nearSrv {@code true} specifies that node initiated tx is server, otherwise it is client. - */ - private void checkAllTxNodesAreTracked(boolean nearSrv) throws Exception { - int srvCnt = 4; - - startGridsMultiThreaded(srvCnt); - - IgniteEx ign; - - if (nearSrv) - ign = grid(0); - else { - client = true; - - ign = startGrid(srvCnt); - } - - IgniteCache cache = ign.createCache(basicCcfg().setBackups(2)); - - Affinity aff = ign.affinity(cache.getName()); - - Integer k1 = null, k2 = null; - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(grid(0).localNode(), i) - && aff.isBackup(grid(1).localNode(), i) - && aff.isBackup(grid(2).localNode(), i)) { - k1 = i; - break; - } - } - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(grid(1).localNode(), i) - && aff.isBackup(grid(0).localNode(), i) - && aff.isBackup(grid(2).localNode(), i)) { - k2 = i; - break; - } - } - - Integer key1 = k1, key2 = k2; - - assert key1 != null && key2 != null; - - // data initialization - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(key1)); - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(key2)); - - ImmutableMap> txNodes = ImmutableMap.of( - grid(0).localNode().id(), Sets.newHashSet(grid(1).localNode().id(), grid(2).localNode().id()), - grid(1).localNode().id(), Sets.newHashSet(grid(0).localNode().id(), grid(2).localNode().id()) - ); - - // cache put - checkScenario(ign, srvCnt, txNodes, () -> { - cache.put(key1, 42); - cache.put(key2, 42); - }); - - // fast update - checkScenario(ign, srvCnt, txNodes, () -> { - cache.query(new SqlFieldsQuery("merge into Integer(_key, _val) values(?, 42)").setArgs(key1)); - cache.query(new SqlFieldsQuery("merge into Integer(_key, _val) values(?, 42)").setArgs(key2)); - }); - - // cursor update - checkScenario(ign, srvCnt, txNodes, () -> { - cache.query(new SqlFieldsQuery("update Integer set _val = _val + 1 where _key = ?").setArgs(key1)); - cache.query(new SqlFieldsQuery("update Integer set _val = _val + 1 where _key = ?").setArgs(key2)); - }); - - // broadcast update - checkScenario(ign, srvCnt, txNodes, () -> { - cache.query(new SqlFieldsQuery("update Integer set _val = _val + 1").setArgs(key1)); - }); - - // select for update does not start remote tx on backup - ImmutableMap> sfuTxNodes = ImmutableMap.of( - grid(0).localNode().id(), Collections.emptySet(), - grid(1).localNode().id(), Collections.emptySet() - ); - - // cursor select for update - checkScenario(ign, srvCnt, sfuTxNodes, () -> { - cache.query(new SqlFieldsQuery("select _val from Integer where _key = ? for update").setArgs(key1)).getAll(); - cache.query(new SqlFieldsQuery("select _val from Integer where _key = ? for update").setArgs(key2)).getAll(); - }); - - // broadcast select for update - checkScenario(ign, srvCnt, sfuTxNodes, () -> { - cache.query(new SqlFieldsQuery("select _val from Integer for update").setArgs(key1)).getAll(); - }); - } - - /** */ - private void checkScenario(IgniteEx ign, int srvCnt, ImmutableMap> txNodes, Runnable r) - throws Exception { - try (Transaction userTx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - r.run(); - - GridNearTxLocal nearTx = ((TransactionProxyImpl)userTx).tx(); - - nearTx.prepareNearTxLocal().get(); - - List txs = IntStream.range(0, srvCnt) - .mapToObj(i -> txsOnNode(grid(i), nearTx.nearXidVersion())) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - - assertFalse(txs.isEmpty()); - - txs.forEach(tx -> assertEquals(txNodes, repack(tx.transactionNodes()))); - } - } - - /** */ - private static CacheConfiguration basicCcfg() { - return new CacheConfiguration<>("test") - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setCacheMode(PARTITIONED) - .setIndexedTypes(Integer.class, Integer.class); - } - - /** */ - private static Map> repack(Map> orig) { - ImmutableMap.Builder> builder = ImmutableMap.builder(); - - orig.forEach((primary, backups) -> { - builder.put(primary, new HashSet<>(backups)); - }); - - return builder.build(); - } - - /** */ - private static List txsOnNode(IgniteEx node, GridCacheVersion xidVer) { - return node.context().cache().context().tm().activeTransactions().stream() - .peek(tx -> assertEquals(xidVer, tx.nearXidVersion())) - .collect(Collectors.toList()); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTxRecoveryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTxRecoveryTest.java deleted file mode 100644 index b9420f6acf90e..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTxRecoveryTest.java +++ /dev/null @@ -1,753 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.IntPredicate; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import java.util.stream.StreamSupport; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.cache.affinity.Affinity; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.IgniteInterruptedCheckedException; -import org.apache.ignite.internal.TestRecordingCommunicationSpi; -import org.apache.ignite.internal.processors.cache.GridCacheContext; -import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest; -import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishResponse; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest; -import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; -import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager; -import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.internal.util.lang.GridAbsPredicate; -import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.lang.IgniteBiPredicate; -import org.apache.ignite.plugin.extensions.communication.Message; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.cache.CacheMode.PARTITIONED; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccTxRecoveryTest.NodeMode.CLIENT; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccTxRecoveryTest.NodeMode.SERVER; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccTxRecoveryTest.TxEndResult.COMMIT; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccTxRecoveryTest.TxEndResult.ROLLBAK; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; -import static org.apache.ignite.transactions.TransactionState.COMMITTED; -import static org.apache.ignite.transactions.TransactionState.PREPARED; -import static org.apache.ignite.transactions.TransactionState.PREPARING; -import static org.apache.ignite.transactions.TransactionState.ROLLED_BACK; - -/** */ -public class CacheMvccTxRecoveryTest extends CacheMvccAbstractTest { - /** */ - public enum TxEndResult { - /** */ - COMMIT, - - /** */ - ROLLBAK - } - - /** */ - public enum NodeMode { - /** */ - SERVER, - - /** */ - CLIENT - } - - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - throw new RuntimeException("Is not supposed to be used"); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - cfg.setCommunicationSpi(new TestRecordingCommunicationSpi()); - - return cfg; - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRecoveryCommitNearFailure1() throws Exception { - checkRecoveryNearFailure(COMMIT, CLIENT); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRecoveryCommitNearFailure2() throws Exception { - checkRecoveryNearFailure(COMMIT, SERVER); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRecoveryRollbackNearFailure1() throws Exception { - checkRecoveryNearFailure(ROLLBAK, CLIENT); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRecoveryRollbackNearFailure2() throws Exception { - checkRecoveryNearFailure(ROLLBAK, SERVER); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRecoveryCommitPrimaryFailure1() throws Exception { - checkRecoveryPrimaryFailure(COMMIT, false); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRecoveryRollbackPrimaryFailure1() throws Exception { - checkRecoveryPrimaryFailure(ROLLBAK, false); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRecoveryCommitPrimaryFailure2() throws Exception { - checkRecoveryPrimaryFailure(COMMIT, true); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRecoveryRollbackPrimaryFailure2() throws Exception { - checkRecoveryPrimaryFailure(ROLLBAK, true); - } - - /** */ - private void checkRecoveryNearFailure(TxEndResult endRes, NodeMode nearNodeMode) throws Exception { - int gridCnt = 4; - int baseCnt = gridCnt - 1; - - boolean commit = endRes == COMMIT; - - startGridsMultiThreaded(baseCnt); - - // tweak client/server near - client = nearNodeMode == CLIENT; - - IgniteEx nearNode = startGrid(baseCnt); - - IgniteCache cache = nearNode.getOrCreateCache(basicCcfg() - .setBackups(1)); - - Affinity aff = nearNode.affinity(DEFAULT_CACHE_NAME); - - List keys = new ArrayList<>(); - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(grid(0).localNode(), i) && aff.isBackup(grid(1).localNode(), i)) { - keys.add(i); - break; - } - } - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(grid(1).localNode(), i) && aff.isBackup(grid(2).localNode(), i)) { - keys.add(i); - break; - } - } - - assert keys.size() == 2; - - TestRecordingCommunicationSpi nearComm - = (TestRecordingCommunicationSpi)nearNode.configuration().getCommunicationSpi(); - - if (!commit) - nearComm.blockMessages(GridNearTxPrepareRequest.class, grid(1).name()); - - GridTestUtils.runAsync(() -> { - // run in separate thread to exclude tx from thread-local map - GridNearTxLocal nearTx - = ((TransactionProxyImpl)nearNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)).tx(); - - for (Integer k : keys) - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(k)); - - List txs = IntStream.range(0, baseCnt) - .mapToObj(i -> txsOnNode(grid(i), nearTx.xidVersion())) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - - IgniteInternalFuture prepareFut = nearTx.prepareNearTxLocal(); - - if (commit) - prepareFut.get(); - else - assertConditionEventually(() -> txs.stream().anyMatch(tx -> tx.state() == PREPARED)); - - // drop near - nearNode.close(); - - assertConditionEventually(() -> txs.stream().allMatch(tx -> tx.state() == (commit ? COMMITTED : ROLLED_BACK))); - - return null; - }).get(); - - if (commit) { - assertConditionEventually(() -> { - int rowsCnt = grid(0).cache(DEFAULT_CACHE_NAME) - .query(new SqlFieldsQuery("select * from Integer")).getAll().size(); - return rowsCnt == keys.size(); - }); - } - else { - int rowsCnt = G.allGrids().get(0).cache(DEFAULT_CACHE_NAME) - .query(new SqlFieldsQuery("select * from Integer")).getAll().size(); - - assertEquals(0, rowsCnt); - } - - assertPartitionCountersAreConsistent(keys, grids(baseCnt, i -> true)); - } - - /** */ - private void checkRecoveryPrimaryFailure(TxEndResult endRes, boolean mvccCrd) throws Exception { - int gridCnt = 4; - int baseCnt = gridCnt - 1; - - boolean commit = endRes == COMMIT; - - startGridsMultiThreaded(baseCnt); - - client = true; - - IgniteEx nearNode = startGrid(baseCnt); - - IgniteCache cache = nearNode.getOrCreateCache(basicCcfg() - .setBackups(1)); - - Affinity aff = nearNode.affinity(DEFAULT_CACHE_NAME); - - List keys = new ArrayList<>(); - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(grid(0).localNode(), i) && aff.isBackup(grid(1).localNode(), i)) { - keys.add(i); - break; - } - } - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(grid(1).localNode(), i) && aff.isBackup(grid(2).localNode(), i)) { - keys.add(i); - break; - } - } - - assert keys.size() == 2; - - int victim, victimBackup; - - if (mvccCrd) { - victim = 0; - victimBackup = 1; - } - else { - victim = 1; - victimBackup = 2; - } - - TestRecordingCommunicationSpi victimComm = (TestRecordingCommunicationSpi)grid(victim).configuration().getCommunicationSpi(); - - if (commit) - victimComm.blockMessages(GridNearTxFinishResponse.class, nearNode.name()); - else - victimComm.blockMessages(GridDhtTxPrepareRequest.class, grid(victimBackup).name()); - - GridNearTxLocal nearTx - = ((TransactionProxyImpl)nearNode.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)).tx(); - - for (Integer k : keys) - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(k)); - - List txs = IntStream.range(0, baseCnt) - .filter(i -> i != victim) - .mapToObj(i -> txsOnNode(grid(i), nearTx.xidVersion())) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - - IgniteInternalFuture commitFut = nearTx.commitAsync(); - - if (commit) - assertConditionEventually(() -> txs.stream().allMatch(tx -> tx.state() == COMMITTED)); - else - assertConditionEventually(() -> txs.stream().anyMatch(tx -> tx.state() == PREPARED)); - - // drop victim - grid(victim).close(); - - awaitPartitionMapExchange(); - - assertConditionEventually(() -> txs.stream().allMatch(tx -> tx.state() == (commit ? COMMITTED : ROLLED_BACK))); - - assert victimComm.hasBlockedMessages(); - - if (commit) { - assertConditionEventually(() -> { - int rowsCnt = G.allGrids().get(0).cache(DEFAULT_CACHE_NAME) - .query(new SqlFieldsQuery("select * from Integer")).getAll().size(); - return rowsCnt == keys.size(); - }); - } - else { - int rowsCnt = G.allGrids().get(0).cache(DEFAULT_CACHE_NAME) - .query(new SqlFieldsQuery("select * from Integer")).getAll().size(); - - assertEquals(0, rowsCnt); - } - - assertTrue(commitFut.isDone()); - - assertPartitionCountersAreConsistent(keys, grids(baseCnt, i -> i != victim)); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testRecoveryCommit() throws Exception { - startGridsMultiThreaded(2); - - client = true; - - IgniteEx ign = startGrid(2); - - IgniteCache cache = ign.getOrCreateCache(basicCcfg()); - - AtomicInteger keyCntr = new AtomicInteger(); - - ArrayList keys = new ArrayList<>(); - - ign.cluster().forServers().nodes() - .forEach(node -> keys.add(keyForNode(ign.affinity(DEFAULT_CACHE_NAME), keyCntr, node))); - - GridTestUtils.runAsync(() -> { - // run in separate thread to exclude tx from thread-local map - Transaction tx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ); - - for (Integer k : keys) - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(k)); - - ((TransactionProxyImpl)tx).tx().prepareNearTxLocal().get(); - - return null; - }).get(); - - // drop near - stopGrid(2, true); - - IgniteEx srvNode = grid(0); - - assertConditionEventually( - () -> srvNode.cache(DEFAULT_CACHE_NAME).query(new SqlFieldsQuery("select * from Integer")).getAll().size() == 2 - ); - - assertPartitionCountersAreConsistent(keys, G.allGrids()); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testCountersNeighborcastServerFailed() throws Exception { - // Reopen https://issues.apache.org/jira/browse/IGNITE-10766 if starts failing - - int srvCnt = 4; - - startGridsMultiThreaded(srvCnt); - - client = true; - - IgniteEx ign = startGrid(srvCnt); - - IgniteCache cache = ign.getOrCreateCache(basicCcfg() - .setBackups(2)); - - ArrayList keys = new ArrayList<>(); - - int vid = 3; - - IgniteEx victim = grid(vid); - - Affinity aff = ign.affinity(DEFAULT_CACHE_NAME); - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(victim.localNode(), i) && !aff.isBackup(grid(0).localNode(), i)) { - keys.add(i); - break; - } - } - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(victim.localNode(), i) && !aff.isBackup(grid(1).localNode(), i)) { - keys.add(i); - break; - } - } - - assert keys.size() == 2 && !keys.contains(99); - - // prevent prepare on one backup - ((TestRecordingCommunicationSpi)victim.configuration().getCommunicationSpi()) - .blockMessages(GridDhtTxPrepareRequest.class, grid(0).name()); - - GridNearTxLocal nearTx = ((TransactionProxyImpl)ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)).tx(); - - for (Integer k : keys) - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(k)); - - List txs = IntStream.range(0, srvCnt) - .mapToObj(this::grid) - .filter(g -> g != victim) - .map(g -> txsOnNode(g, nearTx.xidVersion())) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - - nearTx.commitAsync(); - - // await tx partially prepared - assertConditionEventually(() -> txs.stream().anyMatch(tx -> tx.state() == PREPARED)); - - CountDownLatch latch1 = new CountDownLatch(1); - CountDownLatch latch2 = new CountDownLatch(1); - - IgniteInternalFuture backgroundTxFut = GridTestUtils.runAsync(() -> { - try (Transaction ignored = ign.transactions().txStart()) { - boolean upd = false; - - for (int i = 100; i < 200; i++) { - if (!aff.isPrimary(victim.localNode(), i)) { - cache.put(i, 11); - upd = true; - break; - } - } - - assert upd; - - latch1.countDown(); - - latch2.await(getTestTimeout(), TimeUnit.MILLISECONDS); - } - - return null; - }); - - latch1.await(getTestTimeout(), TimeUnit.MILLISECONDS); - - // drop primary - victim.close(); - - // do all assertions before rebalance - assertConditionEventually(() -> txs.stream().allMatch(tx -> tx.state() == ROLLED_BACK)); - - List liveNodes = grids(srvCnt, i -> i != vid); - - assertPartitionCountersAreConsistent(keys, liveNodes); - - latch2.countDown(); - - backgroundTxFut.get(getTestTimeout()); - - assertTrue(liveNodes.stream() - .map(node -> node.cache(DEFAULT_CACHE_NAME).query(new SqlFieldsQuery("select * from Integer")).getAll()) - .allMatch(Collection::isEmpty)); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testTxRecoveryWithLostFullMessageOnJoiningBackupNode() throws Exception { - CountDownLatch success = new CountDownLatch(1); - - int joiningBackupNodeId = 2; - - IgniteEx crd = startGrid(0); - - IgniteEx partOwner = startGrid(1); - - IgniteCache cache = partOwner.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) - .setAtomicityMode(TRANSACTIONAL) - .setCacheMode(PARTITIONED) - .setIndexedTypes(Integer.class, Integer.class) - .setBackups(2)); - - // prevent FullMassage on joining backup node - ((TestRecordingCommunicationSpi)crd.configuration().getCommunicationSpi()) - .blockMessages(GridDhtPartitionsFullMessage.class, getTestIgniteInstanceName(joiningBackupNodeId)); - - new Thread(() -> { - try { - startGrid(joiningBackupNodeId); - } - catch (Exception e) { - e.printStackTrace(); - } - - success.countDown(); - }).start(); - - assertTrue(GridTestUtils.waitForCondition(() -> crd.cluster().nodes().size() == 3, 10_000)); - - ArrayList keys = new ArrayList<>(); - - Affinity aff = crd.affinity(DEFAULT_CACHE_NAME); - - for (int i = 0; i < 100; i++) { - if (aff.isPrimary(partOwner.localNode(), i)) { - keys.add(i); - break; - } - } - - ((TestRecordingCommunicationSpi)partOwner.configuration().getCommunicationSpi()) - .blockMessages(GridDhtTxPrepareRequest.class, getTestIgniteInstanceName(joiningBackupNodeId)); - - GridNearTxLocal nearTx = ((TransactionProxyImpl)partOwner.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)).tx(); - - for (Integer k : keys) - cache.put(k, k); - - nearTx.commitAsync(); - - // Checks that PartitionCountersNeighborcastRequest will be sent after primary node left. - IgniteTxManager tm = crd.context().cache().context().tm(); - assertTrue(GridTestUtils.waitForCondition(() -> !tm.activeTransactions().isEmpty(), 10_000)); - assertTrue(GridTestUtils.waitForCondition(() -> tm.activeTransactions().iterator().next().state().equals(PREPARED), 10_000)); - - // Primary node left. - partOwner.close(); - - // Node with backup fetch lost FullMessage and starts. - ((TestRecordingCommunicationSpi)crd.configuration().getCommunicationSpi()).stopBlock(); - - success.await(); - - awaitPartitionMapExchange(); - - assertEquals(2, crd.cluster().nodes().size()); - } - - /** - * @throws Exception if failed. - */ - @Test - public void testUpdateCountersGapIsClosed() throws Exception { - int srvCnt = 3; - - startGridsMultiThreaded(srvCnt); - - client = true; - - IgniteEx ign = startGrid(srvCnt); - - IgniteCache cache = ign.getOrCreateCache( - basicCcfg().setBackups(2)); - - int vid = 1; - - IgniteEx victim = grid(vid); - - ArrayList keys = new ArrayList<>(); - - Integer part = null; - - Affinity aff = ign.affinity(DEFAULT_CACHE_NAME); - - for (int i = 0; i < 2000; i++) { - int p = aff.partition(i); - if (aff.isPrimary(victim.localNode(), i)) { - if (part == null) part = p; - if (p == part) keys.add(i); - if (keys.size() == 2) break; - } - } - - assert keys.size() == 2; - - Transaction txA = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ); - - // prevent first transaction prepare on backups - ((TestRecordingCommunicationSpi)victim.configuration().getCommunicationSpi()) - .blockMessages(new IgniteBiPredicate() { - final AtomicInteger limiter = new AtomicInteger(); - - @Override public boolean apply(ClusterNode node, Message msg) { - if (msg instanceof GridDhtTxPrepareRequest) - return limiter.getAndIncrement() < 2; - - return false; - } - }); - - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(keys.get(0))); - - txA.commitAsync(); - - GridCacheVersion aXidVer = ((TransactionProxyImpl)txA).tx().xidVersion(); - - assertConditionEventually(() -> txsOnNode(victim, aXidVer).stream() - .anyMatch(tx -> tx.state() == PREPARING)); - - GridTestUtils.runAsync(() -> { - try (Transaction txB = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, 42)").setArgs(keys.get(1))); - - txB.commit(); - } - }).get(); - - long victimUpdCntr = updateCounter(victim.cachex(DEFAULT_CACHE_NAME).context(), keys.get(0)); - - List backupNodes = grids(srvCnt, i -> i != vid); - - List backupTxsA = backupNodes.stream() - .map(node -> txsOnNode(node, aXidVer)) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - - // drop primary - victim.close(); - - assertConditionEventually(() -> backupTxsA.stream().allMatch(tx -> tx.state() == ROLLED_BACK)); - - backupNodes.stream() - .map(node -> node.cache(DEFAULT_CACHE_NAME)) - .forEach(c -> { - assertEquals(1, c.query(new SqlFieldsQuery("select * from Integer")).getAll().size()); - }); - - backupNodes.forEach(node -> { - for (Integer k : keys) - assertEquals(victimUpdCntr, updateCounter(node.cachex(DEFAULT_CACHE_NAME).context(), k)); - }); - } - - /** */ - private static CacheConfiguration basicCcfg() { - return new CacheConfiguration<>(DEFAULT_CACHE_NAME) - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT) - .setCacheMode(PARTITIONED) - .setIndexedTypes(Integer.class, Integer.class); - } - - /** */ - private static List txsOnNode(IgniteEx node, GridCacheVersion xidVer) { - List txs = node.context().cache().context().tm().activeTransactions().stream() - .peek(tx -> assertEquals(xidVer, tx.nearXidVersion())) - .collect(Collectors.toList()); - - assert !txs.isEmpty(); - - return txs; - } - - /** */ - private static void assertConditionEventually(GridAbsPredicate p) - throws IgniteInterruptedCheckedException { - if (!GridTestUtils.waitForCondition(p, 5_000)) - fail(); - } - - /** */ - private List grids(int cnt, IntPredicate p) { - return IntStream.range(0, cnt).filter(p).mapToObj(this::grid).collect(Collectors.toList()); - } - - /** */ - private void assertPartitionCountersAreConsistent(Iterable keys, Iterable nodes) { - for (Integer key : keys) { - long cntr0 = -1; - - for (Ignite n : nodes) { - IgniteEx node = ((IgniteEx)n); - - if (node.affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(node.localNode(), key)) { - long cntr = updateCounter(node.cachex(DEFAULT_CACHE_NAME).context(), key); -// System.err.println(node.localNode().consistentId() + " " + key + " -> " + cntr); - if (cntr0 == -1) - cntr0 = cntr; - - assertEquals(cntr0, cntr); - } - } - } - } - - /** */ - private static long updateCounter(GridCacheContext cctx, Object key) { - return dataStore(cctx, key) - .map(IgniteCacheOffheapManager.CacheDataStore::updateCounter) - .get(); - } - - /** */ - private static Optional dataStore( - GridCacheContext cctx, Object key) { - int p = cctx.affinity().partition(key); - IgniteCacheOffheapManager offheap = cctx.offheap(); - return StreamSupport.stream(offheap.cacheDataStores().spliterator(), false) - .filter(ds -> ds.partId() == p) - .findFirst(); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccDeadlockDetectionConfigTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccDeadlockDetectionConfigTest.java deleted file mode 100644 index bf1eee6626f5a..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccDeadlockDetectionConfigTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.concurrent.CyclicBarrier; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.TransactionConfiguration; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException; -import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.transactions.Transaction; -import org.junit.After; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** */ -public class MvccDeadlockDetectionConfigTest extends GridCommonAbstractTest { - /** */ - private boolean deadlockDetectionEnabled; - - /** */ - @After - public void stopCluster() { - stopAllGrids(); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - int timeout = deadlockDetectionEnabled ? 1 : 0; - - return super.getConfiguration(igniteInstanceName) - .setTransactionConfiguration(new TransactionConfiguration().setDeadlockTimeout(timeout)); - } - - /** */ - @Test - public void deadlockDetectionDisabled() throws Exception { - deadlockDetectionEnabled = false; - - Ignite ign = startGrid(); - - IgniteCache cache = ign.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT)); - - CyclicBarrier b = new CyclicBarrier(2); - - int txTimeout = 3_000; - - IgniteInternalFuture futA = GridTestUtils.runAsync(() -> { - try (Transaction tx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, txTimeout, 0)) { - cache.put(1, 'a'); - b.await(); - cache.put(2, 'a'); - } - - return null; - }); - - IgniteInternalFuture futB = GridTestUtils.runAsync(() -> { - try (Transaction tx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, txTimeout, 0)) { - cache.put(2, 'b'); - b.await(); - cache.put(1, 'b'); - } - - return null; - }); - - IgniteCheckedException e = awaitCompletion(futA, futB); - - assertTrue(e.toString(), e.hasCause(IgniteTxTimeoutCheckedException.class)); - } - - /** */ - @Test - public void deadlockDetectionEnabled() throws Exception { - deadlockDetectionEnabled = true; - - Ignite ign = startGrid(); - - IgniteCache cache = ign.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT)); - - CyclicBarrier b = new CyclicBarrier(2); - - IgniteInternalFuture futA = GridTestUtils.runAsync(() -> { - try (Transaction tx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(1, 'a'); - b.await(); - cache.put(2, 'a'); - } - - return null; - }); - - IgniteInternalFuture futB = GridTestUtils.runAsync(() -> { - try (Transaction tx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(2, 'b'); - b.await(); - cache.put(1, 'b'); - } - - return null; - }); - - IgniteCheckedException e = awaitCompletion(futA, futB); - - assertTrue(e.toString(), X.hasCause(e, "Deadlock", IgniteTxRollbackCheckedException.class)); - } - - /** */ - private IgniteCheckedException awaitCompletion(IgniteInternalFuture fut1, IgniteInternalFuture fut2) { - IgniteCheckedException e = null; - - try { - fut1.get(10_000); - } - catch (IgniteCheckedException e1) { - e = e1; - } - - try { - fut2.get(10_000); - } - catch (IgniteCheckedException e1) { - e = e1; - } - - return e; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccDeadlockDetectionTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccDeadlockDetectionTest.java deleted file mode 100644 index cd7e65289659d..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccDeadlockDetectionTest.java +++ /dev/null @@ -1,632 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.TransactionConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.TestRecordingCommunicationSpi; -import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal; -import org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl; -import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.GridTestUtils.SF; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionRollbackException; -import org.junit.After; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; -import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; -import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; - -/** */ -public class MvccDeadlockDetectionTest extends GridCommonAbstractTest { - /** */ - private IgniteEx client; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - return super.getConfiguration(igniteInstanceName) - .setCommunicationSpi(new TestRecordingCommunicationSpi()) - .setTransactionConfiguration(new TransactionConfiguration().setDeadlockTimeout(1)); - } - - /** */ - private void setUpGrids(int n, boolean indexed) throws Exception { - Ignite ign = startGridsMultiThreaded(n); - - CacheConfiguration ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME) - .setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - - if (indexed) - ccfg.setIndexedTypes(Integer.class, Integer.class); - - ign.getOrCreateCache(ccfg); - - client = startClientGrid(n); - } - - /** - * @throws Exception If failed. - */ - @After - public void cleanupTest() throws Exception { - stopAllGrids(); - } - - /** - * @throws Exception If failed. - */ - @Test - public void detectSimpleDeadlock() throws Exception { - setUpGrids(2, false); - - Integer key0 = primaryKey(grid(0).cache(DEFAULT_CACHE_NAME)); - Integer key1 = primaryKey(grid(1).cache(DEFAULT_CACHE_NAME)); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - assert client.configuration().isClientMode(); - - CyclicBarrier b = new CyclicBarrier(2); - - IgniteInternalFuture fut0 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key0, 0); - b.await(); - cache.put(key1, 1); - - tx.commit(); - } - - return null; - }); - - IgniteInternalFuture fut1 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key1, 1); - b.await(); - cache.put(key0, 0); - - tx.commit(); - } - - return null; - }); - - assertExactlyOneAbortedDueDeadlock(fut0, fut1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void detectSimpleDeadlockFastUpdate() throws Exception { - setUpGrids(2, true); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - Integer key0 = primaryKey(grid(0).cache(DEFAULT_CACHE_NAME)); - Integer key1 = primaryKey(grid(1).cache(DEFAULT_CACHE_NAME)); - - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(key0, -1)); - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(key1, -1)); - - assert client.configuration().isClientMode(); - - CyclicBarrier b = new CyclicBarrier(2); - - IgniteInternalFuture fut0 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.query(new SqlFieldsQuery("update Integer set _val = 0 where _key = ?").setArgs(key0)); - b.await(); - cache.query(new SqlFieldsQuery("update Integer set _val = 0 where _key = ?").setArgs(key1)); - - tx.commit(); - } - - return null; - }); - - IgniteInternalFuture fut1 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.query(new SqlFieldsQuery("update Integer set _val = 1 where _key = ?").setArgs(key1)); - b.await(); - cache.query(new SqlFieldsQuery("update Integer set _val = 1 where _key = ?").setArgs(key0)); - - tx.commit(); - } - - return null; - }); - - assertExactlyOneAbortedDueDeadlock(fut0, fut1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void detect3Deadlock() throws Exception { - setUpGrids(3, false); - - Integer key0 = primaryKey(grid(0).cache(DEFAULT_CACHE_NAME)); - Integer key1 = primaryKey(grid(1).cache(DEFAULT_CACHE_NAME)); - Integer key2 = primaryKey(grid(2).cache(DEFAULT_CACHE_NAME)); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - assert client.configuration().isClientMode(); - - CyclicBarrier b = new CyclicBarrier(3); - - IgniteInternalFuture fut0 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key0, 0); - b.await(); - cache.put(key1, 1); - - tx.rollback(); - } - - return null; - }); - - IgniteInternalFuture fut1 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key1, 0); - b.await(); - cache.put(key2, 1); - - tx.rollback(); - } - - return null; - }); - - IgniteInternalFuture fut2 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(key2, 1); - b.await(); - cache.put(key0, 0); - - tx.rollback(); - } - - return null; - }); - - assertExactlyOneAbortedDueDeadlock(fut0, fut1, fut2); - } - - /** - * @throws Exception If failed. - */ - @Test - public void detectMultipleLockWaitDeadlock() throws Exception { - // T0 -> T1 - // \-> T2 -> T0 - setUpGrids(3, true); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - Integer key0 = primaryKey(grid(0).cache(DEFAULT_CACHE_NAME)); - Integer key1 = primaryKey(grid(1).cache(DEFAULT_CACHE_NAME)); - Integer key2 = primaryKey(grid(2).cache(DEFAULT_CACHE_NAME)); - - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(key0, -1)); - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(key1, -1)); - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(key2, -1)); - - CyclicBarrier b = new CyclicBarrier(3); - - IgniteInternalFuture fut2 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.query(new SqlFieldsQuery("update Integer set _val = 2 where _key = ?").setArgs(key2)); - b.await(); - cache.query(new SqlFieldsQuery("update Integer set _val = 2 where _key = ?").setArgs(key0)); - - // rollback to prevent waiting tx abort due write conflict - tx.rollback(); - } - - return null; - }); - - IgniteInternalFuture fut1 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.query(new SqlFieldsQuery("update Integer set _val = 1 where _key = ?").setArgs(key1)); - b.await(); - GridTestUtils.waitForCondition(fut2::isDone, 1000); - - // rollback to prevent waiting tx abort due write conflict - tx.rollback(); - } - - return null; - }); - - IgniteInternalFuture fut0 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.query(new SqlFieldsQuery("update Integer set _val = 0 where _key = ?").setArgs(key0)); - b.await(); - cache.query( - new SqlFieldsQuery("update Integer set _val = 0 where _key = ? or _key = ?").setArgs(key2, key1)); - - tx.commit(); - } - - return null; - }); - - fut1.get(10, TimeUnit.SECONDS); - - assertExactlyOneAbortedDueDeadlock(fut0, fut2); - } - - /** - * @throws Exception If failed. - */ - @Test - public void detectDeadlockLocalEntriesEnlistFuture() throws Exception { - setUpGrids(1, false); - - List keys = primaryKeys(grid(0).cache(DEFAULT_CACHE_NAME), 2); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - assert client.configuration().isClientMode(); - - CyclicBarrier b = new CyclicBarrier(2); - - IgniteInternalFuture fut0 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(keys.get(0), 11); - b.await(); - cache.put(keys.get(1), 11); - - tx.commit(); - } - - return null; - }); - - IgniteInternalFuture fut1 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.put(keys.get(1), 22); - b.await(); - cache.put(keys.get(0), 22); - - tx.commit(); - } - - return null; - }); - - assertExactlyOneAbortedDueDeadlock(fut0, fut1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void detectDeadlockLocalPrimary() throws Exception { - // Checks that case when near tx does local on enlist on the same node and no dht tx is created - - setUpGrids(2, false); - - IgniteCache cache0 = grid(0).cache(DEFAULT_CACHE_NAME); - IgniteCache cache1 = grid(1).cache(DEFAULT_CACHE_NAME); - - int key0 = primaryKey(cache0); - int key1 = primaryKey(cache1); - - CyclicBarrier b = new CyclicBarrier(2); - - IgniteInternalFuture fut0 = GridTestUtils.runAsync(() -> { - try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache0.put(key1, 11); - b.await(); - cache0.put(key0, 11); - - tx.commit(); - } - - return null; - }); - - IgniteInternalFuture fut1 = GridTestUtils.runAsync(() -> { - try (Transaction tx = grid(1).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache1.put(key0, 22); - b.await(); - cache1.put(key1, 22); - - tx.commit(); - } - - return null; - }); - - assertExactlyOneAbortedDueDeadlock(fut0, fut1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void detectDeadlockLocalQueryEnlistFuture() throws Exception { - setUpGrids(1, true); - - List keys = primaryKeys(grid(0).cache(DEFAULT_CACHE_NAME), 2); - - Collections.sort(keys); - - Integer key0 = keys.get(0), key1 = keys.get(1); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - assert client.configuration().isClientMode(); - - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(key0, -1)); - cache.query(new SqlFieldsQuery("insert into Integer(_key, _val) values(?, ?)").setArgs(key1, -1)); - - CyclicBarrier b = new CyclicBarrier(2); - - IgniteInternalFuture fut0 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.query(new SqlFieldsQuery("update Integer set _val = 0 where _key <= ?").setArgs(key0)); - b.await(); - cache.query(new SqlFieldsQuery("update Integer set _val = 0 where _key >= ?").setArgs(key1)); - TimeUnit.SECONDS.sleep(2); - - tx.commit(); - } - - return null; - }); - - IgniteInternalFuture fut1 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - cache.query(new SqlFieldsQuery("update Integer set _val = 1 where _key >= ?").setArgs(key1)); - b.await(); - cache.query(new SqlFieldsQuery("update Integer set _val = 1 where _key <= ?").setArgs(key0)); - - tx.commit(); - } - - return null; - }); - - assertExactlyOneAbortedDueDeadlock(fut0, fut1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void nonDeadlockedTxDetectsDeadlock1() throws Exception { - setUpGrids(2, false); - - Integer key0 = primaryKey(grid(0).cache(DEFAULT_CACHE_NAME)); - Integer key1 = primaryKey(grid(1).cache(DEFAULT_CACHE_NAME)); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - assert client.configuration().isClientMode(); - - CyclicBarrier b = new CyclicBarrier(3); - - IgniteInternalFuture fut0 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - blockProbe(grid(1), tx); - - cache.put(key0, 0); - b.await(); - cache.put(key1, 1); - - tx.rollback(); - } - - return null; - }); - - IgniteInternalFuture fut1 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - blockProbe(grid(0), tx); - - cache.put(key1, 1); - b.await(); - cache.put(key0, 0); - - tx.rollback(); - } - - return null; - }); - - b.await(); - tryPutRepeatedly(cache, key0); - - assertExactlyOneAbortedDueDeadlock(fut0, fut1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void nonDeadlockedTxDetectsDeadlock2() throws Exception { - setUpGrids(2, false); - - List keys0 = primaryKeys(grid(0).cache(DEFAULT_CACHE_NAME), 2); - Integer key00 = keys0.get(0); - Integer key01 = keys0.get(1); - Integer key1 = primaryKey(grid(1).cache(DEFAULT_CACHE_NAME)); - - IgniteCache cache = client.cache(DEFAULT_CACHE_NAME); - - assert client.configuration().isClientMode(); - - CyclicBarrier b = new CyclicBarrier(3); - - IgniteInternalFuture fut0 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - blockProbe(grid(1), tx); - - cache.put(key00, 0); - b.await(); - cache.put(key1, 1); - - tx.rollback(); - } - - return null; - }); - - IgniteInternalFuture fut1 = GridTestUtils.runAsync(() -> { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - blockProbe(grid(0), tx); - - cache.put(key1, 1); - cache.put(key01, 0); - b.await(); - cache.put(key00, 0); - - tx.rollback(); - } - - return null; - }); - - b.await(); - tryPutRepeatedly(cache, key01); - - assertExactlyOneAbortedDueDeadlock(fut0, fut1); - } - - /** - * @throws Exception If failed. - */ - @Test - public void randomizedPuts() throws Exception { - int gridCnt = SF.applyLB(10, 2); - int opsByWorker = SF.applyLB(1000, 10); - - setUpGrids(gridCnt, false); - - List keys = new ArrayList<>(); - for (int i = 0; i < gridCnt; i++) - keys.addAll(primaryKeys(grid(i).cache(DEFAULT_CACHE_NAME), 3)); - - AtomicInteger aborted = new AtomicInteger(); - - List> futs = new ArrayList<>(); - for (int i = 0; i < gridCnt * 2; i++) { - IgniteEx ign = grid(i % gridCnt); - IgniteCache cache = ign.cache(DEFAULT_CACHE_NAME); - - IgniteInternalFuture fut = GridTestUtils.runAsync(() -> { - for (int k = 0; k < opsByWorker; k++) { - try (Transaction tx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - ArrayList keys0 = new ArrayList<>(keys); - Collections.shuffle(keys0); - int nkeys = ThreadLocalRandom.current().nextInt(8) + 5; - for (int j = 0; j < nkeys; j++) - cache.put(keys0.get(j), j); - - tx.rollback(); - } - catch (Exception e) { - if (X.hasCause(e, IgniteTxRollbackCheckedException.class)) - aborted.incrementAndGet(); - } - } - }); - futs.add(fut); - } - - for (IgniteInternalFuture fut : futs) - fut.get(10, TimeUnit.MINUTES); - - log.info("Number of txs aborted: " + aborted); - } - - /** */ - private static void blockProbe(IgniteEx ign, Transaction tx) { - ((TestRecordingCommunicationSpi)ign.configuration().getCommunicationSpi()) - .blockMessages((node, msg) -> { - if (msg instanceof DeadlockProbe) { - DeadlockProbe msg0 = (DeadlockProbe)msg; - GridNearTxLocal tx0 = ((TransactionProxyImpl)tx).tx(); - return msg0.initiatorVersion().equals(tx0.xidVersion()); - } - - return false; - }); - } - - /** */ - private void assertExactlyOneAbortedDueDeadlock(IgniteInternalFuture... futs) throws IgniteCheckedException { - assert futs.length > 0; - - int aborted = 0; - - for (IgniteInternalFuture fut : futs) { - try { - fut.get(10, TimeUnit.SECONDS); - } - catch (IgniteCheckedException e) { - if (X.hasCause(e, TransactionRollbackException.class)) - aborted++; - else - throw e; - } - } - - if (aborted != 1) - fail("Exactly one tx is expected to be aborted, but was " + aborted); - } - - /** */ - private void tryPutRepeatedly(IgniteCache cache, Integer key0) { - for (int i = 0; i < 100; i++) { - try (Transaction tx = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, 200, 1)) { - cache.put(key0, 33); - - break; - } - catch (Exception ignored) { - } - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccRepeatableReadBulkOpsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccRepeatableReadBulkOpsTest.java deleted file mode 100644 index 8b97df141d7cd..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccRepeatableReadBulkOpsTest.java +++ /dev/null @@ -1,642 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.cache.processor.EntryProcessorException; -import javax.cache.processor.EntryProcessorResult; -import javax.cache.processor.MutableEntry; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.cache.CacheEntryProcessor; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Test; - -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.GET; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.INVOKE; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.DML; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.WriteMode.PUT; - -/** - * Test basic mvcc bulk cache operations. - */ -public class MvccRepeatableReadBulkOpsTest extends CacheMvccAbstractTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - /** */ - private int nodesCount() { - return 4; - } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - cleanPersistenceDir(); - - startGridsMultiThreaded(nodesCount() - 1); - - client = true; - - startGrid(nodesCount() - 1); - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - stopAllGrids(); - - cleanPersistenceDir(); - - super.afterTestsStopped(); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - grid(0).createCache(cacheConfiguration(cacheMode(), FULL_SYNC, 1, 32). - setIndexedTypes(Integer.class, MvccTestAccount.class)); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - grid(0).destroyCache(DEFAULT_CACHE_NAME); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableReadIsolationGetPut() throws Exception { - checkOperations(GET, GET, PUT, true); - checkOperations(GET, GET, PUT, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableReadIsolationInvoke() throws Exception { - checkOperations(GET, GET, WriteMode.INVOKE, true); - checkOperations(GET, GET, WriteMode.INVOKE, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableReadIsolationSqlPut() throws Exception { - checkOperations(SQL, SQL, PUT, true); - checkOperations(SQL, SQL, PUT, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableReadIsolationSqlInvoke() throws Exception { - checkOperations(SQL, SQL, WriteMode.INVOKE, true); - checkOperations(SQL, SQL, WriteMode.INVOKE, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableReadIsolationSqlDml() throws Exception { - checkOperations(SQL, SQL, DML, true); - checkOperations(SQL, SQL, DML, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableReadIsolationGetDml() throws Exception { - checkOperations(GET, GET, DML, true); - checkOperations(GET, GET, DML, false); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableReadIsolationMixedPut() throws Exception { - checkOperations(SQL, GET, PUT, false); - checkOperations(SQL, GET, PUT, true); - checkOperations(SQL, GET, WriteMode.INVOKE, false); - checkOperations(SQL, GET, WriteMode.INVOKE, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableReadIsolationMixedPut2() throws Exception { - checkOperations(GET, SQL, PUT, false); - checkOperations(GET, SQL, PUT, true); - checkOperations(GET, SQL, WriteMode.INVOKE, false); - checkOperations(GET, SQL, WriteMode.INVOKE, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableReadIsolationMixedDml() throws Exception { - checkOperations(SQL, GET, DML, false); - checkOperations(SQL, GET, DML, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testRepeatableReadIsolationMixedDml2() throws Exception { - checkOperations(GET, SQL, DML, false); - checkOperations(GET, SQL, DML, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testOperationConsistency() throws Exception { - checkOperationsConsistency(PUT, false); - checkOperationsConsistency(DML, false); - checkOperationsConsistency(WriteMode.INVOKE, false); - checkOperationsConsistency(PUT, true); - checkOperationsConsistency(DML, true); - checkOperationsConsistency(WriteMode.INVOKE, true); - } - - /** - * @throws Exception If failed. - */ - @Test - public void testInvokeConsistency() throws Exception { - Ignite node = grid(/*requestFromClient ? nodesCount() - 1 :*/ 0); - - TestCache cache = new TestCache<>(node.cache(DEFAULT_CACHE_NAME)); - - final Set keys1 = new HashSet<>(3); - final Set keys2 = new HashSet<>(3); - - Set allKeys = generateKeySet(cache.cache, keys1, keys2); - - final Map map1 = keys1.stream().collect( - Collectors.toMap(k -> k, k -> new MvccTestAccount(k, 1))); - - final Map map2 = keys2.stream().collect( - Collectors.toMap(k -> k, k -> new MvccTestAccount(k, 1))); - - assertEquals(0, cache.cache.size()); - - updateEntries(cache, map1, WriteMode.INVOKE); - assertEquals(3, cache.cache.size()); - - updateEntries(cache, map1, WriteMode.INVOKE); - assertEquals(3, cache.cache.size()); - - getEntries(cache, allKeys, INVOKE); - assertEquals(3, cache.cache.size()); - - updateEntries(cache, map2, WriteMode.INVOKE); - assertEquals(6, cache.cache.size()); - - getEntries(cache, keys2, INVOKE); - assertEquals(6, cache.cache.size()); - - removeEntries(cache, keys1, WriteMode.INVOKE); - assertEquals(3, cache.cache.size()); - - removeEntries(cache, keys1, WriteMode.INVOKE); - assertEquals(3, cache.cache.size()); - - getEntries(cache, allKeys, INVOKE); - assertEquals(3, cache.cache.size()); - - updateEntries(cache, map1, WriteMode.INVOKE); - assertEquals(6, cache.cache.size()); - - removeEntries(cache, allKeys, WriteMode.INVOKE); - assertEquals(0, cache.cache.size()); - - getEntries(cache, allKeys, INVOKE); - assertEquals(0, cache.cache.size()); - } - - /** - * Checks SQL and CacheAPI operation isolation consistency. - * - * @param readModeBefore read mode used before value updated. - * @param readModeAfter read mode used after value updated. - * @param writeMode write mode used for update. - * @throws Exception If failed. - */ - private void checkOperations(ReadMode readModeBefore, ReadMode readModeAfter, - WriteMode writeMode, boolean readFromClient) throws Exception { - Ignite node1 = grid(readFromClient ? nodesCount() - 1 : 0); - Ignite node2 = grid(readFromClient ? 0 : nodesCount() - 1); - - TestCache cache1 = new TestCache<>(node1.cache(DEFAULT_CACHE_NAME)); - TestCache cache2 = new TestCache<>(node2.cache(DEFAULT_CACHE_NAME)); - - final Set keysForUpdate = new HashSet<>(3); - final Set keysForRemove = new HashSet<>(3); - - final Set allKeys = generateKeySet(grid(0).cache(DEFAULT_CACHE_NAME), keysForUpdate, keysForRemove); - - final Map initialMap = allKeys.stream().collect( - Collectors.toMap(k -> k, k -> new MvccTestAccount(k, 1))); - - final Map updateMap = keysForUpdate.stream().collect(Collectors.toMap(Function.identity(), - k -> new MvccTestAccount(k, 2))); /* Removed keys are excluded. */ - - cache1.cache.putAll(initialMap); - - IgniteTransactions txs1 = node1.transactions(); - IgniteTransactions txs2 = node2.transactions(); - - CountDownLatch updateStart = new CountDownLatch(1); - CountDownLatch updateFinish = new CountDownLatch(1); - - // Start concurrent transactions and check isolation. - IgniteInternalFuture updater = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - updateStart.await(); - - assertEquals(initialMap.size(), cache2.cache.size()); - - try (Transaction tx = txs2.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { - tx.timeout(TX_TIMEOUT); - - updateEntries(cache2, updateMap, writeMode); - removeEntries(cache2, keysForRemove, writeMode); - - assertEquals(updateMap, cache2.cache.getAll(allKeys)); - - tx.commit(); - } - finally { - updateFinish.countDown(); - } - - assertEquals(updateMap.size(), cache2.cache.size()); - - return null; - } - }); - - IgniteInternalFuture reader = GridTestUtils.runAsync(new Callable() { - @Override public Void call() throws Exception { - try (Transaction tx = txs1.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { - assertEquals(initialMap, getEntries(cache1, allKeys, readModeBefore)); - - checkContains(cache1, true, allKeys); - - updateStart.countDown(); - updateFinish.await(); - - assertEquals(initialMap, getEntries(cache1, allKeys, readModeAfter)); - - checkContains(cache1, true, allKeys); - - tx.commit(); - } - - return null; - } - }); - - try { - updater.get(3_000, TimeUnit.MILLISECONDS); - reader.get(3_000, TimeUnit.MILLISECONDS); - } - catch (Throwable e) { - throw new AssertionError(e); - } - finally { - updateStart.countDown(); - updateFinish.countDown(); - } - - assertEquals(updateMap, cache1.cache.getAll(allKeys)); - } - - /** - * Generate 2 sets of keys. Each set contains primary, backup and non-affinity key for given node cache. - * - * @param cache Cache. - * @param keySet1 Key set. - * @param keySet2 Key set. - * @return All keys. - * @throws IgniteCheckedException If failed. - */ - protected Set generateKeySet(IgniteCache cache, Set keySet1, - Set keySet2) throws IgniteCheckedException { - LinkedHashSet allKeys = new LinkedHashSet<>(); - - allKeys.addAll(primaryKeys(cache, 2)); - allKeys.addAll(backupKeys(cache, 2, 1)); - allKeys.addAll(nearKeys(cache, 2, 1)); - - List keys0 = new ArrayList<>(allKeys); - - for (int i = 0; i < 6; i++) { - if (i % 2 == 0) - keySet1.add(keys0.get(i)); - else - keySet2.add(keys0.get(i)); - } - - assert allKeys.size() == 6; // Expects no duplicates. - - return allKeys; - } - - /** - * Checks SQL and CacheAPI operation see consistent results before and after update. - * - * @throws Exception If failed. - */ - private void checkOperationsConsistency(WriteMode writeMode, boolean requestFromClient) throws Exception { - Ignite node = grid(requestFromClient ? nodesCount() - 1 : 0); - - TestCache cache = new TestCache<>(node.cache(DEFAULT_CACHE_NAME)); - - final Set keysForUpdate = new HashSet<>(3); - final Set keysForRemove = new HashSet<>(3); - - final Set allKeys = generateKeySet(grid(0).cache(DEFAULT_CACHE_NAME), keysForUpdate, keysForRemove); - - try { - int updCnt = 1; - - final Map initialVals = allKeys.stream().collect( - Collectors.toMap(k -> k, k -> new MvccTestAccount(k, 1))); - - updateEntries(cache, initialVals, writeMode); - - assertEquals(initialVals.size(), cache.cache.size()); - - IgniteTransactions txs = node.transactions(); - - Map updatedVals = null; - - try (Transaction tx = txs.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { - Map vals1 = getEntries(cache, allKeys, GET); - Map vals2 = getEntries(cache, allKeys, SQL); - Map vals3 = getEntries(cache, allKeys, ReadMode.INVOKE); - - assertEquals(initialVals, vals1); - assertEquals(initialVals, vals2); - assertEquals(initialVals, vals3); - - assertEquals(initialVals.size(), cache.cache.size()); - - for (ReadMode readMode : new ReadMode[] {GET, SQL, INVOKE}) { - int updCnt0 = ++updCnt; - - updatedVals = allKeys.stream().collect(Collectors.toMap(Function.identity(), - k -> new MvccTestAccount(k, updCnt0))); - - updateEntries(cache, updatedVals, writeMode); - assertEquals(allKeys.size(), cache.cache.size()); - - removeEntries(cache, keysForRemove, writeMode); - - for (Integer key : keysForRemove) - updatedVals.remove(key); - - assertEquals(String.valueOf(readMode), updatedVals, getEntries(cache, allKeys, readMode)); - } - - tx.commit(); - } - - try (Transaction tx = txs.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { - assertEquals(updatedVals, getEntries(cache, allKeys, GET)); - assertEquals(updatedVals, getEntries(cache, allKeys, SQL)); - assertEquals(updatedVals, getEntries(cache, allKeys, INVOKE)); - - tx.commit(); - } - - assertEquals(updatedVals.size(), cache.cache.size()); - } - finally { - cache.cache.removeAll(keysForUpdate); - } - - assertEquals(0, cache.cache.size()); - } - - /** - * Gets values with given read mode. - * - * @param cache Cache. - * @param keys Key to be read. - * @param readMode Read mode. - * @return Key-value result map. - */ - protected Map getEntries( - TestCache cache, - Set keys, - ReadMode readMode) { - switch (readMode) { - case GET: - return cache.cache.getAll(keys); - case SQL: - return getAllSql(cache); - case INVOKE: { - Map res = new HashMap<>(); - - CacheEntryProcessor ep = new GetEntryProcessor<>(); - - Map> invokeRes = cache.cache.invokeAll(keys, ep); - - for (Map.Entry> e : invokeRes.entrySet()) - res.put(e.getKey(), e.getValue().get()); - - return res; - } - default: - fail(); - } - - return null; - } - - /** - * Updates entries with given write mode. - * - * @param cache Cache. - * @param entries Entries to be updated. - * @param writeMode Write mode. - */ - protected void updateEntries( - TestCache cache, - Map entries, - WriteMode writeMode) { - switch (writeMode) { - case PUT: { - cache.cache.putAll(entries); - - break; - } - case DML: { - for (Map.Entry e : entries.entrySet()) - mergeSql(cache, e.getKey(), e.getValue().val, e.getValue().updateCnt); - - break; - } - case INVOKE: { - CacheEntryProcessor ep = - new GetAndPutEntryProcessor() { - /** {@inheritDoc} */ - @Override MvccTestAccount newValForKey(Integer key) { - return entries.get(key); - } - }; - - cache.cache.invokeAll(entries.keySet(), ep); - - break; - } - default: - fail(); - } - } - - /** - * Updates entries with given write mode. - * - * @param cache Cache. - * @param keys Key to be deleted. - * @param writeMode Write mode. - */ - protected void removeEntries( - TestCache cache, - Set keys, - WriteMode writeMode) { - switch (writeMode) { - case PUT: { - cache.cache.removeAll(keys); - - break; - } - case DML: { - for (Integer key : keys) - removeSql(cache, key); - - break; - } - case INVOKE: { - CacheEntryProcessor ep = new RemoveEntryProcessor<>(); - - cache.cache.invokeAll(keys, ep); - - break; - } - default: - fail(); - } - } - - /** - * Check cache contains entries. - * - * @param cache Cache. - * @param expected Expected result. - * @param keys Keys to check. - */ - protected void checkContains(TestCache cache, boolean expected, Set keys) { - assertEquals(expected, cache.cache.containsKeys(keys)); - } - - /** - * Applies get operation. - */ - static class GetEntryProcessor implements CacheEntryProcessor { - /** {@inheritDoc} */ - @Override public V process(MutableEntry entry, - Object... arguments) throws EntryProcessorException { - return entry.getValue(); - } - } - - /** - * Applies remove operation. - */ - static class RemoveEntryProcessor implements CacheEntryProcessor { - /** {@inheritDoc} */ - @Override public R process(MutableEntry entry, - Object... arguments) throws EntryProcessorException { - entry.remove(); - - return null; - } - } - - /** - * Applies get and put operation. - */ - static class GetAndPutEntryProcessor implements CacheEntryProcessor { - /** {@inheritDoc} */ - @Override public V process(MutableEntry entry, - Object... args) throws EntryProcessorException { - V newVal = !F.isEmpty(args) ? (V)args[0] : newValForKey(entry.getKey()); - - V oldVal = entry.getValue(); - entry.setValue(newVal); - - return oldVal; - } - - /** - * @param key Key. - * @return New value. - */ - V newValForKey(K key) { - throw new UnsupportedOperationException(); - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccRepeatableReadOperationsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccRepeatableReadOperationsTest.java deleted file mode 100644 index 2154838540f0c..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/MvccRepeatableReadOperationsTest.java +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.mvcc; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteTransactions; -import org.apache.ignite.cache.CacheEntryProcessor; -import org.apache.ignite.transactions.Transaction; -import org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; -import org.junit.Test; - -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.GET; -import static org.apache.ignite.internal.processors.cache.mvcc.CacheMvccAbstractTest.ReadMode.SQL; - -/** - * Test basic mvcc cache operation operations. - */ -public class MvccRepeatableReadOperationsTest extends MvccRepeatableReadBulkOpsTest { - /** {@inheritDoc} */ - @Override protected Map getEntries( - TestCache cache, - Set keys, - ReadMode readMode) { - - switch (readMode) { - case GET: { - Map res = new HashMap<>(); - - for (Integer key : keys) { - MvccTestAccount val = cache.cache.get(key); - - if (val != null) - res.put(key, val); - } - - return res; - } - - case SQL: - return getAllSql(cache); - - case INVOKE: { - Map res = new HashMap<>(); - - CacheEntryProcessor ep = new GetEntryProcessor(); - - for (Integer key : keys) { - MvccTestAccount val = cache.cache.invoke(key, ep); - - if (val != null) - res.put(key, val); - } - - return res; - } - default: - fail(); - } - - return null; - } - - /** {@inheritDoc} */ - @Override protected void updateEntries( - TestCache cache, - Map entries, - WriteMode writeMode) { - switch (writeMode) { - case PUT: { - for (Map.Entry e : entries.entrySet()) - if (e.getValue() == null) - cache.cache.remove(e.getKey()); - else - cache.cache.put(e.getKey(), e.getValue()); - - break; - } - - case DML: { - for (Map.Entry e : entries.entrySet()) { - if (e.getValue() == null) - removeSql(cache, e.getKey()); - else - mergeSql(cache, e.getKey(), e.getValue().val, e.getValue().updateCnt); - } - break; - } - - case INVOKE: { - GetAndPutEntryProcessor ep = new GetAndPutEntryProcessor<>(); - - for (final Map.Entry e : entries.entrySet()) - cache.cache.invoke(e.getKey(), ep, e.getValue()); - - break; - } - - default: - fail(); - } - } - - /** {@inheritDoc} */ - @Override protected void removeEntries( - TestCache cache, - Set keys, - WriteMode writeMode) { - switch (writeMode) { - case PUT: { - for (Integer key : keys) - cache.cache.remove(key); - - break; - } - case DML: { - for (Integer key : keys) - removeSql(cache, key); - - break; - } - case INVOKE: { - CacheEntryProcessor ep = new RemoveEntryProcessor<>(); - - for (Integer key : keys) - cache.cache.invoke(key, ep); - - break; - } - default: - fail(); - } - } - - /** {@inheritDoc} */ - @Override protected void checkContains(TestCache cache, boolean expected, - Set keys) { - for (Integer key : keys) - assertEquals(expected, cache.cache.containsKey(key)); - } - - /** - * Check getAndPut/getAndRemove operations consistency. - * - * @throws IgniteCheckedException If failed. - */ - @Test - public void testGetAndUpdateOperations() throws IgniteCheckedException { - Ignite node1 = grid(0); - - TestCache cache1 = new TestCache<>(node1.cache(DEFAULT_CACHE_NAME)); - - final Set keysForUpdate = new HashSet<>(3); - final Set keysForRemove = new HashSet<>(3); - - final Set allKeys = generateKeySet(grid(0).cache(DEFAULT_CACHE_NAME), keysForUpdate, keysForRemove); - - final Map initialMap = keysForRemove.stream().collect( - Collectors.toMap(k -> k, k -> new MvccTestAccount(k, 1))); - - Map updateMap = keysForUpdate.stream().collect( - Collectors.toMap(k -> k, k -> new MvccTestAccount(k, 3))); - - cache1.cache.putAll(initialMap); - - IgniteTransactions txs = node1.transactions(); - try (Transaction tx = txs.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { - for (Integer key : keysForUpdate) { - MvccTestAccount newVal1 = new MvccTestAccount(key, 1); - - assertNull(cache1.cache.getAndPut(key, newVal1)); // Check create. - - MvccTestAccount newVal2 = new MvccTestAccount(key, 2); - - assertEquals(newVal1, cache1.cache.getAndPut(key, newVal2)); // Check update. - } - - for (Integer key : keysForRemove) { - assertEquals(initialMap.get(key), cache1.cache.getAndRemove(key)); // Check remove existed. - - assertNull(cache1.cache.getAndRemove(key)); // Check remove non-existed. - } - - for (Integer key : allKeys) { - MvccTestAccount oldVal = new MvccTestAccount(key, 2); - MvccTestAccount newVal = new MvccTestAccount(key, 3); - - if (keysForRemove.contains(key)) - assertNull(cache1.cache.getAndReplace(key, newVal)); // Omit update 'null'. - else - assertEquals(oldVal, cache1.cache.getAndReplace(key, newVal)); // Check updated. - } - - assertEquals(updateMap, getEntries(cache1, allKeys, SQL)); - assertEquals(updateMap, getEntries(cache1, allKeys, GET)); - - tx.commit(); - } - - assertEquals(updateMap, getEntries(cache1, allKeys, SQL)); - assertEquals(updateMap, getEntries(cache1, allKeys, GET)); - } - - /** - * Check getAndPut/getAndRemove operations consistency. - * - * @throws IgniteCheckedException If failed. - */ - @Test - public void testPutIfAbsentConsistency() throws IgniteCheckedException { - Ignite node1 = grid(0); - - TestCache cache1 = new TestCache<>(node1.cache(DEFAULT_CACHE_NAME)); - - final Set keysForCreate = new HashSet<>(3); - final Set keysForUpdate = new HashSet<>(3); - - final Set allKeys = generateKeySet(grid(0).cache(DEFAULT_CACHE_NAME), keysForCreate, keysForUpdate); - - final Map initialMap = keysForUpdate.stream().collect( - Collectors.toMap(k -> k, k -> new MvccTestAccount(k, 1))); - - Map updatedMap = allKeys.stream().collect( - Collectors.toMap(k -> k, k -> new MvccTestAccount(k, 1))); - - cache1.cache.putAll(initialMap); - - IgniteTransactions txs = node1.transactions(); - try (Transaction tx = txs.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { - for (Integer key : keysForUpdate) - assertFalse(cache1.cache.putIfAbsent(key, new MvccTestAccount(key, 2))); // Check update. - - for (Integer key : keysForCreate) - assertTrue(cache1.cache.putIfAbsent(key, new MvccTestAccount(key, 1))); // Check create. - - assertEquals(updatedMap, getEntries(cache1, allKeys, SQL)); - - tx.commit(); - } - - assertEquals(updatedMap, getEntries(cache1, allKeys, SQL)); - assertEquals(updatedMap, getEntries(cache1, allKeys, GET)); - } - - /** - * Check getAndPut/getAndRemove operations consistency. - * - * @throws IgniteCheckedException If failed. - */ - @Test - public void testReplaceConsistency() throws IgniteCheckedException { - Ignite node1 = grid(0); - - TestCache cache1 = new TestCache<>(node1.cache(DEFAULT_CACHE_NAME)); - - final Set existedKeys = new HashSet<>(3); - final Set nonExistedKeys = new HashSet<>(3); - - final Set allKeys = generateKeySet(grid(0).cache(DEFAULT_CACHE_NAME), existedKeys, nonExistedKeys); - - final Map initialMap = existedKeys.stream().collect( - Collectors.toMap(k -> k, k -> new MvccTestAccount(k, 1))); - - Map updateMap = existedKeys.stream().collect( - Collectors.toMap(k -> k, k -> new MvccTestAccount(k, 3))); - - cache1.cache.putAll(initialMap); - - IgniteTransactions txs = node1.transactions(); - try (Transaction tx = txs.txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) { - for (Integer key : allKeys) { - MvccTestAccount newVal = new MvccTestAccount(key, 2); - - if (existedKeys.contains(key)) { - assertTrue(cache1.cache.replace(key, new MvccTestAccount(key, 1), newVal)); - - assertEquals(newVal, cache1.cache.getAndReplace(key, new MvccTestAccount(key, 3))); - } - else { - assertFalse(cache1.cache.replace(key, new MvccTestAccount(key, 1), newVal)); - - assertNull(cache1.cache.getAndReplace(key, new MvccTestAccount(key, 3))); - } - } - - assertEquals(updateMap, getEntries(cache1, allKeys, SQL)); - assertEquals(updateMap, getEntries(cache1, allKeys, GET)); - - tx.commit(); - } - - assertEquals(updateMap, getEntries(cache1, allKeys, SQL)); - assertEquals(updateMap, getEntries(cache1, allKeys, GET)); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsIndexingDefragmentationTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsIndexingDefragmentationTest.java index 18f8cb148118a..d90c87d834e67 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsIndexingDefragmentationTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsIndexingDefragmentationTest.java @@ -45,21 +45,16 @@ import org.apache.ignite.internal.processors.query.schema.IndexRebuildCancelToken; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.junits.WithSystemProperty; import org.jetbrains.annotations.Nullable; import org.junit.Test; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR; /** * Defragmentation tests with enabled ignite-indexing. */ public class IgnitePdsIndexingDefragmentationTest extends IgnitePdsDefragmentationTest { - /** Use MVCC in tests. */ - private static final String USE_MVCC = "USE_MVCC"; - /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); @@ -96,12 +91,7 @@ public class IgnitePdsIndexingDefragmentationTest extends IgnitePdsDefragmentati ) .setAffinity(new RendezvousAffinityFunction(false, PARTS)); - if (Boolean.TRUE.toString().equals(System.getProperty(USE_MVCC))) { - cache1Cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - cache2Cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - } - else - cache2Cfg.setExpiryPolicyFactory(new PolicyFactory()); + cache2Cfg.setExpiryPolicyFactory(new PolicyFactory()); cfg.setCacheConfiguration(cache1Cfg, cache2Cfg); @@ -221,28 +211,6 @@ public void testIndexingWithComplexKey() throws Exception { test(integer -> new IgniteCacheUpdateSqlQuerySelfTest.AllTypes((long)integer)); } - /** - * Test using integer keys. - * - * @throws Exception If failed. - */ - @Test - @WithSystemProperty(key = USE_MVCC, value = "true") - public void testIndexingWithIntegerKeyAndMVCC() throws Exception { - test(Function.identity()); - } - - /** - * Test using complex keys (integer and string). - * - * @throws Exception If failed. - */ - @Test - @WithSystemProperty(key = USE_MVCC, value = "true") - public void testIndexingWithComplexKeyAndMVCC() throws Exception { - test(integer -> new IgniteCacheUpdateSqlQuerySelfTest.AllTypes((long)integer)); - } - /** * @throws Exception If failed. */ diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlReadOnlyModeSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlReadOnlyModeSelfTest.java index 257e3dd0bd894..d1a66278536d3 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlReadOnlyModeSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlReadOnlyModeSelfTest.java @@ -25,7 +25,6 @@ import javax.cache.expiry.AccessedExpiryPolicy; import javax.cache.expiry.Duration; import org.apache.ignite.Ignite; -import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; @@ -108,11 +107,6 @@ private static CacheConfiguration[] getCacheConfigurations() { List newCfgs = new ArrayList<>(cfgs.length); for (CacheConfiguration cfg : cfgs) { - if (cfg.getAtomicityMode() == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) { - // Expiry policy cannot be used with TRANSACTIONAL_SNAPSHOT. - continue; - } - cfg.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(new Duration(SECONDS, EXPIRATION_TIMEOUT))); cfg.setEagerTtl(true); diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/RebuildIndexWithMVCCTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/RebuildIndexWithMVCCTest.java deleted file mode 100644 index f5c2440acd98c..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/RebuildIndexWithMVCCTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.database; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; - -/** - * Test index rebuild with MVCC enabled. - */ -public class RebuildIndexWithMVCCTest extends RebuildIndexTest { - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - final IgniteConfiguration configuration = super.getConfiguration(gridName); - - for (CacheConfiguration cacheConfiguration : configuration.getCacheConfiguration()) - cacheConfiguration.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); - - return configuration; - } - -} 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 023ae6d4838ea..a648c312f53a5 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 static Collection parameters() { Object[] paramTemplate = new Object[2]; - for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) { + for (CacheAtomicityMode atomicityMode : CacheAtomicityMode._values()) { paramTemplate = Arrays.copyOf(paramTemplate, paramTemplate.length); paramTemplate[0] = atomicityMode; @@ -185,7 +185,7 @@ public void testUpdateNotLazy() throws Exception { /** */ public void checkUpdateNotLazy(String sql) throws Exception { - try (AutoCloseable checker = CheckLazyIndexing.checkLazy(atomicityMode == CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT)) { + try (AutoCloseable checker = CheckLazyIndexing.checkLazy(false)) { List> res = sql(sql).getAll(); // Check that all rows updates only ones. 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 8a02f14c7feb1..4b2192b4bd1e5 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 @@ -49,9 +49,7 @@ import org.junit.runners.Parameterized; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause; -import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; /** */ @RunWith(Parameterized.class) @@ -89,10 +87,7 @@ public static Collection parameters() { Collection params = new ArrayList<>(); - for (CacheAtomicityMode cacheMode : CacheAtomicityMode.values()) { - if (cacheMode == TRANSACTIONAL_SNAPSHOT) - continue; - + 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}); @@ -152,10 +147,7 @@ public void testPutFromThinClientTx() throws Exception { withThinClient((cli, cache) -> { for (TransactionConcurrency conc : TransactionConcurrency.values()) { - for (TransactionIsolation iso: TransactionIsolation.values()) { - if (conc == OPTIMISTIC && mode == TRANSACTIONAL_SNAPSHOT) - continue; - + for (TransactionIsolation iso : TransactionIsolation.values()) { assertThrowsWithCause(() -> { try (ClientTransaction tx = cli.transactions().txStart(conc, iso)) { cache.put(1, val.get()); @@ -179,16 +171,13 @@ public void testPutTx() throws Exception { withNode((ign, cache) -> { for (TransactionConcurrency conc : TransactionConcurrency.values()) { for (TransactionIsolation iso : TransactionIsolation.values()) { - if (conc == OPTIMISTIC && mode == TRANSACTIONAL_SNAPSHOT) - continue; - assertThrowsWithCause(() -> { try (Transaction tx = ign.transactions().txStart(conc, iso)) { cache.put(1, val.get()); tx.commit(); } - }, mode == TRANSACTIONAL_SNAPSHOT ? CacheException.class : IgniteSQLException.class); + }, IgniteSQLException.class); assertNull(cache.withKeepBinary().get(1)); } diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildWithMvccEnabledSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildWithMvccEnabledSelfTest.java deleted file mode 100644 index 0eb7b29b20dbf..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildWithMvccEnabledSelfTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.query.h2; - -import java.io.File; -import java.util.List; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.internal.processors.cache.CacheObject; -import org.apache.ignite.internal.processors.cache.CacheObjectContext; -import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager; -import org.apache.ignite.internal.processors.cache.IgniteInternalCache; -import org.apache.ignite.internal.processors.cache.mvcc.MvccVersion; -import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; -import org.apache.ignite.internal.util.lang.GridCursor; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteBiTuple; -import org.junit.Test; - -/** - * Index rebuild after node restart test. - */ -public class GridIndexRebuildWithMvccEnabledSelfTest extends GridIndexRebuildSelfTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration serverConfiguration(int idx, boolean filter) throws Exception { - return super.serverConfiguration(idx, filter) - .setMvccVacuumFrequency(Integer.MAX_VALUE); - } - - /** {@inheritDoc} */ - @Test - @Override public void testIndexRebuild() throws Exception { - IgniteEx srv = startServer(); - - execute(srv, "CREATE TABLE T(k int primary key, v int) WITH \"cache_name=T,wrap_value=false," + - "atomicity=transactional_snapshot\""); - - execute(srv, "CREATE INDEX IDX ON T(v)"); - - IgniteInternalCache cc = srv.cachex(CACHE_NAME); - - assertNotNull(cc); - - lockVersion(srv); - - putData(srv, false); - - checkDataState(srv, false); - - File idxPath = indexFile(cc); - - stopAllGrids(); - - assertTrue(U.delete(idxPath)); - - srv = startServer(); - - putData(srv, true); - - checkDataState(srv, true); - } - - /** - * Lock coordinator version in order to keep MVCC versions in place. - * - * @param node Node. - * @throws IgniteCheckedException if failed. - */ - private static void lockVersion(IgniteEx node) throws IgniteCheckedException { - node.context().coordinators().requestReadSnapshotAsync().get(); - } - - /** {@inheritDoc} */ - @Override protected void checkDataState(IgniteEx srv, boolean afterRebuild) throws IgniteCheckedException { - IgniteInternalCache icache = srv.cachex(CACHE_NAME); - - assertNotNull(icache); - - CacheObjectContext coCtx = icache.context().cacheObjectContext(); - - for (IgniteCacheOffheapManager.CacheDataStore store : icache.context().offheap().cacheDataStores()) { - GridCursor cur = store.cursor(); - - while (cur.next()) { - CacheDataRow row = cur.get(); - - int key = row.key().value(coCtx, false); - - List> vers = store.mvccFindAllVersions(icache.context(), row.key()); - - if (!afterRebuild || key <= AMOUNT / 2) - assertEquals(key, vers.size()); - else { - // For keys affected by concurrent put there are two versions - - // -1 (concurrent put mark) and newest restored value as long as put cleans obsolete versions. - assertEquals(2, vers.size()); - - Object val0 = ((CacheObject)vers.get(0).getKey()).value(coCtx, false); - Object val1 = ((CacheObject)vers.get(1).getKey()).value(coCtx, false); - - assertEquals(-1, val0); - assertEquals(key, val1); - } - - } - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/QueryDataPageScanTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/QueryDataPageScanTest.java index 0ef1b08aec308..9abf9dcb366f6 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/QueryDataPageScanTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/QueryDataPageScanTest.java @@ -56,9 +56,9 @@ import org.apache.ignite.internal.processors.query.GridQueryProcessor; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgniteBiPredicate; -import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; +import org.apache.ignite.transactions.TransactionSerializationException; import org.jetbrains.annotations.Nullable; import org.junit.Ignore; import org.junit.Test; @@ -169,18 +169,9 @@ public void testMultipleIndexedTypes() throws Exception { */ @Test @Ignore("https://issues.apache.org/jira/browse/IGNITE-11998") - public void testConcurrentUpdatesWithMvcc() throws Exception { - doTestConcurrentUpdates(true); - } - - /** - * @throws Exception If failed. - */ - @Test - @Ignore("https://issues.apache.org/jira/browse/IGNITE-11998") - public void testConcurrentUpdatesNoMvcc() throws Exception { + public void testConcurrentUpdates() throws Exception { try { - doTestConcurrentUpdates(false); + doTestConcurrentUpdates(); throw new IllegalStateException("Expected to detect data inconsistency."); } @@ -190,7 +181,7 @@ public void testConcurrentUpdatesNoMvcc() throws Exception { } /** */ - private void doTestConcurrentUpdates(boolean enableMvcc) throws Exception { + private void doTestConcurrentUpdates() throws Exception { final String cacheName = "test_updates"; IgniteEx server = startGrid(0); @@ -198,9 +189,7 @@ private void doTestConcurrentUpdates(boolean enableMvcc) throws Exception { CacheConfiguration ccfg = new CacheConfiguration<>(cacheName); ccfg.setIndexedTypes(Long.class, Long.class); - ccfg.setAtomicityMode(enableMvcc ? - CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT : - CacheAtomicityMode.TRANSACTIONAL); + ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); IgniteCache cache = server.createCache(ccfg); @@ -268,7 +257,7 @@ private void doTestConcurrentUpdates(boolean enableMvcc) throws Exception { tx.commit(); } catch (CacheException e) { - MvccFeatureChecker.assertMvccWriteConflict(e); + assertTrue(e.getCause() instanceof TransactionSerializationException); if (!e.getMessage().contains( "Cannot serialize transaction due to write conflict (transaction is marked for rollback)")) diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java index 3adc8aace92f1..bb28e6de1277a 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/AbstractPartitionPruningBaseTest.java @@ -144,21 +144,10 @@ public abstract class AbstractPartitionPruningBaseTest extends GridCommonAbstrac * @param cols Columns. */ protected void createPartitionedTable(String name, Object... cols) { - createPartitionedTable(false, name, cols); - } - - /** - * Create PARTITIONED table. - * - * @param mvcc MVCC flag. - * @param name Name. - * @param cols Columns. - */ - protected void createPartitionedTable(boolean mvcc, String name, Object... cols) { if (createTableWithSql) - createTable0(name, false, mvcc, cols); + createTable0(name, false, cols); else - createCacheTable(name, false, mvcc, cols); + createCacheTable(name, false, cols); } /** @@ -168,21 +157,10 @@ protected void createPartitionedTable(boolean mvcc, String name, Object... cols) * @param cols Columns. */ protected void createReplicatedTable(String name, Object... cols) { - createReplicatedTable(false, name, cols); - } - - /** - * Create REPLICATED table. - * - * @param mvcc MVCC flag. - * @param name Name. - * @param cols Columns. - */ - protected void createReplicatedTable(boolean mvcc, String name, Object... cols) { if (createTableWithSql) - createTable0(name, true, mvcc, cols); + createTable0(name, true, cols); else - createCacheTable(name, true, mvcc, cols); + createCacheTable(name, true, cols); } /** @@ -190,11 +168,10 @@ protected void createReplicatedTable(boolean mvcc, String name, Object... cols) * * @param name Name. * @param replicated Replicated table flag. - * @param mvcc MVCC flag. * @param cols Columns. */ @SuppressWarnings("StringConcatenationInsideStringBufferAppend") - private void createTable0(String name, boolean replicated, boolean mvcc, Object... cols) { + private void createTable0(String name, boolean replicated, Object... cols) { List pkCols = new ArrayList<>(); String affCol = null; @@ -242,9 +219,6 @@ private void createTable0(String name, boolean replicated, boolean mvcc, Object. sql.append(", KEY_TYPE=" + name + "_key"); } - if (mvcc) - sql.append(", atomicity=TRANSACTIONAL_SNAPSHOT"); - sql.append("\""); executeSql(sql.toString()); @@ -255,10 +229,9 @@ private void createTable0(String name, boolean replicated, boolean mvcc, Object. * * @param name Name. * @param replicated Replicated table flag. - * @param mvcc MVCC flag. * @param cols Columns. */ - private void createCacheTable(String name, boolean replicated, boolean mvcc, Object... cols) { + private void createCacheTable(String name, boolean replicated, Object... cols) { QueryEntity e = new QueryEntity() .setValueType(name) .setTableName(name); @@ -300,7 +273,7 @@ private void createCacheTable(String name, boolean replicated, boolean mvcc, Obj CacheConfiguration ccfg = new CacheConfiguration<>() .setName(name) .setSqlSchema(DFLT_SCHEMA) - .setAtomicityMode(mvcc ? CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT : CacheAtomicityMode.TRANSACTIONAL) + .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setCacheMode(replicated ? CacheMode.REPLICATED : CacheMode.PARTITIONED) .setQueryEntities(Collections.singletonList(e)); diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/MvccDmlPartitionPruningSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/MvccDmlPartitionPruningSelfTest.java deleted file mode 100644 index 82731ec25cdea..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/MvccDmlPartitionPruningSelfTest.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.query.h2.twostep; - -import java.util.List; -import org.apache.ignite.Ignite; -import org.apache.ignite.binary.BinaryObject; -import org.apache.ignite.internal.util.typedef.F; -import org.junit.Test; -import org.junit.runners.Parameterized; - -/** - * Tests for use partition pruning at the SELECT step of the UPDATE/DELETE statements execution. - */ -public class MvccDmlPartitionPruningSelfTest extends AbstractPartitionPruningBaseTest { - /** Rows count for test tables. */ - private static final int ROWS = 10; - - /** Recreate tables before each test statement. */ - private boolean recreateTables; - - /** */ - @Parameterized.Parameters(name = "createWithSql = {0}") - public static List params() { - return F.asList(false, true); - } - - /** - * Test UPDATE statement. - */ - @Test - public void testUpdate() { - recreateTables = false; - - recreateTables(); - - // Key (not alias). - execute("UPDATE t1 SET v1 = 'new1' WHERE k1 = ?", - (res) -> { - assertPartitions( - partition("t1", "1") - ); - assertNodes( - node("t1", "1") - ); - assertUpdatedRows(res, 1); - }, - "1" - ); - - // Key (alias). - execute("UPDATE t1 SET v1 = 'new2' WHERE _KEY = ?", - (res) -> { - assertPartitions( - partition("t1", "2") - ); - assertNodes( - node("t1", "2") - ); - assertUpdatedRows(res, 1); - }, - "2" - ); - - // Non-affinity key. - execute("UPDATE t2 SET v2 = 'new1' WHERE k2 = ?", - (res) -> { - assertNoPartitions(); - assertUpdatedRows(res, 1); - }, - "1" - ); - - // Affinity key. - execute("UPDATE t2 SET v2 = 'new1' WHERE ak2 = ?", - (res) -> { - assertPartitions( - partition("t2", "1") - ); - assertNodes( - node("t2", "1") - ); - assertUpdatedRows(res, 1); - }, - "1" - ); - - // Expression: condition IN (...) - execute("UPDATE t1 SET v1 = 'new1' WHERE k1 in (?, ?, ?)", - (res) -> { - assertPartitions( - partition("t1", "1"), - partition("t1", "2"), - partition("t1", "3") - ); - assertNodes( - node("t1", "1"), - node("t1", "2"), - node("t1", "3") - ); - assertUpdatedRows(res, 3); - }, - "1", "2", "3" - ); - - // Expression: logical - execute("UPDATE t1 SET v1 = 'new1' WHERE k1 in (?, ?) or k1 = ?", - (res) -> { - assertPartitions( - partition("t1", "1"), - partition("t1", "2"), - partition("t1", "3") - ); - assertNodes( - node("t1", "1"), - node("t1", "2"), - node("t1", "3") - ); - assertUpdatedRows(res, 3); - }, - "3", "2", "1" - ); - - // No request (empty partitions). - execute("UPDATE t1 SET v1 = 'new1' WHERE k1 in (?, ?) and k1 = ?", - (res) -> { - assertNoRequests(); - assertUpdatedRows(res, 0); - }, - "3", "2", "1" - ); - - // Complex key. - BinaryObject key = client().binary().builder("t2_key") - .setField("k1", "5") - .setField("ak2", "5") - .build(); - - List> res = executeSingle("UPDATE t2 SET v2 = 'new1' WHERE _KEY = ?", key); - assertPartitions( - partition("t2", "5") - ); - assertNodes( - node("t2", "5") - ); - assertUpdatedRows(res, 1); - } - - /** - * Test UPDATE statement. - */ - @Test - public void testDelete() { - recreateTables = true; - - // Expression: condition IN (...) - execute("DELETE FROM t1 WHERE k1 in (?, ?, ?)", - (res) -> { - assertPartitions( - partition("t1", "1"), - partition("t1", "2"), - partition("t1", "3") - ); - assertNodes( - node("t1", "1"), - node("t1", "2"), - node("t1", "3") - ); - assertUpdatedRows(res, 3); - }, - "1", "2", "3" - ); - - // Expression: logical OR - execute("DELETE FROM t1 WHERE k1 in (?, ?) or k1 = ?", - (res) -> { - assertPartitions( - partition("t1", "1"), - partition("t1", "2"), - partition("t1", "3") - ); - assertNodes( - node("t1", "1"), - node("t1", "2"), - node("t1", "3") - ); - assertUpdatedRows(res, 3); - }, - "3", "2", "1" - ); - - // No request (empty partitions). - execute("DELETE FROM t1 WHERE k1 in (?, ?) and k1 = ?", - (res) -> { - assertNoRequests(); - assertUpdatedRows(res, 0); - }, - "3", "2", "1" - ); - } - - /** - * Drop, create and fill test tables. - */ - private void recreateTables() { - Ignite cli = client(); - - cli.destroyCaches(cli.cacheNames()); - - createPartitionedTable(true, "t1", - pkColumn("k1"), - "v1"); - - createPartitionedTable(true, "t2", - pkColumn("k2"), - affinityColumn("ak2"), - "v2"); - - for (int i = 0; i < ROWS; ++i) { - executeSql("INSERT INTO t1 VALUES (?, ?)", - Integer.toString(i), Integer.toString(i)); - - executeSql("INSERT INTO t2 VALUES (?, ?, ?)", - Integer.toString(i), Integer.toString(i), Integer.toString(i)); - } - } - - /** {@inheritDoc} */ - @Override protected List> executeSingle(String sql, Object... args) { - if (recreateTables) - recreateTables(); - - return super.executeSingle(sql, args); - } - - /** - * @param res Updated results. - * @param expUpdated Expected updated rows count. - */ - private static void assertUpdatedRows(List> res, long expUpdated) { - assertEquals(1, res.size()); - assertEquals(expUpdated, res.get(0).get(0)); - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteCachePartitionedAtomicColumnConstraintsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteCachePartitionedAtomicColumnConstraintsTest.java index 0f181d9a0b0c9..44ce5101669e9 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteCachePartitionedAtomicColumnConstraintsTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteCachePartitionedAtomicColumnConstraintsTest.java @@ -41,7 +41,6 @@ import org.junit.Test; 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.CacheWriteSynchronizationMode.FULL_SYNC; import static org.apache.ignite.internal.processors.query.QueryUtils.KEY_FIELD_NAME; @@ -716,9 +715,6 @@ protected CacheConfiguration cacheConfiguration(QueryEntity qryEntity) { cache.setWriteSynchronizationMode(FULL_SYNC); cache.setQueryEntities(Collections.singletonList(qryEntity)); - if (TRANSACTIONAL_SNAPSHOT.equals(atomicityMode())) - cache.setNearConfiguration(null); - return cache; } diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteCachePartitionedTransactionalSnapshotColumnConstraintTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteCachePartitionedTransactionalSnapshotColumnConstraintTest.java deleted file mode 100644 index ca0cc29cf8ea3..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteCachePartitionedTransactionalSnapshotColumnConstraintTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.sql; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.jetbrains.annotations.NotNull; -import org.junit.Ignore; -import org.junit.Test; - -/** */ -public class IgniteCachePartitionedTransactionalSnapshotColumnConstraintTest - extends IgniteCachePartitionedAtomicColumnConstraintsTest { - /** {@inheritDoc} */ - @NotNull @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringValueFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringKeyFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringValueFieldFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringKeyFieldFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringKeyFail2() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringKeyFail3() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyFail2() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueFieldFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueFieldFail2() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyFieldFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueScaleFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyScaleFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyScaleFail2() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueFieldScaleFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueFieldScaleFail2() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyFieldScaleFail() { - // No-op. - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteCacheReplicatedTransactionalSnapshotColumnConstraintTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteCacheReplicatedTransactionalSnapshotColumnConstraintTest.java deleted file mode 100644 index 6505f1e3b57b9..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteCacheReplicatedTransactionalSnapshotColumnConstraintTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.sql; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.jetbrains.annotations.NotNull; -import org.junit.Ignore; -import org.junit.Test; - -/** */ -public class IgniteCacheReplicatedTransactionalSnapshotColumnConstraintTest - extends IgniteCacheReplicatedAtomicColumnConstraintsTest { - /** {@inheritDoc} */ - @NotNull @Override protected CacheAtomicityMode atomicityMode() { - return CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringValueFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringKeyFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringValueFieldFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringKeyFieldFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringKeyFail2() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongStringKeyFail3() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyFail2() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueFieldFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueFieldFail2() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyFieldFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueScaleFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyScaleFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyScaleFail2() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueFieldScaleFail() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalValueFieldScaleFail2() { - // No-op. - } - - /** */ - @Ignore("https://issues.apache.org/jira/browse/IGNITE-10066") - @Test - @Override public void testPutTooLongDecimalKeyFieldScaleFail() { - // No-op. - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteSQLColumnConstraintsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteSQLColumnConstraintsTest.java index 65f2c3d99ef81..3ac0698442a7d 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteSQLColumnConstraintsTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteSQLColumnConstraintsTest.java @@ -36,37 +36,35 @@ public class IgniteSQLColumnConstraintsTest extends AbstractIndexingCommonTest { @Override protected void beforeTestsStarted() throws Exception { startGrid(0); - String mvccQry = mvccEnabled() ? " WITH \"atomicity=transactional_snapshot\"" : ""; - - runSQL("CREATE TABLE varchar_table(id INT PRIMARY KEY, str VARCHAR(5))" + mvccQry); + runSQL("CREATE TABLE varchar_table(id INT PRIMARY KEY, str VARCHAR(5))"); execSQL("INSERT INTO varchar_table VALUES(?, ?)", 1, "12345"); checkSQLResults("SELECT * FROM varchar_table WHERE id = 1", 1, "12345"); - runSQL("CREATE TABLE decimal_table(id INT PRIMARY KEY, val DECIMAL(4, 2))" + mvccQry); + runSQL("CREATE TABLE decimal_table(id INT PRIMARY KEY, val DECIMAL(4, 2))"); execSQL("INSERT INTO decimal_table VALUES(?, ?)", 1, 12.34); checkSQLResults("SELECT * FROM decimal_table WHERE id = 1", 1, BigDecimal.valueOf(12.34)); - runSQL("CREATE TABLE char_table(id INT PRIMARY KEY, str CHAR(5))" + mvccQry); + runSQL("CREATE TABLE char_table(id INT PRIMARY KEY, str CHAR(5))"); execSQL("INSERT INTO char_table VALUES(?, ?)", 1, "12345"); checkSQLResults("SELECT * FROM char_table WHERE id = 1", 1, "12345"); - runSQL("CREATE TABLE decimal_table_4(id INT PRIMARY KEY, field DECIMAL(4, 2))" + mvccQry); + runSQL("CREATE TABLE decimal_table_4(id INT PRIMARY KEY, field DECIMAL(4, 2))"); - runSQL("CREATE TABLE char_table_2(id INT PRIMARY KEY, field INTEGER)" + mvccQry); + runSQL("CREATE TABLE char_table_2(id INT PRIMARY KEY, field INTEGER)"); - runSQL("CREATE TABLE decimal_table_2(id INT PRIMARY KEY, field INTEGER)" + mvccQry); + runSQL("CREATE TABLE decimal_table_2(id INT PRIMARY KEY, field INTEGER)"); - runSQL("CREATE TABLE char_table_3(id INT PRIMARY KEY, field CHAR(5), field2 INTEGER)" + mvccQry); + runSQL("CREATE TABLE char_table_3(id INT PRIMARY KEY, field CHAR(5), field2 INTEGER)"); - runSQL("CREATE TABLE decimal_table_3(id INT PRIMARY KEY, field DECIMAL(4, 2), field2 INTEGER)" + mvccQry); + runSQL("CREATE TABLE decimal_table_3(id INT PRIMARY KEY, field DECIMAL(4, 2), field2 INTEGER)"); - runSQL("CREATE TABLE char_table_4(id INT PRIMARY KEY, field CHAR(5))" + mvccQry); + runSQL("CREATE TABLE char_table_4(id INT PRIMARY KEY, field CHAR(5))"); } /** @@ -371,9 +369,4 @@ protected void checkSQLResults(String sql, Object... args) { for (int i = 0; i < args.length; i++) assertTrue(args[i] + " != " + row.get(i), Objects.equals(args[i], row.get(i))); } - - /** */ - protected boolean mvccEnabled() { - return false; - } } diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteTransactionSQLColumnConstraintTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteTransactionSQLColumnConstraintTest.java deleted file mode 100644 index a666e5c404922..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/sql/IgniteTransactionSQLColumnConstraintTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.sql; - -import java.util.List; -import org.apache.ignite.internal.processors.query.IgniteSQLException; -import org.apache.ignite.testframework.GridTestUtils; -import org.junit.Test; - -/** - */ -public class IgniteTransactionSQLColumnConstraintTest extends IgniteSQLColumnConstraintsTest { - /** {@inheritDoc} */ - @Override protected void checkSQLThrows(String sql, String sqlStateCode, Object... args) { - runSQL("BEGIN TRANSACTION"); - - IgniteSQLException err = (IgniteSQLException)GridTestUtils.assertThrowsWithCause(() -> { - runSQL(sql, args); - - return 0; - }, IgniteSQLException.class); - - runSQL("ROLLBACK TRANSACTION"); - - assertEquals(err.sqlState(), sqlStateCode); - } - - /** {@inheritDoc} */ - @Override protected List execSQL(String sql, Object... args) { - runSQL("BEGIN TRANSACTION"); - - List res = runSQL(sql, args); - - runSQL("COMMIT TRANSACTION"); - - return res; - } - - /** - * That test is ignored due to drop column(s) operation is unsupported for the MVCC tables. - */ - @Test - @Override public void testCharDropColumnWithConstraint() { - // No-op. - } - - /** - * That test is ignored due to drop column(s) operation is unsupported for the MVCC tables. - */ - @Test - @Override public void testDecimalDropColumnWithConstraint() { - // No-op. - } - - /** {@inheritDoc} */ - @Override protected boolean mvccEnabled() { - return true; - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite3.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite3.java index fa47416073c64..4805bf92d01b3 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite3.java +++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite3.java @@ -95,8 +95,7 @@ import org.apache.ignite.internal.processors.cache.index.OptimizedMarshallerIndexNameTest; import org.apache.ignite.internal.processors.cache.index.PojoIndexLocalQueryTest; import org.apache.ignite.internal.processors.cache.index.SqlPartitionEvictionTest; -import org.apache.ignite.internal.processors.cache.index.SqlTransactionCommandsWithMvccDisabledSelfTest; -import org.apache.ignite.internal.processors.cache.index.SqlTransactionsSelfTest; +import org.apache.ignite.internal.processors.cache.index.SqlTransactionCommandsSelfTest; import org.apache.ignite.internal.processors.cache.metric.SqlViewExporterSpiTest; import org.apache.ignite.internal.processors.cache.query.IgniteCacheQueryCacheDestroySelfTest; import org.apache.ignite.internal.processors.cache.query.ScanQueryConcurrentSqlUpdatesTest; @@ -152,16 +151,12 @@ import org.apache.ignite.internal.processors.query.h2.twostep.InOperationExtractPartitionSelfTest; import org.apache.ignite.internal.processors.query.h2.twostep.JoinPartitionPruningSelfTest; import org.apache.ignite.internal.processors.query.h2.twostep.JoinQueryEntityPartitionPruningSelfTest; -import org.apache.ignite.internal.processors.query.h2.twostep.MvccDmlPartitionPruningSelfTest; import org.apache.ignite.internal.processors.query.h2.twostep.SqlDataTypeConversionTest; import org.apache.ignite.internal.processors.sql.IgniteCachePartitionedAtomicColumnConstraintsTest; import org.apache.ignite.internal.processors.sql.IgniteCachePartitionedTransactionalColumnConstraintsTest; -import org.apache.ignite.internal.processors.sql.IgniteCachePartitionedTransactionalSnapshotColumnConstraintTest; import org.apache.ignite.internal.processors.sql.IgniteCacheReplicatedAtomicColumnConstraintsTest; import org.apache.ignite.internal.processors.sql.IgniteCacheReplicatedTransactionalColumnConstraintsTest; -import org.apache.ignite.internal.processors.sql.IgniteCacheReplicatedTransactionalSnapshotColumnConstraintTest; import org.apache.ignite.internal.processors.sql.IgniteSQLColumnConstraintsTest; -import org.apache.ignite.internal.processors.sql.IgniteTransactionSQLColumnConstraintTest; import org.apache.ignite.internal.sql.SqlParserUserSelfTest; import org.apache.ignite.spi.communication.tcp.GridOrderedMessageCancelSelfTest; import org.apache.ignite.spi.communication.tcp.H2CommunicationMessageSerializationTest; @@ -272,13 +267,11 @@ GridIndexRebuildTest.class, CheckIndexesInlineSizeOnNodeJoinMultiJvmTest.class, - SqlTransactionCommandsWithMvccDisabledSelfTest.class, - SqlTransactionsSelfTest.class, + SqlTransactionCommandsSelfTest.class, IgniteSqlDefaultValueTest.class, IgniteDecimalSelfTest.class, IgniteSQLColumnConstraintsTest.class, - IgniteTransactionSQLColumnConstraintTest.class, IgniteSqlDefaultSchemaTest.class, IgniteSqlCustomSchemaTest.class, @@ -289,10 +282,8 @@ IgniteCachePartitionedAtomicColumnConstraintsTest.class, IgniteCachePartitionedTransactionalColumnConstraintsTest.class, - IgniteCachePartitionedTransactionalSnapshotColumnConstraintTest.class, IgniteCacheReplicatedAtomicColumnConstraintsTest.class, IgniteCacheReplicatedTransactionalColumnConstraintsTest.class, - IgniteCacheReplicatedTransactionalSnapshotColumnConstraintTest.class, ThreadLocalObjectPoolSelfTest.class, @@ -332,7 +323,6 @@ JoinPartitionPruningSelfTest.class, JoinQueryEntityPartitionPruningSelfTest.class, DmlSelectPartitionPruningSelfTest.class, - MvccDmlPartitionPruningSelfTest.class, GridCacheDynamicLoadOnClientTest.class, GridCacheDynamicLoadOnClientPersistentTest.class, diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccSqlTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccSqlTestSuite.java deleted file mode 100644 index 23e89ee7cecb1..0000000000000 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccSqlTestSuite.java +++ /dev/null @@ -1,203 +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.testsuites; - -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.NearCacheConfiguration; -import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedTxPessimisticOriginatingNodeFailureSelfTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePartitionedNearDisabledPrimaryNodeFailureRecoveryTest; -import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePartitionedTwoBackupsPrimaryNodeFailureRecoveryTest; -import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedTxPessimisticOriginatingNodeFailureSelfTest; -import org.apache.ignite.internal.processors.cache.index.MvccEmptyTransactionSelfTest; -import org.apache.ignite.internal.processors.cache.index.SqlTransactionsCommandsWithMvccEnabledSelfTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccBasicContinuousQueryTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccBulkLoadTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccClientReconnectContinuousQueryTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousQueryBackupQueueTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousQueryClientReconnectTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousQueryClientTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousQueryImmutableEntryTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousQueryMultiNodesFilteringTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousQueryPartitionedSelfTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousQueryPartitionedTxOneNodeTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousQueryReplicatedSelfTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousQueryReplicatedTxOneNodeTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousWithTransformerClientSelfTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousWithTransformerPartitionedSelfTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccContinuousWithTransformerReplicatedSelfTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccDmlSimpleTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccIteratorWithConcurrentJdbcTransactionTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccLocalEntriesWithConcurrentJdbcTransactionTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccPartitionedBackupsTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccPartitionedSqlCoordinatorFailoverTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccPartitionedSqlQueriesTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccPartitionedSqlTxQueriesTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccPartitionedSqlTxQueriesWithReducerTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccReplicatedBackupsTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccReplicatedSqlCoordinatorFailoverTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccReplicatedSqlQueriesTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccReplicatedSqlTxQueriesTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccReplicatedSqlTxQueriesWithReducerTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccScanQueryWithConcurrentJdbcTransactionTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSelectForUpdateQueryBasicTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSelectForUpdateQueryTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSizeTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSizeWithConcurrentJdbcTransactionTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSqlConfigurationValidationTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSqlContinuousQueryPartitionedSelfTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSqlContinuousQueryReplicatedSelfTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSqlLockTimeoutTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSqlTxModesTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccSqlUpdateCountersTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccStreamingInsertTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccTxNodeMappingTest; -import org.apache.ignite.internal.processors.cache.mvcc.CacheMvccTxRecoveryTest; -import org.apache.ignite.internal.processors.cache.mvcc.MvccDeadlockDetectionConfigTest; -import org.apache.ignite.internal.processors.cache.mvcc.MvccDeadlockDetectionTest; -import org.apache.ignite.internal.processors.cache.mvcc.MvccRepeatableReadBulkOpsTest; -import org.apache.ignite.internal.processors.cache.mvcc.MvccRepeatableReadOperationsTest; -import org.apache.ignite.internal.processors.query.h2.GridIndexRebuildWithMvccEnabledSelfTest; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; - -/** */ -@RunWith(Suite.class) -@Suite.SuiteClasses({ - // Simple tests. - MvccEmptyTransactionSelfTest.class, - CacheMvccSqlConfigurationValidationTest.class, - CacheMvccDmlSimpleTest.class, - SqlTransactionsCommandsWithMvccEnabledSelfTest.class, - CacheMvccSizeTest.class, - CacheMvccSqlUpdateCountersTest.class, - CacheMvccSqlLockTimeoutTest.class, - CacheMvccSqlTxModesTest.class, - GridIndexRebuildWithMvccEnabledSelfTest.class, - - CacheMvccTxNodeMappingTest.class, - - MvccDeadlockDetectionConfigTest.class, - MvccDeadlockDetectionTest.class, - - // SQL vs CacheAPI consistency. - MvccRepeatableReadOperationsTest.class, - MvccRepeatableReadBulkOpsTest.class, - - // JDBC tests. - CacheMvccSizeWithConcurrentJdbcTransactionTest.class, - CacheMvccScanQueryWithConcurrentJdbcTransactionTest.class, - CacheMvccLocalEntriesWithConcurrentJdbcTransactionTest.class, - CacheMvccIteratorWithConcurrentJdbcTransactionTest.class, - - // Load tests. - CacheMvccBulkLoadTest.class, - CacheMvccStreamingInsertTest.class, - - CacheMvccPartitionedSqlQueriesTest.class, - CacheMvccReplicatedSqlQueriesTest.class, - CacheMvccPartitionedSqlTxQueriesTest.class, - CacheMvccReplicatedSqlTxQueriesTest.class, - - CacheMvccPartitionedSqlTxQueriesWithReducerTest.class, - CacheMvccReplicatedSqlTxQueriesWithReducerTest.class, - - CacheMvccSelectForUpdateQueryBasicTest.class, - CacheMvccSelectForUpdateQueryTest.class, - - // Failover tests. - CacheMvccPartitionedBackupsTest.class, - CacheMvccReplicatedBackupsTest.class, - - CacheMvccPartitionedSqlCoordinatorFailoverTest.class, - CacheMvccReplicatedSqlCoordinatorFailoverTest.class, - - // Continuous queries. - CacheMvccBasicContinuousQueryTest.class, - CacheMvccContinuousQueryPartitionedSelfTest.class, - CacheMvccContinuousQueryReplicatedSelfTest.class, - CacheMvccSqlContinuousQueryPartitionedSelfTest.class, - CacheMvccSqlContinuousQueryReplicatedSelfTest.class, - - CacheMvccContinuousQueryPartitionedTxOneNodeTest.class, - CacheMvccContinuousQueryReplicatedTxOneNodeTest.class, - - CacheMvccContinuousQueryClientReconnectTest.class, - CacheMvccContinuousQueryClientTest.class, - - CacheMvccContinuousQueryMultiNodesFilteringTest.class, - CacheMvccContinuousQueryBackupQueueTest.class, - CacheMvccContinuousQueryImmutableEntryTest.class, - CacheMvccClientReconnectContinuousQueryTest.class, - - CacheMvccContinuousWithTransformerClientSelfTest.class, - CacheMvccContinuousWithTransformerPartitionedSelfTest.class, - CacheMvccContinuousWithTransformerReplicatedSelfTest.class, - - // Transaction recovery. - CacheMvccTxRecoveryTest.class, - - IgniteCacheMvccSqlTestSuite.MvccPartitionedPrimaryNodeFailureRecoveryTest.class, - IgniteCacheMvccSqlTestSuite.MvccPartitionedTwoBackupsPrimaryNodeFailureRecoveryTest.class, - IgniteCacheMvccSqlTestSuite.MvccColocatedTxPessimisticOriginatingNodeFailureRecoveryTest.class, - IgniteCacheMvccSqlTestSuite.MvccReplicatedTxPessimisticOriginatingNodeFailureRecoveryTest.class, - CacheMvccTxRecoveryTest.class -}) -public class IgniteCacheMvccSqlTestSuite { - /** */ - public static class MvccPartitionedPrimaryNodeFailureRecoveryTest - extends IgniteCachePartitionedNearDisabledPrimaryNodeFailureRecoveryTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return TRANSACTIONAL_SNAPSHOT; - } - } - - /** */ - public static class MvccPartitionedTwoBackupsPrimaryNodeFailureRecoveryTest - extends IgniteCachePartitionedTwoBackupsPrimaryNodeFailureRecoveryTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return TRANSACTIONAL_SNAPSHOT; - } - - /** {@inheritDoc} */ - @Override protected NearCacheConfiguration nearConfiguration() { - return null; - } - } - - /** */ - public static class MvccColocatedTxPessimisticOriginatingNodeFailureRecoveryTest - extends GridCacheColocatedTxPessimisticOriginatingNodeFailureSelfTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return TRANSACTIONAL_SNAPSHOT; - } - } - - /** */ - public static class MvccReplicatedTxPessimisticOriginatingNodeFailureRecoveryTest - extends GridCacheReplicatedTxPessimisticOriginatingNodeFailureSelfTest { - /** {@inheritDoc} */ - @Override protected CacheAtomicityMode atomicityMode() { - return TRANSACTIONAL_SNAPSHOT; - } - } -} diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite4.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite4.java index 4fa00ed7cc0d2..e01af48715720 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite4.java +++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite4.java @@ -18,14 +18,11 @@ package org.apache.ignite.testsuites; import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryAsyncFailoverAtomicSelfTest; -import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryAsyncFailoverMvccTxSelfTest; import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryAsyncFailoverTxReplicatedSelfTest; import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryAsyncFailoverTxSelfTest; import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverAtomicNearEnabledSelfTest; import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverAtomicReplicatedSelfTest; import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverAtomicSelfTest; -import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverMvccTxReplicatedSelfTest; -import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverMvccTxSelfTest; import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverTxReplicatedSelfTest; import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryFailoverTxSelfTest; import org.junit.runner.RunWith; @@ -42,13 +39,10 @@ CacheContinuousQueryFailoverAtomicReplicatedSelfTest.class, CacheContinuousQueryFailoverTxSelfTest.class, CacheContinuousQueryFailoverTxReplicatedSelfTest.class, - CacheContinuousQueryFailoverMvccTxSelfTest.class, - CacheContinuousQueryFailoverMvccTxReplicatedSelfTest.class, CacheContinuousQueryAsyncFailoverAtomicSelfTest.class, CacheContinuousQueryAsyncFailoverTxReplicatedSelfTest.class, CacheContinuousQueryAsyncFailoverTxSelfTest.class, - CacheContinuousQueryAsyncFailoverMvccTxSelfTest.class }) public class IgniteCacheQuerySelfTestSuite4 { } diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingTestSuite.java index a127384a1b9fb..0fcb2155431c9 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingTestSuite.java +++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingTestSuite.java @@ -40,7 +40,6 @@ import org.apache.ignite.internal.processors.database.IgniteTwoRegionsRebuildIndexTest; import org.apache.ignite.internal.processors.database.RebuildIndexTest; import org.apache.ignite.internal.processors.database.RebuildIndexWithHistoricalRebalanceTest; -import org.apache.ignite.internal.processors.database.RebuildIndexWithMVCCTest; import org.apache.ignite.internal.processors.database.WalDisabledDuringIndexRecreateTest; import org.apache.ignite.internal.processors.query.h2.maintenance.MaintenanceRebuildIndexUtilsSelfTest; import org.junit.runner.RunWith; @@ -63,7 +62,6 @@ LongDestroyDurableBackgroundTaskTest.class, RebuildIndexTest.class, WalDisabledDuringIndexRecreateTest.class, - RebuildIndexWithMVCCTest.class, ClientReconnectWithSqlTableConfiguredTest.class, MultipleParallelCacheDeleteDeadlockTest.class, CacheGroupReencryptionTest.class, diff --git a/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/cache/mvcc/mvcc_person.csv b/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/cache/mvcc/mvcc_person.csv deleted file mode 100644 index ef7a087f839ae..0000000000000 --- a/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/cache/mvcc/mvcc_person.csv +++ /dev/null @@ -1,2 +0,0 @@ -1,John -2,Jack diff --git a/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/cache/mvcc/mvcc_person_broken.csv b/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/cache/mvcc/mvcc_person_broken.csv deleted file mode 100644 index b5c2b3fed757b..0000000000000 --- a/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/cache/mvcc/mvcc_person_broken.csv +++ /dev/null @@ -1,2 +0,0 @@ -1,John -2 diff --git a/modules/platforms/cpp/odbc-test/CMakeLists.txt b/modules/platforms/cpp/odbc-test/CMakeLists.txt index ee8d77dd8781d..d7ce25963579a 100644 --- a/modules/platforms/cpp/odbc-test/CMakeLists.txt +++ b/modules/platforms/cpp/odbc-test/CMakeLists.txt @@ -63,7 +63,6 @@ set(SOURCES src/errors_test.cpp src/odbc_test_suite.cpp src/types_test.cpp - src/transaction_test.cpp src/authentication_test.cpp src/sql_parsing_test.cpp src/streaming_test.cpp diff --git a/modules/platforms/cpp/odbc-test/config/queries-transaction-32.xml b/modules/platforms/cpp/odbc-test/config/queries-transaction-32.xml deleted file mode 100644 index b5479c720a4aa..0000000000000 --- a/modules/platforms/cpp/odbc-test/config/queries-transaction-32.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/platforms/cpp/odbc-test/config/queries-transaction.xml b/modules/platforms/cpp/odbc-test/config/queries-transaction.xml deleted file mode 100644 index 9d8c535d0e080..0000000000000 --- a/modules/platforms/cpp/odbc-test/config/queries-transaction.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/platforms/cpp/odbc-test/src/transaction_test.cpp b/modules/platforms/cpp/odbc-test/src/transaction_test.cpp deleted file mode 100644 index 3f4ab758d17a7..0000000000000 --- a/modules/platforms/cpp/odbc-test/src/transaction_test.cpp +++ /dev/null @@ -1,845 +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. - */ - -#ifdef _WIN32 -# include -#endif - -#include -#include - -#include - -#include - -#include "ignite/ignition.h" - -#include "test_utils.h" -#include "odbc_test_suite.h" - -using namespace ignite; -using namespace ignite_test; - -using namespace boost::unit_test; - -/** - * Test setup fixture. - */ -struct TransactionTestSuiteFixture : public odbc::OdbcTestSuite -{ - static Ignite StartAdditionalNode(const char* name) - { - return StartTestNode("queries-transaction.xml", name); - } - - /** - * Constructor. - */ - TransactionTestSuiteFixture() : - grid(StartAdditionalNode("NodeMain")) - { - // No-op. - } - - /** - * Destructor. - */ - ~TransactionTestSuiteFixture() - { - // No-op. - } - - /** - * Insert test string value in cache and make all the neccessary checks. - * - * @param key Key. - * @param value Value. - */ - void InsertTestValue(int64_t key, const std::string& value) - { - InsertTestValue(stmt, key, value); - } - - /** - * Insert test string value in cache and make all the neccessary checks. - * - * @param stmt Statement. - * @param key Key. - * @param value Value. - */ - static void InsertTestValue(SQLHSTMT stmt, int64_t key, const std::string& value) - { - SQLCHAR insertReq[] = "INSERT INTO TestType(_key, strField) VALUES(?, ?)"; - - SQLRETURN ret = SQLPrepare(stmt, insertReq, SQL_NTS); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - char strField[1024] = { 0 }; - SQLLEN strFieldLen = 0; - - ret = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_BIGINT, 0, 0, &key, 0, 0); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(strField), - sizeof(strField), &strField, sizeof(strField), &strFieldLen); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - CopyStringToBuffer(strField, value, sizeof(strField)); - strFieldLen = SQL_NTS; - - ret = SQLExecute(stmt); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - SQLLEN affected = 0; - ret = SQLRowCount(stmt, &affected); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - BOOST_CHECK_EQUAL(affected, 1); - - ret = SQLMoreResults(stmt); - - if (ret != SQL_NO_DATA) - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ResetStatement(stmt); - } - - /** - * Update test string value in cache and make all the neccessary checks. - * - * @param key Key. - * @param value Value. - */ - void UpdateTestValue(int64_t key, const std::string& value) - { - UpdateTestValue(stmt, key, value); - } - - /** - * Update test string value in cache and make all the neccessary checks. - * - * @param stmt Statement. - * @param key Key. - * @param value Value. - */ - static void UpdateTestValue(SQLHSTMT stmt, int64_t key, const std::string& value) - { - SQLCHAR insertReq[] = "UPDATE TestType SET strField=? WHERE _key=?"; - - SQLRETURN ret = SQLPrepare(stmt, insertReq, SQL_NTS); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - char strField[1024] = { 0 }; - SQLLEN strFieldLen = 0; - - ret = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(strField), - sizeof(strField), &strField, sizeof(strField), &strFieldLen); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_BIGINT, 0, 0, &key, 0, 0); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - CopyStringToBuffer(strField, value, sizeof(strField)); - strFieldLen = SQL_NTS; - - ret = SQLExecute(stmt); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - SQLLEN affected = 0; - ret = SQLRowCount(stmt, &affected); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - BOOST_CHECK_EQUAL(affected, 1); - - ret = SQLMoreResults(stmt); - - if (ret != SQL_NO_DATA) - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ResetStatement(stmt); - } - - /** - * Delete test string value. - * - * @param key Key. - */ - void DeleteTestValue(int64_t key) - { - DeleteTestValue(stmt, key); - } - - /** - * Delete test string value. - * - * @param stmt Statement. - * @param key Key. - */ - static void DeleteTestValue(SQLHSTMT stmt, int64_t key) - { - SQLCHAR insertReq[] = "DELETE FROM TestType WHERE _key=?"; - - SQLRETURN ret = SQLPrepare(stmt, insertReq, SQL_NTS); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_BIGINT, 0, 0, &key, 0, 0); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLExecute(stmt); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - SQLLEN affected = 0; - ret = SQLRowCount(stmt, &affected); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - BOOST_CHECK_EQUAL(affected, 1); - - ret = SQLMoreResults(stmt); - - if (ret != SQL_NO_DATA) - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ResetStatement(stmt); - } - /** - * Selects and checks the value. - * - * @param key Key. - * @param expect Expected value. - */ - void CheckTestValue(int64_t key, const std::string& expect) - { - CheckTestValue(stmt, key, expect); - } - - /** - * Selects and checks the value. - * - * @param stmt Statement. - * @param key Key. - * @param expect Expected value. - */ - static void CheckTestValue(SQLHSTMT stmt, int64_t key, const std::string& expect) - { - // Just selecting everything to make sure everything is OK - SQLCHAR selectReq[] = "SELECT strField FROM TestType WHERE _key = ?"; - - char strField[1024] = { 0 }; - SQLLEN strFieldLen = 0; - - SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_CHAR, &strField, sizeof(strField), &strFieldLen); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_BIGINT, 0, 0, &key, 0, 0); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLExecDirect(stmt, selectReq, sizeof(selectReq)); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLFetch(stmt); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - BOOST_CHECK_EQUAL(std::string(strField, strFieldLen), expect); - - ret = SQLFetch(stmt); - - BOOST_CHECK_EQUAL(ret, SQL_NO_DATA); - - ret = SQLMoreResults(stmt); - - if (ret != SQL_NO_DATA) - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ResetStatement(stmt); - } - - /** - * Selects and checks that value is absent. - * - * @param key Key. - */ - void CheckNoTestValue(int64_t key) - { - CheckNoTestValue(stmt, key); - } - - /** - * Selects and checks that value is absent. - * - * @param stmt Statement. - * @param key Key. - */ - static void CheckNoTestValue(SQLHSTMT stmt, int64_t key) - { - // Just selecting everything to make sure everything is OK - SQLCHAR selectReq[] = "SELECT strField FROM TestType WHERE _key = ?"; - - char strField[1024] = { 0 }; - SQLLEN strFieldLen = 0; - - SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_CHAR, &strField, sizeof(strField), &strFieldLen); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_BIGINT, 0, 0, &key, 0, 0); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLExecDirect(stmt, selectReq, sizeof(selectReq)); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLFetch(stmt); - - BOOST_CHECK_EQUAL(ret, SQL_NO_DATA); - - if (ret != SQL_NO_DATA) - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLMoreResults(stmt); - - BOOST_CHECK_EQUAL(ret, SQL_NO_DATA); - - if (ret != SQL_NO_DATA) - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ResetStatement(stmt); - } - - /** - * Reset statement state. - */ - void ResetStatement() - { - ResetStatement(stmt); - } - - /** - * Reset statement state. - * - * @param stmt Statement. - */ - static void ResetStatement(SQLHSTMT stmt) - { - SQLRETURN ret = SQLFreeStmt(stmt, SQL_RESET_PARAMS); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - - ret = SQLFreeStmt(stmt, SQL_UNBIND); - - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_STMT, stmt); - } - - /** Node started during the test. */ - Ignite grid; -}; - -BOOST_FIXTURE_TEST_SUITE(TransactionTestSuite, TransactionTestSuiteFixture) - -BOOST_AUTO_TEST_CASE(TransactionConnectionCommit) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_COMMIT); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionConnectionRollbackInsert) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckNoTestValue(42); -} - -BOOST_AUTO_TEST_CASE(TransactionConnectionRollbackUpdate1) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - UpdateTestValue(42, "Other"); - - CheckTestValue(42, "Other"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionConnectionRollbackUpdate2) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_COMMIT); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckTestValue(42, "Some"); - - UpdateTestValue(42, "Other"); - - CheckTestValue(42, "Other"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionConnectionRollbackDelete1) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - DeleteTestValue(42); - - CheckNoTestValue(42); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionConnectionRollbackDelete2) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_COMMIT); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckTestValue(42, "Some"); - - DeleteTestValue(42); - - CheckNoTestValue(42); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionConnectionTxModeError) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache;nested_tx_mode=error"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - ret = ExecQuery("BEGIN"); - - BOOST_CHECK_EQUAL(ret, SQL_ERROR); -} - -BOOST_AUTO_TEST_CASE(TransactionConnectionTxModeIgnore) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache;nested_tx_mode=ignore"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - ret = ExecQuery("BEGIN"); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckNoTestValue(42); -} - -BOOST_AUTO_TEST_CASE(TransactionConnectionTxModeCommit) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache;nested_tx_mode=commit"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - ret = ExecQuery("BEGIN"); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - UpdateTestValue(42, "Other"); - - CheckTestValue(42, "Other"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionEnvironmentCommit) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_COMMIT); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionEnvironmentRollbackInsert) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - ret = SQLEndTran(SQL_HANDLE_ENV, env, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env); - - CheckNoTestValue(42); -} - -BOOST_AUTO_TEST_CASE(TransactionEnvironmentRollbackUpdate1) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - UpdateTestValue(42, "Other"); - - CheckTestValue(42, "Other"); - - ret = SQLEndTran(SQL_HANDLE_ENV, env, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionEnvironmentRollbackUpdate2) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_COMMIT); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env); - - CheckTestValue(42, "Some"); - - UpdateTestValue(42, "Other"); - - CheckTestValue(42, "Other"); - - ret = SQLEndTran(SQL_HANDLE_ENV, env, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionEnvironmentRollbackDelete1) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - DeleteTestValue(42); - - CheckNoTestValue(42); - - ret = SQLEndTran(SQL_HANDLE_ENV, env, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionEnvironmentRollbackDelete2) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - CheckTestValue(42, "Some"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_COMMIT); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env); - - CheckTestValue(42, "Some"); - - DeleteTestValue(42); - - CheckNoTestValue(42); - - ret = SQLEndTran(SQL_HANDLE_ENV, env, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionEnvironmentTxModeError) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache;nested_tx_mode=error"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - ret = ExecQuery("BEGIN"); - - BOOST_CHECK_EQUAL(ret, SQL_ERROR); -} - -BOOST_AUTO_TEST_CASE(TransactionEnvironmentTxModeIgnore) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache;nested_tx_mode=ignore"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - ret = ExecQuery("BEGIN"); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - ret = SQLEndTran(SQL_HANDLE_ENV, env, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env); - - CheckNoTestValue(42); -} - -BOOST_AUTO_TEST_CASE(TransactionEnvironmentTxModeCommit) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache;nested_tx_mode=commit"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - InsertTestValue(42, "Some"); - - ret = ExecQuery("BEGIN"); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - UpdateTestValue(42, "Other"); - - CheckTestValue(42, "Other"); - - ret = SQLEndTran(SQL_HANDLE_ENV, env, SQL_ROLLBACK); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_ENV, env); - - CheckTestValue(42, "Some"); -} - -BOOST_AUTO_TEST_CASE(TransactionVersionMismatchError) -{ - Connect("DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - InsertTestValue(1, "test_1"); - - SQLRETURN ret = SQLSetConnectAttr(dbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - CheckTestValue(1, "test_1"); - - SQLHDBC dbc2; - SQLHSTMT stmt2; - - Connect(dbc2, stmt2, "DRIVER={Apache Ignite};address=127.0.0.1:11110;schema=cache"); - - ret = SQLSetConnectAttr(dbc2, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc2); - - InsertTestValue(stmt2, 2, "test_2"); - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc2, SQL_COMMIT); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc2); - - CheckTestValue(stmt2, 1, "test_1"); - CheckTestValue(stmt2, 2, "test_2"); - - try - { - InsertTestValue(2, "test_2"); - - BOOST_FAIL("Exception is expected"); - } - catch (OdbcClientError& err) - { - BOOST_CHECK(err.message.find("Cannot serialize transaction due to write conflict") != err.message.npos); - BOOST_CHECK_EQUAL(err.sqlstate, "40001"); - - ResetStatement(stmt); - } - - try - { - CheckTestValue(1, "test_1"); - - BOOST_FAIL("Exception is expected"); - } - catch (OdbcClientError& err) - { - BOOST_CHECK(err.message.find("Transaction is already completed") != err.message.npos); - BOOST_CHECK_EQUAL(err.sqlstate, "25000"); - - ResetStatement(stmt); - } - - ret = SQLEndTran(SQL_HANDLE_DBC, dbc, SQL_ROLLBACK); - ODBC_THROW_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - SQLFreeHandle(SQL_HANDLE_STMT, stmt2); - - SQLDisconnect(dbc2); - - SQLFreeHandle(SQL_HANDLE_DBC, dbc2); -} - -BOOST_AUTO_TEST_SUITE_END()