You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/09/20 13:33:01 UTC
[1/2] ignite git commit: conn
Repository: ignite
Updated Branches:
refs/heads/ignite-comm-opts2 fb58fc4fd -> c1d243699
conn
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f6ea2d82
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f6ea2d82
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f6ea2d82
Branch: refs/heads/ignite-comm-opts2
Commit: f6ea2d82d233b393eed6178e475cf47eee874a31
Parents: fb58fc4
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 20 16:09:52 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 20 16:09:52 2016 +0300
----------------------------------------------------------------------
.../tcp/GridTcpCommunicationSpiRecoverySelfTest.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ea2d82/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
index dfa8a54..fbbc5de 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
@@ -742,9 +742,8 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T extends CommunicationSpi>
spi.spiStop();
}
- for (IgniteTestResources rsrcs : spiRsrcs) {
+ for (IgniteTestResources rsrcs : spiRsrcs)
rsrcs.stopThreads();
- }
spis.clear();
nodes.clear();
[2/2] ignite git commit: conn
Posted by sb...@apache.org.
conn
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c1d24369
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c1d24369
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c1d24369
Branch: refs/heads/ignite-comm-opts2
Commit: c1d243699b7dcdca4d1e052267770edd4981a87f
Parents: f6ea2d8
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 20 16:30:40 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 20 16:30:40 2016 +0300
----------------------------------------------------------------------
.../IgniteVariousConnectionNumberTest.java | 161 +++++++++++++++++++
.../ignite/testsuites/IgniteCacheTestSuite.java | 3 +
2 files changed, 164 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c1d24369/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteVariousConnectionNumberTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteVariousConnectionNumberTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteVariousConnectionNumberTest.java
new file mode 100644
index 0000000..360eb8d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteVariousConnectionNumberTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.managers.communication;
+
+import java.util.Random;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteRunnable;
+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.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheMode.REPLICATED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class IgniteVariousConnectionNumberTest extends GridCommonAbstractTest {
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final int NODES = 6;
+
+ /** */
+ private static Random rnd = new Random();
+
+ /** */
+ private boolean client;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ int connections = rnd.nextInt(10) + 1;
+
+ log.info("Node connections [name=" + gridName + ", connections=" + connections + ']');
+
+ ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setConnectionsPerNode(connections);
+ ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
+ cfg.setClientMode(client);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ long seed = U.currentTimeMillis();
+
+ rnd.setSeed(seed);
+
+ log.info("Random seed: " + seed);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testVariousConnectionNumber() throws Exception {
+ startGridsMultiThreaded(3);
+
+ client = true;
+
+ startGridsMultiThreaded(3, 3);
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setCacheMode(REPLICATED);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ ignite(0).createCache(ccfg);
+
+ for (int i = 0; i < 10; i++) {
+ log.info("Iteration: " + i);
+
+ runOperations(5000);
+
+ awaitPartitionMapExchange();
+
+ int idx = ThreadLocalRandom.current().nextInt(NODES);
+
+ stopGrid(idx);
+
+ startGrid(idx);
+ }
+ }
+
+ /**
+ * @param time Execution time.
+ * @throws Exception If failed.
+ */
+ private void runOperations(final long time) throws Exception {
+ final AtomicInteger idx = new AtomicInteger();
+
+ GridTestUtils.runMultiThreaded(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ Ignite node = ignite(idx.getAndIncrement() % NODES);
+
+ IgniteCache cache = node.cache(null);
+
+ long stopTime = U.currentTimeMillis() + time;
+
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ while (U.currentTimeMillis() < stopTime) {
+ cache.put(rnd.nextInt(10_000), 0);
+
+ node.compute().broadcast(new DummyJob());
+ }
+
+ return null;
+ }
+ }, NODES * 10, "test-thread");
+ }
+
+ /**
+ *
+ */
+ private static class DummyJob implements IgniteRunnable {
+ /** {@inheritDoc} */
+ @Override public void run() {
+ // No-op.
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c1d24369/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 2ce6e57..3a0d1ee 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -37,6 +37,7 @@ import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreOptimizedMarshallerS
import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreTest;
import org.apache.ignite.cache.store.jdbc.GridCacheJdbcBlobStoreMultithreadedSelfTest;
import org.apache.ignite.cache.store.jdbc.GridCacheJdbcBlobStoreSelfTest;
+import org.apache.ignite.internal.managers.communication.IgniteVariousConnectionNumberTest;
import org.apache.ignite.internal.processors.cache.CacheAffinityCallSelfTest;
import org.apache.ignite.internal.processors.cache.CacheDeferredDeleteSanitySelfTest;
import org.apache.ignite.internal.processors.cache.CacheEntryProcessorCopySelfTest;
@@ -319,6 +320,8 @@ public class IgniteCacheTestSuite extends TestSuite {
suite.addTestSuite(CacheTxFastFinishTest.class);
+ suite.addTestSuite(IgniteVariousConnectionNumberTest.class);
+
return suite;
}
}