You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/06/25 05:27:11 UTC

[1/7] incubator-ignite git commit: ignite-1045 properly handle flag DynamicCacheChangeRequest.clientStartOnly

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-1023 08cba6b52 -> 93a44296a


ignite-1045 properly handle flag DynamicCacheChangeRequest.clientStartOnly


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a6cda33a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a6cda33a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a6cda33a

Branch: refs/heads/ignite-1023
Commit: a6cda33a8b76925d09c21262e88467421025fa77
Parents: c7ba154
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 23 16:47:13 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 23 17:29:49 2015 +0300

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        |  46 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++++++++++
 .../distributed/IgniteCache150ClientsTest.java  | 189 ++++++++
 ...teCacheClientNodePartitionsExchangeTest.java |   1 +
 .../testsuites/IgniteCacheTestSuite4.java       |   1 +
 .../testsuites/IgniteClientTestSuite.java       |  38 ++
 6 files changed, 733 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 7c780b0..38a0d55 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -153,6 +153,9 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
     /** Skip preload flag. */
     private boolean skipPreload;
 
+    /** */
+    private boolean clientOnlyExchange;
+
     /**
      * Dummy future created to trigger reassignments if partition
      * topology changed while preloading.
@@ -524,6 +527,9 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                         if (exchId.isLeft())
                             cctx.mvcc().removeExplicitNodeLocks(exchId.nodeId(), exchId.topologyVersion());
 
+                        rmtIds = Collections.emptyList();
+                        rmtNodes = Collections.emptyList();
+
                         onDone(exchId.topologyVersion());
 
                         skipPreload = cctx.kernalContext().clientNode();
@@ -532,8 +538,10 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                     }
                 }
 
-                if (cctx.kernalContext().clientNode()) {
-                    skipPreload = true;
+                clientOnlyExchange = clientNodeEvt || cctx.kernalContext().clientNode();
+
+                if (clientOnlyExchange) {
+                    skipPreload = cctx.kernalContext().clientNode();
 
                     for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
                         if (cacheCtx.isLocal())
@@ -551,23 +559,45 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                         initTopology(cacheCtx);
                     }
 
-                    if (oldestNode.get() != null) {
+                    if (oldest != null) {
                         rmtNodes = new ConcurrentLinkedQueue<>(CU.aliveRemoteServerNodesWithCaches(cctx,
                             exchId.topologyVersion()));
 
                         rmtIds = Collections.unmodifiableSet(new HashSet<>(F.nodeIds(rmtNodes)));
 
-                        ready.set(true);
-
                         initFut.onDone(true);
 
                         if (log.isDebugEnabled())
                             log.debug("Initialized future: " + this);
 
-                        sendPartitions();
+                        if (cctx.localNode().equals(oldest)) {
+                            for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
+                                boolean updateTop = !cacheCtx.isLocal() &&
+                                    exchId.topologyVersion().equals(cacheCtx.startTopologyVersion());
+
+                                if (updateTop) {
+                                    for (GridClientPartitionTopology top : cctx.exchange().clientTopologies()) {
+                                        if (top.cacheId() == cacheCtx.cacheId()) {
+                                            cacheCtx.topology().update(exchId, top.partitionMap(true));
+
+                                            break;
+                                        }
+                                    }
+
+                                }
+                            }
+
+                            onDone(exchId.topologyVersion());
+                        }
+                        else
+                            sendPartitions();
                     }
-                    else
+                    else {
+                        rmtIds = Collections.emptyList();
+                        rmtNodes = Collections.emptyList();
+
                         onDone(exchId.topologyVersion());
+                    }
 
                     return;
                 }
@@ -885,7 +915,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
      */
     private void sendLocalPartitions(ClusterNode node, @Nullable GridDhtPartitionExchangeId id) throws IgniteCheckedException {
         GridDhtPartitionsSingleMessage m = new GridDhtPartitionsSingleMessage(id,
-            cctx.kernalContext().clientNode(),
+            clientOnlyExchange,
             cctx.versions().last());
 
         for (GridCacheContext cacheCtx : cctx.cacheContexts()) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
new file mode 100644
index 0000000..5011e5f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
@@ -0,0 +1,466 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.fair.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.managers.communication.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.communication.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ *
+ */
+public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbstractTest {
+    /** */
+    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final int NODES = 4;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+        cfg.setCommunicationSpi(new TestCommunicationSpi());
+
+        if (gridName.equals(getTestGridName(NODES - 1)))
+            cfg.setClientMode(true);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        startGrids(NODES);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMultinodeCacheStart() throws Exception {
+        for (int i = 0; i < 10; i++) {
+            log.info("Iteration: " + i);
+
+            final String name = "cache-" + i;
+
+            final AtomicInteger idx = new AtomicInteger();
+
+            GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    Ignite ignite = ignite(idx.getAndIncrement());
+
+                    CacheConfiguration ccfg = new CacheConfiguration();
+
+                    ccfg.setName(name);
+
+                    assertNotNull(ignite.getOrCreateCache(ccfg));
+
+                    return null;
+                }
+            }, 2, "create-cache").get(15_000);
+
+            awaitPartitionMapExchange();
+
+            checkCache(name);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldestNotAffinityNode1() throws Exception {
+        for (CacheConfiguration ccfg : cacheConfigurations())
+            oldestNotAffinityNode1(ccfg);
+    }
+
+    /**
+     * @param ccfg Cache configuration.
+     * @throws Exception If failed.
+     */
+    private void oldestNotAffinityNode1(final CacheConfiguration ccfg) throws Exception {
+        log.info("Test with cache: " + ccfg.getName());
+
+        IgniteEx ignite = grid(0);
+
+        assertEquals(1L, ignite.localNode().order());
+
+        ccfg.setNodeFilter(new TestFilterExcludeOldest());
+
+        assertNotNull(ignite.getOrCreateCache(ccfg));
+
+        awaitPartitionMapExchange();
+
+        checkCache(ccfg.getName());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldestNotAffinityNode2() throws Exception {
+        for (CacheConfiguration ccfg : cacheConfigurations())
+            oldestNotAffinityNode2(ccfg);
+    }
+
+    /**
+     * @param ccfg Cache configuration.
+     * @throws Exception If failed.
+     */
+    private void oldestNotAffinityNode2(final CacheConfiguration ccfg) throws Exception {
+        log.info("Test with cache: " + ccfg.getName());
+
+        IgniteEx ignite0 = grid(0);
+        IgniteEx ignite1 = grid(1);
+
+        assertEquals(1L, ignite0.localNode().order());
+
+        ccfg.setNodeFilter(new TestFilterExcludeOldest());
+
+        assertNotNull(ignite1.getOrCreateCache(ccfg));
+
+        assertNotNull(ignite0.cache(ccfg.getName()));
+
+        awaitPartitionMapExchange();
+
+        checkCache(ccfg.getName());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNotAffinityNode1() throws Exception {
+        for (CacheConfiguration ccfg : cacheConfigurations())
+            notAffinityNode1(ccfg);
+    }
+
+    /**
+     * @param ccfg Cache configuration.
+     * @throws Exception If failed.
+     */
+    private void notAffinityNode1(final CacheConfiguration ccfg) throws Exception {
+        log.info("Test with cache: " + ccfg.getName());
+
+        IgniteEx ignite = grid(1);
+
+        assertEquals(2, ignite.localNode().order());
+
+        ccfg.setNodeFilter(new TestFilterExcludeNode(2));
+
+        assertNotNull(ignite.getOrCreateCache(ccfg));
+
+        awaitPartitionMapExchange();
+
+        checkCache(ccfg.getName());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNotAffinityNode2() throws Exception {
+        for (CacheConfiguration ccfg : cacheConfigurations())
+            notAffinityNode2(ccfg);
+    }
+
+    /**
+     * @param ccfg Cache configuration.
+     * @throws Exception If failed.
+     */
+    private void notAffinityNode2(final CacheConfiguration ccfg) throws Exception {
+        log.info("Test with cache: " + ccfg.getName());
+
+        IgniteEx ignite0 = grid(0);
+        IgniteEx ignite1 = grid(1);
+
+        assertEquals(2L, ignite1.localNode().order());
+
+        ccfg.setNodeFilter(new TestFilterExcludeNode(2));
+
+        assertNotNull(ignite0.getOrCreateCache(ccfg));
+
+        assertNotNull(ignite1.cache(ccfg.getName()));
+
+        awaitPartitionMapExchange();
+
+        checkCache(ccfg.getName());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldestChanged1() throws Exception {
+        IgniteEx ignite0 = grid(0);
+
+        assertEquals(1L, ignite0.localNode().order());
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setNodeFilter(new TestFilterExcludeOldest());
+
+        assertNotNull(ignite0.getOrCreateCache(ccfg));
+
+        stopGrid(0);
+
+        IgniteEx client = grid(NODES - 1);
+
+        assertTrue(client.configuration().isClientMode());
+
+        assertNotNull(client.getOrCreateCache((String)null));
+
+        awaitPartitionMapExchange();
+
+        checkCache(null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldestChanged2() throws Exception {
+        IgniteEx ignite0 = grid(0);
+
+        assertEquals(1L, ignite0.localNode().order());
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setNodeFilter(new TestFilterIncludeNode(3));
+
+        assertNotNull(ignite0.getOrCreateCache(ccfg));
+
+        stopGrid(0);
+
+        IgniteEx ingite1 = grid(1);
+
+        assertNotNull(ingite1.getOrCreateCache((String)null));
+
+        awaitPartitionMapExchange();
+
+        checkCache(null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOldestChanged3() throws Exception {
+        IgniteEx ignite0 = grid(0);
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setNodeFilter(new TestFilterIncludeNode(3));
+
+        assertNotNull(ignite0.getOrCreateCache(ccfg));
+
+        stopGrid(0);
+
+        IgniteEx client = grid(NODES - 1);
+
+        assertTrue(client.configuration().isClientMode());
+
+        assertNotNull(client.getOrCreateCache((String)null));
+
+        awaitPartitionMapExchange();
+
+        checkCache(null);
+    }
+
+    /**
+     * @param name Cache name.
+     */
+    private void checkCache(@Nullable String name) {
+        int key = 0;
+
+        for (Ignite ignite : G.allGrids()) {
+            IgniteCache<Object, Object> cache = ignite.cache(name);
+
+            assertNotNull(cache);
+
+            for (int i = 0; i < 100; i++) {
+                cache.put(key, key);
+
+                assertEquals(key, cache.get(key));
+
+                key++;
+            }
+        }
+    }
+
+    /**
+     * @return Cache configurations.
+     */
+    private List<CacheConfiguration> cacheConfigurations() {
+        List<CacheConfiguration> res = new ArrayList<>();
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-1");
+            ccfg.setAtomicityMode(ATOMIC);
+            ccfg.setBackups(0);
+
+            res.add(ccfg);
+        }
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-2");
+            ccfg.setAtomicityMode(ATOMIC);
+            ccfg.setBackups(1);
+
+            res.add(ccfg);
+        }
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-3");
+            ccfg.setAtomicityMode(ATOMIC);
+            ccfg.setBackups(1);
+            ccfg.setAffinity(new FairAffinityFunction());
+
+            res.add(ccfg);
+        }
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-4");
+            ccfg.setAtomicityMode(TRANSACTIONAL);
+            ccfg.setBackups(0);
+
+            res.add(ccfg);
+        }
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-5");
+            ccfg.setAtomicityMode(TRANSACTIONAL);
+            ccfg.setBackups(1);
+
+            res.add(ccfg);
+        }
+
+        {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setName("cache-4");
+            ccfg.setAtomicityMode(TRANSACTIONAL);
+            ccfg.setBackups(1);
+            ccfg.setAffinity(new FairAffinityFunction());
+
+            res.add(ccfg);
+        }
+
+        return res;
+    }
+
+    /**
+     *
+     */
+    private static class TestFilterExcludeOldest implements IgnitePredicate<ClusterNode> {
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode node) {
+            return node.order() > 1;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestFilterExcludeNode implements IgnitePredicate<ClusterNode> {
+        /** */
+        private final long excludeOrder;
+
+        /**
+         * @param excludeOrder Node order to exclude.
+         */
+        public TestFilterExcludeNode(long excludeOrder) {
+            this.excludeOrder = excludeOrder;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode node) {
+            return node.order() != excludeOrder;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestFilterIncludeNode implements IgnitePredicate<ClusterNode> {
+        /** */
+        private final long includeOrder;
+
+        /**
+         * @param includeOrder Node order to exclude.
+         */
+        public TestFilterIncludeNode(long includeOrder) {
+            this.includeOrder = includeOrder;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode node) {
+            return node.order() == includeOrder;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestCommunicationSpi extends TcpCommunicationSpi {
+        /** {@inheritDoc} */
+        @Override public void sendMessage(ClusterNode node, Message msg)
+            throws IgniteSpiException {
+            Object msg0 = ((GridIoMessage)msg).message();
+
+            if (msg0 instanceof GridDhtPartitionsSingleRequest) // Sent in case of exchange timeout.
+                fail("Unexpected message: " + msg0);
+
+            super.sendMessage(node, msg);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
new file mode 100644
index 0000000..282c7c8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.spi.communication.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jsr166.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ *
+ */
+public class IgniteCache150ClientsTest extends GridCommonAbstractTest {
+    /** */
+    protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final int CACHES = 10;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setNetworkTimeout(30_000);
+        cfg.setConnectorConfiguration(null);
+        cfg.setPeerClassLoadingEnabled(false);
+        cfg.setTimeServerPortRange(200);
+
+        ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSocketWriteTimeout(200);
+        ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setLocalPortRange(200);
+        ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setJoinTimeout(0);
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setMaxMissedClientHeartbeats(200);
+
+        cfg.setClientMode(!gridName.equals(getTestGridName(0)));
+
+        CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES];
+
+        for (int i = 0 ; i < ccfgs.length; i++) {
+            CacheConfiguration ccfg = new CacheConfiguration();
+
+            ccfg.setCacheMode(PARTITIONED);
+            ccfg.setAtomicityMode(i % 2 == 0 ? ATOMIC : TRANSACTIONAL);
+            ccfg.setWriteSynchronizationMode(PRIMARY_SYNC);
+            ccfg.setBackups(1);
+
+            ccfg.setName("cache-" + i);
+
+            ccfgs[i] = ccfg;
+        }
+
+        cfg.setCacheConfiguration(ccfgs);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return 10 * 60_000;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void test150Clients() throws Exception {
+        Ignite srv = startGrid(0);
+
+        assertFalse(srv.configuration().isClientMode());
+
+        final int CLIENTS = 150;
+
+        final AtomicInteger idx = new AtomicInteger(1);
+
+        final CountDownLatch latch = new CountDownLatch(CLIENTS);
+
+        final List<String> cacheNames = new ArrayList<>();
+
+        for (int i = 0; i < CACHES; i++)
+            cacheNames.add("cache-" + i);
+
+        IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                boolean cnt = false;
+
+                try {
+                    Ignite ignite = startGrid(idx.getAndIncrement());
+
+                    assertTrue(ignite.configuration().isClientMode());
+                    assertTrue(ignite.cluster().localNode().isClient());
+
+                    latch.countDown();
+
+                    cnt = true;
+
+                    log.info("Started [node=" + ignite.name() + ", left=" + latch.getCount() + ']');
+
+                    ThreadLocalRandom8 rnd = ThreadLocalRandom8.current();
+
+                    while (latch.getCount() > 0) {
+                        Thread.sleep(1000);
+
+                        IgniteCache<Object, Object> cache = ignite.cache(cacheNames.get(rnd.nextInt(0, CACHES)));
+
+                        Integer key = rnd.nextInt(0, 100_000);
+
+                        cache.put(key, 0);
+
+                        assertNotNull(cache.get(key));
+                    }
+
+                    return null;
+                }
+                finally {
+                    if (!cnt)
+                        latch.countDown();
+                }
+            }
+        }, CLIENTS, "start-client");
+
+        fut.get();
+
+        log.info("Started all clients.");
+
+        checkNodes(CLIENTS + 1);
+    }
+
+    /**
+     * @param expCnt Expected number of nodes.
+     */
+    private void checkNodes(int expCnt) {
+        assertEquals(expCnt, G.allGrids().size());
+
+        long topVer = -1L;
+
+        for (Ignite ignite : G.allGrids()) {
+            log.info("Check node: " + ignite.name());
+
+            if (topVer == -1L)
+                topVer = ignite.cluster().topologyVersion();
+            else
+                assertEquals("Unexpected topology version for node: " + ignite.name(),
+                    topVer,
+                    ignite.cluster().topologyVersion());
+
+            assertEquals("Unexpected number of nodes for node: " + ignite.name(),
+                expCnt,
+                ignite.cluster().nodes().size());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
index e5d30b6..d60a0c3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
@@ -464,6 +464,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
 
     /**
      * @param nearCache If {@code true} creates near cache on client.
+     * @param srvNode If {@code true} creates client cache on server node.
      * @throws Exception If failed.
      */
     private void clientOnlyCacheStart(boolean nearCache, boolean srvNode) throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 6295a4d..d13a99d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -102,6 +102,7 @@ public class IgniteCacheTestSuite4 extends TestSuite {
         suite.addTestSuite(IgniteCacheConfigurationTemplateTest.class);
         suite.addTestSuite(IgniteCacheConfigurationDefaultTemplateTest.class);
         suite.addTestSuite(IgniteDynamicClientCacheStartSelfTest.class);
+        suite.addTestSuite(IgniteDynamicCacheStartNoExchangeTimeoutTest.class);
 
         suite.addTestSuite(GridCacheTxLoadFromStoreOnLockSelfTest.class);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a6cda33a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteClientTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteClientTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteClientTestSuite.java
new file mode 100644
index 0000000..98f9181
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteClientTestSuite.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.testsuites;
+
+import junit.framework.*;
+import org.apache.ignite.internal.processors.cache.distributed.*;
+
+/**
+ *
+ */
+public class IgniteClientTestSuite extends TestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception If failed.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Ignite Client Test Suite");
+
+        suite.addTestSuite(IgniteCache150ClientsTest.class);
+
+        return suite;
+    }
+}


[6/7] incubator-ignite git commit: Merge branches 'ignite-1023' and 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1023

Posted by ak...@apache.org.
Merge branches 'ignite-1023' and 'ignite-sprint-7' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-1023


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a57fba69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a57fba69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a57fba69

Branch: refs/heads/ignite-1023
Commit: a57fba69e69f55ba179dcfe16f23616874b70b20
Parents: 08cba6b b29ff1c
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jun 25 10:25:20 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jun 25 10:25:20 2015 +0700

----------------------------------------------------------------------
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../distributed/dht/GridDhtLockFuture.java      |   2 +-
 .../GridDhtPartitionsExchangeFuture.java        |  46 +-
 .../CacheReadThroughAtomicRestartSelfTest.java  |  32 ++
 ...heReadThroughLocalAtomicRestartSelfTest.java |  32 ++
 .../CacheReadThroughLocalRestartSelfTest.java   |  32 ++
 ...dThroughReplicatedAtomicRestartSelfTest.java |  32 ++
 ...cheReadThroughReplicatedRestartSelfTest.java |  32 ++
 .../cache/CacheReadThroughRestartSelfTest.java  | 133 ++++++
 .../cache/GridCacheAbstractSelfTest.java        |   2 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++++++++++
 .../cache/IgniteDynamicCacheStartSelfTest.java  |  37 ++
 .../distributed/IgniteCache150ClientsTest.java  | 189 ++++++++
 ...teCacheClientNodePartitionsExchangeTest.java |   1 +
 .../IgniteCacheTxStoreSessionTest.java          |   4 +
 .../testsuites/IgniteCacheTestSuite4.java       |   8 +
 .../testsuites/IgniteClientTestSuite.java       |  38 ++
 17 files changed, 1077 insertions(+), 11 deletions(-)
----------------------------------------------------------------------



[5/7] incubator-ignite git commit: # ignite-sprint-7 added test

Posted by ak...@apache.org.
# ignite-sprint-7 added test


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b29ff1cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b29ff1cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b29ff1cb

Branch: refs/heads/ignite-1023
Commit: b29ff1cb24ff344fb624a803cf210cae9f9001d2
Parents: c270bd8
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 24 15:40:56 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 24 15:40:56 2015 +0300

----------------------------------------------------------------------
 .../cache/IgniteDynamicCacheStartSelfTest.java  | 37 ++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b29ff1cb/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
index 7905565..9c483ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
@@ -1105,4 +1105,41 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
         fut.get();
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testStartStopSameCacheMultinode() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-993");
+
+        final AtomicInteger idx = new AtomicInteger();
+
+        IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                int node = idx.getAndIncrement();
+
+                Ignite ignite = ignite(node);
+
+                Thread.currentThread().setName("start-stop-" + ignite.name());
+
+                CacheConfiguration ccfg = new CacheConfiguration();
+
+                ccfg.setName("testStartStop");
+
+                for (int i = 0; i < 1000; i++) {
+                    log.info("Start cache: " + i);
+
+                    try (IgniteCache<Object, Object> cache = ignite.getOrCreateCache(ccfg)) {
+                        // No-op.
+                    }
+
+                    log.info("Stopped cache: " + i);
+                }
+
+                return null;
+            }
+        }, nodeCount(), "start-stop-cache");
+
+        fut.get();
+    }
 }


[4/7] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-1045' into ignite-sprint-7

Posted by ak...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1045' into ignite-sprint-7


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c270bd81
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c270bd81
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c270bd81

Branch: refs/heads/ignite-1023
Commit: c270bd812df9cdf43d55ce0f546657e2f0e8d1da
Parents: bf1ea21 a2141c6
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jun 24 12:17:57 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 24 12:17:57 2015 +0300

----------------------------------------------------------------------
 .../GridDhtPartitionsExchangeFuture.java        |  46 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java | 466 +++++++++++++++++++
 .../distributed/IgniteCache150ClientsTest.java  | 189 ++++++++
 ...teCacheClientNodePartitionsExchangeTest.java |   1 +
 .../testsuites/IgniteCacheTestSuite4.java       |   1 +
 .../testsuites/IgniteClientTestSuite.java       |  38 ++
 6 files changed, 733 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c270bd81/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------


[2/7] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-1045

Posted by ak...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-1045


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a2141c6a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a2141c6a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a2141c6a

Branch: refs/heads/ignite-1023
Commit: a2141c6a7012f10e8f8003160752047046ffdf0d
Parents: a6cda33 359b431
Author: sboikov <se...@inria.fr>
Authored: Tue Jun 23 22:14:51 2015 +0300
Committer: sboikov <se...@inria.fr>
Committed: Tue Jun 23 22:14:51 2015 +0300

----------------------------------------------------------------------
 .../configuration/IgniteReflectionFactory.java  |  81 ++++++-
 .../distributed/dht/GridDhtLocalPartition.java  |   3 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   9 +-
 .../processors/hadoop/HadoopJobInfo.java        |   4 +-
 .../hadoop/counter/HadoopCounterWriter.java     |   5 +-
 .../testframework/junits/GridAbstractTest.java  |   2 +-
 modules/hadoop/pom.xml                          |  78 ------
 .../fs/IgniteHadoopFileSystemCounterWriter.java |   9 +-
 .../processors/hadoop/HadoopClassLoader.java    |  29 +++
 .../processors/hadoop/HadoopDefaultJobInfo.java |  27 +--
 .../internal/processors/hadoop/HadoopUtils.java | 237 ------------------
 .../hadoop/SecondaryFileSystemProvider.java     |   3 +-
 .../hadoop/fs/HadoopFileSystemCacheUtils.java   | 241 +++++++++++++++++++
 .../hadoop/fs/HadoopFileSystemsUtils.java       |  11 +
 .../hadoop/fs/HadoopLazyConcurrentMap.java      |   5 +
 .../hadoop/jobtracker/HadoopJobTracker.java     |  25 +-
 .../child/HadoopChildProcessRunner.java         |   3 +-
 .../processors/hadoop/v2/HadoopV2Job.java       |  84 ++++++-
 .../hadoop/v2/HadoopV2JobResourceManager.java   |  22 +-
 .../hadoop/v2/HadoopV2TaskContext.java          |  37 ++-
 .../apache/ignite/igfs/IgfsEventsTestSuite.java |   5 +-
 .../processors/hadoop/HadoopMapReduceTest.java  |   2 +-
 .../processors/hadoop/HadoopTasksV1Test.java    |   7 +-
 .../processors/hadoop/HadoopTasksV2Test.java    |   7 +-
 .../processors/hadoop/HadoopV2JobSelfTest.java  |   6 +-
 .../collections/HadoopAbstractMapTest.java      |   3 +-
 .../testsuites/IgniteHadoopTestSuite.java       |   2 +-
 .../IgniteIgfsLinuxAndMacOSTestSuite.java       |   3 +-
 28 files changed, 561 insertions(+), 389 deletions(-)
----------------------------------------------------------------------



[3/7] incubator-ignite git commit: #ignite-1043: Add tests for read through flag.

Posted by ak...@apache.org.
#ignite-1043: Add tests for read through flag.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bf1ea21b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bf1ea21b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bf1ea21b

Branch: refs/heads/ignite-1023
Commit: bf1ea21b2f2ff6964b8e13e821b5194243855ff4
Parents: b3e2bd4
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed Jun 24 11:30:15 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed Jun 24 11:30:15 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheContext.java      |   2 +-
 .../distributed/dht/GridDhtLockFuture.java      |   2 +-
 .../CacheReadThroughAtomicRestartSelfTest.java  |  32 +++++
 ...heReadThroughLocalAtomicRestartSelfTest.java |  32 +++++
 .../CacheReadThroughLocalRestartSelfTest.java   |  32 +++++
 ...dThroughReplicatedAtomicRestartSelfTest.java |  32 +++++
 ...cheReadThroughReplicatedRestartSelfTest.java |  32 +++++
 .../cache/CacheReadThroughRestartSelfTest.java  | 133 +++++++++++++++++++
 .../cache/GridCacheAbstractSelfTest.java        |   2 +-
 .../IgniteCacheTxStoreSessionTest.java          |   4 +
 .../testsuites/IgniteCacheTestSuite4.java       |   7 +
 11 files changed, 307 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 8a4e3b9..9b7801c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1377,7 +1377,7 @@ public class GridCacheContext<K, V> implements Externalizable {
     }
 
     /**
-     * @return {@code True} if store read-through mode is enabled.
+     * @return {@code True} if {@link CacheConfiguration#isLoadPreviousValue()} flag is set.
      */
     public boolean loadPreviousValue() {
         return cacheCfg.isLoadPreviousValue();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
index bdaa552..e160529 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
@@ -958,7 +958,7 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture<Boolean>
      *
      */
     private void loadMissingFromStore() {
-        if (!skipStore && cctx.loadPreviousValue() && cctx.readThrough() && (needReturnVal || read)) {
+        if (!skipStore && (read || cctx.loadPreviousValue()) && cctx.readThrough() && (needReturnVal || read)) {
             final Map<KeyCacheObject, GridDhtCacheEntry> loadMap = new LinkedHashMap<>();
 
             final GridCacheVersion ver = version();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughAtomicRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughAtomicRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughAtomicRestartSelfTest.java
new file mode 100644
index 0000000..3ac7c3c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughAtomicRestartSelfTest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ * Test for read through store.
+ */
+public class CacheReadThroughAtomicRestartSelfTest extends CacheReadThroughRestartSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalAtomicRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalAtomicRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalAtomicRestartSelfTest.java
new file mode 100644
index 0000000..f0892ef
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalAtomicRestartSelfTest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ * Test for read through store.
+ */
+public class CacheReadThroughLocalAtomicRestartSelfTest extends CacheReadThroughLocalRestartSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java
new file mode 100644
index 0000000..7561edf
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.*;
+
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Test for read through store.
+ */
+public class CacheReadThroughLocalRestartSelfTest extends CacheReadThroughRestartSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return LOCAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughReplicatedAtomicRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughReplicatedAtomicRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughReplicatedAtomicRestartSelfTest.java
new file mode 100644
index 0000000..0e179ff
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughReplicatedAtomicRestartSelfTest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ * Test for read through store.
+ */
+public class CacheReadThroughReplicatedAtomicRestartSelfTest extends CacheReadThroughReplicatedRestartSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughReplicatedRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughReplicatedRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughReplicatedRestartSelfTest.java
new file mode 100644
index 0000000..5f1419c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughReplicatedRestartSelfTest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.*;
+
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Test for read through store.
+ */
+public class CacheReadThroughReplicatedRestartSelfTest extends CacheReadThroughRestartSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return REPLICATED;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
new file mode 100644
index 0000000..7d0cd4c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.transactions.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+
+/**
+ * Test for read through store.
+ */
+public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 2;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        TransactionConfiguration txCfg = new TransactionConfiguration();
+
+        txCfg.setTxSerializableEnabled(true);
+
+        cfg.setTransactionConfiguration(txCfg);
+
+        CacheConfiguration cc = cacheConfiguration(gridName);
+
+        cc.setLoadPreviousValue(false);
+
+        cfg.setCacheConfiguration(cc);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return TRANSACTIONAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return PARTITIONED;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReadThroughInTx() throws Exception {
+        IgniteCache<String, Integer> cache = grid(1).cache(null);
+
+        for (int k = 0; k < 1000; k++)
+            cache.put("key" + k, k);
+
+        stopAllGrids();
+
+        startGrids(2);
+
+        Ignite ignite = grid(1);
+
+        cache = ignite.cache(null);
+
+        for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) {
+            for (TransactionIsolation txIsolation : TransactionIsolation.values()) {
+                try (Transaction tx = ignite.transactions().txStart(txConcurrency, txIsolation, 100000, 1000)) {
+                    for (int k = 0; k < 1000; k++) {
+                        String key = "key" + k;
+
+                        assertNotNull("Null value for key: " + key, cache.get(key));
+                    }
+
+                    tx.commit();
+                }
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReadThrough() throws Exception {
+        IgniteCache<String, Integer> cache = grid(1).cache(null);
+
+        for (int k = 0; k < 1000; k++)
+            cache.put("key" + k, k);
+
+        stopAllGrids();
+
+        startGrids(2);
+
+        Ignite ignite = grid(1);
+
+        cache = ignite.cache(null);
+
+        for (int k = 0; k < 1000; k++) {
+            String key = "key" + k;
+
+            assertNotNull("Null value for key: " + key, cache.get(key));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index 3f14f49..468aec1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -531,7 +531,7 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
     /**
      * Serializable factory.
      */
-    private static class TestStoreFactory implements Factory<CacheStore> {
+    protected static class TestStoreFactory implements Factory<CacheStore> {
         @Override public CacheStore create() {
             return cacheStore();
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
index 269b9ae..c97fe29 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
@@ -135,9 +135,13 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
 
         try (Transaction tx = startTx(concurrency, isolation)) {
             log.info("Do tx get.");
+            expData.add(new ExpectedData(false, "load", new HashMap(), cache.getName()));
+            expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "load"), cache.getName()));
 
             cache.get(key1);
 
+            expData.clear();
+
             log.info("Do tx put.");
 
             cache.put(key1, key1);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bf1ea21b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 6295a4d..682965a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -145,6 +145,13 @@ public class IgniteCacheTestSuite4 extends TestSuite {
 
         suite.addTestSuite(IgniteCacheManyClientsTest.class);
 
+        suite.addTestSuite(CacheReadThroughRestartSelfTest.class);
+        suite.addTestSuite(CacheReadThroughReplicatedRestartSelfTest.class);
+        suite.addTestSuite(CacheReadThroughReplicatedAtomicRestartSelfTest.class);
+        suite.addTestSuite(CacheReadThroughLocalRestartSelfTest.class);
+        suite.addTestSuite(CacheReadThroughLocalAtomicRestartSelfTest.class);
+        suite.addTestSuite(CacheReadThroughAtomicRestartSelfTest.class);
+
         return suite;
     }
 }


[7/7] incubator-ignite git commit: # IGNITE-1023 Fixed build: added example ini file to binary build.

Posted by ak...@apache.org.
# IGNITE-1023 Fixed build: added example ini file to binary build.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/93a44296
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/93a44296
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/93a44296

Branch: refs/heads/ignite-1023
Commit: 93a44296a05a4d4b6923d86b4899d32ea50637b4
Parents: a57fba6
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jun 25 10:26:59 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jun 25 10:26:59 2015 +0700

----------------------------------------------------------------------
 assembly/dependencies-visor-console.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/93a44296/assembly/dependencies-visor-console.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-visor-console.xml b/assembly/dependencies-visor-console.xml
index d773769..aa1f59b 100644
--- a/assembly/dependencies-visor-console.xml
+++ b/assembly/dependencies-visor-console.xml
@@ -42,6 +42,7 @@
                         <outputDirectory>/visorcmd</outputDirectory>
                         <includes>
                             <include>licenses/**</include>
+                            <include>*.ini</include>
                         </includes>
                     </fileSet>