ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [08/11] ignite git commit: IGNITE-5267 - Moved WAL system properties to WAL configuration
Date Thu, 08 Jun 2017 16:11:26 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/cd4d0400/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsMultiNodePutGetRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsMultiNodePutGetRestartTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsMultiNodePutGetRestartTest.java
new file mode 100644
index 0000000..41b1b29
--- /dev/null
+++ b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsMultiNodePutGetRestartTest.java
@@ -0,0 +1,242 @@
+/*
+ * 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.cache.database.db;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.List;
+import java.util.UUID;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.BinaryConfiguration;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.configuration.MemoryConfiguration;
+
+/**
+ *
+ */
+public class IgnitePdsMultiNodePutGetRestartTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final int GRID_CNT = 3;
+
+    /** */
+    private static final String CACHE_NAME = "cache";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        MemoryConfiguration dbCfg = new MemoryConfiguration();
+
+        MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+
+        memPlcCfg.setName("dfltMemPlc");
+        memPlcCfg.setInitialSize(100 * 1024 * 1024);
+        memPlcCfg.setMaxSize(100 * 1024 * 1024);
+
+        dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+        dbCfg.setMemoryPolicies(memPlcCfg);
+
+        cfg.setMemoryConfiguration(dbCfg);
+
+        CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
+
+        ccfg.setIndexedTypes(Integer.class, DbValue.class);
+
+        ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
+
+        ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
+
+        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+        cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
+
+        cfg.setMarshaller(null);
+
+        BinaryConfiguration bCfg = new BinaryConfiguration();
+
+        bCfg.setCompactFooter(false);
+
+        cfg.setBinaryConfiguration(bCfg);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+
+        super.beforeTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testPutGetSimple() throws Exception {
+        String home = U.getIgniteHome();
+
+        File allocPath = new File(home, "work/db/" + UUID.randomUUID());
+
+        allocPath.mkdirs();
+
+        info(">>> Will use path: " + allocPath);
+
+        startGrids(GRID_CNT);
+
+        try {
+            IgniteEx ig = grid(0);
+
+            checkPutGetSql(ig, true);
+        }
+        finally {
+            stopAllGrids();
+        }
+
+        info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+        info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+        info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+
+        startGrids(GRID_CNT);
+
+        try {
+            IgniteEx ig = grid(0);
+
+            checkPutGetSql(ig, false);
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @param ig Ig.
+     * @param write Write.
+     */
+    private void checkPutGetSql(IgniteEx ig, boolean write) {
+        IgniteCache<Integer, DbValue> cache = ig.cache(CACHE_NAME);
+
+        if (write) {
+            try (IgniteDataStreamer<Object, Object> streamer = ig.dataStreamer(CACHE_NAME)) {
+                for (int i = 0; i < 10_000; i++)
+                    streamer.addData(i, new DbValue(i, "value-" + i, i));
+            }
+        }
+
+        List<List<?>> res = cache.query(new SqlFieldsQuery("select ival from dbvalue where ival < ? order by ival asc")
+                .setArgs(10_000)).getAll();
+
+        assertEquals(10_000, res.size());
+
+        for (int i = 0; i < 10_000; i++) {
+            assertEquals(1, res.get(i).size());
+            assertEquals(i, res.get(i).get(0));
+        }
+
+        assertEquals(1, cache.query(new SqlFieldsQuery("select lval from dbvalue where ival = 7899")).getAll().size());
+        assertEquals(5000, cache.query(new SqlFieldsQuery("select lval from dbvalue where ival >= 5000 and ival < 10000"))
+                .getAll().size());
+
+        for (int i = 0; i < 10_000; i++)
+            assertEquals(new DbValue(i, "value-" + i, i), cache.get(i));
+    }
+
+    /**
+     *
+     */
+    private static class DbValue implements Serializable {
+        /** */
+        @QuerySqlField(index = true)
+        private int iVal;
+
+        /** */
+        @QuerySqlField(index = true)
+        private String sVal;
+
+        /** */
+        @QuerySqlField
+        private long lVal;
+
+        /**
+         * @param iVal Integer value.
+         * @param sVal String value.
+         * @param lVal Long value.
+         */
+        public DbValue(int iVal, String sVal, long lVal) {
+            this.iVal = iVal;
+            this.sVal = sVal;
+            this.lVal = lVal;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            DbValue dbVal = (DbValue)o;
+
+            return iVal == dbVal.iVal && lVal == dbVal.lVal &&
+                !(sVal != null ? !sVal.equals(dbVal.sVal) : dbVal.sVal != null);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            int res = iVal;
+
+            res = 31 * res + (sVal != null ? sVal.hashCode() : 0);
+            res = 31 * res + (int)(lVal ^ (lVal >>> 32));
+
+            return res;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(DbValue.class, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cd4d0400/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsPageEvictionDuringPartitionClearTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
new file mode 100644
index 0000000..b4ffde8
--- /dev/null
+++ b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsPageEvictionDuringPartitionClearTest.java
@@ -0,0 +1,174 @@
+/*
+ * 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.cache.database.db;
+
+import java.util.concurrent.Callable;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.cache.database.GridCacheDatabaseSharedManager;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class IgnitePdsPageEvictionDuringPartitionClearTest extends GridCommonAbstractTest {
+    /** */
+    public static final String CACHE_NAME = "cache";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME)
+            .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+            .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
+            .setAffinity(new RendezvousAffinityFunction(false, 128))
+            .setRebalanceMode(CacheRebalanceMode.SYNC)
+            .setBackups(1);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        // Intentionally set small page cache size.
+
+        MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+
+        memPlcCfg.setInitialSize(70 * 1024 * 1024);
+        memPlcCfg.setMaxSize(70 * 1024 * 1024);
+
+        memPlcCfg.setName("dfltMemPlc");
+
+        MemoryConfiguration memCfg = new MemoryConfiguration();
+
+        memCfg.setMemoryPolicies(memPlcCfg);
+
+        memCfg.setDefaultMemoryPolicyName(memPlcCfg.getName());
+
+        cfg.setMemoryConfiguration(memCfg);
+
+        cfg.setPersistentStoreConfiguration(
+            new PersistentStoreConfiguration()
+                .setWalMode(WALMode.LOG_ONLY)
+        );
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return 20 * 60 * 1000;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        System.setProperty(GridCacheDatabaseSharedManager.IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC, "true");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        System.clearProperty(GridCacheDatabaseSharedManager.IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC);
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testPageEvictionOnNodeStart() throws Exception {
+        for (int r = 0; r < 3; r++) {
+            deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+
+            startGrids(2);
+
+            try {
+                Ignite ig = ignite(0);
+
+                IgniteDataStreamer<Object, Object> streamer = ig.dataStreamer(CACHE_NAME);
+
+                for (int i = 0; i < 300_000; i++) {
+                    streamer.addData(i, new TestValue(i));
+
+                    if (i > 0 && i % 10_000 == 0)
+                        info("Done: " + i);
+                }
+
+                streamer.flush();
+
+                IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        IgniteEx ig = startGrid(2);
+
+                        info(">>>>>>>>>>>");
+                        info(">>>>>>>>>>>");
+                        info(">>>>>>>>>>>");
+
+                        return ig;
+                    }
+                });
+
+                for (int i = 500_000; i < 1_000_000; i++) {
+                    streamer.addData(i, new TestValue(i));
+
+                    if (i > 0 && i % 10_000 == 0) {
+                        info("Done: " + i);
+
+                        U.sleep(1000);
+                    }
+                }
+
+                streamer.close();
+
+                fut.get();
+            }
+            finally {
+                stopAllGrids();
+
+                deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+            }
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestValue {
+        /** */
+        private int id;
+
+        /** */
+        private byte[] payload = new byte[512];
+
+        /**
+         * @param id ID.
+         */
+        private TestValue(int id) {
+            this.id = id;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cd4d0400/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsPageEvictionTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsPageEvictionTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsPageEvictionTest.java
new file mode 100644
index 0000000..d48617d
--- /dev/null
+++ b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsPageEvictionTest.java
@@ -0,0 +1,239 @@
+/*
+ * 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.cache.database.db;
+
+import java.io.Serializable;
+import java.util.List;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+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.MemoryConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class IgnitePdsPageEvictionTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** Test entry count. */
+    public static final int ENTRY_CNT = 1_000_000;
+
+    /** Cache name. */
+    private static final String CACHE_NAME = "cache";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        MemoryConfiguration memCfg = new MemoryConfiguration();
+
+        memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
+
+        memCfg.setPageSize(1024);
+
+        MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+
+        memPlcCfg.setName("dfltMemPlc");
+        memPlcCfg.setInitialSize(50 * 1024 * 1024);
+        memPlcCfg.setMaxSize(50 * 1024 * 1024);
+
+        memCfg.setMemoryPolicies(memPlcCfg);
+        memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+
+        cfg.setMemoryConfiguration(memCfg);
+
+        CacheConfiguration<DbKey, DbValue> ccfg = new CacheConfiguration<>(CACHE_NAME);
+
+        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
+        ccfg.setIndexedTypes(DbKey.class, DbValue.class);
+        ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
+
+        cfg.setCacheConfiguration(ccfg);
+
+        cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
+
+        cfg.setDiscoverySpi(
+            new TcpDiscoverySpi()
+                .setIpFinder(IP_FINDER)
+        );
+
+        cfg.setMarshaller(null);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+
+        stopAllGrids();
+
+        startGrids(1);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testPageEvictionSql() throws Exception {
+        IgniteEx ig = grid(0);
+
+        try (IgniteDataStreamer<DbKey, DbValue> streamer = ig.dataStreamer(CACHE_NAME)) {
+            for (int i = 0; i < ENTRY_CNT; i++) {
+                streamer.addData(new DbKey(i), new DbValue(i, "value-" + i, Long.MAX_VALUE - i));
+
+                if (i > 0 && i % 10_000 == 0)
+                    info("Done put: " + i);
+            }
+        }
+
+        IgniteCache<DbKey, DbValue> cache = ignite(0).cache(CACHE_NAME);
+
+        for (int i = 0; i < ENTRY_CNT; i++) {
+            assertEquals(Long.MAX_VALUE - i, cache.get(new DbKey(i)).lVal);
+
+            if (i > 0 && i % 10_000 == 0)
+                info("Done get: " + i);
+        }
+
+        for (int i = 0; i < ENTRY_CNT; i++) {
+            List<List<?>> rows = cache.query(
+                new SqlFieldsQuery("select lVal from DbValue where iVal=?").setArgs(i)
+            ).getAll();
+
+            assertEquals(1, rows.size());
+            assertEquals(Long.MAX_VALUE - i, rows.get(0).get(0));
+
+            if (i > 0 && i % 10_000 == 0)
+                info("Done SQL query: " + i);
+        }
+    }
+
+    /**
+     *
+     */
+    private static class DbKey implements Serializable {
+        /** */
+        private int val;
+
+        /**
+         * @param val Value.
+         */
+        private DbKey(int val) {
+            this.val = val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || !(o instanceof DbKey))
+                return false;
+
+            DbKey key = (DbKey)o;
+
+            return val == key.val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return val;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class DbValue implements Serializable {
+        /** */
+        @QuerySqlField(index = true)
+        private int iVal;
+
+        /** */
+        @QuerySqlField(index = true)
+        private String sVal;
+
+        /** */
+        @QuerySqlField
+        private long lVal;
+
+        /**
+         * @param iVal Integer value.
+         * @param sVal String value.
+         * @param lVal Long value.
+         */
+        private DbValue(int iVal, String sVal, long lVal) {
+            this.iVal = iVal;
+            this.sVal = sVal;
+            this.lVal = lVal;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            DbValue dbVal = (DbValue)o;
+
+            return iVal == dbVal.iVal && lVal == dbVal.lVal &&
+                !(sVal != null ? !sVal.equals(dbVal.sVal) : dbVal.sVal != null);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            int res = iVal;
+
+            res = 31 * res + (sVal != null ? sVal.hashCode() : 0);
+            res = 31 * res + (int)(lVal ^ (lVal >>> 32));
+
+            return res;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(DbValue.class, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cd4d0400/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsRebalancingOnNotStableTopologyTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
new file mode 100644
index 0000000..dfe174a
--- /dev/null
+++ b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsRebalancingOnNotStableTopologyTest.java
@@ -0,0 +1,215 @@
+/*
+ * 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.cache.database.db;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+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.cache.PartitionLossPolicy;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy;
+
+/**
+ * We start writing to unstable cluster.
+ * After that we start killing node.
+ * There will be entries in WAL which belongs to evicted partitions.
+ * We should ignore them (not throw exceptions). This point is tested.
+ */
+public class IgnitePdsRebalancingOnNotStableTopologyTest extends GridCommonAbstractTest {
+    /** Checkpoint frequency. */
+    private static final long CHECKPOINT_FREQUENCY = 2_000_000;
+
+    /** Cluster size. */
+    private static final int CLUSTER_SIZE = 5;
+
+    /** */
+    private static final String CACHE_NAME = "cache1";
+
+    /**
+     * @throws Exception When fails.
+     */
+    public void test() throws Exception {
+        Ignite ex = startGrid(0);
+
+        startGrid(1);
+
+        final CountDownLatch startLatch = new CountDownLatch(1);
+        final CountDownLatch doneLatch = new CountDownLatch(1);
+
+        final Ignite ex1 = ex;
+
+        final AtomicBoolean stop = new AtomicBoolean();
+        final AtomicInteger keyCnt = new AtomicInteger();
+
+        Thread thread = new Thread(new Runnable() {
+            @Override public void run() {
+                ex1.active(true);
+
+                try {
+                    checkTopology(2);
+
+                    startLatch.countDown();
+
+                    IgniteCache<Object, Object> cache1 = ex1.cache(CACHE_NAME);
+
+                    int key = keyCnt.get();
+
+                    while (!stop.get()) {
+                        if (key > 0 && (key % 500 == 0)) {
+                            U.sleep(5);
+
+                            System.out.println("key = " + key);
+                        }
+
+                        cache1.put(key, -key);
+
+                        key = keyCnt.incrementAndGet();
+                    }
+                }
+                catch (Throwable th) {
+                    th.printStackTrace();
+                }
+
+                doneLatch.countDown();
+            }
+        });
+
+        thread.setName("Data-Loader");
+        thread.start();
+
+        startLatch.await(60, TimeUnit.SECONDS);
+
+        for (int i = 2; i < CLUSTER_SIZE; i++) {
+            startGrid(i);
+
+            U.sleep(5000);
+        }
+
+        U.sleep(10000);
+
+        IgniteProcessProxy.kill("db.RebalancingOnNotStableTopologyTest2");
+
+        Thread.sleep(5000);
+
+        IgniteProcessProxy.kill("db.RebalancingOnNotStableTopologyTest1");
+
+        assert doneLatch.getCount() > 0;
+
+        stop.set(true);
+
+        doneLatch.await(600, TimeUnit.SECONDS);
+
+        IgniteProcessProxy.killAll();
+
+        stopAllGrids();
+
+        //start cluster. it will cause memory restoration and reading WAL.
+        ex = startGrids(CLUSTER_SIZE);
+
+        ex.active(true);
+
+        checkTopology(CLUSTER_SIZE);
+
+        IgniteCache<Object, Object> cache1 = ex.cache(CACHE_NAME);
+
+        assert keyCnt.get() > 0;
+
+        for (int i = 0; i < keyCnt.get(); i++)
+            assertEquals(-i, cache1.get(i));
+
+        System.out.println("Test finished with total keys count = " + keyCnt.get());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setActiveOnStart(false);
+
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(CACHE_NAME);
+
+        ccfg.setPartitionLossPolicy(PartitionLossPolicy.READ_ONLY_SAFE);
+        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        ccfg.setCacheMode(CacheMode.PARTITIONED);
+        ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
+        ccfg.setBackups(2);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        cfg.setPersistentStoreConfiguration(
+            new PersistentStoreConfiguration()
+                .setCheckpointingFrequency(CHECKPOINT_FREQUENCY)
+        );
+
+        MemoryConfiguration memCfg = new MemoryConfiguration();
+
+        MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+
+        memPlcCfg.setName("dfltMemPlc");
+        memPlcCfg.setInitialSize(200 * 1024 * 1024);
+        memPlcCfg.setMaxSize(200 * 1024 * 1024);
+
+        memCfg.setMemoryPolicies(memPlcCfg);
+        memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+
+        cfg.setMemoryConfiguration(memCfg);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean isMultiJvm() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean checkTopology() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        stopAllGrids();
+
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return TimeUnit.MINUTES.toMillis(10);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cd4d0400/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsTransactionsHangTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsTransactionsHangTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsTransactionsHangTest.java
new file mode 100644
index 0000000..0007a3b
--- /dev/null
+++ b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsTransactionsHangTest.java
@@ -0,0 +1,304 @@
+/*
+ * 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.cache.database.db;
+
+import java.util.Random;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+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.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.BinaryConfiguration;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.TransactionConfiguration;
+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.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.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionIsolation;
+import org.jsr166.LongAdder8;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ * Checks that transactions don't hang during checkpoint creation.
+ */
+public class IgnitePdsTransactionsHangTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** Page cache size. */
+    private static final int PAGE_CACHE_SIZE = 512;
+
+    /** Page size. */
+    private static final Integer PAGE_SIZE = 16;
+
+    /** Cache name. */
+    private static final String CACHE_NAME = "IgnitePdsTransactionsHangTest";
+
+    /** Number of insert threads. */
+    public static final int THREADS_CNT = 32;
+
+    /** Warm up period, seconds. */
+    public static final int WARM_UP_PERIOD = 20;
+
+    /** Duration. */
+    public static final int DURATION = 180;
+
+    /** Maximum count of inserted keys. */
+    public static final int MAX_KEY_COUNT = 500_000;
+
+    /** Checkpoint frequency. */
+    public static final long CHECKPOINT_FREQUENCY = 20_000;
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return Long.MAX_VALUE;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+        discoSpi.setIpFinder(IP_FINDER);
+        cfg.setDiscoverySpi(discoSpi);
+
+        BinaryConfiguration binaryCfg = new BinaryConfiguration();
+        binaryCfg.setCompactFooter(false);
+        cfg.setBinaryConfiguration(binaryCfg);
+
+        cfg.setPeerClassLoadingEnabled(true);
+
+        TcpCommunicationSpi tcpCommSpi = new TcpCommunicationSpi();
+
+        tcpCommSpi.setSharedMemoryPort(-1);
+        cfg.setCommunicationSpi(tcpCommSpi);
+
+        TransactionConfiguration txCfg = new TransactionConfiguration();
+
+        txCfg.setDefaultTxIsolation(TransactionIsolation.READ_COMMITTED);
+
+        cfg.setTransactionConfiguration(txCfg);
+
+        cfg.setPersistentStoreConfiguration(
+            new PersistentStoreConfiguration()
+                .setWalHistorySize(1)
+                .setCheckpointingFrequency(CHECKPOINT_FREQUENCY)
+        );
+
+        MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+
+        memPlcCfg.setName("dfltMemPlc");
+        memPlcCfg.setInitialSize(PAGE_CACHE_SIZE * 1024 * 1024);
+        memPlcCfg.setMaxSize(PAGE_CACHE_SIZE * 1024 * 1024);
+
+        MemoryConfiguration memCfg = new MemoryConfiguration();
+
+        memCfg.setMemoryPolicies(memPlcCfg);
+        memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+
+        memCfg.setPageSize(PAGE_SIZE * 1024);
+
+        cfg.setMemoryConfiguration(memCfg);
+
+        return cfg;
+    }
+
+    /**
+     * Creates cache configuration.
+     *
+     * @return Cache configuration.
+     * */
+    private CacheConfiguration getCacheConfiguration() {
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setName(CACHE_NAME);
+        ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        ccfg.setAffinity(new RendezvousAffinityFunction(false, 64 * 4));
+        ccfg.setReadFromBackup(true);
+
+        ccfg.setCacheMode(CacheMode.PARTITIONED);
+
+        return ccfg;
+    }
+
+    /**
+     * Copied from customers benchmark.
+     *
+     * @throws Exception If failed.
+     * */
+    public void testTransactionsDontHang() throws Exception {
+        try {
+            final Ignite g = startGrids(2);
+
+            g.getOrCreateCache(getCacheConfiguration());
+
+            ExecutorService threadPool = Executors.newFixedThreadPool(THREADS_CNT);
+            final CyclicBarrier cyclicBarrier = new CyclicBarrier(THREADS_CNT);
+
+            final AtomicBoolean interrupt = new AtomicBoolean(false);
+            final LongAdder8 operationCnt = new LongAdder8();
+
+            final IgniteCache<Long, TestEntity> cache = g.cache(CACHE_NAME);
+
+            for (int i = 0; i < THREADS_CNT; i++) {
+                threadPool.submit(new Runnable() {
+                    @Override public void run() {
+                        try {
+                            ThreadLocalRandom locRandom = ThreadLocalRandom.current();
+
+                            cyclicBarrier.await();
+
+                            while (!interrupt.get()) {
+                                long randomKey = locRandom.nextLong(MAX_KEY_COUNT);
+
+                                TestEntity entity = TestEntity.newTestEntity(locRandom);
+
+                                try (Transaction tx = g.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                                    cache.put(randomKey, entity);
+
+                                    tx.commit();
+                                }
+
+                                operationCnt.increment();
+                            }
+                        }
+                        catch (Throwable e) {
+                            System.out.println(e.toString());
+
+                            throw new RuntimeException(e);
+                        }
+                    }
+                });
+            }
+
+            long stopTime = System.currentTimeMillis() + DURATION * 1000;
+            long totalOperations = 0;
+            int periods = 0;
+            long max = Long.MIN_VALUE, min = Long.MAX_VALUE;
+
+            while (System.currentTimeMillis() < stopTime) {
+                U.sleep(1000);
+
+                long sum = operationCnt.sumThenReset();
+                periods++;
+
+                if (periods > WARM_UP_PERIOD) {
+                    totalOperations += sum;
+
+                    max = Math.max(max, sum);
+                    min = Math.min(min, sum);
+
+                    System.out.println("Operation count: " + sum + " min=" + min + " max=" + max + " avg=" + totalOperations / (periods - WARM_UP_PERIOD));
+                }
+            }
+
+            interrupt.set(true);
+
+            threadPool.shutdown();
+            System.out.println("Test complete");
+
+            threadPool.awaitTermination(getTestTimeout(), TimeUnit.MILLISECONDS);
+
+            IgniteTxManager tm = internalCache(cache).context().tm();
+
+            assertEquals("There are still active transactions", 0, tm.activeTransactions().size());
+        } finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * Entity for test.
+     * */
+    public static class TestEntity {
+        /** String value. */
+        private String strVal;
+
+        /** Long value. */
+        private Long longVal;
+
+        /** Int value. */
+        private int intVal;
+
+        /**
+         * @param strVal String value.
+         */
+        public void setStrVal(String strVal) {
+            this.strVal = strVal;
+        }
+
+        /**
+         * @param longVal Long value.
+         */
+        public void setLongVal(Long longVal) {
+            this.longVal = longVal;
+        }
+
+        /**
+         * @param intVal Integer value.
+         */
+        public void setIntVal(int intVal) {
+            this.intVal = intVal;
+        }
+
+        /**
+         * Creates test entity with random values.
+         *
+         * @param random Random seq generator.
+         * @return new test entity
+         * */
+        private static TestEntity newTestEntity(Random random) {
+            TestEntity entity = new TestEntity();
+
+            entity.setLongVal((long) random.nextInt(1_000));
+            entity.setIntVal(random.nextInt(1_000));
+            entity.setStrVal("test" + random.nextInt(1_000));
+
+            return entity;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cd4d0400/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsWholeClusterRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsWholeClusterRestartTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsWholeClusterRestartTest.java
new file mode 100644
index 0000000..576b40e
--- /dev/null
+++ b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/IgnitePdsWholeClusterRestartTest.java
@@ -0,0 +1,165 @@
+/*
+ * 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.cache.database.db;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.checkpoint.noop.NoopCheckpointSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class IgnitePdsWholeClusterRestartTest extends GridCommonAbstractTest {
+    /** */
+    private static final int GRID_CNT = 5;
+
+    /** */
+    private static final int ENTRIES_COUNT = 1_000;
+
+    /** */
+    public static final String CACHE_NAME = "cache1";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        MemoryConfiguration dbCfg = new MemoryConfiguration();
+
+        MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+
+        memPlcCfg.setName("dfltMemPlc");
+        memPlcCfg.setInitialSize(100 * 1024 * 1024);
+        memPlcCfg.setMaxSize(100 * 1024 * 1024);
+
+        dbCfg.setMemoryPolicies(memPlcCfg);
+        dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+
+        cfg.setMemoryConfiguration(dbCfg);
+
+        CacheConfiguration ccfg1 = new CacheConfiguration();
+
+        ccfg1.setName(CACHE_NAME);
+        ccfg1.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+        ccfg1.setRebalanceMode(CacheRebalanceMode.SYNC);
+        ccfg1.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        ccfg1.setAffinity(new RendezvousAffinityFunction(false, 32));
+        ccfg1.setBackups(2);
+
+        cfg.setLateAffinityAssignment(false);
+        cfg.setActiveOnStart(false);
+
+        // To avoid hostname lookup on start.
+        cfg.setCheckpointSpi(new NoopCheckpointSpi());
+
+        cfg.setCacheConfiguration(ccfg1);
+
+        cfg.setPersistentStoreConfiguration(
+            new PersistentStoreConfiguration()
+                .setWalMode(WALMode.LOG_ONLY)
+        );
+
+        cfg.setConsistentId(gridName);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        stopAllGrids();
+
+        deleteWorkFiles();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        deleteWorkFiles();
+    }
+
+    /**
+     * @throws IgniteCheckedException If failed.
+     */
+    private void deleteWorkFiles() throws IgniteCheckedException {
+        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testRestarts() throws Exception {
+        startGrids(GRID_CNT);
+
+        ignite(0).active(true);
+
+        awaitPartitionMapExchange();
+
+        try (IgniteDataStreamer<Object, Object> ds = ignite(0).dataStreamer(CACHE_NAME)) {
+            for (int i = 0; i < ENTRIES_COUNT; i++)
+                ds.addData(i, i);
+        }
+
+        stopAllGrids();
+
+        List<Integer> idxs = new ArrayList<>();
+
+        for (int i = 0; i < GRID_CNT; i++)
+            idxs.add(i);
+
+        for (int r = 0; r < 10; r++) {
+            Collections.shuffle(idxs);
+
+            info("Will start in the following order: " + idxs);
+
+            for (Integer idx : idxs)
+                startGrid(idx);
+
+            try {
+                ignite(0).active(true);
+
+                for (int g = 0; g < GRID_CNT; g++) {
+                    Ignite ig = ignite(g);
+
+                    for (int k = 0; k < ENTRIES_COUNT; k++)
+                        assertEquals("Failed to read [g=" + g + ", part=" + ig.affinity(CACHE_NAME).partition(k) +
+                            ", nodes=" + ig.affinity(CACHE_NAME).mapKeyToPrimaryAndBackups(k) + ']',
+                            k, ig.cache(CACHE_NAME).get(k));
+                }
+            }
+            finally {
+                stopAllGrids();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cd4d0400/modules/pds/src/test/java/org/apache/ignite/cache/database/db/RebalancingOnNotStableTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/RebalancingOnNotStableTopologyTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/RebalancingOnNotStableTopologyTest.java
deleted file mode 100644
index e85c639..0000000
--- a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/RebalancingOnNotStableTopologyTest.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.cache.database.db;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-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.cache.PartitionLossPolicy;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy;
-
-/**
- * We start writing to unstable cluster.
- * After that we start killing node.
- * There will be entries in WAL which belongs to evicted partitions.
- * We should ignore them (not throw exceptions). This point is tested.
- */
-public class RebalancingOnNotStableTopologyTest extends GridCommonAbstractTest {
-    /** Checkpoint frequency. */
-    private static final long CHECKPOINT_FREQUENCY = 2_000_000;
-
-    /** Cluster size. */
-    private static final int CLUSTER_SIZE = 5;
-
-    /** */
-    private static final String CACHE_NAME = "cache1";
-
-    /**
-     * @throws Exception When fails.
-     */
-    public void test() throws Exception {
-        stopAllGrids();
-
-        Ignite ex = startGrid(0);
-
-        startGrid(1);
-
-        final CountDownLatch startLatch = new CountDownLatch(1);
-        final CountDownLatch doneLatch = new CountDownLatch(1);
-
-        final Ignite ex1 = ex;
-
-        final AtomicBoolean stop = new AtomicBoolean();
-        final AtomicInteger keyCnt = new AtomicInteger();
-
-        Thread thread = new Thread(new Runnable() {
-            @Override public void run() {
-                ex1.active(true);
-
-                try {
-                    checkTopology(2);
-
-                    startLatch.countDown();
-
-                    IgniteCache<Object, Object> cache1 = ex1.cache(CACHE_NAME);
-
-                    int key = keyCnt.get();
-
-                    while (!stop.get()) {
-                        if (key > 0 && (key % 500 == 0)) {
-                            U.sleep(5);
-
-                            System.out.println("key = " + key);
-                        }
-
-                        cache1.put(key, -key);
-
-                        key = keyCnt.incrementAndGet();
-                    }
-                }
-                catch (Throwable th) {
-                    th.printStackTrace();
-                }
-
-                doneLatch.countDown();
-            }
-        });
-
-        thread.setName("Data-Loader");
-        thread.start();
-
-        startLatch.await(60, TimeUnit.SECONDS);
-
-        for (int i = 2; i < CLUSTER_SIZE; i++) {
-            startGrid(i);
-
-            U.sleep(5000);
-        }
-
-        U.sleep(10000);
-
-        IgniteProcessProxy.kill("db.RebalancingOnNotStableTopologyTest2");
-
-        Thread.sleep(5000);
-
-        IgniteProcessProxy.kill("db.RebalancingOnNotStableTopologyTest1");
-
-        assert doneLatch.getCount() > 0;
-
-        stop.set(true);
-
-        doneLatch.await(600, TimeUnit.SECONDS);
-
-        IgniteProcessProxy.killAll();
-
-        stopAllGrids();
-
-        //start cluster. it will cause memory restoration and reading WAL.
-        ex = startGrids(CLUSTER_SIZE);
-
-        ex.active(true);
-
-        checkTopology(CLUSTER_SIZE);
-
-        IgniteCache<Object, Object> cache1 = ex.cache(CACHE_NAME);
-
-        assert keyCnt.get() > 0;
-
-        for (int i = 0; i < keyCnt.get(); i++)
-            assertEquals(-i, cache1.get(i));
-
-        System.out.println("Test finished with total keys count = " + keyCnt.get());
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setActiveOnStart(false);
-
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(CACHE_NAME);
-
-        ccfg.setPartitionLossPolicy(PartitionLossPolicy.READ_ONLY_SAFE);
-        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-        ccfg.setCacheMode(CacheMode.PARTITIONED);
-        ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
-        ccfg.setBackups(2);
-
-        cfg.setCacheConfiguration(ccfg);
-
-        PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
-
-        pCfg.setCheckpointingFrequency(CHECKPOINT_FREQUENCY);
-
-        cfg.setPersistentStoreConfiguration(pCfg);
-
-        MemoryConfiguration memCfg = new MemoryConfiguration();
-
-        MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
-        memPlcCfg.setName("dfltMemPlc");
-        memPlcCfg.setInitialSize(200 * 1024 * 1024);
-        memPlcCfg.setMaxSize(200 * 1024 * 1024);
-
-        memCfg.setMemoryPolicies(memPlcCfg);
-        memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
-        cfg.setMemoryConfiguration(memCfg);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean isMultiJvm() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean checkTopology() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        stopAllGrids();
-        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
-    }
-
-    /** {@inheritDoc} */
-    @Override protected long getTestTimeout() {
-        return TimeUnit.MINUTES.toMillis(10);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cd4d0400/modules/pds/src/test/java/org/apache/ignite/cache/database/db/TransactionsHangTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/TransactionsHangTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/TransactionsHangTest.java
deleted file mode 100644
index 3d57ba4..0000000
--- a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/TransactionsHangTest.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.cache.database.db;
-
-import java.util.Random;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-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.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.configuration.BinaryConfiguration;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
-import org.apache.ignite.configuration.TransactionConfiguration;
-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.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.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.transactions.Transaction;
-import org.apache.ignite.transactions.TransactionIsolation;
-import org.jsr166.LongAdder8;
-
-import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
-
-/**
- * Checks that transactions don't hang during checkpoint creation.
- */
-public class TransactionsHangTest extends GridCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** Page cache size. */
-    private static final int PAGE_CACHE_SIZE = 512;
-
-    /** Page size. */
-    private static final Integer PAGE_SIZE = 16;
-
-    /** Cache name. */
-    private static final String CACHE_NAME = "TransactionsHangTest";
-
-    /** Number of insert threads. */
-    public static final int THREADS_CNT = 32;
-
-    /** Warm up period, seconds. */
-    public static final int WARM_UP_PERIOD = 20;
-
-    /** Duration. */
-    public static final int DURATION = 180;
-
-    /** Maximum count of inserted keys. */
-    public static final int MAX_KEY_COUNT = 500_000;
-
-    /** Checkpoint frequency. */
-    public static final long CHECKPOINT_FREQUENCY = 20_000;
-
-    /** {@inheritDoc} */
-    @Override protected long getTestTimeout() {
-        return Long.MAX_VALUE;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-        discoSpi.setIpFinder(IP_FINDER);
-        cfg.setDiscoverySpi(discoSpi);
-
-        BinaryConfiguration binaryCfg = new BinaryConfiguration();
-        binaryCfg.setCompactFooter(false);
-        cfg.setBinaryConfiguration(binaryCfg);
-
-        cfg.setPeerClassLoadingEnabled(true);
-
-        TcpCommunicationSpi tcpCommSpi = new TcpCommunicationSpi();
-
-        tcpCommSpi.setSharedMemoryPort(-1);
-        cfg.setCommunicationSpi(tcpCommSpi);
-
-        TransactionConfiguration txCfg = new TransactionConfiguration();
-
-        txCfg.setDefaultTxIsolation(TransactionIsolation.READ_COMMITTED);
-
-        cfg.setTransactionConfiguration(txCfg);
-
-        PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
-
-        pCfg.setWalHistorySize(1);
-        pCfg.setCheckpointingFrequency(CHECKPOINT_FREQUENCY);
-
-        cfg.setPersistentStoreConfiguration(pCfg);
-
-        MemoryConfiguration memCfg = new MemoryConfiguration();
-
-        MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
-        memPlcCfg.setName("dfltMemPlc");
-        memPlcCfg.setInitialSize(PAGE_CACHE_SIZE * 1024 * 1024);
-        memPlcCfg.setMaxSize(PAGE_CACHE_SIZE * 1024 * 1024);
-
-        memCfg.setMemoryPolicies(memPlcCfg);
-        memCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
-        memCfg.setPageSize(PAGE_SIZE * 1024);
-
-        cfg.setMemoryConfiguration(memCfg);
-
-        return cfg;
-    }
-
-    /**
-     * Creates cache configuration.
-     *
-     * @return Cache configuration.
-     * */
-    private CacheConfiguration getCacheConfiguration() {
-        CacheConfiguration ccfg = new CacheConfiguration();
-
-        ccfg.setName(CACHE_NAME);
-        ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
-        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-        ccfg.setAffinity(new RendezvousAffinityFunction(false, 64 * 4));
-        ccfg.setReadFromBackup(true);
-
-        ccfg.setCacheMode(CacheMode.PARTITIONED);
-
-        return ccfg;
-    }
-
-    /**
-     * Copied from customers benchmark.
-     *
-     * @throws Exception If failed.
-     * */
-    public void testTransactionsDontHang() throws Exception {
-        try {
-            final Ignite g = startGrids(2);
-
-            g.getOrCreateCache(getCacheConfiguration());
-
-            ExecutorService threadPool = Executors.newFixedThreadPool(THREADS_CNT);
-            final CyclicBarrier cyclicBarrier = new CyclicBarrier(THREADS_CNT);
-
-            final AtomicBoolean interrupt = new AtomicBoolean(false);
-            final LongAdder8 operationCnt = new LongAdder8();
-
-            final IgniteCache<Long, TestEntity> cache = g.cache(CACHE_NAME);
-
-            for (int i = 0; i < THREADS_CNT; i++) {
-                threadPool.submit(new Runnable() {
-                    @Override public void run() {
-                        try {
-                            ThreadLocalRandom locRandom = ThreadLocalRandom.current();
-
-                            cyclicBarrier.await();
-
-                            while (!interrupt.get()) {
-                                long randomKey = locRandom.nextLong(MAX_KEY_COUNT);
-
-                                TestEntity entity = TestEntity.newTestEntity(locRandom);
-
-                                try (Transaction tx = g.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                                    cache.put(randomKey, entity);
-
-                                    tx.commit();
-                                }
-
-                                operationCnt.increment();
-                            }
-                        }
-                        catch (Throwable e) {
-                            System.out.println(e.toString());
-
-                            throw new RuntimeException(e);
-                        }
-                    }
-                });
-            }
-
-            long stopTime = System.currentTimeMillis() + DURATION * 1000;
-            long totalOperations = 0;
-            int periods = 0;
-            long max = Long.MIN_VALUE, min = Long.MAX_VALUE;
-
-            while (System.currentTimeMillis() < stopTime) {
-                U.sleep(1000);
-
-                long sum = operationCnt.sumThenReset();
-                periods++;
-
-                if (periods > WARM_UP_PERIOD) {
-                    totalOperations += sum;
-
-                    max = Math.max(max, sum);
-                    min = Math.min(min, sum);
-
-                    System.out.println("Operation count: " + sum + " min=" + min + " max=" + max + " avg=" + totalOperations / (periods - WARM_UP_PERIOD));
-                }
-            }
-
-            interrupt.set(true);
-
-            threadPool.shutdown();
-            System.out.println("Test complete");
-
-            threadPool.awaitTermination(getTestTimeout(), TimeUnit.MILLISECONDS);
-
-            IgniteTxManager tm = internalCache(cache).context().tm();
-
-            assertEquals("There are still active transactions", 0, tm.activeTransactions().size());
-        } finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * Entity for test.
-     * */
-    public static class TestEntity {
-        /** String value. */
-        private String strVal;
-
-        /** Long value. */
-        private Long longVal;
-
-        /** Int value. */
-        private int intVal;
-
-        /**
-         * @param strVal String value.
-         */
-        public void setStrVal(String strVal) {
-            this.strVal = strVal;
-        }
-
-        /**
-         * @param longVal Long value.
-         */
-        public void setLongVal(Long longVal) {
-            this.longVal = longVal;
-        }
-
-        /**
-         * @param intVal Integer value.
-         */
-        public void setIntVal(int intVal) {
-            this.intVal = intVal;
-        }
-
-        /**
-         * Creates test entity with random values.
-         *
-         * @param random Random seq generator.
-         * @return new test entity
-         * */
-        private static TestEntity newTestEntity(Random random) {
-            TestEntity entity = new TestEntity();
-
-            entity.setLongVal((long) random.nextInt(1_000));
-            entity.setIntVal(random.nextInt(1_000));
-            entity.setStrVal("test" + random.nextInt(1_000));
-
-            return entity;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cd4d0400/modules/pds/src/test/java/org/apache/ignite/cache/database/db/file/IgniteCachePageStoreIntegrationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/file/IgniteCachePageStoreIntegrationSelfTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/file/IgniteCachePageStoreIntegrationSelfTest.java
deleted file mode 100644
index 229c226..0000000
--- a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/file/IgniteCachePageStoreIntegrationSelfTest.java
+++ /dev/null
@@ -1,290 +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.cache.database.db.file;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.concurrent.Callable;
-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.CacheRebalanceMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.configuration.BinaryConfiguration;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryPolicyConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
-import org.apache.ignite.internal.processors.cache.database.wal.FileWriteAheadLogManager;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- *
- */
-public class IgniteCachePageStoreIntegrationSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final int GRID_CNT = 3;
-
-    /** */
-    private static final String CACHE_NAME = "cache";
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        MemoryConfiguration dbCfg = new MemoryConfiguration();
-
-        dbCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
-
-        MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
-
-        memPlcCfg.setName("dfltMemPlc");
-        memPlcCfg.setInitialSize(100 * 1024 * 1024);
-        memPlcCfg.setMaxSize(100 * 1024 * 1024);
-
-        dbCfg.setMemoryPolicies(memPlcCfg);
-        dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
-
-        cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration());
-
-        cfg.setMemoryConfiguration(dbCfg);
-
-        CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
-
-        ccfg.setIndexedTypes(Integer.class, DbValue.class);
-
-        ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
-
-        ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
-
-        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
-
-        ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
-
-        cfg.setCacheConfiguration(ccfg);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        cfg.setMarshaller(null);
-
-        BinaryConfiguration bCfg = new BinaryConfiguration();
-
-        bCfg.setCompactFooter(false);
-
-        cfg.setBinaryConfiguration(bCfg);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
-
-        System.setProperty(FileWriteAheadLogManager.IGNITE_PDS_WAL_MODE, "LOG_ONLY");
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        super.afterTest();
-
-        System.clearProperty(FileWriteAheadLogManager.IGNITE_PDS_WAL_MODE);
-
-        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
-    }
-
-    /**
-     * @throws Exception if failed.
-     */
-    public void testPutGetSimple() throws Exception {
-        startGrids(GRID_CNT);
-
-        try {
-            IgniteEx ig = grid(0);
-
-            checkPutGetSql(ig, true);
-        }
-        finally {
-            stopAllGrids();
-        }
-
-        info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
-        info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
-        info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
-
-        startGrids(GRID_CNT);
-
-        try {
-            IgniteEx ig = grid(0);
-
-            checkPutGetSql(ig, false);
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * @throws Exception if failed.
-     */
-    public void testPutMultithreaded() throws Exception {
-        startGrids(4);
-
-        try {
-            final IgniteEx grid = grid(0);
-
-            GridTestUtils.runMultiThreaded(new Callable<Object>() {
-                @Override public Object call() throws Exception {
-                    for (int i = 0; i < 1000; i++)
-                        grid.cache(CACHE_NAME).put(i, i);
-
-                    return null;
-                }
-            }, 8, "updater");
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * @param ig Ignite instance.
-     * @param write Write flag.
-     */
-    private void checkPutGetSql(Ignite ig, boolean write) {
-        IgniteCache<Integer, DbValue> cache = ig.cache(CACHE_NAME);
-
-        int entryCnt = 50_000;
-
-        if (write) {
-            try (IgniteDataStreamer<Object, Object> streamer = ig.dataStreamer(CACHE_NAME)) {
-                streamer.allowOverwrite(true);
-
-                for (int i = 0; i < entryCnt; i++)
-                    streamer.addData(i, new DbValue(i, "value-" + i, i));
-            }
-        }
-
-        for (int i = 0; i < GRID_CNT; i++) {
-            IgniteEx ignite = grid(i);
-
-            GridCacheAdapter<Object, Object> cache0 = ignite.context().cache().internalCache(CACHE_NAME);
-
-            for (int k = 0; k < entryCnt; k++)
-                assertNull(cache0.peekEx(i));
-
-            assertEquals(entryCnt, ignite.cache(CACHE_NAME).size());
-        }
-
-        for (int i = 0; i < entryCnt; i++)
-            assertEquals("i = " + i, new DbValue(i, "value-" + i, i), cache.get(i));
-
-        List<List<?>> res = cache.query(new SqlFieldsQuery("select ival from dbvalue where ival < ? order by ival asc")
-            .setArgs(10_000)).getAll();
-
-        assertEquals(10_000, res.size());
-
-        for (int i = 0; i < 10_000; i++) {
-            assertEquals(1, res.get(i).size());
-            assertEquals(i, res.get(i).get(0));
-        }
-
-        assertEquals(1, cache.query(new SqlFieldsQuery("select lval from dbvalue where ival = 7899")).getAll().size());
-        assertEquals(5000, cache.query(new SqlFieldsQuery("select lval from dbvalue where ival >= 5000 and ival < 10000"))
-            .getAll().size());
-
-        for (int i = 0; i < 10_000; i++)
-            assertEquals(new DbValue(i, "value-" + i, i), cache.get(i));
-    }
-
-    /**
-     *
-     */
-    private static class DbValue implements Serializable {
-        /** */
-        @QuerySqlField(index = true)
-        private int iVal;
-
-        /** */
-        @QuerySqlField(index = true)
-        private String sVal;
-
-        /** */
-        @QuerySqlField
-        private long lVal;
-
-        /**
-         * @param iVal Integer value.
-         * @param sVal String value.
-         * @param lVal Long value.
-         */
-        private DbValue(int iVal, String sVal, long lVal) {
-            this.iVal = iVal;
-            this.sVal = sVal;
-            this.lVal = lVal;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            DbValue dbVal = (DbValue)o;
-
-            return iVal == dbVal.iVal && lVal == dbVal.lVal &&
-                !(sVal != null ? !sVal.equals(dbVal.sVal) : dbVal.sVal != null);
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            int res = iVal;
-
-            res = 31 * res + (sVal != null ? sVal.hashCode() : 0);
-            res = 31 * res + (int)(lVal ^ (lVal >>> 32));
-
-            return res;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(DbValue.class, this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cd4d0400/modules/pds/src/test/java/org/apache/ignite/cache/database/db/file/IgniteNoActualWalHistorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/file/IgniteNoActualWalHistorySelfTest.java b/modules/pds/src/test/java/org/apache/ignite/cache/database/db/file/IgniteNoActualWalHistorySelfTest.java
deleted file mode 100644
index 1c5024a..0000000
--- a/modules/pds/src/test/java/org/apache/ignite/cache/database/db/file/IgniteNoActualWalHistorySelfTest.java
+++ /dev/null
@@ -1,219 +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.cache.database.db.file;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheRebalanceMode;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.configuration.BinaryConfiguration;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.processors.cache.database.GridCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.database.wal.FileWriteAheadLogManager;
-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.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- *
- */
-public class IgniteNoActualWalHistorySelfTest extends GridCommonAbstractTest {
-    /** Cache name. */
-    private static final String CACHE_NAME = "cache";
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(CACHE_NAME);
-
-        ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
-        ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
-        ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
-
-        cfg.setCacheConfiguration(ccfg);
-
-        MemoryConfiguration dbCfg = new MemoryConfiguration();
-
-        dbCfg.setPageSize(4 * 1024);
-
-        cfg.setMemoryConfiguration(dbCfg);
-
-        PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
-
-        pCfg.setWalSegmentSize(4 * 1024 * 1024);
-        pCfg.setWalHistorySize(2);
-        pCfg.setWalSegments(10);
-
-        cfg.setPersistentStoreConfiguration(pCfg);
-
-        cfg.setMarshaller(null);
-
-        BinaryConfiguration binCfg = new BinaryConfiguration();
-
-        binCfg.setCompactFooter(false);
-
-        cfg.setBinaryConfiguration(binCfg);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        stopAllGrids();
-
-        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
-
-        System.setProperty(FileWriteAheadLogManager.IGNITE_PDS_WAL_MODE, "LOG_ONLY");
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-
-        deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
-
-        System.clearProperty(FileWriteAheadLogManager.IGNITE_PDS_WAL_MODE);
-    }
-
-    /**
-     * @throws Exception if failed.
-     */
-    public void testWalBig() throws Exception {
-        try {
-            IgniteEx ignite = startGrid(1);
-
-            IgniteCache<Object, Object> cache = ignite.cache(CACHE_NAME);
-
-            Random rnd = new Random();
-
-            Map<Integer, IndexedObject> map = new HashMap<>();
-
-            for (int i = 0; i < 40_000; i++) {
-                if (i % 1000 == 0)
-                    X.println(" >> " + i);
-
-                int k = rnd.nextInt(300_000);
-                IndexedObject v = new IndexedObject(rnd.nextInt(10_000));
-
-                cache.put(k, v);
-                map.put(k, v);
-            }
-
-            GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager)ignite.context().cache().context()
-                .database();
-
-            // Create many checkpoints to clean up the history.
-            dbMgr.wakeupForCheckpoint("test").get();
-            dbMgr.wakeupForCheckpoint("test").get();
-            dbMgr.wakeupForCheckpoint("test").get();
-            dbMgr.wakeupForCheckpoint("test").get();
-            dbMgr.wakeupForCheckpoint("test").get();
-            dbMgr.wakeupForCheckpoint("test").get();
-            dbMgr.wakeupForCheckpoint("test").get();
-
-            dbMgr.enableCheckpoints(false).get();
-
-            for (int i = 0; i < 50; i++) {
-                int k = rnd.nextInt(300_000);
-                IndexedObject v = new IndexedObject(rnd.nextInt(10_000));
-
-                cache.put(k, v);
-                map.put(k, v);
-            }
-
-            stopGrid(1);
-
-            ignite = startGrid(1);
-
-            cache = ignite.cache(CACHE_NAME);
-
-            // Check.
-            for (Integer k : map.keySet())
-                assertEquals(map.get(k), cache.get(k));
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     *
-     */
-    private static class IndexedObject {
-        /** */
-        @QuerySqlField(index = true)
-        private int iVal;
-
-        /** */
-        private byte[] payload = new byte[1024];
-
-        /**
-         * @param iVal Integer value.
-         */
-        private IndexedObject(int iVal) {
-            this.iVal = iVal;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (!(o instanceof IndexedObject))
-                return false;
-
-            IndexedObject that = (IndexedObject)o;
-
-            return iVal == that.iVal;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return iVal;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(IndexedObject.class, this);
-        }
-    }
-
-    /**
-     *
-     */
-    private enum EnumVal {
-        /** */
-        VAL1,
-
-        /** */
-        VAL2,
-
-        /** */
-        VAL3
-    }
-}


Mime
View raw message