Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 903AA200D29 for ; Thu, 26 Oct 2017 12:32:50 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8EBDE160BF2; Thu, 26 Oct 2017 10:32:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 85F591609E8 for ; Thu, 26 Oct 2017 12:32:49 +0200 (CEST) Received: (qmail 56085 invoked by uid 500); 26 Oct 2017 10:32:48 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 56076 invoked by uid 99); 26 Oct 2017 10:32:48 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Oct 2017 10:32:48 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8D813DFAE4; Thu, 26 Oct 2017 10:32:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Message-Id: <45c1748e1f23436582c934713b512024@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: ignite-3478 Tests with persistence enabled. Date: Thu, 26 Oct 2017 10:32:48 +0000 (UTC) archived-at: Thu, 26 Oct 2017 10:32:50 -0000 Repository: ignite Updated Branches: refs/heads/ignite-3478 2a2a2c459 -> 980517fb1 ignite-3478 Tests with persistence enabled. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/980517fb Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/980517fb Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/980517fb Branch: refs/heads/ignite-3478 Commit: 980517fb1a905447471b53a8fdae1eea46331c7d Parents: 2a2a2c4 Author: sboikov Authored: Thu Oct 26 13:11:02 2017 +0300 Committer: sboikov Committed: Thu Oct 26 13:32:38 2017 +0300 ---------------------------------------------------------------------- .../cache/mvcc/CacheCoordinatorsProcessor.java | 25 +++++++++++------ .../cache/mvcc/CacheMvccAbstractTest.java | 28 ++++++++++++++++---- .../cache/mvcc/CacheMvccClusterRestartTest.java | 20 +++++++++----- .../cache/mvcc/CacheMvccTransactionsTest.java | 25 +++++++++++++++-- .../cache/mvcc/CacheMvccSqlQueriesTest.java | 18 +++++++++++++ 5 files changed, 94 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/980517fb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsProcessor.java index 07e30d8..c88ca1c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/CacheCoordinatorsProcessor.java @@ -255,6 +255,8 @@ public class CacheCoordinatorsProcessor extends GridProcessorAdapter { if (evtType == EVT_NODE_METRICS_UPDATED || evtType == EVT_DISCOVERY_CUSTOM_EVT) return; + // TODO: IGNITE-3478 handle inactive state. + MvccCoordinator crd; if (evtType == EVT_NODE_SEGMENTED || evtType == EVT_CLIENT_NODE_DISCONNECTED) @@ -269,7 +271,8 @@ public class CacheCoordinatorsProcessor extends GridProcessorAdapter { if (crdC != null) { crdNode = crdC.apply(nodes); - log.info("Assigned coordinator using test closure: " + crd); + if (log.isInfoEnabled()) + log.info("Assigned coordinator using test closure: " + crd); } else { // Expect nodes are sorted by order. @@ -282,11 +285,12 @@ public class CacheCoordinatorsProcessor extends GridProcessorAdapter { } } - crd = crdNode != null ? new - MvccCoordinator(crdNode.id(), coordinatorVersion(topVer), new AffinityTopologyVersion(topVer, 0)) : null; + crd = crdNode != null ? new MvccCoordinator(crdNode.id(), coordinatorVersion(topVer), new AffinityTopologyVersion(topVer, 0)) : null; - if (crd != null) - log.info("Assigned mvcc coordinator [crd=" + crd + ", crdNode=" + crdNode +']'); + if (crd != null) { + if (log.isInfoEnabled()) + log.info("Assigned mvcc coordinator [crd=" + crd + ", crdNode=" + crdNode + ']'); + } else U.warn(log, "New mvcc coordinator was not assigned [topVer=" + topVer + ']'); } @@ -1130,10 +1134,15 @@ public class CacheCoordinatorsProcessor extends GridProcessorAdapter { { assert ctx.localNodeId().equals(curCrd.nodeId()); - log.info("Initialize local node as mvcc coordinator [node=" + ctx.localNodeId() + - ", topVer=" + topVer + ']'); + MvccCoordinator crd = discoCache.mvccCoordinator(); - crdVer = coordinatorVersion(topVer.topologyVersion()); + assert crd != null; + + crdVer = crd.coordinatorVersion(); + + log.info("Initialize local node as mvcc coordinator [node=" + ctx.localNodeId() + + ", topVer=" + topVer + + ", crdVer=" + crdVer + ']'); prevCrdQueries.init(activeQueries, discoCache, ctx.discovery()); http://git-wip-us.apache.org/repos/asf/ignite/blob/980517fb/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java index 1949cd2..2065784 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java @@ -45,8 +45,10 @@ 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.MemoryConfiguration; +import org.apache.ignite.configuration.WALMode; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.TestRecordingCommunicationSpi; @@ -93,7 +95,7 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest { static final long DFLT_TEST_TIME = 30_000; /** */ - protected static final int PAGE_SIZE = MemoryConfiguration.DFLT_PAGE_SIZE; + protected static final int PAGE_SIZE = DataStorageConfiguration.DFLT_PAGE_SIZE; /** */ protected static final int SRVS = 4; @@ -107,6 +109,9 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest { /** */ protected String nodeAttr; + /** */ + protected boolean persistence; + /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); @@ -125,11 +130,20 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest { if (nodeAttr != null) cfg.setUserAttributes(F.asMap(nodeAttr, true)); - MemoryConfiguration memCfg = new MemoryConfiguration(); + DataStorageConfiguration storageCfg = new DataStorageConfiguration(); + + storageCfg.setWalMode(WALMode.LOG_ONLY); + storageCfg.setPageSize(PAGE_SIZE); + + DataRegionConfiguration regionCfg = new DataRegionConfiguration(); - memCfg.setPageSize(PAGE_SIZE); + regionCfg.setPersistenceEnabled(persistence); - cfg.setMemoryConfiguration(memCfg); + storageCfg.setDefaultDataRegionConfiguration(regionCfg); + + cfg.setDataStorageConfiguration(storageCfg); + + cfg.setConsistentId(gridName); return cfg; } @@ -144,6 +158,8 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest { super.beforeTest(); CacheCoordinatorsProcessor.coordinatorAssignClosure(null); + + GridTestUtils.deleteDbFiles(); } /** {@inheritDoc} */ @@ -157,6 +173,8 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest { CacheCoordinatorsProcessor.coordinatorAssignClosure(null); + GridTestUtils.deleteDbFiles(); + super.afterTest(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/980517fb/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java index ed7b62d..2078497 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClusterRestartTest.java @@ -23,9 +23,9 @@ 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.MemoryConfiguration; -import org.apache.ignite.configuration.PersistentStoreConfiguration; import org.apache.ignite.configuration.WALMode; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; @@ -56,13 +56,19 @@ public class CacheMvccClusterRestartTest extends GridCommonAbstractTest { ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER); - MemoryConfiguration memCfg = new MemoryConfiguration(); - memCfg.setPageSize(1024); - memCfg.setDefaultMemoryPolicySize(100 * 1024 * 1024); + DataStorageConfiguration storageCfg = new DataStorageConfiguration(); - cfg.setMemoryConfiguration(memCfg); + storageCfg.setWalMode(WALMode.LOG_ONLY); + storageCfg.setPageSize(1024); - cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration().setWalMode(WALMode.LOG_ONLY)); + DataRegionConfiguration regionCfg = new DataRegionConfiguration(); + + regionCfg.setPersistenceEnabled(true); + regionCfg.setMaxSize(100 * 1024 * 1024); + + storageCfg.setDefaultDataRegionConfiguration(regionCfg); + + cfg.setDataStorageConfiguration(storageCfg); return cfg; } http://git-wip-us.apache.org/repos/asf/ignite/blob/980517fb/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java ---------------------------------------------------------------------- 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 index df9f21e..db07b04 100644 --- 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 @@ -300,13 +300,13 @@ public class CacheMvccTransactionsTest extends CacheMvccAbstractTest { client = true; - Ignite srv0 = startGrid(SRVS); + Ignite client = startGrid(SRVS); final int NODES = SRVS + 1; CacheConfiguration ccfg = cacheConfiguration(PARTITIONED, FULL_SYNC, 1, 512); - srv0.createCache(ccfg); + client.createCache(ccfg); final long stopTime = System.currentTimeMillis() + 5000; @@ -1300,6 +1300,15 @@ public class CacheMvccTransactionsTest extends CacheMvccAbstractTest { /** * @throws Exception If failed. */ + public void testPutAllGetAll_ClientServer_Backups0_Persistence() throws Exception { + persistence = true; + + testPutAllGetAll_ClientServer_Backups0(); + } + + /** + * @throws Exception If failed. + */ public void testPutAllGetAll_ClientServer_Backups1() throws Exception { putAllGetAll(null, 4, 2, 1, 64); } @@ -3131,6 +3140,9 @@ public class CacheMvccTransactionsTest extends CacheMvccAbstractTest { for (int i = 0; i < 4; i++) { startGrid(i); + if (persistence && i == 0) + ignite(i).active(true); + checkCoordinatorsConsistency(i + 1); } @@ -3154,6 +3166,15 @@ public class CacheMvccTransactionsTest extends CacheMvccAbstractTest { } /** + * @throws Exception If failed. + */ + public void testMvccCoordinatorInfoConsistency_Persistence() throws Exception { + persistence = true; + + testMvccCoordinatorInfoConsistency(); + } + + /** * @param expNodes Expected nodes number. */ private void checkCoordinatorsConsistency(@Nullable Integer expNodes) { http://git-wip-us.apache.org/repos/asf/ignite/blob/980517fb/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesTest.java index e77a3f1..5543933 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSqlQueriesTest.java @@ -80,6 +80,15 @@ public class CacheMvccSqlQueriesTest extends CacheMvccAbstractTest { /** * @throws Exception If failed. */ + public void testAccountsTxSql_SingleNode_Persistence() throws Exception { + persistence = true; + + testAccountsTxSql_SingleNode(); + } + + /** + * @throws Exception If failed. + */ public void testAccountsTxSumSql_SingleNode() throws Exception { accountsTxReadAll(1, 0, 0, 64, new InitIndexing(Integer.class, MvccTestAccount.class), false, ReadMode.SQL_SUM); } @@ -94,6 +103,15 @@ public class CacheMvccSqlQueriesTest extends CacheMvccAbstractTest { /** * @throws Exception If failed. */ + public void testAccountsTxSql_WithRemoves_SingleNode_Persistence() throws Exception { + persistence = true; + + testAccountsTxSql_WithRemoves_SingleNode(); + } + + /** + * @throws Exception If failed. + */ public void testAccountsTxSql_ClientServer_Backups2() throws Exception { accountsTxReadAll(4, 2, 2, 64, new InitIndexing(Integer.class, MvccTestAccount.class), false, ReadMode.SQL_ALL); }