You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/06/01 13:45:30 UTC
[38/53] [abbrv] incubator-ignite git commit: # ignite-709 can not
skip preload on server nodes
# ignite-709 can not skip preload on server nodes
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2c3ce158
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2c3ce158
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2c3ce158
Branch: refs/heads/ignite-sprint-5
Commit: 2c3ce158de266dfd02c91e3e6e377ce667fd598f
Parents: 581f4d9
Author: sboikov <sb...@gridgain.com>
Authored: Fri May 29 10:35:24 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri May 29 10:35:24 2015 +0300
----------------------------------------------------------------------
.../GridDhtPartitionsExchangeFuture.java | 2 +-
.../IgniteCacheClientNodeConcurrentStart.java | 105 +++++++++++++++++++
...teCacheClientNodePartitionsExchangeTest.java | 6 +-
.../testsuites/IgniteCacheTestSuite2.java | 1 +
4 files changed, 110 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c3ce158/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 162c7b3..145def8 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
@@ -517,7 +517,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
onDone(exchId.topologyVersion());
- skipPreload = true;
+ skipPreload = cctx.kernalContext().clientNode();
return;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c3ce158/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeConcurrentStart.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeConcurrentStart.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeConcurrentStart.java
new file mode 100644
index 0000000..bd74ece
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeConcurrentStart.java
@@ -0,0 +1,105 @@
+/*
+ * 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.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.junits.common.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
+
+/**
+ *
+ */
+public class IgniteCacheClientNodeConcurrentStart extends GridCommonAbstractTest {
+ /** */
+ protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final int NODES_CNT = 5;
+
+ /** */
+ private Set<Integer> clientNodes;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ assertNotNull(clientNodes);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ boolean client = false;
+
+ for (Integer clientIdx : clientNodes) {
+ if (getTestGridName(clientIdx).equals(gridName)) {
+ client = true;
+
+ break;
+ }
+ }
+
+ cfg.setClientMode(client);
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setBackups(0);
+ ccfg.setRebalanceMode(SYNC);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testConcurrentStart() throws Exception {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ for (int i = 0; i < 3; i++) {
+ try {
+ clientNodes = new HashSet<>();
+
+ while (clientNodes.size() < 2)
+ clientNodes.add(rnd.nextInt(0, NODES_CNT));
+
+ clientNodes.add(NODES_CNT - 1);
+
+ log.info("Test iteration [iter=" + i + ", clients=" + clientNodes + ']');
+
+ startGridsMultiThreaded(NODES_CNT, true);
+
+ for (int node : clientNodes) {
+ Ignite ignite = grid(node);
+
+ assertTrue(ignite.configuration().isClientMode());
+ }
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c3ce158/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 162aa81..68ae211 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
@@ -158,11 +158,11 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
Ignite ignite1 = startGrid(1);
- assertFalse(evtLatch0.await(1000, TimeUnit.MILLISECONDS));
+ assertTrue(evtLatch0.await(1000, TimeUnit.MILLISECONDS));
ignite1.close();
- assertFalse(evtLatch0.await(1000, TimeUnit.MILLISECONDS));
+ assertTrue(evtLatch0.await(1000, TimeUnit.MILLISECONDS));
ignite1 = startGrid(1);
@@ -178,7 +178,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
}
}, EventType.EVT_CACHE_REBALANCE_STARTED, EventType.EVT_CACHE_REBALANCE_STOPPED);
- assertFalse(evtLatch0.await(1000, TimeUnit.MILLISECONDS));
+ assertTrue(evtLatch0.await(1000, TimeUnit.MILLISECONDS));
client = false;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2c3ce158/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index 4664c66..037af9d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -136,6 +136,7 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(IgniteCachePartitionMapUpdateTest.class));
suite.addTest(new TestSuite(IgniteCacheClientNodePartitionsExchangeTest.class));
suite.addTest(new TestSuite(IgniteCacheClientNodeChangingTopologyTest.class));
+ suite.addTest(new TestSuite(IgniteCacheClientNodeConcurrentStart.class));
return suite;
}