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 2015/07/01 07:24:46 UTC
[01/25] incubator-ignite git commit: # init marshaller cache on
daemon nodes
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-950 048d71151 -> cc19b0862
# init marshaller cache on daemon 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/3231f933
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3231f933
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3231f933
Branch: refs/heads/ignite-950
Commit: 3231f93373a2f84b7e0ea64d969b53121b6fe323
Parents: 01d842a
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 26 14:34:24 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 26 15:28:52 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/GridKernalContextImpl.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 62 ++++--
.../IgniteDaemonNodeMarshallerCacheTest.java | 192 +++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 1 +
4 files changed, 245 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3231f933/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
index 65107a7..8abb135 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java
@@ -899,7 +899,7 @@ public class GridKernalContextImpl implements GridKernalContext, Externalizable
/** {@inheritDoc} */
@Override public boolean clientNode() {
- return cfg.isClientMode();
+ return cfg.isClientMode() || cfg.isDaemon();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3231f933/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 2f7f22c..8124594 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -265,7 +265,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
// Suppress warning if at least one ATOMIC cache found.
perf.add("Enable ATOMIC mode if not using transactions (set 'atomicityMode' to ATOMIC)",
- cfg.getAtomicityMode() == ATOMIC);
+ cfg.getAtomicityMode() == ATOMIC);
// Suppress warning if at least one non-FULL_SYNC mode found.
perf.add("Disable fully synchronous writes (set 'writeSynchronizationMode' to PRIMARY_SYNC or FULL_ASYNC)",
@@ -341,8 +341,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
"Serializable transactions are disabled while default transaction isolation is SERIALIZABLE " +
"(most likely misconfiguration - either update 'isTxSerializableEnabled' or " +
"'defaultTxIsolationLevel' properties) for cache: " + U.maskName(cc.getName()),
- "Serializable transactions are disabled while default transaction isolation is SERIALIZABLE " +
- "for cache: " + U.maskName(cc.getName()));
+ "Serializable transactions are disabled while default transaction isolation is SERIALIZABLE " +
+ "for cache: " + U.maskName(cc.getName()));
if (cc.isWriteBehindEnabled()) {
if (cfgStore == null)
@@ -527,8 +527,14 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@SuppressWarnings( {"unchecked"})
@Override public void start() throws IgniteCheckedException {
- if (ctx.config().isDaemon())
+ if (ctx.config().isDaemon()) {
+ sharedCtx = createSharedContext(ctx, CU.startStoreSessionListeners(ctx, null));
+
+ for (GridCacheSharedManager mgr : sharedCtx.managers())
+ mgr.start(sharedCtx);
+
return;
+ }
DeploymentMode depMode = ctx.config().getDeploymentMode();
@@ -667,8 +673,45 @@ public class GridCacheProcessor extends GridProcessorAdapter {
@SuppressWarnings("unchecked")
@Override public void onKernalStart() throws IgniteCheckedException {
try {
- if (ctx.config().isDaemon())
+ if (ctx.config().isDaemon()) {
+ for (CacheConfiguration ccfg : ctx.config().getCacheConfiguration()) {
+ if (CU.isMarshallerCache(ccfg.getName())) {
+ CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
+
+ initialize(ccfg, cacheObjCtx);
+
+ GridCacheContext ctx = createCache(ccfg, null, CacheType.MARSHALLER, cacheObjCtx, true);
+
+ ctx.dynamicDeploymentId(IgniteUuid.randomUuid());
+
+ sharedCtx.addCacheContext(ctx);
+
+ GridCacheAdapter cache = ctx.cache();
+
+ String name = ccfg.getName();
+
+ caches.put(maskNull(name), cache);
+
+ startCache(cache);
+
+ break;
+ }
+ }
+
+ marshallerCache().context().preloader().syncFuture().listen(new CIX1<IgniteInternalFuture<?>>() {
+ @Override public void applyx(IgniteInternalFuture<?> f) throws IgniteCheckedException {
+ ctx.marshallerContext().onMarshallerCachePreloaded(ctx);
+ }
+ });
+
+ for (GridCacheSharedManager<?, ?> mgr : sharedCtx.managers())
+ mgr.onKernalStart();
+
+ for (GridCacheAdapter<?, ?> cache : caches.values())
+ onKernalStart(cache);
+
return;
+ }
ClusterNode locNode = ctx.discovery().localNode();
@@ -808,9 +851,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void stop(boolean cancel) throws IgniteCheckedException {
- if (ctx.config().isDaemon())
- return;
-
for (String cacheName : stopSeq) {
GridCacheAdapter<?, ?> cache = caches.remove(maskNull(cacheName));
@@ -850,9 +890,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
@Override public void onKernalStop(boolean cancel) {
cacheStartedLatch.countDown();
- if (ctx.config().isDaemon())
- return;
-
for (String cacheName : stopSeq) {
GridCacheAdapter<?, ?> cache = caches.get(maskNull(cacheName));
@@ -1390,6 +1427,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
Collection<DynamicCacheChangeRequest> reqs,
AffinityTopologyVersion topVer
) throws IgniteCheckedException {
+ if (ctx.isDaemon())
+ return;
+
for (DynamicCacheChangeRequest req : reqs) {
assert req.start() : req;
assert req.cacheType() != null : req;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3231f933/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java
new file mode 100644
index 0000000..a0f4074
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java
@@ -0,0 +1,192 @@
+/*
+ * 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.configuration.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.resources.*;
+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.io.*;
+
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheRebalanceMode.*;
+import static org.apache.ignite.internal.IgniteNodeAttributes.*;
+
+/**
+ *
+ */
+public class IgniteDaemonNodeMarshallerCacheTest extends GridCommonAbstractTest {
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private boolean daemon;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setDaemon(daemon);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMarshalOnDaemonNode1() throws Exception {
+ marshalOnDaemonNode(true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testMarshalOnDaemonNode2() throws Exception {
+ marshalOnDaemonNode(false);
+ }
+
+ /**
+ * @param startFirst If {@code true} daemon node is started first.
+ * @throws Exception If failed.
+ */
+ public void marshalOnDaemonNode(boolean startFirst) throws Exception {
+ int nodeIdx = 0;
+
+ if (!startFirst) {
+ Ignite ignite1 = startGrid(nodeIdx++);
+
+ assertFalse("true".equals(ignite1.cluster().localNode().attribute(ATTR_DAEMON)));
+ }
+
+ daemon = true;
+
+ Ignite daemonNode = startGrid(nodeIdx++);
+
+ assertEquals("true", daemonNode.cluster().localNode().attribute(ATTR_DAEMON));
+
+ daemon = false;
+
+ if (startFirst) {
+ Ignite ignite1 = startGrid(nodeIdx++);
+
+ assertFalse("true".equals(ignite1.cluster().localNode().attribute(ATTR_DAEMON)));
+ }
+
+ awaitPartitionMapExchange();
+
+ TestClass1 res1 = daemonNode.compute(daemonNode.cluster().forRemotes()).call(new TestCallable1());
+
+ assertNotNull(res1);
+ assertEquals(111, res1.val);
+
+ Ignite ignite2 = startGrid(nodeIdx);
+
+ CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+
+ ccfg.setRebalanceMode(SYNC);
+ ccfg.setCacheMode(REPLICATED);
+
+ IgniteCache<Object, Object> cache = ignite2.getOrCreateCache(ccfg);
+
+ awaitPartitionMapExchange();
+
+ cache.put(1, new TestClass1(1));
+ cache.put(2, new TestClass2(2));
+
+ TestClass2 res2 = daemonNode.compute(daemonNode.cluster().forRemotes()).call(new TestCallable2());
+
+ assertNotNull(res2);
+ assertEquals(222, res2.val);
+ }
+
+ /**
+ *
+ */
+ private static class TestCallable1 implements IgniteCallable<TestClass1> {
+ /** */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** {@inheritDoc} */
+ @Override public TestClass1 call() throws Exception {
+ assertFalse("true".equals(ignite.cluster().localNode().attribute(ATTR_DAEMON)));
+
+ return new TestClass1(111);
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestCallable2 implements IgniteCallable<TestClass2> {
+ /** */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** {@inheritDoc} */
+ @Override public TestClass2 call() throws Exception {
+ assertFalse("true".equals(ignite.cluster().localNode().attribute(ATTR_DAEMON)));
+
+ return new TestClass2(222);
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestClass1 implements Serializable {
+ /** */
+ public int val;
+
+ /**
+ * @param val Value.
+ */
+ public TestClass1(int val) {
+ this.val = val;
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestClass2 implements Serializable {
+ /** */
+ public int val;
+
+ /**
+ * @param val Value.
+ */
+ public TestClass2(int val) {
+ this.val = val;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3231f933/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 6ff83e2..df22290 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -94,6 +94,7 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTestSuite(GridFailFastNodeFailureDetectionSelfTest.class);
suite.addTestSuite(OffHeapTieredTransactionSelfTest.class);
suite.addTestSuite(IgniteSlowClientDetectionSelfTest.class);
+ suite.addTestSuite(IgniteDaemonNodeMarshallerCacheTest.class);
return suite;
}
[08/25] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-sprint-7' into ignite-sprint-7
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-7' 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/5dff89c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5dff89c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5dff89c6
Branch: refs/heads/ignite-950
Commit: 5dff89c650575b6fe92450492027e77ffce48186
Parents: a226666 15f3612
Author: avinogradov <av...@gridgain.com>
Authored: Mon Jun 29 15:56:02 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Jun 29 15:56:02 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/GridKernalContextImpl.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 62 ++++--
.../cache/GridCacheDaemonNodeStopSelfTest.java | 119 ------------
.../IgniteDaemonNodeMarshallerCacheTest.java | 192 +++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 1 +
.../testsuites/IgniteCacheTestSuite3.java | 1 -
6 files changed, 245 insertions(+), 132 deletions(-)
----------------------------------------------------------------------
[03/25] incubator-ignite git commit: # ignite-gg-10453 removed test
(test is invalid after fix)
Posted by sb...@apache.org.
# ignite-gg-10453 removed test (test is invalid after fix)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d51db291
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d51db291
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d51db291
Branch: refs/heads/ignite-950
Commit: d51db291037866b03ac828430cfdcc914c2f79ed
Parents: d86882c
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jun 29 09:21:05 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jun 29 09:21:05 2015 +0300
----------------------------------------------------------------------
.../cache/GridCacheDaemonNodeStopSelfTest.java | 119 -------------------
.../testsuites/IgniteCacheTestSuite3.java | 1 -
2 files changed, 120 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d51db291/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java
deleted file mode 100644
index c56ad1c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java
+++ /dev/null
@@ -1,119 +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.internal.processors.cache;
-
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-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 java.util.concurrent.*;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
-import static org.apache.ignite.cache.CacheMode.*;
-
-/**
- * Test cache operations with daemon node.
- */
-public class GridCacheDaemonNodeStopSelfTest extends GridCommonAbstractTest {
- /** */
- private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
- /** Daemon flag. */
- protected boolean daemon;
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- super.beforeTest();
-
- daemon = false;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration c = super.getConfiguration(gridName);
-
- c.setDaemon(daemon);
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
- disco.setIpFinder(ipFinder);
-
- c.setDiscoverySpi(disco);
-
- c.setConnectorConfiguration(null);
-
- CacheConfiguration cc = defaultCacheConfiguration();
-
- cc.setCacheMode(LOCAL);
- cc.setAtomicityMode(ATOMIC);
-
- TransactionConfiguration cfg = new TransactionConfiguration();
-
- c.setTransactionConfiguration(cfg);
-
- c.setCacheConfiguration(cc);
-
- return c;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testStartStop() throws Exception {
- try {
- daemon = true;
-
- final IgniteEx daemonNode = startGrid(0);
-
- final IgniteInternalFuture<Object> f = GridTestUtils.runAsync(new Callable<Object>() {
- @Override public Object call() throws Exception {
- daemonNode.context().marshallerContext().getClass(1,
- GridCacheDaemonNodeStopSelfTest.class.getClassLoader());
-
- return null;
- }
- });
-
- GridTestUtils.assertThrowsWithCause(new Callable<Object>() {
- @Override public Object call() throws Exception {
- f.get(300);
-
- return null;
- }
- }, IgniteFutureTimeoutCheckedException.class);
-
- // Stop grid.
- stopGrid(0);
-
- GridTestUtils.assertThrowsWithCause(new Callable<Object>() {
- @Override public Object call() throws Exception {
- f.get(5, TimeUnit.SECONDS);
-
- return null;
- }
- }, IllegalStateException.class);
- }
- finally {
- stopAllGrids();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d51db291/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index b83f50f..5947d33 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -100,7 +100,6 @@ public class IgniteCacheTestSuite3 extends TestSuite {
suite.addTestSuite(GridCacheDaemonNodeLocalSelfTest.class);
suite.addTestSuite(GridCacheDaemonNodePartitionedSelfTest.class);
suite.addTestSuite(GridCacheDaemonNodeReplicatedSelfTest.class);
- suite.addTestSuite(GridCacheDaemonNodeStopSelfTest.class);
// Write-behind.
suite.addTest(IgniteCacheWriteBehindTestSuite.suite());
[20/25] incubator-ignite git commit: IGNITE-1062 Added tests.
Posted by sb...@apache.org.
IGNITE-1062 Added tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6ebcb6de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6ebcb6de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6ebcb6de
Branch: refs/heads/ignite-950
Commit: 6ebcb6de192e1916e58226990eb9d9ec759da6ef
Parents: 8006a84
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Tue Jun 30 16:51:15 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Tue Jun 30 16:51:15 2015 +0300
----------------------------------------------------------------------
.../discovery/GridDiscoveryManager.java | 26 +--------
.../IgniteTopologyPrintFormatSelfTest.java | 60 +++++++++++++++++++-
2 files changed, 61 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ebcb6de/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 1d555e4..a8ce8ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -101,7 +101,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
/** Predicate filtering client nodes. */
private static final IgnitePredicate<ClusterNode> clientFilter = new P1<ClusterNode>() {
@Override public boolean apply(ClusterNode n) {
- return n.isClient();
+ return CU.clientNode(n);
}
};
@@ -940,9 +940,9 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
Collection<ClusterNode> rmtNodes = discoCache.remoteNodes();
- Collection<ClusterNode> serverNodes = discoCache.serverNodes();
+ Collection<ClusterNode> serverNodes = F.view(discoCache.allNodes(), F.not(clientFilter));
- Collection<ClusterNode> clientNodes = discoCache.clientNodes();
+ Collection<ClusterNode> clientNodes = F.view(discoCache.allNodes(), clientFilter);
ClusterNode locNode = discoCache.localNode();
@@ -2122,12 +2122,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
/** Remote nodes. */
private final List<ClusterNode> rmtNodes;
- /** Client nodes. */
- private final List<ClusterNode> clientNodes;
-
- /** Server nodes. */
- private final List<ClusterNode> serverNodes;
-
/** All nodes. */
private final List<ClusterNode> allNodes;
@@ -2216,10 +2210,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
all.addAll(rmtNodes);
- clientNodes = Collections.unmodifiableList(new ArrayList<>(F.view(all, clientFilter)));
-
- serverNodes = Collections.unmodifiableList(new ArrayList<>(F.view(all, F.not(clientFilter))));
-
Collections.sort(all, GridNodeOrderComparator.INSTANCE);
allNodes = Collections.unmodifiableList(all);
@@ -2370,16 +2360,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
return rmtNodes;
}
- /** @return Server nodes. */
- Collection<ClusterNode> serverNodes() {
- return serverNodes;
- }
-
- /** @return Client nodes. */
- Collection<ClusterNode> clientNodes() {
- return clientNodes;
- }
-
/** @return All nodes. */
Collection<ClusterNode> allNodes() {
return allNodes;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6ebcb6de/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
index efbc431..2a71f28 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
@@ -56,11 +56,16 @@ public class IgniteTopologyPrintFormatSelfTest extends GridCommonAbstractTest {
TcpDiscoverySpi disc = new TcpDiscoverySpi();
disc.setIpFinder(IP_FINDER);
- cfg.setDiscoverySpi(disc);
-
if (gridName.endsWith("client"))
cfg.setClientMode(true);
+ if (gridName.endsWith("client_force_server")) {
+ cfg.setClientMode(true);
+ disc.setForceServerMode(true);
+ }
+
+ cfg.setDiscoverySpi(disc);
+
return cfg;
}
@@ -176,6 +181,57 @@ public class IgniteTopologyPrintFormatSelfTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testForceServerAndClientLogs() throws Exception {
+ MockLogger log = new MockLogger();
+
+ log.setLevel(Level.INFO);
+
+ doForceServerAndClientTest(log);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testForceServerAndClientDebugLogs() throws Exception {
+ MockLogger log = new MockLogger();
+
+ log.setLevel(Level.DEBUG);
+
+ doForceServerAndClientTest(log);
+ }
+
+ /**
+ * @param log Log.
+ * @throws Exception If failed.
+ */
+ private void doForceServerAndClientTest(MockLogger log) throws Exception {
+ try {
+ Ignite server = startGrid("server");
+
+ setLogger(log, server);
+
+ Ignite server1 = startGrid("server1");
+ Ignite client1 = startGrid("first client");
+ Ignite client2 = startGrid("second client");
+ Ignite forceServClnt3 = startGrid("third client_force_server");
+
+ waitForDiscovery(server, server1, client1, client2, forceServClnt3);
+ }
+ finally {
+ stopAllGrids();
+ }
+
+ assertTrue(F.forAny(log.logs(), new IgnitePredicate<String>() {
+ @Override public boolean apply(String s) {
+ return s.contains("Topology snapshot [ver=5, server nodes=2, client nodes=3,")
+ || (s.contains(">>> Number of server nodes: 2") && s.contains(">>> Number of client nodes: 3"));
+ }
+ }));
+ }
+
+ /**
* Set log.
*
* @param log Log.
[15/25] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-sprint-7' into ignite-sprint-7
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-7' 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/bade9f16
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bade9f16
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bade9f16
Branch: refs/heads/ignite-950
Commit: bade9f16b64416b4ea032699a8a651d0a3ad064f
Parents: 596c538 8c55f8a
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jun 30 10:39:09 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jun 30 10:39:09 2015 +0700
----------------------------------------------------------------------
.../ignite/internal/GridKernalContextImpl.java | 2 +-
.../discovery/GridDiscoveryManager.java | 6 +
.../cache/GridCacheDeploymentManager.java | 10 +-
.../processors/cache/GridCacheProcessor.java | 62 ++++--
.../shmem/IpcSharedMemoryServerEndpoint.java | 10 +-
.../core/src/test/config/spark/spark-config.xml | 46 +++++
.../cache/GridCacheDaemonNodeStopSelfTest.java | 119 ------------
.../IgniteDaemonNodeMarshallerCacheTest.java | 192 +++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 1 +
.../testsuites/IgniteCacheTestSuite3.java | 1 -
.../org/apache/ignite/spark/IgniteContext.scala | 50 ++++-
.../org/apache/ignite/spark/IgniteRddSpec.scala | 18 ++
pom.xml | 12 +-
13 files changed, 380 insertions(+), 149 deletions(-)
----------------------------------------------------------------------
[04/25] incubator-ignite git commit: Fixed javadoc build.
Posted by sb...@apache.org.
Fixed javadoc 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/1a214778
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1a214778
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1a214778
Branch: refs/heads/ignite-950
Commit: 1a21477898fb69df09eafb0ec8bedec7e06ec462
Parents: c6187a9
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Mon Jun 29 11:20:40 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Mon Jun 29 11:20:40 2015 +0300
----------------------------------------------------------------------
.../internal/visor/util/VisorClusterGroupEmptyException.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1a214778/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorClusterGroupEmptyException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorClusterGroupEmptyException.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorClusterGroupEmptyException.java
index b969178..0cca514 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorClusterGroupEmptyException.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorClusterGroupEmptyException.java
@@ -26,7 +26,11 @@ public class VisorClusterGroupEmptyException extends ClusterGroupEmptyException
/** */
private static final long serialVersionUID = 0L;
- /** @inheritDoc */
+ /**
+ * Creates exception with given error message.
+ *
+ * @param msg Error message.
+ */
public VisorClusterGroupEmptyException(String msg) {
super(msg);
}
[22/25] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-1064' into ignite-sprint-7
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1064' 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/e91bc484
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e91bc484
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e91bc484
Branch: refs/heads/ignite-950
Commit: e91bc484e224ce8a039ef5bba71aa7f093dce262
Parents: 28525ac 0ef74a1
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 30 17:31:22 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 30 17:31:22 2015 +0300
----------------------------------------------------------------------
.../processors/clock/GridClockServer.java | 21 ++++--
.../TcpDiscoveryMulticastIpFinder.java | 74 ++++++++++++++++----
2 files changed, 76 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
[11/25] incubator-ignite git commit: # fixed delays on node stop
Posted by sb...@apache.org.
# fixed delays on node stop
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/68c21ac4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/68c21ac4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/68c21ac4
Branch: refs/heads/ignite-950
Commit: 68c21ac4c924caac6b6e4f7dd287ba1326f4fc11
Parents: 6929a0c
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Jun 29 11:44:17 2015 -0700
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Jun 29 11:44:17 2015 -0700
----------------------------------------------------------------------
.../util/ipc/shmem/IpcSharedMemoryServerEndpoint.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/68c21ac4/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java
index 102c5b1..8c3f29e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryServerEndpoint.java
@@ -531,7 +531,9 @@ public class IpcSharedMemoryServerEndpoint implements IpcServerEndpoint {
while (true) {
try {
- Thread.sleep(GC_FREQ);
+ // Sleep only if not cancelled.
+ if (lastRunNeeded)
+ Thread.sleep(GC_FREQ);
}
catch (InterruptedException ignored) {
// No-op.
@@ -559,8 +561,12 @@ public class IpcSharedMemoryServerEndpoint implements IpcServerEndpoint {
}
if (isCancelled()) {
- if (lastRunNeeded)
+ if (lastRunNeeded) {
lastRunNeeded = false;
+
+ // Clear interrupted status.
+ Thread.interrupted();
+ }
else {
Thread.currentThread().interrupt();
[18/25] incubator-ignite git commit: # ignite-gg-1064 use loopback
address in clock server if failed to get local host
Posted by sb...@apache.org.
# ignite-gg-1064 use loopback address in clock server if failed to get local host
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0ef74a14
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0ef74a14
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0ef74a14
Branch: refs/heads/ignite-950
Commit: 0ef74a1449d503ae65a200e48da735b545e923da
Parents: b5bc06e
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 30 15:07:18 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 30 15:07:18 2015 +0300
----------------------------------------------------------------------
.../processors/clock/GridClockServer.java | 21 +++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0ef74a14/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java
index e47d1fa..a835da8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockServer.java
@@ -62,9 +62,20 @@ public class GridClockServer {
int startPort = ctx.config().getTimeServerPortBase();
int endPort = startPort + ctx.config().getTimeServerPortRange() - 1;
- InetAddress locHost = !F.isEmpty(ctx.config().getLocalHost()) ?
- InetAddress.getByName(ctx.config().getLocalHost()) :
- U.getLocalHost();
+ InetAddress locHost;
+
+ if (F.isEmpty(ctx.config().getLocalHost())) {
+ try {
+ locHost = U.getLocalHost();
+ }
+ catch (IOException e) {
+ locHost = InetAddress.getLoopbackAddress();
+
+ U.warn(log, "Failed to get local host address, will use loopback address: " + locHost);
+ }
+ }
+ else
+ locHost = InetAddress.getByName(ctx.config().getLocalHost());
for (int p = startPort; p <= endPort; p++) {
try {
@@ -83,8 +94,8 @@ public class GridClockServer {
}
if (sock == null)
- throw new IgniteCheckedException("Failed to bind time server socket within specified port range [locHost=" +
- locHost + ", startPort=" + startPort + ", endPort=" + endPort + ']');
+ throw new IgniteCheckedException("Failed to bind time server socket within specified port range " +
+ "[locHost=" + locHost + ", startPort=" + startPort + ", endPort=" + endPort + ']');
}
catch (IOException e) {
throw new IgniteCheckedException("Failed to start time server (failed to get local host address)", e);
[14/25] incubator-ignite git commit: sprint-7 - Merge branch
ignite-1061 into ignite-sprint-7
Posted by sb...@apache.org.
sprint-7 - Merge branch ignite-1061 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/8c55f8ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8c55f8ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8c55f8ab
Branch: refs/heads/ignite-950
Commit: 8c55f8abe8c8e56b5f28c26482027190d5e908d7
Parents: 68c21ac b467822
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Mon Jun 29 20:34:29 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Mon Jun 29 20:34:29 2015 -0700
----------------------------------------------------------------------
.../core/src/test/config/spark/spark-config.xml | 46 ++++++++++++++++++
.../org/apache/ignite/spark/IgniteContext.scala | 50 ++++++++++++++++++--
.../org/apache/ignite/spark/IgniteRddSpec.scala | 18 +++++++
3 files changed, 110 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
[13/25] incubator-ignite git commit: IGNITE-1061 - Fixed as discussed.
Posted by sb...@apache.org.
IGNITE-1061 - Fixed as discussed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b467822d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b467822d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b467822d
Branch: refs/heads/ignite-950
Commit: b467822d55c8f796de2d7b3c2aa80b46f81811c1
Parents: 68c21ac
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Mon Jun 29 20:33:20 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Mon Jun 29 20:33:20 2015 -0700
----------------------------------------------------------------------
.../core/src/test/config/spark/spark-config.xml | 46 ++++++++++++++++++
.../org/apache/ignite/spark/IgniteContext.scala | 50 ++++++++++++++++++--
.../org/apache/ignite/spark/IgniteRddSpec.scala | 18 +++++++
3 files changed, 110 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b467822d/modules/core/src/test/config/spark/spark-config.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/spark/spark-config.xml b/modules/core/src/test/config/spark/spark-config.xml
new file mode 100644
index 0000000..4b7ffe1
--- /dev/null
+++ b/modules/core/src/test/config/spark/spark-config.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+ <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+ <property name="localHost" value="127.0.0.1"/>
+
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+ <property name="addresses">
+ <list>
+ <value>127.0.0.1:47500</value>
+ <value>127.0.0.1:47501</value>
+ <value>127.0.0.1:47502</value>
+ <value>127.0.0.1:47503</value>
+ <value>127.0.0.1:47504</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b467822d/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala b/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
index e52555a..5dbb1d3 100644
--- a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
+++ b/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
@@ -33,11 +33,13 @@ import org.apache.spark.sql.SQLContext
* @tparam V Value type.
*/
class IgniteContext[K, V](
- @scala.transient val sparkContext: SparkContext,
+ @transient val sparkContext: SparkContext,
cfgF: () ⇒ IgniteConfiguration,
client: Boolean = true
) extends Serializable with Logging {
- @scala.transient private val driver = true
+ @transient private val driver = true
+
+ private val cfgClo = new Once(cfgF)
if (!client) {
val workers = sparkContext.getExecutorStorageStatus.length - 1
@@ -51,6 +53,15 @@ class IgniteContext[K, V](
sparkContext.parallelize(1 to workers, workers).foreach(it ⇒ ignite())
}
+ // Make sure to start Ignite on context creation.
+ ignite()
+
+ /**
+ * Creates an instance of IgniteContext with the given spring configuration.
+ *
+ * @param sc Spark context.
+ * @param springUrl Spring configuration path.
+ */
def this(
sc: SparkContext,
springUrl: String
@@ -58,6 +69,17 @@ class IgniteContext[K, V](
this(sc, () ⇒ IgnitionEx.loadConfiguration(springUrl).get1())
}
+ /**
+ * Creates an instance of IgniteContext with default Ignite configuration.
+ * By default this method will use grid configuration defined in `IGNITE_HOME/config/default-config.xml`
+ * configuration file.
+ *
+ * @param sc Spark context.
+ */
+ def this(sc: SparkContext) {
+ this(sc, IgnitionEx.DFLT_CFG)
+ }
+
val sqlContext = new SQLContext(sparkContext)
/**
@@ -89,7 +111,7 @@ class IgniteContext[K, V](
* @return Ignite instance.
*/
def ignite(): Ignite = {
- val igniteCfg = cfgF()
+ val igniteCfg = cfgClo()
try {
Ignition.ignite(igniteCfg.getGridName)
@@ -112,8 +134,28 @@ class IgniteContext[K, V](
* a no-op.
*/
def close() = {
- val igniteCfg = cfgF()
+ val igniteCfg = cfgClo()
Ignition.stop(igniteCfg.getGridName, false)
}
}
+
+/**
+ * Auxiliary closure that ensures that passed in closure is executed only once.
+ *
+ * @param clo Closure to wrap.
+ */
+private class Once(clo: () ⇒ IgniteConfiguration) extends Serializable {
+ @transient @volatile var res: IgniteConfiguration = null
+
+ def apply(): IgniteConfiguration = {
+ if (res == null) {
+ this.synchronized {
+ if (res == null)
+ res = clo()
+ }
+ }
+
+ res
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b467822d/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec.scala b/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec.scala
index 26ce693..8fa6949 100644
--- a/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec.scala
+++ b/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRddSpec.scala
@@ -147,6 +147,24 @@ class IgniteRddSpec extends FunSpec with Matchers with BeforeAndAfterAll with Be
sc.stop()
}
}
+
+ it("should successfully start spark context with XML configuration") {
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val ic = new IgniteContext[String, String](sc,
+ "modules/core/src/test/config/spark/spark-config.xml")
+
+ val cache: IgniteRDD[String, String] = ic.fromCache(PARTITIONED_CACHE_NAME)
+
+ cache.savePairs(sc.parallelize(1 to 1000, 2).map(i ⇒ (String.valueOf(i), "val" + i)))
+
+ assert(1000 == cache.count())
+ }
+ finally {
+ sc.stop()
+ }
+ }
}
override protected def beforeEach() = {
[24/25] incubator-ignite git commit: ignite-950: preparing for
handover
Posted by sb...@apache.org.
ignite-950: preparing for handover
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/76309bb8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/76309bb8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/76309bb8
Branch: refs/heads/ignite-950
Commit: 76309bb8cb50b05296d242104f0a92068b105ef9
Parents: 8929cb4
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 1 08:24:04 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 1 08:24:04 2015 +0300
----------------------------------------------------------------------
.../cache/CacheIndexedObjectImpl.java | 26 +----
.../cacheobject/IgniteCacheObjectProcessor.java | 8 +-
.../IgniteCacheObjectProcessorImpl.java | 27 ++---
.../processors/query/GridQueryProcessor.java | 105 +++++--------------
4 files changed, 43 insertions(+), 123 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/76309bb8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheIndexedObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheIndexedObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheIndexedObjectImpl.java
index 66631ec..8993039 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheIndexedObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheIndexedObjectImpl.java
@@ -165,21 +165,10 @@ public class CacheIndexedObjectImpl extends CacheObjectAdapter {
*
* @param fieldName Field name.
* @param marsh Marshaller.
- * @param field Field instance to get access through reflection.
* @return {@code true} if has.
* @throws IgniteCheckedException In case of error.
*/
- public boolean hasField(String fieldName, OptimizedMarshaller marsh, Field field) throws IgniteCheckedException {
- if (field != null && val != null) {
- try {
- field.get(val);
- return true;
- }
- catch (Exception e) {
- return false;
- }
- }
-
+ public boolean hasField(String fieldName, OptimizedMarshaller marsh) throws IgniteCheckedException {
assert valBytes != null;
return marsh.hasField(fieldName, valBytes, start, len);
@@ -190,22 +179,11 @@ public class CacheIndexedObjectImpl extends CacheObjectAdapter {
*
* @param fieldName Field name.
* @param marsh Marshaller.
- * @param field Field instance to get access through reflection.
* @return Field.
* @throws IgniteFieldNotFoundException In case if there is no such a field.
* @throws IgniteCheckedException In case of error.
*/
- public Object field(String fieldName, OptimizedMarshaller marsh, Field field) throws IgniteCheckedException {
- if (field != null && val != null) {
- try {
- return field.get(val);
- }
- catch (Exception e) {
- throw new IgniteFieldNotFoundException("Object doesn't have the field [obj=" + val + ", field="
- + fieldName + "]", e);
- }
- }
-
+ public Object field(String fieldName, OptimizedMarshaller marsh) throws IgniteCheckedException {
assert valBytes != null;
return marsh.readField(fieldName, valBytes, start, len, val != null ? val.getClass().getClassLoader() : null);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/76309bb8/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
index aa5a550..164d666 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
@@ -88,21 +88,19 @@ public interface IgniteCacheObjectProcessor extends GridProcessor {
*
* @param obj Object to get field from.
* @param fieldName Field name.
- * @param field Field instance to get access through reflection.
* @throws IgniteFieldNotFoundException In case if there is no such a field.
* @return Field value.
*/
- public Object field(Object obj, String fieldName, @Nullable Field field) throws IgniteFieldNotFoundException;
+ public Object field(Object obj, String fieldName) throws IgniteFieldNotFoundException;
/**
* Checks whether field is set in the object. Object should be an instance of {@link CacheObject}.
*
* @param obj Object.
* @param fieldName Field name.
- * @param field Field instance to get access through reflection.
* @return {@code true} if field is set.
*/
- public boolean hasField(Object obj, String fieldName, @Nullable Field field);
+ public boolean hasField(Object obj, String fieldName);
/**
* Checks whether this functionality is globally supported.
@@ -116,7 +114,7 @@ public interface IgniteCacheObjectProcessor extends GridProcessor {
* Footer contains information about fields location in the serialized form, thus enabling fast queries without
* a need to deserialize the object.
*
- * Indexing is enabled with {@link OptimizedMarshallerExt#enableFieldsIndexing(Class)}.
+ * Indexing is enabled with {@link OptimizedMarshallerIndexingHandler#enableFieldsIndexingForClass(Class)}.
*
* @param cls Class.
* @return {@code true} if the footer is enabled.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/76309bb8/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
index bba6966..689c4f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
@@ -340,31 +340,32 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
}
/** {@inheritDoc} */
- @Override public Object field(Object obj, String fieldName, Field field) throws IgniteFieldNotFoundException {
+ @Override public Object field(Object obj, String fieldName) throws IgniteFieldNotFoundException {
assert indexingMgr != null;
- try {
- return ((CacheIndexedObjectImpl)obj).field(fieldName, optMarsh, field);
- }
- catch (IgniteFieldNotFoundException e) {
- throw e;
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
+ if (obj instanceof CacheIndexedObjectImpl) {
+ try {
+ return ((CacheIndexedObjectImpl)obj).field(fieldName, optMarsh);
+ }
+ catch (IgniteFieldNotFoundException e) {
+ throw e;
+ }
+ catch (IgniteCheckedException e) {
+ throw new IgniteException(e);
+ }
}
- catch (ClassCastException e) {
+ else
throw new IgniteFieldNotFoundException("Object doesn't have field [obj=" + obj + ", field=" + fieldName
+ "]");
- }
}
/** {@inheritDoc} */
- @Override public boolean hasField(Object obj, String fieldName, Field field) {
+ @Override public boolean hasField(Object obj, String fieldName) {
if (obj instanceof CacheIndexedObjectImpl) {
assert indexingMgr != null;
try {
- return ((CacheIndexedObjectImpl)obj).hasField(fieldName, optMarsh, null);
+ return ((CacheIndexedObjectImpl)obj).hasField(fieldName, optMarsh);
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/76309bb8/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index e00acbd..f2710b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -141,12 +141,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
TypeId typeId;
if (valCls == null || ctx.cacheObjects().isPortableEnabled()) {
- processCacheTypeMeta(meta, desc, PORTABLE_PROPERTY, keyCls, valCls);
+ processCacheTypeMeta(meta, desc, PORTABLE_PROPERTY);
typeId = new TypeId(ccfg.getName(), ctx.cacheObjects().typeId(meta.getValueType()));
}
else if (ctx.cacheObjects().enableFieldsIndexing(valCls)) {
- processCacheTypeMeta(meta, desc, INDEXED_FIELDS_PROPERTY, keyCls, valCls);
+ processCacheTypeMeta(meta, desc, INDEXED_FIELDS_PROPERTY);
typeId = new TypeId(ccfg.getName(), ctx.cacheObjects().typeId(valCls.getName()));
}
@@ -1239,18 +1239,16 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param meta Declared metadata.
* @param d Type descriptor.
* @param propType PropertyType.
- * @param keyCls Key class.
- * @param valCls Value class.
* @throws IgniteCheckedException If failed.
*/
- private void processCacheTypeMeta(CacheTypeMetadata meta, TypeDescriptor d, PropertyType propType,
- @Nullable Class<?> keyCls, @Nullable Class<?> valCls) throws IgniteCheckedException {
+ private void processCacheTypeMeta(CacheTypeMetadata meta, TypeDescriptor d, PropertyType propType)
+ throws IgniteCheckedException {
assert propType != CLASS_PROPERTY;
for (Map.Entry<String, Class<?>> entry : meta.getAscendingFields().entrySet()) {
Property prop = propType == PORTABLE_PROPERTY ?
buildPortableProperty(entry.getKey(), entry.getValue()) :
- buildIndexedFieldsProperty(entry.getKey(), entry.getValue(), keyCls, valCls);
+ buildIndexedFieldsProperty(entry.getKey(), entry.getValue());
d.addProperty(prop, false);
@@ -1264,7 +1262,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
for (Map.Entry<String, Class<?>> entry : meta.getDescendingFields().entrySet()) {
Property prop = propType == PORTABLE_PROPERTY ?
buildPortableProperty(entry.getKey(), entry.getValue()) :
- buildIndexedFieldsProperty(entry.getKey(), entry.getValue(), keyCls, valCls);
+ buildIndexedFieldsProperty(entry.getKey(), entry.getValue());
d.addProperty(prop, false);
@@ -1278,7 +1276,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
for (String txtIdx : meta.getTextFields()) {
Property prop = propType == PORTABLE_PROPERTY ?
buildPortableProperty(txtIdx, String.class) :
- buildIndexedFieldsProperty(txtIdx, String.class, keyCls, valCls);
+ buildIndexedFieldsProperty(txtIdx, String.class);
d.addProperty(prop, false);
@@ -1298,7 +1296,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
for (Map.Entry<String, IgniteBiTuple<Class<?>, Boolean>> idxField : idxFields.entrySet()) {
Property prop = propType == PORTABLE_PROPERTY ?
buildPortableProperty(idxField.getKey(), idxField.getValue().get1()) :
- buildIndexedFieldsProperty(idxField.getKey(), idxField.getValue().get1(), keyCls, valCls);
+ buildIndexedFieldsProperty(idxField.getKey(), idxField.getValue().get1());
d.addProperty(prop, false);
@@ -1314,7 +1312,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
for (Map.Entry<String, Class<?>> entry : meta.getQueryFields().entrySet()) {
Property prop = propType == PORTABLE_PROPERTY ?
buildPortableProperty(entry.getKey(), entry.getValue()) :
- buildIndexedFieldsProperty(entry.getKey(), entry.getValue(), keyCls, valCls);
+ buildIndexedFieldsProperty(entry.getKey(), entry.getValue());
if (!d.props.containsKey(prop.name()))
d.addProperty(prop, false);
@@ -1421,18 +1419,15 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param pathStr String representing path to the property. May contains dots '.' to identify
* nested fields.
* @param resType Result type.
- * @param keyCls Key class.
- * @param valCls Value class.
* @return Portable property.
*/
- private IndexedFieldsProperty buildIndexedFieldsProperty(String pathStr, Class<?> resType,
- @Nullable Class<?> keyCls, @Nullable Class<?> valCls) {
+ private IndexedFieldsProperty buildIndexedFieldsProperty(String pathStr, Class<?> resType) {
String[] path = pathStr.split("\\.");
IndexedFieldsProperty res = null;
for (String prop : path)
- res = new IndexedFieldsProperty(prop, res, resType, keyCls, valCls);
+ res = new IndexedFieldsProperty(prop, res, resType);
return res;
}
@@ -1702,9 +1697,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (isKeyProp0 == 0) {
// Key is allowed to be a non-portable object here.
// We check key before value consistently with ClassProperty.
- if (ctx.cacheObjects().isPortableObject(key) && ctx.cacheObjects().hasField(key, propName, null))
+ if (ctx.cacheObjects().isPortableObject(key) && ctx.cacheObjects().hasField(key, propName))
isKeyProp = isKeyProp0 = 1;
- else if (ctx.cacheObjects().hasField(val, propName, null))
+ else if (ctx.cacheObjects().hasField(val, propName))
isKeyProp = isKeyProp0 = -1;
else {
U.warn(log, "Neither key nor value have property " +
@@ -1717,7 +1712,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
obj = isKeyProp0 == 1 ? key : val;
}
- return ctx.cacheObjects().field(obj, propName, null);
+ return ctx.cacheObjects().field(obj, propName);
}
/** {@inheritDoc} */
@@ -1744,49 +1739,17 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/** Result class. */
private Class<?> type;
- /** Key field */
- private Field keyField;
-
- /** Value field */
- private Field valueField;
-
/**
* Constructor.
*
* @param propName Property name.
* @param parent Parent property.
* @param type Result type.
- * @param keyCls Key class.
- * @param valCls Value class.
*/
- private IndexedFieldsProperty(String propName, IndexedFieldsProperty parent, Class<?> type,
- @Nullable Class<?> keyCls, @Nullable Class<?> valCls) {
+ private IndexedFieldsProperty(String propName, IndexedFieldsProperty parent, Class<?> type) {
this.propName = propName;
this.parent = parent;
this.type = type;
-
- /*if (keyCls != null) {
- try {
- keyField = keyCls.getDeclaredField(propName);
-
- keyField.setAccessible(true);
- } catch (NoSuchFieldException e) {
- // No-op
- }
- }
- else if (valCls != null && keyField == null) {
- try {
- valueField = valCls.getDeclaredField(propName);
-
- valueField.setAccessible(true);
- } catch (NoSuchFieldException e) {
- // No-op
- }
- }
-
- if ((keyCls != null || valCls != null) && keyField == null && valueField == null)
- U.warn(log, "Neither key nor value class has field " +
- "[fieldName=" + propName + ", key=" + keyCls + ", val=" + valCls + "]");*/
}
/** {@inheritDoc} */
@@ -1803,42 +1766,22 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new IgniteCheckedException("Non-indexed object received as a result of property extraction " +
"[parent=" + parent + ", propName=" + propName + ", obj=" + obj + ']');
- return ctx.cacheObjects().field(obj, propName, keyField != null ? keyField : valueField);
+ return ctx.cacheObjects().field(obj, propName);
}
else {
- if (key instanceof CacheIndexedObjectImpl) {
- try {
+ try {
- return ctx.cacheObjects().field(key, propName, keyField);
- }
- catch (IgniteFieldNotFoundException e) {
- // Ignore
- }
+ return ctx.cacheObjects().field(key, propName);
}
- else if (keyField != null) {
- try {
- return keyField.get(key);
- }
- catch (Exception e) {
- throw new IgniteCheckedException(e);
- }
+ catch (IgniteFieldNotFoundException e) {
+ // Ignore
}
- if (val instanceof CacheIndexedObjectImpl) {
- try {
- return ctx.cacheObjects().field(val, propName, valueField);
- }
- catch (IgniteFieldNotFoundException e) {
- // Ignore
- }
+ try {
+ return ctx.cacheObjects().field(val, propName);
}
- else if (valueField != null) {
- try {
- return valueField.get(val);
- }
- catch (Exception e) {
- throw new IgniteCheckedException(e);
- }
+ catch (IgniteFieldNotFoundException e) {
+ // Ignore
}
U.warn(log, "Neither key nor value has property " +
[21/25] incubator-ignite git commit: Merge branch 'ignite-sprint-7'
into ignite-1063
Posted by sb...@apache.org.
Merge branch 'ignite-sprint-7' into ignite-1063
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/28525acb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/28525acb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/28525acb
Branch: refs/heads/ignite-950
Commit: 28525acbe2e19f5605137dbb7e9b3824eab25987
Parents: ef7a35c 6ebcb6d
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Tue Jun 30 16:56:15 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Tue Jun 30 16:56:15 2015 +0300
----------------------------------------------------------------------
.../discovery/GridDiscoveryManager.java | 26 +-
.../IgniteTopologyPrintFormatSelfTest.java | 289 +++++++++++++++++++
.../testsuites/IgniteKernalSelfTestSuite.java | 1 +
3 files changed, 310 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
[05/25] incubator-ignite git commit: encoding fix
Posted by sb...@apache.org.
encoding fix
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f45f96d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f45f96d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f45f96d0
Branch: refs/heads/ignite-950
Commit: f45f96d0cb6e4a71c75d5020b59e9d128e02acea
Parents: 1a21477
Author: avinogradov <av...@gridgain.com>
Authored: Mon Jun 29 14:18:23 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Jun 29 14:18:23 2015 +0300
----------------------------------------------------------------------
pom.xml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f45f96d0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 44cb0ce..b935b2e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -604,12 +604,12 @@
</copy>
<!-- appending filename to md5 and sha1 files. to be improved. -->
- <concat destfile="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.md5" append="true"> ${project.artifactId}-fabric-${project.version}-bin.zip</concat>
- <concat destfile="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.sha1" append="true"> ${project.artifactId}-fabric-${project.version}-bin.zip</concat>
- <concat destfile="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.md5" append="true"> ${project.artifactId}-hadoop-${project.version}-bin.zip</concat>
- <concat destfile="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.sha1" append="true"> ${project.artifactId}-hadoop-${project.version}-bin.zip</concat>
- <concat destfile="${basedir}/target/site/${project.artifactId}-${project.version}-src.zip.md5" append="true"> ${project.artifactId}-${project.version}-src.zip</concat>
- <concat destfile="${basedir}/target/site/${project.artifactId}-${project.version}-src.zip.sha1" append="true"> ${project.artifactId}-${project.version}-src.zip</concat>
+ <concat destfile="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.md5" append="true"> ${project.artifactId}-fabric-${project.version}-bin.zip</concat>
+ <concat destfile="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.sha1" append="true"> ${project.artifactId}-fabric-${project.version}-bin.zip</concat>
+ <concat destfile="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.md5" append="true"> ${project.artifactId}-hadoop-${project.version}-bin.zip</concat>
+ <concat destfile="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.sha1" append="true"> ${project.artifactId}-hadoop-${project.version}-bin.zip</concat>
+ <concat destfile="${basedir}/target/site/${project.artifactId}-${project.version}-src.zip.md5" append="true"> ${project.artifactId}-${project.version}-src.zip</concat>
+ <concat destfile="${basedir}/target/site/${project.artifactId}-${project.version}-src.zip.sha1" append="true"> ${project.artifactId}-${project.version}-src.zip</concat>
<copy file="${basedir}/KEYS" todir="${basedir}/target/site" failonerror="false" />
</target>
[07/25] incubator-ignite git commit: minor fix
Posted by sb...@apache.org.
minor fix
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a2266666
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a2266666
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a2266666
Branch: refs/heads/ignite-950
Commit: a226666663f0d5de94284a3662a6103c1d9c2b17
Parents: f45f96d
Author: avinogradov <av...@gridgain.com>
Authored: Mon Jun 29 15:55:41 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Mon Jun 29 15:55:41 2015 +0300
----------------------------------------------------------------------
pom.xml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a2266666/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b935b2e..4f2441c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -604,12 +604,12 @@
</copy>
<!-- appending filename to md5 and sha1 files. to be improved. -->
- <concat destfile="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.md5" append="true"> ${project.artifactId}-fabric-${project.version}-bin.zip</concat>
- <concat destfile="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.sha1" append="true"> ${project.artifactId}-fabric-${project.version}-bin.zip</concat>
- <concat destfile="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.md5" append="true"> ${project.artifactId}-hadoop-${project.version}-bin.zip</concat>
- <concat destfile="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.sha1" append="true"> ${project.artifactId}-hadoop-${project.version}-bin.zip</concat>
- <concat destfile="${basedir}/target/site/${project.artifactId}-${project.version}-src.zip.md5" append="true"> ${project.artifactId}-${project.version}-src.zip</concat>
- <concat destfile="${basedir}/target/site/${project.artifactId}-${project.version}-src.zip.sha1" append="true"> ${project.artifactId}-${project.version}-src.zip</concat>
+ <echo file="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.md5" append="true" message=" ${project.artifactId}-fabric-${project.version}-bin.zip"/>
+ <echo file="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.sha1" append="true" message=" ${project.artifactId}-fabric-${project.version}-bin.zip"/>
+ <echo file="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.md5" append="true" message=" ${project.artifactId}-hadoop-${project.version}-bin.zip"/>
+ <echo file="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.sha1" append="true" message=" ${project.artifactId}-hadoop-${project.version}-bin.zip"/>
+ <echo file="${basedir}/target/site/${project.artifactId}-${project.version}-src.zip.md5" append="true" message=" ${project.artifactId}-${project.version}-src.zip"/>
+ <echo file="${basedir}/target/site/${project.artifactId}-${project.version}-src.zip.sha1" append="true" message=" ${project.artifactId}-${project.version}-src.zip"/>
<copy file="${basedir}/KEYS" todir="${basedir}/target/site" failonerror="false" />
</target>
[17/25] incubator-ignite git commit: # ignite-gg-1064 allow start if
can not initialize multicast
Posted by sb...@apache.org.
# ignite-gg-1064 allow start if can not initialize multicast
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b5bc06ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b5bc06ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b5bc06ee
Branch: refs/heads/ignite-950
Commit: b5bc06ee813471643c460aaa74ef4395ad79bd53
Parents: bade9f1
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 30 12:40:53 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 30 12:40:53 2015 +0300
----------------------------------------------------------------------
.../TcpDiscoveryMulticastIpFinder.java | 74 ++++++++++++++++----
1 file changed, 60 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5bc06ee/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
index 8e5a1fd..014d937 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
@@ -26,7 +26,6 @@ import org.apache.ignite.marshaller.*;
import org.apache.ignite.marshaller.jdk.*;
import org.apache.ignite.resources.*;
import org.apache.ignite.spi.*;
-import org.apache.ignite.spi.discovery.*;
import org.apache.ignite.spi.discovery.tcp.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
import org.jetbrains.annotations.*;
@@ -278,7 +277,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
addrSnds = new ArrayList<>(locAddrs.size());
- Collection<InetAddress> reqItfs = new ArrayList<>(locAddrs.size()); // Interfaces used to send requests.
+ Set<InetAddress> reqItfs = new HashSet<>(locAddrs.size()); // Interfaces used to send requests.
for (String locAddr : locAddrs) {
InetAddress addr;
@@ -309,6 +308,8 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
}
}
+ boolean mcastErr = false;
+
if (!clientMode) {
if (addrSnds.isEmpty()) {
try {
@@ -317,13 +318,31 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
addrSnds.add(new AddressSender(mcastAddr, null, addrs));
}
catch (IOException e) {
- throw new IgniteSpiException("Failed to create multicast socket [mcastAddr=" + mcastAddr +
- ", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ']', e);
+ if (log.isDebugEnabled())
+ log.debug("Failed to create multicast socket [mcastAddr=" + mcastAddr +
+ ", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ", err=" + e + ']');
+ }
+
+ if (addrSnds.isEmpty()) {
+ try {
+ addrSnds.add(new AddressSender(mcastAddr, mcastAddr, addrs));
+
+ reqItfs.add(mcastAddr);
+ }
+ catch (IOException e) {
+ log.debug("Failed to create multicast socket [mcastAddr=" + mcastAddr +
+ ", mcastGrp=" + mcastGrp + ", mcastPort=" + mcastPort + ", locAddr=" + mcastAddr +
+ ", err=" + e + ']');
+ }
}
}
- for (AddressSender addrSnd : addrSnds)
- addrSnd.start();
+ if (!addrSnds.isEmpty()) {
+ for (AddressSender addrSnd : addrSnds)
+ addrSnd.start();
+ }
+ else
+ mcastErr = true;
}
else
assert addrSnds.isEmpty() : addrSnds;
@@ -358,10 +377,30 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
}
}
}
- else
- ret = requestAddresses(mcastAddr, F.first(reqItfs));
+ else {
+ T2<Collection<InetSocketAddress>, Boolean> res = requestAddresses(mcastAddr, F.first(reqItfs));
+
+ ret = res.get1();
+
+ mcastErr |= res.get2();
+ }
+
+ if (ret.isEmpty()) {
+ if (mcastErr) {
+ if (getRegisteredAddresses().isEmpty()) {
+ InetSocketAddress addr = new InetSocketAddress("localhost", TcpDiscoverySpi.DFLT_PORT);
+
+ U.quietAndWarn(log, "TcpDiscoveryMulticastIpFinder failed to initialize multicast, " +
+ "will use default address: " + addr);
- if (!ret.isEmpty())
+ registerAddresses(Collections.singleton(addr));
+ }
+ else
+ U.quietAndWarn(log, "TcpDiscoveryMulticastIpFinder failed to initialize multicast, " +
+ "will use pre-configured addresses.");
+ }
+ }
+ else
registerAddresses(ret);
}
@@ -379,11 +418,16 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
*
* @param mcastAddr Multicast address where to send request.
* @param sockItf Optional interface multicast socket should be bound to.
- * @return Collection of received addresses.
+ * @return Tuple where first value is collection of received addresses, second is boolean which is
+ * {@code true} if got error on send.
*/
- private Collection<InetSocketAddress> requestAddresses(InetAddress mcastAddr, @Nullable InetAddress sockItf) {
+ private T2<Collection<InetSocketAddress>, Boolean> requestAddresses(InetAddress mcastAddr,
+ @Nullable InetAddress sockItf)
+ {
Collection<InetSocketAddress> rmtAddrs = new HashSet<>();
+ boolean sndErr = false;
+
try {
DatagramPacket reqPckt = new DatagramPacket(MSG_ADDR_REQ_DATA, MSG_ADDR_REQ_DATA.length,
mcastAddr, mcastPort);
@@ -414,6 +458,8 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
sock.send(reqPckt);
}
catch (IOException e) {
+ sndErr = true;
+
if (!handleNetworkError(e))
break;
@@ -486,14 +532,14 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
if (rmtAddrs.isEmpty() && sndError)
U.quietAndWarn(log, "Failed to send multicast message (is multicast enabled on this node?).");
- return rmtAddrs;
+ return new T2<>(rmtAddrs, sndErr);
}
catch (IgniteInterruptedCheckedException ignored) {
U.warn(log, "Got interrupted while sending address request.");
Thread.currentThread().interrupt();
- return rmtAddrs;
+ return new T2<>(rmtAddrs, sndErr);
}
}
@@ -610,7 +656,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
/** {@inheritDoc} */
@Override protected void body() throws InterruptedException {
- addrs = requestAddresses(mcastAddr, sockAddr);
+ addrs = requestAddresses(mcastAddr, sockAddr).get1();
}
/**
[19/25] incubator-ignite git commit: IGNITE-1062 Split in topology
snapshot server and client nodes.
Posted by sb...@apache.org.
IGNITE-1062 Split in topology snapshot server and client 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/8006a843
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8006a843
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8006a843
Branch: refs/heads/ignite-950
Commit: 8006a84344118f39e9190643420512fbee06bc73
Parents: bade9f1
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Tue Jun 30 16:06:28 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Tue Jun 30 16:06:28 2015 +0300
----------------------------------------------------------------------
.../discovery/GridDiscoveryManager.java | 46 +++-
.../IgniteTopologyPrintFormatSelfTest.java | 233 +++++++++++++++++++
.../testsuites/IgniteKernalSelfTestSuite.java | 1 +
3 files changed, 274 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8006a843/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 5e7600f..1d555e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -98,6 +98,13 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
};
+ /** Predicate filtering client nodes. */
+ private static final IgnitePredicate<ClusterNode> clientFilter = new P1<ClusterNode>() {
+ @Override public boolean apply(ClusterNode n) {
+ return n.isClient();
+ }
+ };
+
/** Disco history entries comparator. */
private static final Comparator<Map.Entry<AffinityTopologyVersion, DiscoCache>> histCmp =
new Comparator<Map.Entry<AffinityTopologyVersion, DiscoCache>>() {
@@ -933,6 +940,10 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
Collection<ClusterNode> rmtNodes = discoCache.remoteNodes();
+ Collection<ClusterNode> serverNodes = discoCache.serverNodes();
+
+ Collection<ClusterNode> clientNodes = discoCache.clientNodes();
+
ClusterNode locNode = discoCache.localNode();
Collection<ClusterNode> allNodes = discoCache.allNodes();
@@ -949,7 +960,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
double heap = U.heapSize(allNodes, 2);
if (log.isQuiet())
- U.quiet(false, topologySnapshotMessage(rmtNodes.size(), totalCpus, heap));
+ U.quiet(false, topologySnapshotMessage(serverNodes.size(), clientNodes.size(), totalCpus, heap));
if (log.isDebugEnabled()) {
String dbg = "";
@@ -959,7 +970,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
">>> " + PREFIX + "." + U.nl() +
">>> +----------------+" + U.nl() +
">>> Grid name: " + (ctx.gridName() == null ? "default" : ctx.gridName()) + U.nl() +
- ">>> Number of nodes: " + (rmtNodes.size() + 1) + U.nl() +
+ ">>> Number of server nodes: " + serverNodes.size() + U.nl() +
+ ">>> Number of client nodes: " + clientNodes.size() + U.nl() +
(discoOrdered ? ">>> Topology version: " + topVer + U.nl() : "") +
">>> Topology hash: 0x" + Long.toHexString(hash).toUpperCase() + U.nl();
@@ -992,19 +1004,21 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
log.debug(dbg);
}
else if (log.isInfoEnabled())
- log.info(topologySnapshotMessage(rmtNodes.size(), totalCpus, heap));
+ log.info(topologySnapshotMessage(serverNodes.size(), clientNodes.size(), totalCpus, heap));
}
/**
- * @param rmtNodesNum Remote nodes number.
+ * @param serverNodesNum Server nodes number.
+ * @param clientNodesNum Client nodes number.
* @param totalCpus Total cpu number.
* @param heap Heap size.
* @return Topology snapshot message.
*/
- private String topologySnapshotMessage(int rmtNodesNum, int totalCpus, double heap) {
+ private String topologySnapshotMessage(int serverNodesNum, int clientNodesNum, int totalCpus, double heap) {
return PREFIX + " [" +
(discoOrdered ? "ver=" + topSnap.get().topVer.topologyVersion() + ", " : "") +
- "nodes=" + (rmtNodesNum + 1) +
+ "server nodes=" + serverNodesNum +
+ ", client nodes=" + clientNodesNum +
", CPUs=" + totalCpus +
", heap=" + heap + "GB" +
']';
@@ -2108,6 +2122,12 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
/** Remote nodes. */
private final List<ClusterNode> rmtNodes;
+ /** Client nodes. */
+ private final List<ClusterNode> clientNodes;
+
+ /** Server nodes. */
+ private final List<ClusterNode> serverNodes;
+
/** All nodes. */
private final List<ClusterNode> allNodes;
@@ -2196,6 +2216,10 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
all.addAll(rmtNodes);
+ clientNodes = Collections.unmodifiableList(new ArrayList<>(F.view(all, clientFilter)));
+
+ serverNodes = Collections.unmodifiableList(new ArrayList<>(F.view(all, F.not(clientFilter))));
+
Collections.sort(all, GridNodeOrderComparator.INSTANCE);
allNodes = Collections.unmodifiableList(all);
@@ -2346,6 +2370,16 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
return rmtNodes;
}
+ /** @return Server nodes. */
+ Collection<ClusterNode> serverNodes() {
+ return serverNodes;
+ }
+
+ /** @return Client nodes. */
+ Collection<ClusterNode> clientNodes() {
+ return clientNodes;
+ }
+
/** @return All nodes. */
Collection<ClusterNode> allNodes() {
return allNodes;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8006a843/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
new file mode 100644
index 0000000..efbc431
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/IgniteTopologyPrintFormatSelfTest.java
@@ -0,0 +1,233 @@
+/*
+ * 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.discovery;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.managers.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+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.apache.ignite.testframework.junits.logger.*;
+import org.apache.log4j.*;
+
+import java.util.*;
+
+/**
+ *
+ */
+public class IgniteTopologyPrintFormatSelfTest extends GridCommonAbstractTest {
+ /** */
+ public static final String TOPOLOGY_SNAPSHOT = "Topology snapshot";
+
+ /** */
+ public static final String SERV_NODE = ">>> Number of server nodes";
+
+ /** */
+ public static final String CLIENT_NODE = ">>> Number of client nodes";
+
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi disc = new TcpDiscoverySpi();
+ disc.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(disc);
+
+ if (gridName.endsWith("client"))
+ cfg.setClientMode(true);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ if (log instanceof MockLogger)
+ ((MockLogger)log).clear();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testServerLogs() throws Exception {
+ MockLogger log = new MockLogger();
+
+ log.setLevel(Level.INFO);
+
+ doServerLogTest(log);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testServerDebugLogs() throws Exception {
+ MockLogger log = new MockLogger();
+
+ log.setLevel(Level.DEBUG);
+
+ doServerLogTest(log);
+ }
+
+ /**
+ * @param log Logger.
+ * @throws Exception If failed.
+ */
+ private void doServerLogTest(MockLogger log) throws Exception {
+ try {
+ Ignite server = startGrid("server");
+
+ setLogger(log, server);
+
+ Ignite server1 = startGrid("server1");
+
+ waitForDiscovery(server, server1);
+ }
+ finally {
+ stopAllGrids();
+ }
+
+ assertTrue(F.forAny(log.logs(), new IgnitePredicate<String>() {
+ @Override public boolean apply(String s) {
+ return s.contains("Topology snapshot [ver=2, server nodes=2, client nodes=0,")
+ || (s.contains(">>> Number of server nodes: 2") && s.contains(">>> Number of client nodes: 0"));
+ }
+ }));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testServerAndClientLogs() throws Exception {
+ MockLogger log = new MockLogger();
+
+ log.setLevel(Level.INFO);
+
+ doServerAndClientTest(log);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testServerAndClientDebugLogs() throws Exception {
+ MockLogger log = new MockLogger();
+
+ log.setLevel(Level.DEBUG);
+
+ doServerAndClientTest(log);
+ }
+
+ /**
+ * @param log Log.
+ * @throws Exception If failed.
+ */
+ private void doServerAndClientTest(MockLogger log) throws Exception {
+ try {
+ Ignite server = startGrid("server");
+
+ setLogger(log, server);
+
+ Ignite server1 = startGrid("server1");
+ Ignite client1 = startGrid("first client");
+ Ignite client2 = startGrid("second client");
+
+ waitForDiscovery(server, server1, client1, client2);
+ }
+ finally {
+ stopAllGrids();
+ }
+
+ assertTrue(F.forAny(log.logs(), new IgnitePredicate<String>() {
+ @Override public boolean apply(String s) {
+ return s.contains("Topology snapshot [ver=4, server nodes=2, client nodes=2,")
+ || (s.contains(">>> Number of server nodes: 2") && s.contains(">>> Number of client nodes: 2"));
+ }
+ }));
+ }
+
+ /**
+ * Set log.
+ *
+ * @param log Log.
+ * @param server Ignite.
+ */
+ private void setLogger(MockLogger log, Ignite server) {
+ IgniteKernal server0 = (IgniteKernal)server;
+
+ GridDiscoveryManager discovery = server0.context().discovery();
+
+ GridTestUtils.setFieldValue(discovery, GridManagerAdapter.class, "log", log);
+ }
+
+ /**
+ *
+ */
+ private static class MockLogger extends GridTestLog4jLogger {
+ /** */
+ private List<String> logs = new ArrayList<>();
+
+ /** {@inheritDoc} */
+ @Override public void debug(String msg) {
+ if ((msg != null && !msg.isEmpty()) && (
+ msg.contains(TOPOLOGY_SNAPSHOT)
+ || msg.contains(SERV_NODE)
+ || msg.contains(CLIENT_NODE)))
+ logs.add(msg);
+
+ super.debug(msg);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void info(String msg) {
+ if ((msg != null && !msg.isEmpty()) && (
+ msg.contains(TOPOLOGY_SNAPSHOT)
+ || msg.contains(SERV_NODE)
+ || msg.contains(CLIENT_NODE)))
+ logs.add(msg);
+
+ super.info(msg);
+ }
+
+ /**
+ * @return Logs.
+ */
+ public List<String> logs() {
+ return logs;
+ }
+
+ /** */
+ public void clear() {
+ logs.clear();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8006a843/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
index e8c89ec..575f1fa 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
@@ -83,6 +83,7 @@ public class IgniteKernalSelfTestSuite extends TestSuite {
suite.addTestSuite(GridKernalConcurrentAccessStopSelfTest.class);
suite.addTestSuite(GridUpdateNotifierSelfTest.class);
suite.addTestSuite(GridLocalEventListenerSelfTest.class);
+ suite.addTestSuite(IgniteTopologyPrintFormatSelfTest.class);
// Managed Services.
suite.addTestSuite(GridServiceProcessorSingleNodeSelfTest.class);
[25/25] incubator-ignite git commit: ignite-950: added benchmarks
temporaly
Posted by sb...@apache.org.
ignite-950: added benchmarks temporaly
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cc19b086
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cc19b086
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cc19b086
Branch: refs/heads/ignite-950
Commit: cc19b0862df3461024f43786ea61b6321d678966
Parents: 76309bb
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 1 08:24:31 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 1 08:24:31 2015 +0300
----------------------------------------------------------------------
.../ignite/jmh/CliendServerNodeBenchmark.java | 204 +++++++++
.../ignite/jmh/MarshallerContextJMHImpl.java | 57 +++
.../ignite/jmh/MarshallerMethodsBenchmark.java | 95 ++++
.../ignite/jmh/QueryMarshallerBenchmark.java | 412 ++++++++++++++++++
.../apache/ignite/jmh/ReadFieldBenchmark.java | 91 ++++
.../SeveralNodesQueryMarshallerBenchmark.java | 432 +++++++++++++++++++
.../ignite/jmh/SimpleMarshallerBenchmark.java | 208 +++++++++
.../java/org/apache/ignite/jmh/model/City.java | 72 ++++
.../org/apache/ignite/jmh/model/Department.java | 75 ++++
.../apache/ignite/jmh/model/Organization.java | 39 ++
.../org/apache/ignite/jmh/model/Person.java | 97 +++++
.../ignite/jmh/model/PersonExternalizable.java | 190 ++++++++
.../ignite/jmh/model/PersonMarshalAware.java | 199 +++++++++
.../apache/ignite/jmh/model/PersonSimple.java | 172 ++++++++
14 files changed, 2343 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/CliendServerNodeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/CliendServerNodeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/CliendServerNodeBenchmark.java
new file mode 100644
index 0000000..6018ae9
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/CliendServerNodeBenchmark.java
@@ -0,0 +1,204 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.jmh.model.*;
+import org.apache.ignite.marshaller.*;
+import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.output.*;
+import org.openjdk.jmh.runner.*;
+import org.openjdk.jmh.runner.options.*;
+
+import javax.cache.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Created by GridAdmin1234 on 6/29/2015.
+ */
+@State (value = Scope.Benchmark)
+public class CliendServerNodeBenchmark {
+ private TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ private Ignite node;
+
+ private IgniteCache<Integer, PersonSimple> cache;
+
+ private static final int ROWS_COUNT = 50000;
+
+ private int putCounter = ROWS_COUNT + 1;
+
+ private IgniteConfiguration createConfiguration(String gridName, boolean newMarshaller) {
+ IgniteConfiguration cfg = new IgniteConfiguration();
+
+ cfg.setGridName(gridName);
+
+ TcpDiscoverySpi spi = new TcpDiscoverySpi();
+ spi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(spi);
+
+ OptimizedMarshaller marsh = new OptimizedMarshaller(false);
+ marsh.setProtocolVersion(newMarshaller ? OptimizedMarshallerProtocolVersion.VER_1_1 :
+ OptimizedMarshallerProtocolVersion.VER_1);
+ cfg.setMarshaller(marsh);
+
+ CacheConfiguration cCfg = new CacheConfiguration();
+ cCfg.setName("query");
+ cCfg.setCacheMode(CacheMode.PARTITIONED);
+ cCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ cCfg.setSwapEnabled(false);
+// cCfg.setCopyOnRead(false);
+
+ CacheTypeMetadata meta = new CacheTypeMetadata();
+
+ meta.setKeyType(Integer.class);
+ meta.setValueType(PersonSimple.class);
+
+ HashMap<String, Class<?>> indexes = new HashMap<>();
+ indexes.put("id", Integer.class);
+ indexes.put("orgId", Integer.class);
+ indexes.put("salary", Double.class);
+
+ meta.setAscendingFields(indexes);
+
+ HashMap<String, Class<?>> queryFields = new HashMap<>();
+ queryFields.put("firstName", String.class);
+ queryFields.put("lastName", String.class);
+
+ meta.setQueryFields(queryFields);
+
+ cCfg.setTypeMetadata(Arrays.asList(meta));
+
+ cfg.setCacheConfiguration(cCfg);
+
+ return cfg;
+ }
+
+ @TearDown
+ public void stopNodes() {
+ Ignition.stopAll(true);
+ }
+
+ //@Setup
+ public void startOldNodes() {
+ System.out.println();
+ System.out.println("STARTED OLD NODE");
+
+ Ignition.start(createConfiguration("node", false));
+
+ IgniteConfiguration clientCfg = createConfiguration("client", false);
+ clientCfg.setClientMode(true);
+
+ node = Ignition.start(clientCfg);
+
+ cache = node.cache("query");
+
+ for (int i = 0; i < ROWS_COUNT; i++) {
+ PersonSimple person = new PersonSimple(i, "Name ", "Surname ", (i + 1) * 100);
+ cache.put(i, person);
+ }
+ }
+
+ @Setup
+ public void startNewNodes() {
+ System.out.println();
+ System.out.println("STARTED NEW NODE");
+
+ Ignite server = Ignition.start(createConfiguration("node", true));
+
+ IgniteConfiguration clientCfg = createConfiguration("client", true);
+ clientCfg.setClientMode(true);
+
+ node = Ignition.start(clientCfg);
+
+ cache = node.cache("query");
+
+ for (int i = 0; i < ROWS_COUNT; i++) {
+ PersonSimple person = new PersonSimple(i, "Name ", "Surname ", (i + 1) * 100);
+ cache.put(i, person);
+ }
+ }
+
+
+ @GenerateMicroBenchmark
+ public void testGet() throws Exception {
+ int key = ThreadLocalRandom.current().nextInt(0, ROWS_COUNT);
+
+ PersonSimple personSimple = cache.get(key);
+
+ if (personSimple == null)
+ throw new IgniteException("Person is null");
+ }
+
+ //@GenerateMicroBenchmark
+ public void testPut() throws Exception {
+ cache.put(putCounter, new PersonSimple(putCounter, "Name ", "Surname ", (putCounter + 1) * 100));
+ putCounter++;
+ }
+
+ //@GenerateMicroBenchmark
+ public void testFieldsQuery() throws Exception {
+ double salary = ThreadLocalRandom.current().nextInt(0, ROWS_COUNT);
+
+ double maxSalary = salary + 100;
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("SELECT PersonSimple.firstName, PersonSimple.lastName FROM " +
+ "PersonSimple WHERE salary >= ? and salary <= ?");
+
+ qry.setArgs(salary, maxSalary);
+
+ List<List<?>> result = cache.query(qry).getAll();
+
+ for (List<?> row : result) {
+ if (row.get(0) == null || row.get(1) == null)
+ throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary +
+ ", person=" + row + ']');
+ }
+ }
+
+// public static void main(String args[]) throws Exception {
+// CliendServerNodeBenchmark benchmark = new CliendServerNodeBenchmark();
+//
+// benchmark.startNewNodes();
+//
+// for (int i = ROWS_COUNT + 1; i < 1000000; i++) {
+// benchmark.cache.put(i, new PersonSimple(i, "Name DSda hdasjhdkas ajksdhasjkd " + i, "Surname dasdsad " + i,
+// (i + 1) * 100));
+//
+// if (i % 10000 == 0)
+// System.out.println("Put :" + i);
+// }
+//
+// System.out.println("Put all the data!");
+// }
+
+
+ public static void main(String... args) throws Exception {
+ Options opts = new OptionsBuilder()
+ .include(".*" + CliendServerNodeBenchmark.class.getSimpleName() + ".*")
+ .warmupIterations(15)
+ .measurementIterations(65)
+ .jvmArgs("-server")
+ .forks(1)
+ .outputFormat(OutputFormatType.TextReport)
+ //.shouldDoGC(true)
+ .build();
+
+ new Runner(opts).run();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/MarshallerContextJMHImpl.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/MarshallerContextJMHImpl.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/MarshallerContextJMHImpl.java
new file mode 100644
index 0000000..5504851
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/MarshallerContextJMHImpl.java
@@ -0,0 +1,57 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh;
+
+import org.apache.ignite.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.plugin.*;
+import org.jsr166.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Test marshaller context.
+ */
+public class MarshallerContextJMHImpl extends MarshallerContextAdapter {
+ /** */
+ private final static ConcurrentMap<Integer, String> map = new ConcurrentHashMap8<>();
+
+ /**
+ * Initializes context.
+ *
+ * @param plugins Plugins.
+ */
+ public MarshallerContextJMHImpl(List<PluginProvider> plugins) {
+ super(plugins);
+ }
+
+ /**
+ * Initializes context.
+ */
+ public MarshallerContextJMHImpl() {
+ super(null);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean registerClassName(int id, String clsName) throws IgniteCheckedException {
+ String oldClsName = map.putIfAbsent(id, clsName);
+
+ if (oldClsName != null && !oldClsName.equals(clsName))
+ throw new IgniteCheckedException("Duplicate ID [id=" + id + ", oldClsName=" + oldClsName + ", clsName=" +
+ clsName + ']');
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String className(int id) {
+ return map.get(id);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/MarshallerMethodsBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/MarshallerMethodsBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/MarshallerMethodsBenchmark.java
new file mode 100644
index 0000000..728637c
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/MarshallerMethodsBenchmark.java
@@ -0,0 +1,95 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh;
+
+import org.apache.ignite.jmh.model.*;
+import org.apache.ignite.marshaller.*;
+import org.apache.ignite.marshaller.optimized.*;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.output.*;
+import org.openjdk.jmh.runner.*;
+import org.openjdk.jmh.runner.options.*;
+
+import java.util.concurrent.*;
+
+/**
+ * Created by GridAdmin1234 on 6/30/2015.
+ */
+@State(value = Scope.Benchmark)
+public class MarshallerMethodsBenchmark {
+ private OptimizedMarshaller marsh;
+
+ private PersonSimple personSimple;
+
+ @Setup
+ public void initNewMarshaller() {
+ marsh = new OptimizedMarshaller(false);
+ marsh.setProtocolVersion(OptimizedMarshallerProtocolVersion.VER_1_1);
+
+ marsh.setContext(new MarshallerContextJMHImpl());
+
+ OptimizedMarshallerIndexingHandler idxHandler = new OptimizedMarshallerIndexingHandler();
+
+ idxHandler.setMetaHandler(new OptimizedMarshallerMetaHandler() {
+
+ private ConcurrentHashMap<Integer, OptimizedObjectMetadata> map = new ConcurrentHashMap<Integer,
+ OptimizedObjectMetadata>();
+
+ @Override public void addMeta(int typeId, OptimizedObjectMetadata meta) {
+ map.put(typeId, meta);
+ }
+
+ @Override public OptimizedObjectMetadata metadata(int typeId) {
+ return map.get(typeId);
+ }
+ });
+
+ marsh.setIndexingHandler(idxHandler);
+
+ personSimple = new PersonSimple(100, 200, "asdjkas aksjdhkajsd ajd", "asjdlaskd askdjsalkd", 900);
+ }
+
+ //@Setup
+ public void initOldMarshaller() {
+ marsh = new OptimizedMarshaller(false);
+
+ marsh.setProtocolVersion(OptimizedMarshallerProtocolVersion.VER_1);
+ marsh.setContext(new MarshallerContextJMHImpl());
+
+ personSimple = new PersonSimple(100, 200, "asdjkas aksjdhkajsd ajd", "asjdlaskd askdjsalkd", 900);
+ }
+
+ @GenerateMicroBenchmark
+ public void testMarshal() throws Exception {
+ marsh.marshal(personSimple);
+ }
+
+ public static void main(String... args) throws Exception {
+ Options opts = new OptionsBuilder()
+ .include(".*" + MarshallerMethodsBenchmark.class.getSimpleName() + ".*")
+ .warmupIterations(15)
+ .measurementIterations(65)
+ .jvmArgs("-server")
+ .forks(1)
+ .outputFormat(OutputFormatType.TextReport)
+ //.shouldDoGC(true)
+ .build();
+
+ new Runner(opts).run();
+ }
+
+// public static void main(String[] args) throws Exception {
+// MarshallerMethodsBenchmark benchmark = new MarshallerMethodsBenchmark();
+//
+// benchmark.initNewMarshaller();
+//
+// for (int i = 0; i < 40; i++)
+// benchmark.testMarshal();
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/QueryMarshallerBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/QueryMarshallerBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/QueryMarshallerBenchmark.java
new file mode 100644
index 0000000..76aee7f
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/QueryMarshallerBenchmark.java
@@ -0,0 +1,412 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.jmh.model.*;
+import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.output.*;
+import org.openjdk.jmh.runner.*;
+import org.openjdk.jmh.runner.options.*;
+
+import javax.cache.*;
+import java.util.*;
+
+/**
+ * Created by GridAdmin1234 on 6/25/2015.
+ */
+@State (value = Scope.Benchmark)
+public class QueryMarshallerBenchmark {
+
+ private final static String PERSON_CACHE = "person";
+
+ private final static String CITY_CACHE = "city";
+
+ private final static String DEPARTMENT_CACHE = "dep";
+
+ private final static String ORGANIZATION_CACHE = "org";
+
+ private static final int PERSON_ROWS_COUNT = 400000;
+
+ private static final int CITY_ROWS_COUNT = 500;
+
+ private static final int DEPARTMENT_ROWS_COUNT = CITY_ROWS_COUNT * 10;
+
+ private static final int ORGANIZATION_ROWS_COUNT = 30;
+
+ private static final int SALARY_LIMIT = 100000;
+
+
+ private TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ private Ignite node1;
+
+ private Ignite node2;
+
+ private IgniteCache<AffinityKey<UUID>, Person> personCache;
+
+ private IgniteConfiguration createOldConfiguration(String gridName) {
+ IgniteConfiguration cfg = new IgniteConfiguration();
+
+ cfg.setGridName(gridName);
+
+ TcpDiscoverySpi spi = new TcpDiscoverySpi();
+ spi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(spi);
+
+ OptimizedMarshaller marshaller = new OptimizedMarshaller();
+ marshaller.setProtocolVersion(OptimizedMarshallerProtocolVersion.VER_1);
+
+ cfg.setMarshaller(marshaller);
+
+ CacheConfiguration cityCacheCfg = createCacheCfg(CITY_CACHE);
+ cityCacheCfg.setTypeMetadata(Arrays.asList(createCityMetadata()));
+
+ CacheConfiguration orgCacheCfg = createCacheCfg(ORGANIZATION_CACHE);
+ orgCacheCfg.setTypeMetadata(Arrays.asList(createOrgMetadata()));
+
+ CacheConfiguration depCacheCfg = createCacheCfg(DEPARTMENT_CACHE);
+ depCacheCfg.setTypeMetadata(Arrays.asList(createDepartmentMeta()));
+
+ CacheConfiguration personCacheCfg = createCacheCfg(PERSON_CACHE);
+ personCacheCfg.setTypeMetadata(Arrays.asList(createPersonMeta()));
+
+ cfg.setCacheConfiguration(cityCacheCfg, orgCacheCfg, depCacheCfg, personCacheCfg);
+
+// CacheConfiguration cityCacheCfg = createCacheCfg(CITY_CACHE);
+// cityCacheCfg.setIndexedTypes(UUID.class, City.class);
+//
+// CacheConfiguration orgCacheCfg = createCacheCfg(ORGANIZATION_CACHE);
+// orgCacheCfg.setIndexedTypes(UUID.class, Organization.class);
+//
+// CacheConfiguration depCacheCfg = createCacheCfg(DEPARTMENT_CACHE);
+// depCacheCfg.setIndexedTypes(AffinityKey.class, Department.class);
+//
+// CacheConfiguration personCacheCfg = createCacheCfg(PERSON_CACHE);
+// personCacheCfg.setIndexedTypes(AffinityKey.class, Person.class);
+//
+// cfg.setCacheConfiguration(cityCacheCfg, orgCacheCfg, depCacheCfg, personCacheCfg);
+
+ return cfg;
+ }
+
+ private IgniteConfiguration createNewConfiguration(String gridName) {
+ IgniteConfiguration cfg = new IgniteConfiguration();
+
+ cfg.setGridName(gridName);
+
+ TcpDiscoverySpi spi = new TcpDiscoverySpi();
+ spi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(spi);
+
+ OptimizedMarshaller marshaller = new OptimizedMarshaller();
+ marshaller.setProtocolVersion(OptimizedMarshallerProtocolVersion.VER_1_1);
+ cfg.setMarshaller(marshaller);
+
+ CacheConfiguration cityCacheCfg = createCacheCfg(CITY_CACHE);
+ cityCacheCfg.setTypeMetadata(Arrays.asList(createCityMetadata()));
+
+ CacheConfiguration orgCacheCfg = createCacheCfg(ORGANIZATION_CACHE);
+ orgCacheCfg.setTypeMetadata(Arrays.asList(createOrgMetadata()));
+
+ CacheConfiguration depCacheCfg = createCacheCfg(DEPARTMENT_CACHE);
+ depCacheCfg.setTypeMetadata(Arrays.asList(createDepartmentMeta()));
+
+ CacheConfiguration personCacheCfg = createCacheCfg(PERSON_CACHE);
+ personCacheCfg.setTypeMetadata(Arrays.asList(createPersonMeta()));
+
+ cfg.setCacheConfiguration(cityCacheCfg, orgCacheCfg, depCacheCfg, personCacheCfg);
+
+ return cfg;
+ }
+
+ private CacheConfiguration createCacheCfg(String name) {
+ CacheConfiguration cCfg = new CacheConfiguration();
+ cCfg.setName(name);
+ cCfg.setCacheMode(CacheMode.PARTITIONED);
+ cCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ cCfg.setSwapEnabled(false);
+
+// cCfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
+// cCfg.setOffHeapMaxMemory(0);
+// cCfg.setSqlOnheapRowCacheSize(1);
+
+ return cCfg;
+ }
+
+ private CacheTypeMetadata createCityMetadata() {
+ CacheTypeMetadata meta = new CacheTypeMetadata();
+
+ meta.setKeyType(UUID.class);
+ meta.setValueType(City.class);
+
+ HashMap<String, Class<?>> indexes = new HashMap<>();
+ indexes.put("id", UUID.class);
+
+ HashMap<String, Class<?>> queryFields = new HashMap<>();
+ queryFields.put("name", String.class);
+ queryFields.put("population", Integer.class);
+ queryFields.put("age", Integer.class);
+
+ meta.setAscendingFields(indexes);
+ meta.setQueryFields(queryFields);
+
+ return meta;
+ }
+
+ private CacheTypeMetadata createOrgMetadata() {
+ CacheTypeMetadata meta = new CacheTypeMetadata();
+
+ meta.setKeyType(UUID.class);
+ meta.setValueType(Organization.class);
+
+ HashMap<String, Class<?>> indexes = new HashMap<>();
+ indexes.put("id", UUID.class);
+
+ HashMap<String, Class<?>> queryFields = new HashMap<>();
+ queryFields.put("name", String.class);
+
+ meta.setAscendingFields(indexes);
+ meta.setQueryFields(queryFields);
+
+ return meta;
+ }
+
+ private CacheTypeMetadata createDepartmentMeta() {
+ CacheTypeMetadata meta = new CacheTypeMetadata();
+
+ meta.setKeyType(AffinityKey.class);
+ meta.setValueType(Department.class);
+
+ HashMap<String, Class<?>> indexes = new HashMap<>();
+ indexes.put("id", UUID.class);
+ indexes.put("cityId", UUID.class);
+ indexes.put("orgId", UUID.class);
+
+ HashMap<String, Class<?>> queryFields = new HashMap<>();
+ queryFields.put("name", String.class);
+
+ meta.setAscendingFields(indexes);
+ meta.setQueryFields(queryFields);
+
+ return meta;
+ }
+
+ private CacheTypeMetadata createPersonMeta() {
+ CacheTypeMetadata meta = new CacheTypeMetadata();
+
+ meta.setKeyType(AffinityKey.class);
+ meta.setValueType(Person.class);
+
+ HashMap<String, Class<?>> indexes = new HashMap<>();
+ indexes.put("id", UUID.class);
+ indexes.put("depId", UUID.class);
+
+ HashMap<String, Class<?>> queryFields = new HashMap<>();
+ queryFields.put("firstName", String.class);
+ queryFields.put("lastName", String.class);
+ queryFields.put("rank", Integer.class);
+ queryFields.put("title", String.class);
+ queryFields.put("age", Integer.class);
+ queryFields.put("salary", Integer.class);
+
+ meta.setAscendingFields(indexes);
+ meta.setQueryFields(queryFields);
+
+ return meta;
+ }
+
+ private void populateCaches() {
+ Random rand = new Random();
+
+ System.out.println();
+
+ IgniteCache<UUID, City> cityCache = node1.cache(CITY_CACHE);
+
+ City[] cities = new City[CITY_ROWS_COUNT];
+
+ for (int i = 0; i < CITY_ROWS_COUNT; i++) {
+ City city = new City("City Name " + i, rand.nextInt(10000000), rand.nextInt(2000), "Country" + i);
+
+ cities[i] = city;
+
+ cityCache.put(city.getId(), city);
+ }
+
+ System.out.println("Populated cities: " + CITY_ROWS_COUNT);
+
+ IgniteCache<UUID, Organization> orgCache = node1.cache(ORGANIZATION_CACHE);
+
+ Organization[] organizations = new Organization[ORGANIZATION_ROWS_COUNT];
+
+ for (int i = 0; i < ORGANIZATION_ROWS_COUNT; i++) {
+ Organization org = new Organization("Org Name " + i);
+
+ organizations[i] = org;
+
+ orgCache.put(org.getId(), org);
+ }
+
+ System.out.println("Populated organizations: " + ORGANIZATION_ROWS_COUNT);
+
+ IgniteCache<AffinityKey<UUID>, Department> depCache = node1.cache(DEPARTMENT_CACHE);
+
+ Department[] departments = new Department[DEPARTMENT_ROWS_COUNT];
+
+ for (int i = 0; i < DEPARTMENT_ROWS_COUNT; i++) {
+ Department dep = new Department("Dep Name " + i, cities[rand.nextInt(CITY_ROWS_COUNT)],
+ organizations[rand.nextInt(ORGANIZATION_ROWS_COUNT)]);
+
+ departments[i] = dep;
+
+ try {
+ depCache.put(dep.getKey(), dep);
+ }
+ catch (Exception e) {
+ System.out.println("ROW: " + i);
+ e.printStackTrace();
+ }
+ }
+
+ System.out.println("Populated departments: " + DEPARTMENT_ROWS_COUNT);
+
+ cities = null;
+ organizations = null;
+
+ personCache = node1.cache(PERSON_CACHE);
+
+ for (int i = 0; i < PERSON_ROWS_COUNT; i++) {
+ Person person = new Person(departments[rand.nextInt(DEPARTMENT_ROWS_COUNT)], "First Name " + i,
+ "Last Name " + i, rand.nextInt(21), "Title " + i, rand.nextInt(90), rand.nextInt(SALARY_LIMIT));
+
+ personCache.put(person.getKey(), person);
+ }
+
+ System.out.println("Populated persons: " + PERSON_ROWS_COUNT);
+
+ System.out.printf("");
+ }
+
+ @Setup (Level.Trial)
+ public void startOldNodes() {
+ System.out.println();
+
+ System.out.println("Using OLD marshaller");
+
+ node1 = Ignition.start(createOldConfiguration("node1"));
+ //node2 = Ignition.start(createOldConfiguration("node2"));
+
+ populateCaches();
+ }
+
+ //@Setup (Level.Trial)
+ public void startNewNodes() {
+ System.out.println();
+
+ System.out.println("Using New marshaller");
+
+ node1 = Ignition.start(createNewConfiguration("node1"));
+ //node2 = Ignition.start(createNewConfiguration("node2"));
+
+ populateCaches();
+ }
+
+ @TearDown (Level.Trial)
+ public void stopNodes() {
+ Ignition.stopAll(true);
+ }
+
+ //@GenerateMicroBenchmark
+ public void sqlQuerySimple() {
+ String sql = "salary > ? and salary <= ?";
+
+ List<Cache.Entry<AffinityKey<UUID>, Person>> result =
+ personCache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, sql).
+ setArgs(0, 200000)).getAll();
+
+ if (result.size() == 0)
+ throw new RuntimeException("Invalid result size");
+ }
+
+ //@GenerateMicroBenchmark
+ public void sqlQueryWithJoin() {
+ // SQL clause query which joins on 2 types to select people for a specific organization.
+ String joinSql =
+ "from Person, \"" + DEPARTMENT_CACHE + "\".Department as dep " +
+ "where Person.depId = dep.id " +
+ "and lower(dep.name) = lower(?)";
+
+ // Execute queries for find employees for different organizations.
+ List<Cache.Entry<AffinityKey<UUID>, Person>> result =
+ personCache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, joinSql).
+ setArgs("Dep Name 1")).getAll();
+
+ if (result.size() == 0)
+ throw new RuntimeException("Invalid result size");
+ }
+
+ @GenerateMicroBenchmark
+ public void sqlQueryWithAggregation() {
+ // Calculate average of salary of all persons in ApacheIgnite.
+ // Note that we also join on Organization cache as well.
+ Random rand = new Random();
+
+ String sql =
+// "select Person.firstName, Person.lastName, Person.salary " +
+ "select Person.firstName, city.name " +
+ "from Person, \"" + DEPARTMENT_CACHE + "\".Department as dep, " +
+ "\"" + CITY_CACHE + "\".City as city " +
+ "where Person.depId = dep.id and dep.cityId = city.id " +
+ "and city.population > ? and city.population <= ?";
+
+ QueryCursor<List<?>> cursor = personCache.query(new SqlFieldsQuery(sql).setArgs(rand.nextInt(1000),
+ rand.nextInt(10000000)));
+
+ if (cursor.getAll().size() == 0)
+ System.err.println("Invalid result size");
+ }
+
+
+ /*public static void main(String... args) throws Exception {
+ Options opts = new OptionsBuilder()
+ .include(".*" + QueryMarshallerBenchmark.class.getSimpleName() + ".*")
+ .warmupIterations(15)
+ .measurementIterations(35)
+ .jvmArgs("-server")
+ .forks(1)
+ .outputFormat(OutputFormatType.TextReport)
+ .build();
+
+ new Runner(opts).run();
+ }*/
+
+ public static void main(String... args) throws Exception {
+ QueryMarshallerBenchmark benchmark = new QueryMarshallerBenchmark();
+
+ benchmark.startOldNodes();
+
+ for (int i = 0; i < 20000; i++) {
+ benchmark.sqlQuerySimple();
+
+ if (i % 1000 == 0)
+ System.out.println("Iteration: " + i);
+ }
+
+ benchmark.stopNodes();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/ReadFieldBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/ReadFieldBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/ReadFieldBenchmark.java
new file mode 100644
index 0000000..a118ca5
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/ReadFieldBenchmark.java
@@ -0,0 +1,91 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh;
+
+import org.apache.ignite.jmh.model.*;
+import org.apache.ignite.marshaller.optimized.*;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.logic.results.*;
+import org.openjdk.jmh.output.*;
+import org.openjdk.jmh.runner.*;
+import org.openjdk.jmh.runner.options.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ *
+ */
+@State
+public class ReadFieldBenchmark {
+
+ private OptimizedMarshaller marshaller;
+
+ private byte[] arr;
+
+ @Setup
+ public void init() throws Exception {
+ marshaller = new OptimizedMarshaller();
+
+ marshaller.setContext(new MarshallerContextJMHImpl());
+
+ /*marshaller.setMetadataHandler(new OptimizedMarshallerMetaHandler() {
+
+ private ConcurrentHashMap<Integer, OptimizedObjectMetadata> map = new ConcurrentHashMap<Integer,
+ OptimizedObjectMetadata>();
+
+ @Override public void addMeta(int typeId, OptimizedObjectMetadata meta) {
+ map.put(typeId, meta);
+ }
+
+ @Override public OptimizedObjectMetadata metadata(int typeId) {
+ return map.get(typeId);
+ }
+ });
+
+ marshaller.enableFieldsIndexing(PersonSimple.class);
+*/
+ PersonSimple person = new PersonSimple(100, "Denis A", "Magda", 200);
+
+ arr = marshaller.marshal(person);
+ }
+
+ @GenerateMicroBenchmark
+ public void testReadField() throws Exception {
+ //boolean res = marshaller.hasField("firstName", arr, 0, arr.length);
+
+ //if (!res)
+ // throw new RuntimeException("Fuck");
+
+ Object name = marshaller.readField("id", arr, 0, arr.length, null);
+
+ if (name == null)
+ throw new RuntimeException("Fuck");
+ }
+
+ public static void main(String... args) throws Exception {
+ Options opts = new OptionsBuilder()
+ .include(".*")
+ .warmupIterations(15)
+ .measurementIterations(15)
+ .jvmArgs("-server")
+ .forks(1)
+ .outputFormat(OutputFormatType.TextReport)
+ .build();
+
+ Map<BenchmarkRecord,RunResult> records = new Runner(opts).run();
+ /*for (Map.Entry<BenchmarkRecord, RunResult> result : records.entrySet()) {
+ Result r = result.getValue().getPrimaryResult();
+ System.out.println("API replied benchmark score: "
+ + r.getScore() + " "
+ + r.getScoreUnit() + " over "
+ + r.getStatistics().getN() + " iterations");
+ }*/
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/SeveralNodesQueryMarshallerBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/SeveralNodesQueryMarshallerBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/SeveralNodesQueryMarshallerBenchmark.java
new file mode 100644
index 0000000..54b00aa
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/SeveralNodesQueryMarshallerBenchmark.java
@@ -0,0 +1,432 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.jmh.model.*;
+import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.output.*;
+import org.openjdk.jmh.runner.*;
+import org.openjdk.jmh.runner.options.*;
+
+import javax.cache.*;
+import java.util.*;
+
+/**
+ * Created by GridAdmin1234 on 6/25/2015.
+ */
+@State (value = Scope.Benchmark)
+public class SeveralNodesQueryMarshallerBenchmark {
+
+ private final static String PERSON_CACHE = "person";
+
+ private final static String CITY_CACHE = "city";
+
+ private final static String DEPARTMENT_CACHE = "dep";
+
+ private final static String ORGANIZATION_CACHE = "org";
+
+ private static final int PERSON_ROWS_COUNT = 50000;
+
+ private static final int CITY_ROWS_COUNT = 500;
+
+ private static final int DEPARTMENT_ROWS_COUNT = CITY_ROWS_COUNT * 10;
+
+ private static final int ORGANIZATION_ROWS_COUNT = 30;
+
+ private static final int SALARY_LIMIT = 100000;
+
+
+ private TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ private Ignite clientNode;
+
+ private IgniteCache<AffinityKey<UUID>, Person> personCache;
+
+ private IgniteConfiguration createOldConfiguration(String gridName) {
+ IgniteConfiguration cfg = new IgniteConfiguration();
+
+ cfg.setGridName(gridName);
+
+ TcpDiscoverySpi spi = new TcpDiscoverySpi();
+ spi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(spi);
+
+ OptimizedMarshaller marshaller = new OptimizedMarshaller();
+ marshaller.setProtocolVersion(OptimizedMarshallerProtocolVersion.VER_1);
+
+ cfg.setMarshaller(marshaller);
+
+ CacheConfiguration cityCacheCfg = createCacheCfg(CITY_CACHE);
+ cityCacheCfg.setTypeMetadata(Arrays.asList(createCityMetadata()));
+
+ CacheConfiguration orgCacheCfg = createCacheCfg(ORGANIZATION_CACHE);
+ orgCacheCfg.setTypeMetadata(Arrays.asList(createOrgMetadata()));
+
+ CacheConfiguration depCacheCfg = createCacheCfg(DEPARTMENT_CACHE);
+ depCacheCfg.setTypeMetadata(Arrays.asList(createDepartmentMeta()));
+
+ CacheConfiguration personCacheCfg = createCacheCfg(PERSON_CACHE);
+ personCacheCfg.setTypeMetadata(Arrays.asList(createPersonMeta()));
+
+ cfg.setCacheConfiguration(cityCacheCfg, orgCacheCfg, depCacheCfg, personCacheCfg);
+
+// CacheConfiguration cityCacheCfg = createCacheCfg(CITY_CACHE);
+// cityCacheCfg.setIndexedTypes(UUID.class, City.class);
+//
+// CacheConfiguration orgCacheCfg = createCacheCfg(ORGANIZATION_CACHE);
+// orgCacheCfg.setIndexedTypes(UUID.class, Organization.class);
+//
+// CacheConfiguration depCacheCfg = createCacheCfg(DEPARTMENT_CACHE);
+// depCacheCfg.setIndexedTypes(AffinityKey.class, Department.class);
+//
+// CacheConfiguration personCacheCfg = createCacheCfg(PERSON_CACHE);
+// personCacheCfg.setIndexedTypes(AffinityKey.class, Person.class);
+//
+// cfg.setCacheConfiguration(cityCacheCfg, orgCacheCfg, depCacheCfg, personCacheCfg);
+
+ return cfg;
+ }
+
+ private IgniteConfiguration createNewConfiguration(String gridName) {
+ IgniteConfiguration cfg = new IgniteConfiguration();
+
+ cfg.setGridName(gridName);
+
+ TcpDiscoverySpi spi = new TcpDiscoverySpi();
+ spi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(spi);
+
+ OptimizedMarshaller marshaller = new OptimizedMarshaller();
+ marshaller.setProtocolVersion(OptimizedMarshallerProtocolVersion.VER_1_1);
+ cfg.setMarshaller(marshaller);
+
+ CacheConfiguration cityCacheCfg = createCacheCfg(CITY_CACHE);
+ cityCacheCfg.setTypeMetadata(Arrays.asList(createCityMetadata()));
+
+ CacheConfiguration orgCacheCfg = createCacheCfg(ORGANIZATION_CACHE);
+ orgCacheCfg.setTypeMetadata(Arrays.asList(createOrgMetadata()));
+
+ CacheConfiguration depCacheCfg = createCacheCfg(DEPARTMENT_CACHE);
+ depCacheCfg.setTypeMetadata(Arrays.asList(createDepartmentMeta()));
+
+ CacheConfiguration personCacheCfg = createCacheCfg(PERSON_CACHE);
+ personCacheCfg.setTypeMetadata(Arrays.asList(createPersonMeta()));
+
+ cfg.setCacheConfiguration(cityCacheCfg, orgCacheCfg, depCacheCfg, personCacheCfg);
+
+ return cfg;
+ }
+
+ private CacheConfiguration createCacheCfg(String name) {
+ CacheConfiguration cCfg = new CacheConfiguration();
+ cCfg.setName(name);
+ cCfg.setCacheMode(CacheMode.PARTITIONED);
+ cCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ cCfg.setSwapEnabled(false);
+
+// cCfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
+// cCfg.setOffHeapMaxMemory(0);
+// cCfg.setSqlOnheapRowCacheSize(1);
+
+ return cCfg;
+ }
+
+ private CacheTypeMetadata createCityMetadata() {
+ CacheTypeMetadata meta = new CacheTypeMetadata();
+
+ meta.setKeyType(UUID.class);
+ meta.setValueType(City.class);
+
+ HashMap<String, Class<?>> indexes = new HashMap<>();
+ indexes.put("id", UUID.class);
+
+ HashMap<String, Class<?>> queryFields = new HashMap<>();
+ queryFields.put("name", String.class);
+ queryFields.put("population", Integer.class);
+ queryFields.put("age", Integer.class);
+
+ meta.setAscendingFields(indexes);
+ meta.setQueryFields(queryFields);
+
+ return meta;
+ }
+
+ private CacheTypeMetadata createOrgMetadata() {
+ CacheTypeMetadata meta = new CacheTypeMetadata();
+
+ meta.setKeyType(UUID.class);
+ meta.setValueType(Organization.class);
+
+ HashMap<String, Class<?>> indexes = new HashMap<>();
+ indexes.put("id", UUID.class);
+
+ HashMap<String, Class<?>> queryFields = new HashMap<>();
+ queryFields.put("name", String.class);
+
+ meta.setAscendingFields(indexes);
+ meta.setQueryFields(queryFields);
+
+ return meta;
+ }
+
+ private CacheTypeMetadata createDepartmentMeta() {
+ CacheTypeMetadata meta = new CacheTypeMetadata();
+
+ meta.setKeyType(AffinityKey.class);
+ meta.setValueType(Department.class);
+
+ HashMap<String, Class<?>> indexes = new HashMap<>();
+ indexes.put("id", UUID.class);
+ indexes.put("cityId", UUID.class);
+ indexes.put("orgId", UUID.class);
+
+ HashMap<String, Class<?>> queryFields = new HashMap<>();
+ queryFields.put("name", String.class);
+
+ meta.setAscendingFields(indexes);
+ meta.setQueryFields(queryFields);
+
+ return meta;
+ }
+
+ private CacheTypeMetadata createPersonMeta() {
+ CacheTypeMetadata meta = new CacheTypeMetadata();
+
+ meta.setKeyType(AffinityKey.class);
+ meta.setValueType(Person.class);
+
+ HashMap<String, Class<?>> indexes = new HashMap<>();
+ indexes.put("id", UUID.class);
+ indexes.put("depId", UUID.class);
+
+ HashMap<String, Class<?>> queryFields = new HashMap<>();
+ queryFields.put("firstName", String.class);
+ queryFields.put("lastName", String.class);
+ queryFields.put("rank", Integer.class);
+ queryFields.put("title", String.class);
+ queryFields.put("age", Integer.class);
+ queryFields.put("salary", Integer.class);
+
+ meta.setAscendingFields(indexes);
+ meta.setQueryFields(queryFields);
+
+ return meta;
+ }
+
+ private void populateCaches() {
+ Random rand = new Random();
+
+ System.out.println();
+
+ IgniteCache<UUID, City> cityCache = clientNode.cache(CITY_CACHE);
+
+ City[] cities = new City[CITY_ROWS_COUNT];
+
+ for (int i = 0; i < CITY_ROWS_COUNT; i++) {
+ City city = new City("City Name " + i, rand.nextInt(10000000), rand.nextInt(2000), "Country" + i);
+
+ cities[i] = city;
+
+ cityCache.put(city.getId(), city);
+ }
+
+ System.out.println("Populated cities: " + CITY_ROWS_COUNT);
+
+ IgniteCache<UUID, Organization> orgCache = clientNode.cache(ORGANIZATION_CACHE);
+
+ Organization[] organizations = new Organization[ORGANIZATION_ROWS_COUNT];
+
+ for (int i = 0; i < ORGANIZATION_ROWS_COUNT; i++) {
+ Organization org = new Organization("Org Name " + i);
+
+ organizations[i] = org;
+
+ orgCache.put(org.getId(), org);
+ }
+
+ System.out.println("Populated organizations: " + ORGANIZATION_ROWS_COUNT);
+
+ IgniteCache<AffinityKey<UUID>, Department> depCache = clientNode.cache(DEPARTMENT_CACHE);
+
+ Department[] departments = new Department[DEPARTMENT_ROWS_COUNT];
+
+ for (int i = 0; i < DEPARTMENT_ROWS_COUNT; i++) {
+ Department dep = new Department("Dep Name " + i, cities[rand.nextInt(CITY_ROWS_COUNT)],
+ organizations[rand.nextInt(ORGANIZATION_ROWS_COUNT)]);
+
+ departments[i] = dep;
+
+ try {
+ depCache.put(dep.getKey(), dep);
+ }
+ catch (Exception e) {
+ System.out.println("ROW: " + i);
+ e.printStackTrace();
+ }
+ }
+
+ System.out.println("Populated departments: " + DEPARTMENT_ROWS_COUNT);
+
+ cities = null;
+ organizations = null;
+
+ personCache = clientNode.cache(PERSON_CACHE);
+
+ for (int i = 0; i < PERSON_ROWS_COUNT; i++) {
+ Person person = new Person(departments[rand.nextInt(DEPARTMENT_ROWS_COUNT)], "First Name " + i,
+ "Last Name " + i, rand.nextInt(21), "Title " + i, rand.nextInt(90), rand.nextInt(SALARY_LIMIT));
+
+ personCache.put(person.getKey(), person);
+ }
+
+ System.out.println("Populated persons: " + PERSON_ROWS_COUNT);
+
+ System.out.printf("");
+ }
+
+ //@Setup (Level.Trial)
+ public void startOldNodes() {
+ System.out.println();
+
+ System.out.println("Using OLD marshaller");
+
+ Ignition.start(createOldConfiguration("server1"));
+ Ignition.start(createOldConfiguration("server2"));
+ Ignition.start(createOldConfiguration("server3"));
+
+ IgniteConfiguration clientCfg = createOldConfiguration("client");
+ clientCfg.setClientMode(true);
+
+ clientNode = Ignition.start(clientCfg);
+
+ populateCaches();
+ }
+
+ @Setup (Level.Trial)
+ public void startNewNodes() {
+ System.out.println();
+
+ System.out.println("Using NEW marshaller");
+
+ Ignition.start(createNewConfiguration("server1"));
+ Ignition.start(createNewConfiguration("server2"));
+ Ignition.start(createNewConfiguration("server3"));
+
+ IgniteConfiguration clientCfg = createNewConfiguration("client");
+ clientCfg.setClientMode(true);
+
+ clientNode = Ignition.start(clientCfg);
+
+ populateCaches();
+ }
+
+ @TearDown (Level.Trial)
+ public void stopNodes() {
+ Ignition.stopAll(true);
+ }
+
+ //@GenerateMicroBenchmark
+ public void sqlQuerySimple() {
+ String sql = "salary > ? and salary <= ?";
+
+ List<Cache.Entry<AffinityKey<UUID>, Person>> result =
+ personCache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, sql).
+ setArgs(0, 200000)).getAll();
+
+ if (result.size() == 0)
+ throw new RuntimeException("Invalid result size");
+ }
+
+ //@GenerateMicroBenchmark
+ public void sqlQueryWithJoin() {
+ // SQL clause query which joins on 2 types to select people for a specific organization.
+ String joinSql =
+ "from Person, \"" + DEPARTMENT_CACHE + "\".Department as dep " +
+ "where Person.depId = dep.id " +
+ "and lower(dep.name) = lower(?)";
+
+ // Execute queries for find employees for different organizations.
+ List<Cache.Entry<AffinityKey<UUID>, Person>> result =
+ personCache.query(new SqlQuery<AffinityKey<UUID>, Person>(Person.class, joinSql).
+ setArgs("Dep Name 1")).getAll();
+
+ if (result.size() == 0)
+ throw new RuntimeException("Invalid result size");
+ }
+
+ @GenerateMicroBenchmark
+ public void sqlQueryWithAggregation() {
+ // Calculate average of salary of all persons in ApacheIgnite.
+ // Note that we also join on Organization cache as well.
+ Random rand = new Random();
+
+ String sql =
+// "select Person.firstName, Person.lastName, Person.salary " +
+ "select Person.firstName, city.name " +
+ "from Person, \"" + DEPARTMENT_CACHE + "\".Department as dep, " +
+ "\"" + CITY_CACHE + "\".City as city " +
+ "where Person.depId = dep.id and dep.cityId = city.id " +
+ "and city.population > ? and city.population <= ?";
+
+ QueryCursor<List<?>> cursor = personCache.query(new SqlFieldsQuery(sql).setArgs(rand.nextInt(1000),
+ rand.nextInt(10000000)));
+
+ if (cursor.getAll().size() == 0)
+ System.err.println("Invalid result size");
+ }
+
+
+ public static void main(String... args) throws Exception {
+ Options opts = new OptionsBuilder()
+ .include(".*" + SeveralNodesQueryMarshallerBenchmark.class.getSimpleName() + ".*")
+ .warmupIterations(15)
+ .measurementIterations(35)
+ .jvmArgs("-server")
+ .forks(1)
+ .outputFormat(OutputFormatType.TextReport)
+ .build();
+
+ new Runner(opts).run();
+ }
+
+// public static void main(String... args) throws Exception {
+// SeveralNodesQueryMarshallerBenchmark benchmark = new SeveralNodesQueryMarshallerBenchmark();
+//
+// benchmark.startNewNodes();
+//
+// for (int i = 0; i < 20000; i++) {
+// benchmark.sqlQueryWithAggregation();
+//
+// if (i != 0 && i % 2000 == 0) {
+// System.out.println("Iteration: " + i);
+// break;
+// }
+// }
+//
+// //benchmark.stopNodes();
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/SimpleMarshallerBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/SimpleMarshallerBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/SimpleMarshallerBenchmark.java
new file mode 100644
index 0000000..2fb6f8f
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/SimpleMarshallerBenchmark.java
@@ -0,0 +1,208 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.jmh.model.*;
+import org.apache.ignite.marshaller.*;
+import org.apache.ignite.marshaller.optimized.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.logic.results.*;
+import org.openjdk.jmh.output.*;
+import org.openjdk.jmh.runner.*;
+import org.openjdk.jmh.runner.options.*;
+
+import javax.cache.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ *
+ */
+@State
+public class SimpleMarshallerBenchmark {
+
+ private TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ private Ignite node;
+
+ private IgniteCache<Integer, PersonSimple> cache;
+
+ private static final int ROWS_COUNT = 50000;
+
+ private IgniteConfiguration createConfiguration(String gridName, Marshaller marshaller) {
+ IgniteConfiguration cfg = new IgniteConfiguration();
+
+ cfg.setGridName(gridName);
+
+ TcpDiscoverySpi spi = new TcpDiscoverySpi();
+ spi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(spi);
+
+ cfg.setMarshaller(marshaller);
+
+ CacheConfiguration cCfg = new CacheConfiguration();
+ cCfg.setName("query");
+ cCfg.setCacheMode(CacheMode.PARTITIONED);
+ cCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ cCfg.setSwapEnabled(false);
+
+ /*cCfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
+ cCfg.setOffHeapMaxMemory(0);
+ cCfg.setSqlOnheapRowCacheSize(1);*/
+
+ CacheTypeMetadata meta = new CacheTypeMetadata();
+
+ meta.setKeyType(Integer.class);
+ meta.setValueType(PersonSimple.class);
+
+ HashMap<String, Class<?>> indexes = new HashMap<>();
+ indexes.put("id", Integer.class);
+ indexes.put("orgId", Integer.class);
+ indexes.put("salary", Double.class);
+
+ meta.setAscendingFields(indexes);
+
+ HashMap<String, Class<?>> queryFields = new HashMap<>();
+ queryFields.put("firstName", String.class);
+ queryFields.put("lastName", String.class);
+
+ meta.setQueryFields(queryFields);
+
+ cCfg.setTypeMetadata(Arrays.asList(meta));
+
+ cfg.setCacheConfiguration(cCfg);
+
+ return cfg;
+ }
+
+ @TearDown
+ public void stopNodes() {
+ Ignition.stopAll(true);
+ }
+
+ //@Setup
+ public void startOldNodes() {
+ System.out.println();
+ System.out.println("STARTED OLD NODE");
+
+ OptimizedMarshaller marsh = new OptimizedMarshaller();
+ marsh.setProtocolVersion(OptimizedMarshallerProtocolVersion.VER_1);
+
+ node = Ignition.start(createConfiguration("node", marsh));
+
+ cache = node.cache("query");
+
+ for (int i = 0; i < ROWS_COUNT; i++) {
+ PersonSimple person = new PersonSimple(i, "Name ", "Surname ", (i + 1) * 100);
+ cache.put(i, person);
+ }
+ }
+
+ @Setup
+ public void startNewNodes() {
+ System.out.println();
+ System.out.println("STARTED NEW NODE");
+
+ OptimizedMarshaller marsh = new OptimizedMarshaller();
+ marsh.setProtocolVersion(OptimizedMarshallerProtocolVersion.VER_1_1);
+
+ node = Ignition.start(createConfiguration("node", marsh));
+
+ cache = node.cache("query");
+
+ for (int i = 0; i < ROWS_COUNT; i++) {
+ PersonSimple person = new PersonSimple(i, "Name ", "Surname ", (i + 1) * 100);
+ cache.put(i, person);
+ }
+ }
+
+
+ //@GenerateMicroBenchmark
+ public void testQuery() throws Exception {
+ double salary = ThreadLocalRandom.current().nextInt(0, ROWS_COUNT);
+
+ double maxSalary = salary + 100;
+
+ SqlQuery qry = new SqlQuery(PersonSimple.class, "salary >= ? and salary <= ?");
+
+ qry.setArgs(salary, maxSalary);
+
+ Collection<Cache.Entry<Integer, Object>> entries = cache.query(qry).getAll();
+
+ entries.size();
+
+// Collection<Cache.Entry<Integer, PersonSimple>> entries = cache.query(qry).getAll();
+//
+// for (Cache.Entry<Integer, PersonSimple> entry : entries) {
+// PersonSimple p = entry.getValue();
+//
+// if (p.getSalary() < salary || p.getSalary() > maxSalary)
+// throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary +
+// ", person=" + p + ']');
+// }
+ }
+
+ @GenerateMicroBenchmark
+ public void testFieldsQuery() throws Exception {
+ double salary = ThreadLocalRandom.current().nextInt(0, ROWS_COUNT);
+
+ double maxSalary = salary + 100;
+
+ SqlFieldsQuery qry = new SqlFieldsQuery("SELECT PersonSimple.firstName, PersonSimple.lastName FROM " +
+ "PersonSimple WHERE salary >= ? and salary <= ?");
+
+ qry.setArgs(salary, maxSalary);
+
+ List<List<?>> result = cache.query(qry).getAll();
+
+ for (List<?> row : result) {
+ if (row.get(0) == null || row.get(1) == null)
+ throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary +
+ ", person=" + row + ']');
+ }
+ }
+
+// public static void main(String args[]) throws Exception {
+// SimpleMarshallerBenchmark benchmark = new SimpleMarshallerBenchmark();
+//
+// benchmark.startOldNodes();
+//
+// for (int i = 0; i < 500000000; i++) {
+// benchmark.testFieldsQuery();
+//
+// if (i % 10000 == 0)
+// System.out.println("Iteration: " + i);
+// }
+//
+// benchmark.stopNodes();
+// }
+
+
+ public static void main(String... args) throws Exception {
+ Options opts = new OptionsBuilder()
+ .include(".*" + SimpleMarshallerBenchmark.class.getSimpleName() + ".*")
+ .warmupIterations(15)
+ .measurementIterations(35)
+ .jvmArgs("-server")
+ .forks(1)
+ .outputFormat(OutputFormatType.TextReport)
+ //.shouldDoGC(true)
+ .build();
+
+ new Runner(opts).run();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/City.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/City.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/City.java
new file mode 100644
index 0000000..f2ca065
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/City.java
@@ -0,0 +1,72 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh.model;
+
+import org.apache.ignite.cache.query.annotations.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Created by GridAdmin1234 on 6/25/2015.
+ */
+public class City implements Serializable {
+ @QuerySqlField(index = true)
+ private UUID id;
+
+ @QuerySqlField
+ private String name;
+
+ @QuerySqlField
+ private int population;
+
+ @QuerySqlField
+ private int age;
+
+ private String country;
+
+ public City(String name, int population, int age, String country) {
+ id = UUID.randomUUID();
+
+ this.name = name;
+ this.population = population;
+ this.age = age;
+ this.country = country;
+ }
+
+ public UUID getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getPopulation() {
+ return population;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ @Override public String toString() {
+ return "City{" +
+ "id=" + id +
+ ", name='" + name + '\'' +
+ ", population=" + population +
+ ", age=" + age +
+ ", country='" + country + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Department.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Department.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Department.java
new file mode 100644
index 0000000..a1a6633
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Department.java
@@ -0,0 +1,75 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh.model;
+
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.annotations.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Created by GridAdmin1234 on 6/25/2015.
+ */
+public class Department implements Serializable {
+ @QuerySqlField(index = true)
+ private UUID id;
+
+ @QuerySqlField (index = true)
+ private UUID cityId;
+
+ @QuerySqlField (index = true)
+ private UUID orgId;
+
+ @QuerySqlField
+ private String name;
+
+ private transient AffinityKey<UUID> key;
+
+ public Department(String name, City city, Organization org) {
+ id = UUID.randomUUID();
+
+ cityId = city.getId();
+ orgId = org.getId();
+
+ this.name = name;
+ }
+
+ public UUID getId() {
+ return id;
+ }
+
+ public UUID getCityId() {
+ return cityId;
+ }
+
+ public UUID getOrgId() {
+ return orgId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public AffinityKey<UUID> getKey() {
+ if (key == null)
+ key = new AffinityKey<>(id, cityId);
+
+ return key;
+ }
+
+ @Override public String toString() {
+ return "Department{" +
+ "id=" + id +
+ ", cityId=" + cityId +
+ ", orgId=" + orgId +
+ ", name='" + name + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Organization.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Organization.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Organization.java
new file mode 100644
index 0000000..a0882ef
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Organization.java
@@ -0,0 +1,39 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh.model;
+
+import org.apache.ignite.cache.query.annotations.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Created by GridAdmin1234 on 6/25/2015.
+ */
+public class Organization implements Serializable {
+ @QuerySqlField (index = true)
+ private UUID id;
+
+ @QuerySqlField
+ private String name;
+
+ public Organization(String name) {
+ id = UUID.randomUUID();
+
+ this.name = name;
+ }
+
+ public UUID getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Person.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Person.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Person.java
new file mode 100644
index 0000000..e9d7331
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/Person.java
@@ -0,0 +1,97 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh.model;
+
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.annotations.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Created by GridAdmin1234 on 6/25/2015.
+ */
+public class Person implements Serializable {
+ @QuerySqlField (index = true)
+ private UUID id;
+
+ @QuerySqlField (index = true)
+ private UUID depId;
+
+ @QuerySqlField
+ private String firstName;
+
+ @QuerySqlField
+ private String lastName;
+
+ @QuerySqlField
+ private int rank;
+
+ @QuerySqlField
+ private String title;
+
+ @QuerySqlField
+ private int age;
+
+ @QuerySqlField
+ private int salary;
+
+ private transient AffinityKey<UUID> key;
+
+ public Person(Department dep, String firstName, String lastName, int rank, String title, int age, int salary) {
+ id = UUID.randomUUID();
+ depId = dep.getId();
+
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.rank = rank;
+ this.title = title;
+ this.age = age;
+ this.salary = salary;
+ }
+
+ public UUID getId() {
+ return id;
+ }
+
+ public UUID getDepId() {
+ return depId;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public int getRank() {
+ return rank;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public int getSalary() {
+ return salary;
+ }
+
+ public AffinityKey<UUID> getKey() {
+ if (key == null)
+ key = new AffinityKey<>(id, depId);
+
+ return key;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonExternalizable.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonExternalizable.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonExternalizable.java
new file mode 100644
index 0000000..854f95e
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonExternalizable.java
@@ -0,0 +1,190 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh.model;
+
+import org.apache.ignite.cache.query.annotations.*;
+
+import java.io.*;
+
+/**
+ * Person record used for query test.
+ */
+public class PersonExternalizable implements Externalizable {
+ /** Person ID. */
+ @QuerySqlField(index = true)
+ private int id;
+
+ /** Organization ID. */
+ @QuerySqlField(index = true)
+ private int orgId;
+
+ /** First name (not-indexed). */
+ @QuerySqlField
+ private String firstName;
+
+ /** Last name (not indexed). */
+ @QuerySqlField
+ private String lastName;
+
+ /** Salary. */
+ @QuerySqlField(index = true)
+ private double salary;
+
+ /**
+ * Constructs empty person.
+ */
+ public PersonExternalizable() {
+ // No-op.
+ }
+
+ /**
+ * Constructs person record that is not linked to any organization.
+ *
+ * @param id Person ID.
+ * @param firstName First name.
+ * @param lastName Last name.
+ * @param salary Salary.
+ */
+ public PersonExternalizable(int id, String firstName, String lastName, double salary) {
+ this(id, 0, firstName, lastName, salary);
+ }
+
+ /**
+ * Constructs person record.
+ *
+ * @param id Person ID.
+ * @param orgId Organization ID.
+ * @param firstName First name.
+ * @param lastName Last name.
+ * @param salary Salary.
+ */
+ public PersonExternalizable(int id, int orgId, String firstName, String lastName, double salary) {
+ this.id = id;
+ this.orgId = orgId;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.salary = salary;
+ }
+
+ /**
+ * @return Person id.
+ */
+ public int getId() {
+ return id;
+ }
+
+ /**
+ * @param id Person id.
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ /**
+ * @return Organization id.
+ */
+ public int getOrganizationId() {
+ return orgId;
+ }
+
+ /**
+ * @param orgId Organization id.
+ */
+ public void setOrganizationId(int orgId) {
+ this.orgId = orgId;
+ }
+
+ /**
+ * @return Person first name.
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * @param firstName Person first name.
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ * @return Person last name.
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ * @param lastName Person last name.
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ * @return Salary.
+ */
+ public double getSalary() {
+ return salary;
+ }
+
+ /**
+ * @param salary Salary.
+ */
+ public void setSalary(double salary) {
+ this.salary = salary;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(id);
+ out.writeInt(orgId);
+ out.writeUTF(firstName);
+ out.writeUTF(lastName);
+ out.writeDouble(salary);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ id = in.readInt();
+ orgId = in.readInt();
+ firstName = in.readUTF();
+ lastName = in.readUTF();
+ salary = in.readDouble();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || (o instanceof PersonExternalizable) && id == ((PersonExternalizable)o).id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Person [firstName=" + firstName +
+ ", id=" + id +
+ ", orgId=" + orgId +
+ ", lastName=" + lastName +
+ ", salary=" + salary +
+ ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonMarshalAware.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonMarshalAware.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonMarshalAware.java
new file mode 100644
index 0000000..8e80db6
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonMarshalAware.java
@@ -0,0 +1,199 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh.model;
+
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.marshaller.optimized.*;
+
+import java.io.*;
+
+/**
+ * Person record used for query test.
+ */
+public class PersonMarshalAware implements OptimizedMarshalAware {
+ /** Person ID. */
+ @QuerySqlField(index = true)
+ private int id;
+
+ /** Organization ID. */
+ @QuerySqlField(index = true)
+ private int orgId;
+
+ /** First name (not-indexed). */
+ @QuerySqlField
+ private String firstName;
+
+ /** Last name (not indexed). */
+ @QuerySqlField
+ private String lastName;
+
+ /** Salary. */
+ @QuerySqlField(index = true)
+ private double salary;
+
+ /**
+ * Constructs empty person.
+ */
+ public PersonMarshalAware() {
+ // No-op.
+ }
+
+ /**
+ * Constructs person record that is not linked to any organization.
+ *
+ * @param id Person ID.
+ * @param firstName First name.
+ * @param lastName Last name.
+ * @param salary Salary.
+ */
+ public PersonMarshalAware(int id, String firstName, String lastName, double salary) {
+ this(id, 0, firstName, lastName, salary);
+ }
+
+ /**
+ * Constructs person record.
+ *
+ * @param id Person ID.
+ * @param orgId Organization ID.
+ * @param firstName First name.
+ * @param lastName Last name.
+ * @param salary Salary.
+ */
+ public PersonMarshalAware(int id, int orgId, String firstName, String lastName, double salary) {
+ this.id = id;
+ this.orgId = orgId;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.salary = salary;
+ }
+
+ /**
+ * @return Person id.
+ */
+ public int getId() {
+ return id;
+ }
+
+ /**
+ * @param id Person id.
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ /**
+ * @return Organization id.
+ */
+ public int getOrganizationId() {
+ return orgId;
+ }
+
+ /**
+ * @param orgId Organization id.
+ */
+ public void setOrganizationId(int orgId) {
+ this.orgId = orgId;
+ }
+
+ /**
+ * @return Person first name.
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * @param firstName Person first name.
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ * @return Person last name.
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ * @param lastName Person last name.
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ * @return Salary.
+ */
+ public double getSalary() {
+ return salary;
+ }
+
+ /**
+ * @param salary Salary.
+ */
+ public void setSalary(double salary) {
+ this.salary = salary;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeFields(OptimizedFieldsWriter writer) throws IOException {
+ writer.writeInt("id", id);
+ writer.writeInt("orgId", orgId);
+ writer.writeString("firstName", firstName);
+ writer.writeString("lastName", lastName);
+ writer.writeDouble("salary", salary);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readFields(OptimizedFieldsReader reader) throws IOException {
+ id = reader.readInt("id");
+ orgId = reader.readInt("orgId");
+ firstName = reader.readString("firstName");
+ lastName = reader.readString("lastName");
+ salary = reader.readDouble("salary");
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || (o instanceof PersonMarshalAware) && id == ((PersonMarshalAware)o).id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Person [firstName=" + firstName +
+ ", id=" + id +
+ ", orgId=" + orgId +
+ ", lastName=" + lastName +
+ ", salary=" + salary +
+ ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cc19b086/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonSimple.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonSimple.java b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonSimple.java
new file mode 100644
index 0000000..b749de1
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/jmh/model/PersonSimple.java
@@ -0,0 +1,172 @@
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+/*
+ * _________ _____ __________________ _____
+ * __ ____/___________(_)______ /__ ____/______ ____(_)_______
+ * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
+ * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
+ * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
+ */
+
+package org.apache.ignite.jmh.model;
+
+import org.apache.ignite.cache.query.annotations.*;
+
+import java.io.*;
+
+/**
+ * Person record used for query test.
+ */
+public class PersonSimple implements Serializable {
+ /** Person ID. */
+ @QuerySqlField(index = true)
+ private int id;
+
+ /** Organization ID. */
+ @QuerySqlField(index = true)
+ private int orgId;
+
+ /** First name (not-indexed). */
+ @QuerySqlField
+ private String firstName;
+
+ /** Last name (not indexed). */
+ @QuerySqlField
+ private String lastName;
+
+ /** Salary. */
+ @QuerySqlField(index = true)
+ private double salary;
+
+ /**
+ * Constructs empty person.
+ */
+ public PersonSimple() {
+ // No-op.
+ }
+
+ /**
+ * Constructs person record that is not linked to any organization.
+ *
+ * @param id Person ID.
+ * @param firstName First name.
+ * @param lastName Last name.
+ * @param salary Salary.
+ */
+ public PersonSimple(int id, String firstName, String lastName, double salary) {
+ this(id, 0, firstName, lastName, salary);
+ }
+
+ /**
+ * Constructs person record.
+ *
+ * @param id Person ID.
+ * @param orgId Organization ID.
+ * @param firstName First name.
+ * @param lastName Last name.
+ * @param salary Salary.
+ */
+ public PersonSimple(int id, int orgId, String firstName, String lastName, double salary) {
+ this.id = id;
+ this.orgId = orgId;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.salary = salary;
+ }
+
+ /**
+ * @return Person id.
+ */
+ public int getId() {
+ return id;
+ }
+
+ /**
+ * @param id Person id.
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ /**
+ * @return Organization id.
+ */
+ public int getOrganizationId() {
+ return orgId;
+ }
+
+ /**
+ * @param orgId Organization id.
+ */
+ public void setOrganizationId(int orgId) {
+ this.orgId = orgId;
+ }
+
+ /**
+ * @return Person first name.
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * @param firstName Person first name.
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ * @return Person last name.
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ * @param lastName Person last name.
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ * @return Salary.
+ */
+ public double getSalary() {
+ return salary;
+ }
+
+ /**
+ * @param salary Salary.
+ */
+ public void setSalary(double salary) {
+ this.salary = salary;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || (o instanceof PersonSimple) && id == ((PersonSimple)o).id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Person [firstName=" + firstName +
+ ", id=" + id +
+ ", orgId=" + orgId +
+ ", lastName=" + lastName +
+ ", salary=" + salary +
+ ']';
+ }
+}
[02/25] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sprint-7' into ignite-gg-10453
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-gg-10453
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d86882c3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d86882c3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d86882c3
Branch: refs/heads/ignite-950
Commit: d86882c3597080c62877ba36b916dda29089b900
Parents: 3231f93 6e23608
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 26 16:55:32 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 26 16:55:32 2015 +0300
----------------------------------------------------------------------
.../GridCachePartitionExchangeManager.java | 6 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 151 ++++++-----
.../ignite/spi/discovery/tcp/ServerImpl.java | 103 +++++--
.../spi/discovery/tcp/TcpDiscoverySpi.java | 3 +-
...achePartitionedMultiNodeFullApiSelfTest.java | 4 +-
.../tcp/TcpClientDiscoverySpiSelfTest.java | 265 ++++++++++++++++++-
6 files changed, 451 insertions(+), 81 deletions(-)
----------------------------------------------------------------------
[12/25] incubator-ignite git commit: # sprint-7 Minor fixes in
javadocs.
Posted by sb...@apache.org.
# sprint-7 Minor fixes in javadocs.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/596c5389
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/596c5389
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/596c5389
Branch: refs/heads/ignite-950
Commit: 596c5389b0faf1de1be5cbe2a88b5579a93683b2
Parents: 1a21477
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Jun 30 10:26:12 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Jun 30 10:26:12 2015 +0700
----------------------------------------------------------------------
.../main/java/org/apache/ignite/schema/model/PojoDescriptor.java | 2 ++
.../src/main/java/org/apache/ignite/schema/model/PojoField.java | 1 +
.../apache/ignite/schema/parser/dialect/OracleMetadataDialect.java | 2 +-
3 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/596c5389/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
index 4ef8b00..5e1da06 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
@@ -304,6 +304,8 @@ public class PojoDescriptor {
/**
* Gets indexes groups.
+ *
+ * @return Map with indexes.
*/
public Map<String, Map<String, IndexItem>> groups() {
Map<String, Map<String, Boolean>> idxs = tbl.indexes();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/596c5389/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java
index 10939d9..88e4008 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java
@@ -184,6 +184,7 @@ public class PojoField {
/**
* @param jdbcType String name for JDBC type.
+ * @return String name for JDBC type.
*/
private static String jdbcTypeName(int jdbcType) {
switch (jdbcType) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/596c5389/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
index 6b16042..855c9f7 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
@@ -189,7 +189,7 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
* @param owner DB owner.
* @param tbl Table name.
* @return Index columns.
- * @throws SQLException If failed to retrieve indexe columns.
+ * @throws SQLException If failed to retrieve indexes columns.
*/
private Map<String, Map<String, Boolean>> indexes(PreparedStatement stmt, String owner, String tbl)
throws SQLException {
[16/25] incubator-ignite git commit: IGNITE-1063 Added generic for
chaining setters.
Posted by sb...@apache.org.
IGNITE-1063 Added generic for chaining setters.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ef7a35ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ef7a35ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ef7a35ce
Branch: refs/heads/ignite-950
Commit: ef7a35ce9afb830c2e02b624eb3f3298f66e6129
Parents: bade9f1
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Tue Jun 30 12:31:13 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Tue Jun 30 12:31:13 2015 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 105 ++++++++++---------
.../configuration/NearCacheConfiguration.java | 10 +-
2 files changed, 61 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef7a35ce/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 7af4974..e2308f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -419,7 +419,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param name Cache name. May be <tt>null</tt>, but may not be empty string.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setName(String name) {
+ public CacheConfiguration<K, V> setName(String name) {
A.ensure(name == null || !name.isEmpty(), "Name cannot be null or empty.");
this.name = name;
@@ -444,7 +444,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param evictPlc Cache expiration policy.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setEvictionPolicy(@Nullable EvictionPolicy evictPlc) {
+ public CacheConfiguration<K, V> setEvictionPolicy(@Nullable EvictionPolicy evictPlc) {
this.evictPlc = evictPlc;
return this;
@@ -461,7 +461,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param nearCfg Near cache configuration.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setNearConfiguration(NearCacheConfiguration<K, V> nearCfg) {
+ public CacheConfiguration<K, V> setNearConfiguration(NearCacheConfiguration<K, V> nearCfg) {
this.nearCfg = nearCfg;
return this;
@@ -483,7 +483,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param writeSync Write synchronization mode.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setWriteSynchronizationMode(CacheWriteSynchronizationMode writeSync) {
+ public CacheConfiguration<K, V> setWriteSynchronizationMode(CacheWriteSynchronizationMode writeSync) {
this.writeSync = writeSync;
return this;
@@ -504,7 +504,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param nodeFilter Predicate specifying on which nodes the cache should be started.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setNodeFilter(IgnitePredicate<ClusterNode> nodeFilter) {
+ public CacheConfiguration<K, V> setNodeFilter(IgnitePredicate<ClusterNode> nodeFilter) {
this.nodeFilter = nodeFilter;
return this;
@@ -536,7 +536,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param evictSync {@code true} if synchronized, {@code false} if not.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setEvictSynchronized(boolean evictSync) {
+ public CacheConfiguration<K, V> setEvictSynchronized(boolean evictSync) {
this.evictSync = evictSync;
return this;
@@ -559,7 +559,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param evictKeyBufSize Eviction key buffer size.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setEvictSynchronizedKeyBufferSize(int evictKeyBufSize) {
+ public CacheConfiguration<K, V> setEvictSynchronizedKeyBufferSize(int evictKeyBufSize) {
this.evictKeyBufSize = evictKeyBufSize;
return this;
@@ -593,7 +593,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param evictSyncConcurrencyLvl Concurrency level for synchronized evictions.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl) {
+ public CacheConfiguration<K, V> setEvictSynchronizedConcurrencyLevel(int evictSyncConcurrencyLvl) {
this.evictSyncConcurrencyLvl = evictSyncConcurrencyLvl;
return this;
@@ -619,7 +619,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param evictSyncTimeout Timeout for synchronized evictions.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setEvictSynchronizedTimeout(long evictSyncTimeout) {
+ public CacheConfiguration<K, V> setEvictSynchronizedTimeout(long evictSyncTimeout) {
this.evictSyncTimeout = evictSyncTimeout;
return this;
@@ -651,7 +651,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param evictMaxOverflowRatio Maximum eviction overflow ratio.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setEvictMaxOverflowRatio(float evictMaxOverflowRatio) {
+ public CacheConfiguration<K, V> setEvictMaxOverflowRatio(float evictMaxOverflowRatio) {
this.evictMaxOverflowRatio = evictMaxOverflowRatio;
return this;
@@ -680,7 +680,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param evictFilter Eviction filter.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setEvictionFilter(EvictionFilter<K, V> evictFilter) {
+ public CacheConfiguration<K, V> setEvictionFilter(EvictionFilter<K, V> evictFilter) {
this.evictFilter = evictFilter;
return this;
@@ -709,7 +709,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @see #isEagerTtl()
* @return {@code this} for chaining.
*/
- public CacheConfiguration setEagerTtl(boolean eagerTtl) {
+ public CacheConfiguration<K, V> setEagerTtl(boolean eagerTtl) {
this.eagerTtl = eagerTtl;
return this;
@@ -731,7 +731,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param startSize Cache start size.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setStartSize(int startSize) {
+ public CacheConfiguration<K, V> setStartSize(int startSize) {
this.startSize = startSize;
return this;
@@ -775,7 +775,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param loadPrevVal Load previous value flag.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setLoadPreviousValue(boolean loadPrevVal) {
+ public CacheConfiguration<K, V> setLoadPreviousValue(boolean loadPrevVal) {
this.loadPrevVal = loadPrevVal;
return this;
@@ -798,7 +798,8 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @return {@code this} for chaining.
*/
@SuppressWarnings("unchecked")
- public CacheConfiguration setCacheStoreFactory(Factory<? extends CacheStore<? super K, ? super V>> storeFactory) {
+ public CacheConfiguration<K, V> setCacheStoreFactory(
+ Factory<? extends CacheStore<? super K, ? super V>> storeFactory) {
this.storeFactory = storeFactory;
return this;
@@ -819,7 +820,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param aff Cache key affinity.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setAffinity(AffinityFunction aff) {
+ public CacheConfiguration<K, V> setAffinity(AffinityFunction aff) {
this.aff = aff;
return this;
@@ -842,7 +843,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param cacheMode Caching mode.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setCacheMode(CacheMode cacheMode) {
+ public CacheConfiguration<K, V> setCacheMode(CacheMode cacheMode) {
this.cacheMode = cacheMode;
return this;
@@ -865,7 +866,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param atomicityMode Cache atomicity mode.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setAtomicityMode(CacheAtomicityMode atomicityMode) {
+ public CacheConfiguration<K, V> setAtomicityMode(CacheAtomicityMode atomicityMode) {
this.atomicityMode = atomicityMode;
return this;
@@ -888,7 +889,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param atomicWriteOrderMode Cache write ordering mode.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setAtomicWriteOrderMode(CacheAtomicWriteOrderMode atomicWriteOrderMode) {
+ public CacheConfiguration<K, V> setAtomicWriteOrderMode(CacheAtomicWriteOrderMode atomicWriteOrderMode) {
this.atomicWriteOrderMode = atomicWriteOrderMode;
return this;
@@ -913,7 +914,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param backups Number of backup nodes for one partition.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setBackups(int backups) {
+ public CacheConfiguration<K, V> setBackups(int backups) {
this.backups = backups;
return this;
@@ -935,7 +936,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param dfltLockTimeout Default lock timeout.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setDefaultLockTimeout(long dfltLockTimeout) {
+ public CacheConfiguration<K, V> setDefaultLockTimeout(long dfltLockTimeout) {
this.dfltLockTimeout = dfltLockTimeout;
return this;
@@ -956,7 +957,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param invalidate Flag to set this cache into invalidation-based mode. Default value is {@code false}.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setInvalidate(boolean invalidate) {
+ public CacheConfiguration<K, V> setInvalidate(boolean invalidate) {
this.invalidate = invalidate;
return this;
@@ -978,7 +979,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* receive JTA transaction manager.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setTransactionManagerLookupClassName(String tmLookupClsName) {
+ public CacheConfiguration<K, V> setTransactionManagerLookupClassName(String tmLookupClsName) {
this.tmLookupClsName = tmLookupClsName;
return this;
@@ -990,7 +991,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param rebalanceMode Rebalance mode.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setRebalanceMode(CacheRebalanceMode rebalanceMode) {
+ public CacheConfiguration<K, V> setRebalanceMode(CacheRebalanceMode rebalanceMode) {
this.rebalanceMode = rebalanceMode;
return this;
@@ -1033,7 +1034,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @see #getRebalanceOrder()
* @return {@code this} for chaining.
*/
- public CacheConfiguration setRebalanceOrder(int rebalanceOrder) {
+ public CacheConfiguration<K, V> setRebalanceOrder(int rebalanceOrder) {
this.rebalanceOrder = rebalanceOrder;
return this;
@@ -1057,7 +1058,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param rebalanceBatchSize Rebalance batch size.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setRebalanceBatchSize(int rebalanceBatchSize) {
+ public CacheConfiguration<K, V> setRebalanceBatchSize(int rebalanceBatchSize) {
this.rebalanceBatchSize = rebalanceBatchSize;
return this;
@@ -1079,7 +1080,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param swapEnabled {@code True} if swap storage is enabled.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setSwapEnabled(boolean swapEnabled) {
+ public CacheConfiguration<K, V> setSwapEnabled(boolean swapEnabled) {
this.swapEnabled = swapEnabled;
return this;
@@ -1108,7 +1109,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @see #getMaxConcurrentAsyncOperations()
* @return {@code this} for chaining.
*/
- public CacheConfiguration setMaxConcurrentAsyncOperations(int maxConcurrentAsyncOps) {
+ public CacheConfiguration<K, V> setMaxConcurrentAsyncOperations(int maxConcurrentAsyncOps) {
this.maxConcurrentAsyncOps = maxConcurrentAsyncOps;
return this;
@@ -1131,7 +1132,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param writeBehindEnabled {@code true} if write-behind is enabled.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setWriteBehindEnabled(boolean writeBehindEnabled) {
+ public CacheConfiguration<K, V> setWriteBehindEnabled(boolean writeBehindEnabled) {
this.writeBehindEnabled = writeBehindEnabled;
return this;
@@ -1159,7 +1160,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @see #getWriteBehindFlushSize()
* @return {@code this} for chaining.
*/
- public CacheConfiguration setWriteBehindFlushSize(int writeBehindFlushSize) {
+ public CacheConfiguration<K, V> setWriteBehindFlushSize(int writeBehindFlushSize) {
this.writeBehindFlushSize = writeBehindFlushSize;
return this;
@@ -1188,7 +1189,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @see #getWriteBehindFlushFrequency()
* @return {@code this} for chaining.
*/
- public CacheConfiguration setWriteBehindFlushFrequency(long writeBehindFlushFreq) {
+ public CacheConfiguration<K, V> setWriteBehindFlushFrequency(long writeBehindFlushFreq) {
this.writeBehindFlushFreq = writeBehindFlushFreq;
return this;
@@ -1215,7 +1216,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @see #getWriteBehindFlushThreadCount()
* @return {@code this} for chaining.
*/
- public CacheConfiguration setWriteBehindFlushThreadCount(int writeBehindFlushThreadCnt) {
+ public CacheConfiguration<K, V> setWriteBehindFlushThreadCount(int writeBehindFlushThreadCnt) {
this.writeBehindFlushThreadCnt = writeBehindFlushThreadCnt;
return this;
@@ -1242,7 +1243,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @see #getWriteBehindBatchSize()
* @return {@code this} for chaining.
*/
- public CacheConfiguration setWriteBehindBatchSize(int writeBehindBatchSize) {
+ public CacheConfiguration<K, V> setWriteBehindBatchSize(int writeBehindBatchSize) {
this.writeBehindBatchSize = writeBehindBatchSize;
return this;
@@ -1267,7 +1268,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param rebalancePoolSize Size of rebalancing thread pool.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setRebalanceThreadPoolSize(int rebalancePoolSize) {
+ public CacheConfiguration<K, V> setRebalanceThreadPoolSize(int rebalancePoolSize) {
this.rebalancePoolSize = rebalancePoolSize;
return this;
@@ -1290,7 +1291,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param rebalanceTimeout Rebalance timeout (ms).
* @return {@code this} for chaining.
*/
- public CacheConfiguration setRebalanceTimeout(long rebalanceTimeout) {
+ public CacheConfiguration<K, V> setRebalanceTimeout(long rebalanceTimeout) {
this.rebalanceTimeout = rebalanceTimeout;
return this;
@@ -1328,7 +1329,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param rebalanceDelay Rebalance delay to set.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setRebalanceDelay(long rebalanceDelay) {
+ public CacheConfiguration<K, V> setRebalanceDelay(long rebalanceDelay) {
this.rebalanceDelay = rebalanceDelay;
return this;
@@ -1364,7 +1365,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* {@code 0} to disable throttling.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setRebalanceThrottle(long rebalanceThrottle) {
+ public CacheConfiguration<K, V> setRebalanceThrottle(long rebalanceThrottle) {
this.rebalanceThrottle = rebalanceThrottle;
return this;
@@ -1391,7 +1392,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param affMapper Affinity mapper.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setAffinityMapper(AffinityKeyMapper affMapper) {
+ public CacheConfiguration<K, V> setAffinityMapper(AffinityKeyMapper affMapper) {
this.affMapper = affMapper;
return this;
@@ -1438,7 +1439,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param offHeapMaxMem Maximum memory in bytes available to off-heap memory space.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setOffHeapMaxMemory(long offHeapMaxMem) {
+ public CacheConfiguration<K, V> setOffHeapMaxMemory(long offHeapMaxMem) {
this.offHeapMaxMem = offHeapMaxMem;
return this;
@@ -1462,7 +1463,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param memMode Memory mode.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setMemoryMode(CacheMemoryMode memMode) {
+ public CacheConfiguration<K, V> setMemoryMode(CacheMemoryMode memMode) {
this.memMode = memMode;
return this;
@@ -1484,7 +1485,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param interceptor Cache interceptor.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setInterceptor(CacheInterceptor<K, V> interceptor) {
+ public CacheConfiguration<K, V> setInterceptor(CacheInterceptor<K, V> interceptor) {
this.interceptor = interceptor;
return this;
@@ -1505,7 +1506,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param typeMeta Collection of type metadata.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setTypeMetadata(Collection<CacheTypeMetadata> typeMeta) {
+ public CacheConfiguration<K, V> setTypeMetadata(Collection<CacheTypeMetadata> typeMeta) {
this.typeMeta = typeMeta;
return this;
@@ -1530,7 +1531,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param readFromBackup {@code true} to allow reads from backups.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setReadFromBackup(boolean readFromBackup) {
+ public CacheConfiguration<K, V> setReadFromBackup(boolean readFromBackup) {
this.readFromBackup = readFromBackup;
return this;
@@ -1554,7 +1555,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @see #isCopyOnRead
* @return {@code this} for chaining.
*/
- public CacheConfiguration setCopyOnRead(boolean cpOnRead) {
+ public CacheConfiguration<K, V> setCopyOnRead(boolean cpOnRead) {
this.cpOnRead = cpOnRead;
return this;
@@ -1567,7 +1568,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param cls One or more classes with SQL functions.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setSqlFunctionClasses(Class<?>... cls) {
+ public CacheConfiguration<K, V> setSqlFunctionClasses(Class<?>... cls) {
this.sqlFuncCls = cls;
return this;
@@ -1598,7 +1599,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param longQryWarnTimeout Timeout in milliseconds.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setLongQueryWarningTimeout(long longQryWarnTimeout) {
+ public CacheConfiguration<K, V> setLongQueryWarningTimeout(long longQryWarnTimeout) {
this.longQryWarnTimeout = longQryWarnTimeout;
return this;
@@ -1623,7 +1624,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param sqlEscapeAll Flag value.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setSqlEscapeAll(boolean sqlEscapeAll) {
+ public CacheConfiguration<K, V> setSqlEscapeAll(boolean sqlEscapeAll) {
this.sqlEscapeAll = sqlEscapeAll;
return this;
@@ -1660,7 +1661,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param indexedTypes Key and value type pairs.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setIndexedTypes(Class<?>... indexedTypes) {
+ public CacheConfiguration<K, V> setIndexedTypes(Class<?>... indexedTypes) {
A.ensure(indexedTypes == null || (indexedTypes.length & 1) == 0,
"Number of indexed types is expected to be even. Refer to method javadoc for details.");
@@ -1699,7 +1700,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @see #setOffHeapMaxMemory(long)
* @return {@code this} for chaining.
*/
- public CacheConfiguration setSqlOnheapRowCacheSize(int size) {
+ public CacheConfiguration<K, V> setSqlOnheapRowCacheSize(int size) {
this.sqlOnheapRowCacheSize = size;
return this;
@@ -1720,7 +1721,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param pluginCfgs Cache plugin configurations.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setPluginConfigurations(CachePluginConfiguration... pluginCfgs) {
+ public CacheConfiguration<K, V> setPluginConfigurations(CachePluginConfiguration... pluginCfgs) {
this.pluginCfgs = pluginCfgs;
return this;
@@ -1739,7 +1740,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param topValidator validator.
* @return {@code this} for chaining.
*/
- public CacheConfiguration setTopologyValidator(TopologyValidator topValidator) {
+ public CacheConfiguration<K, V> setTopologyValidator(TopologyValidator topValidator) {
this.topValidator = topValidator;
return this;
@@ -1766,7 +1767,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @return {@code this} for chaining.
* @see CacheStoreSessionListener
*/
- public CacheConfiguration setCacheStoreSessionListenerFactories(
+ public CacheConfiguration<K, V> setCacheStoreSessionListenerFactories(
Factory<? extends CacheStoreSessionListener>... storeSesLsnrs) {
this.storeSesLsnrs = storeSesLsnrs;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ef7a35ce/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
index 0593601..580010a 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
@@ -64,9 +64,12 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> {
/**
* @param nearEvictPlc Near eviction policy.
+ * @return {@code this} for chaining.
*/
- public void setNearEvictionPolicy(EvictionPolicy<K, V> nearEvictPlc) {
+ public NearCacheConfiguration<K, V> setNearEvictionPolicy(EvictionPolicy<K, V> nearEvictPlc) {
this.nearEvictPlc = nearEvictPlc;
+
+ return this;
}
/**
@@ -83,9 +86,12 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* Start size for near cache. This property is only used for {@link CacheMode#PARTITIONED} caching mode.
*
* @param nearStartSize Start size for near cache.
+ * @return {@code this} for chaining.
*/
- public void setNearStartSize(int nearStartSize) {
+ public NearCacheConfiguration<K, V> setNearStartSize(int nearStartSize) {
this.nearStartSize = nearStartSize;
+
+ return this;
}
/** {@inheritDoc} */
[10/25] incubator-ignite git commit: # suppress undeployed message if
nothing has
Posted by sb...@apache.org.
# suppress undeployed message if nothing has
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6929a0cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6929a0cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6929a0cb
Branch: refs/heads/ignite-950
Commit: 6929a0cbb382d4b924f127ed65b9fbbe4b232780
Parents: 1d5cfbc
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Jun 29 11:08:37 2015 -0700
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Jun 29 11:08:37 2015 -0700
----------------------------------------------------------------------
.../processors/cache/GridCacheDeploymentManager.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6929a0cb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
index ff109ed..677377e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
@@ -255,17 +255,17 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
cacheCtx.near().dht().context().swap().onUndeploy(ldr) :
cacheCtx.swap().onUndeploy(ldr);
- if (cacheCtx.userCache()) {
+ if (cacheCtx.userCache() && (!keys.isEmpty() || swapUndeployCnt != 0)) {
U.quietAndWarn(log, "");
U.quietAndWarn(
log,
- "Cleared all cache entries for undeployed class loader [[cacheName=" + cacheCtx.namexx() +
+ "Cleared all cache entries for undeployed class loader [cacheName=" + cacheCtx.namexx() +
", undeployCnt=" + keys.size() + ", swapUndeployCnt=" + swapUndeployCnt +
- ", clsLdr=" + ldr.getClass().getName() + ']',
- "Cleared all cache entries for undeployed class loader for cache: " + cacheCtx.namexx());
+ ", clsLdr=" + ldr.getClass().getName() + ']');
U.quietAndWarn(
log,
- " ^-- Cache auto-undeployment happens in SHARED deployment mode (to turn off, switch to CONTINUOUS mode)");
+ " ^-- Cache auto-undeployment happens in SHARED deployment mode " +
+ "(to turn off, switch to CONTINUOUS mode)");
U.quietAndWarn(log, "");
}
[09/25] incubator-ignite git commit: #ignite-18: Property
segmentationResolveAttempts seems to be ignored.
Posted by sb...@apache.org.
#ignite-18: Property segmentationResolveAttempts seems to be ignored.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1d5cfbcc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1d5cfbcc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1d5cfbcc
Branch: refs/heads/ignite-950
Commit: 1d5cfbcc6ef79dd8da99dc46a2797952dbcf4eab
Parents: 5dff89c
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jun 29 17:50:49 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jun 29 17:50:49 2015 +0300
----------------------------------------------------------------------
.../internal/managers/discovery/GridDiscoveryManager.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1d5cfbcc/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 1e4b972..5e7600f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -326,6 +326,12 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
U.warn(log, "Configuration parameter 'segmentCheckFrequency' is too low " +
"(at least 2000 ms recommended): " + segChkFreq);
+ int segResAttemp = ctx.config().getSegmentationResolveAttempts();
+
+ if (segResAttemp < 1)
+ throw new IgniteCheckedException(
+ "Segment resolve attempts cannot be negative or zero: " + segResAttemp);
+
checkSegmentOnStart();
}
[06/25] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-gg-10453' into ignite-sprint-7
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-gg-10453' 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/15f3612d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/15f3612d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/15f3612d
Branch: refs/heads/ignite-950
Commit: 15f3612d31a1f39046d4bf5cc7be6e0aed7d02c8
Parents: f45f96d d51db29
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jun 29 15:25:53 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jun 29 15:25:53 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/GridKernalContextImpl.java | 2 +-
.../processors/cache/GridCacheProcessor.java | 62 ++++--
.../cache/GridCacheDaemonNodeStopSelfTest.java | 119 ------------
.../IgniteDaemonNodeMarshallerCacheTest.java | 192 +++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 1 +
.../testsuites/IgniteCacheTestSuite3.java | 1 -
6 files changed, 245 insertions(+), 132 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15f3612d/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
[23/25] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sprint-7' into ignite-950
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-950
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8929cb44
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8929cb44
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8929cb44
Branch: refs/heads/ignite-950
Commit: 8929cb44350ac74f3c5f275a97ca58728fb9a8e4
Parents: 048d711 e91bc48
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 1 08:10:52 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 1 08:10:52 2015 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 105 +++----
.../configuration/NearCacheConfiguration.java | 10 +-
.../ignite/internal/GridKernalContextImpl.java | 2 +-
.../discovery/GridDiscoveryManager.java | 32 +-
.../cache/GridCacheDeploymentManager.java | 10 +-
.../processors/cache/GridCacheProcessor.java | 62 +++-
.../processors/clock/GridClockServer.java | 21 +-
.../shmem/IpcSharedMemoryServerEndpoint.java | 10 +-
.../util/VisorClusterGroupEmptyException.java | 6 +-
.../TcpDiscoveryMulticastIpFinder.java | 74 ++++-
.../core/src/test/config/spark/spark-config.xml | 46 +++
.../IgniteTopologyPrintFormatSelfTest.java | 289 +++++++++++++++++++
.../cache/GridCacheDaemonNodeStopSelfTest.java | 119 --------
.../IgniteDaemonNodeMarshallerCacheTest.java | 192 ++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 1 +
.../testsuites/IgniteCacheTestSuite3.java | 1 -
.../testsuites/IgniteKernalSelfTestSuite.java | 1 +
.../ignite/schema/model/PojoDescriptor.java | 2 +
.../apache/ignite/schema/model/PojoField.java | 1 +
.../parser/dialect/OracleMetadataDialect.java | 2 +-
.../org/apache/ignite/spark/IgniteContext.scala | 50 +++-
.../org/apache/ignite/spark/IgniteRddSpec.scala | 18 ++
pom.xml | 12 +-
23 files changed, 836 insertions(+), 230 deletions(-)
----------------------------------------------------------------------