You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2015/06/30 16:33:55 UTC
[01/11] incubator-ignite git commit: #ignite-18: Property
segmentationResolveAttempts seems to be ignored.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-1060 d685e82a5 -> 25cef86ab
#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-1060
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();
}
[11/11] incubator-ignite git commit: ignite-1060
Posted by av...@apache.org.
ignite-1060
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/25cef86a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/25cef86a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/25cef86a
Branch: refs/heads/ignite-1060
Commit: 25cef86ab016d8345086f1bd90d6c6b3f6fdc2d8
Parents: 2502b62
Author: avinogradov <av...@gridgain.com>
Authored: Tue Jun 30 17:33:43 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Tue Jun 30 17:33:43 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/spi/deployment/uri/tasks/GarHelloWorldBean.java | 3 +--
.../apache/ignite/spi/deployment/uri/tasks/GarHelloWorldTask.java | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25cef86a/modules/extdata/uri/modules/uri-dependency/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldBean.java
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/modules/uri-dependency/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldBean.java b/modules/extdata/uri/modules/uri-dependency/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldBean.java
index bf329be..e62d49f 100644
--- a/modules/extdata/uri/modules/uri-dependency/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldBean.java
+++ b/modules/extdata/uri/modules/uri-dependency/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldBean.java
@@ -36,8 +36,7 @@ public class GarHelloWorldBean {
* @param key Message key.
* @return Keyed message.
*/
- @Nullable
- public String getMessage(String key) {
+ @Nullable public String getMessage(String key) {
InputStream in = null;
try {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/25cef86a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldTask.java
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldTask.java b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldTask.java
index 13b2641..7e46781 100644
--- a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldTask.java
+++ b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldTask.java
@@ -61,8 +61,7 @@ public class GarHelloWorldTask extends ComputeTaskSplitAdapter<String, String> {
/*
* Simply prints the job's argument.
*/
- @Nullable
- @Override public Serializable execute() {
+ @Nullable @Override public Serializable execute() {
System.out.println(">>>");
System.out.println(">>> Printing '" + argument(0) + "' on this node from grid job.");
System.out.println(">>>");
[07/11] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-sprint-7' into ignite-sprint-7
Posted by av...@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-1060
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/11] incubator-ignite git commit: # sprint-7 Minor fixes in
javadocs.
Posted by av...@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-1060
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 {
[10/11] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-sprint-7' into ignite-1060
Posted by av...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-sprint-7' into ignite-1060
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2502b621
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2502b621
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2502b621
Branch: refs/heads/ignite-1060
Commit: 2502b6212b59832a03882adc554e655b51725230
Parents: d685e82 6ebcb6d
Author: avinogradov <av...@gridgain.com>
Authored: Tue Jun 30 16:54:23 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Tue Jun 30 16:54:23 2015 +0300
----------------------------------------------------------------------
.../discovery/GridDiscoveryManager.java | 32 +-
.../cache/GridCacheDeploymentManager.java | 10 +-
.../shmem/IpcSharedMemoryServerEndpoint.java | 10 +-
.../core/src/test/config/spark/spark-config.xml | 46 +++
.../IgniteTopologyPrintFormatSelfTest.java | 289 +++++++++++++++++++
.../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 ++
11 files changed, 443 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
[06/11] incubator-ignite git commit: sprint-7 - Merge branch
ignite-1061 into ignite-sprint-7
Posted by av...@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-1060
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(-)
----------------------------------------------------------------------
[03/11] incubator-ignite git commit: # fixed delays on node stop
Posted by av...@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-1060
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();
[02/11] incubator-ignite git commit: # suppress undeployed message if
nothing has
Posted by av...@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-1060
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, "");
}
[08/11] incubator-ignite git commit: IGNITE-1062 Split in topology
snapshot server and client nodes.
Posted by av...@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-1060
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);
[09/11] incubator-ignite git commit: IGNITE-1062 Added tests.
Posted by av...@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-1060
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.
[05/11] incubator-ignite git commit: IGNITE-1061 - Fixed as discussed.
Posted by av...@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-1060
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() = {