You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/08/25 09:14:03 UTC
[03/18] ignite git commit: ignite-1205 - Disabled disco data exchange
for daemon nodes. Closes #17.
ignite-1205 - Disabled disco data exchange for daemon nodes. Closes #17.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2ce02098
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2ce02098
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2ce02098
Branch: refs/heads/ignite-1288
Commit: 2ce02098150dfd66dc7442c60adcf89096c1a270
Parents: 321b78a
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Mon Aug 24 17:33:23 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Mon Aug 24 17:33:23 2015 -0700
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 63 ++++----------------
.../visor/cache/VisorCacheClearTask.java | 11 ++--
.../spi/discovery/tcp/TcpDiscoverySpi.java | 9 ++-
.../GridCacheDaemonNodeAbstractSelfTest.java | 9 +--
.../local/GridCacheDaemonNodeLocalSelfTest.java | 30 ----------
.../tcp/TcpDiscoverySpiStartStopSelfTest.java | 2 +-
6 files changed, 27 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ce02098/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 a7d6bf6..287b3c7 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
@@ -536,15 +536,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@SuppressWarnings( {"unchecked"})
@Override public void start() throws IgniteCheckedException {
- 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();
if (!F.isEmpty(ctx.config().getCacheConfiguration())) {
@@ -574,6 +565,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
!ctx.config().getTransactionConfiguration().isTxSerializableEnabled());
for (int i = 0; i < cfgs.length; i++) {
+ if (ctx.config().isDaemon() && !CU.isMarshallerCache(cfgs[i].getName()))
+ continue;
+
checkSerializable(cfgs[i]);
CacheConfiguration<?, ?> cfg = new CacheConfiguration(cfgs[i]);
@@ -691,49 +685,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
@SuppressWarnings("unchecked")
@Override public void onKernalStart() throws IgniteCheckedException {
try {
- if (ctx.config().isDaemon()) {
- for (CacheConfiguration ccfg : ctx.config().getCacheConfiguration()) {
- if (CU.isMarshallerCache(ccfg.getName())) {
- CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
-
- initialize(internalCachesNames().contains(maskNull(ccfg.getName())), 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(false);
-
- for (GridCacheAdapter<?, ?> cache : caches.values())
- onKernalStart(cache);
-
- return;
- }
-
ClusterNode locNode = ctx.discovery().localNode();
- if (!getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK)) {
+ if (!ctx.config().isDaemon() && !getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK)) {
for (ClusterNode n : ctx.discovery().remoteNodes()) {
if (n.attribute(ATTR_CONSISTENCY_CHECK_SKIPPED))
continue;
@@ -765,6 +719,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
// Start dynamic caches received from collect discovery data.
for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+ if (ctx.config().isDaemon() && !CU.isMarshallerCache(desc.cacheConfiguration().getName()))
+ continue;
+
boolean started = desc.onStart();
assert started : "Failed to change started flag for locally configured cache: " + desc;
@@ -805,7 +762,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cacheStartedLatch.countDown();
}
- ctx.marshallerContext().onMarshallerCacheStarted(ctx);
+ if (!ctx.config().isDaemon())
+ ctx.marshallerContext().onMarshallerCacheStarted(ctx);
marshallerCache().context().preloader().syncFuture().listen(new CIX1<IgniteInternalFuture<?>>() {
@Override public void applyx(IgniteInternalFuture<?> f) throws IgniteCheckedException {
@@ -863,7 +821,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
assert caches.containsKey(CU.MARSH_CACHE_NAME) : "Marshaller cache should be started";
- assert caches.containsKey(CU.UTILITY_CACHE_NAME) : "Utility cache should be started";
+ assert ctx.config().isDaemon() || caches.containsKey(CU.UTILITY_CACHE_NAME) : "Utility cache should be started";
}
/** {@inheritDoc} */
@@ -3429,4 +3387,3 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
}
}
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ce02098/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
index 4b588b6..2ba489d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheClearTask.java
@@ -47,17 +47,17 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
private static final long serialVersionUID = 0L;
/** */
- @JobContextResource
- private ComputeJobContext jobCtx;
+ private final String cacheName;
/** */
private final IgniteInClosure<IgniteFuture<Integer>> lsnr;
/** */
- private final IgniteFuture<Integer>[] futs = new IgniteFuture[3];
+ private IgniteFuture<Integer>[] futs;
/** */
- private final String cacheName;
+ @JobContextResource
+ private ComputeJobContext jobCtx;
/**
* Create job.
@@ -110,6 +110,9 @@ public class VisorCacheClearTask extends VisorOneNodeTask<String, IgniteBiTuple<
/** {@inheritDoc} */
@Override protected IgniteBiTuple<Integer, Integer> run(final String cacheName) {
+ if (futs == null)
+ futs = new IgniteFuture[3];
+
if (futs[0] == null || futs[1] == null || futs[2] == null) {
IgniteCache cache = ignite.cache(cacheName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ce02098/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index d6a4081..e683dad 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1602,10 +1602,12 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
* @return Marshalled exchange data.
*/
protected Map<Integer, byte[]> collectExchangeData(UUID nodeId) {
+ if (locNode.isDaemon())
+ return Collections.emptyMap();
+
Map<Integer, Serializable> data = exchange.collect(nodeId);
- if (data == null)
- return null;
+ assert data != null;
Map<Integer, byte[]> data0 = U.newHashMap(data.size());
@@ -1635,6 +1637,9 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
Map<Integer, byte[]> data,
ClassLoader clsLdr)
{
+ if (locNode.isDaemon())
+ return;
+
Map<Integer, Serializable> data0 = U.newHashMap(data.size());
for (Map.Entry<Integer, byte[]> entry : data.entrySet()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ce02098/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java
index ebac314..4badba9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java
@@ -169,16 +169,11 @@ public abstract class GridCacheDaemonNodeAbstractSelfTest extends GridCommonAbst
Ignite g2 = startGrid(4);
for (long i = 0; i < Integer.MAX_VALUE; i = (i << 1) + 1) {
- ClusterNode n;
-
// Call mapKeyToNode for normal node.
- assertNotNull(n = g1.cluster().mapKeyToNode(null, i));
+ assertNotNull(g1.cluster().mapKeyToNode(null, i));
// Call mapKeyToNode for daemon node.
- if (cacheMode() == PARTITIONED)
- assertEquals(n, g2.cluster().mapKeyToNode(null, i));
- else
- assertNotNull(g2.cluster().mapKeyToNode(null, i));
+ assertNull(g2.cluster().mapKeyToNode(null, i));
}
}
finally {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ce02098/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheDaemonNodeLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheDaemonNodeLocalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheDaemonNodeLocalSelfTest.java
index 346dccd..752e8df 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheDaemonNodeLocalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheDaemonNodeLocalSelfTest.java
@@ -31,34 +31,4 @@ public class GridCacheDaemonNodeLocalSelfTest extends GridCacheDaemonNodeAbstrac
@Override protected CacheMode cacheMode() {
return LOCAL;
}
-
- /** {@inheritDoc} */
- @Override public void testMapKeyToNode() throws Exception {
- try {
- // Start normal nodes.
- Ignite g1 = startGridsMultiThreaded(3);
-
- // Start daemon node.
- daemon = true;
-
- Ignite g2 = startGrid(4);
-
- for (long i = 0; i < Integer.MAX_VALUE; i = (i << 1) + 1) {
- // Call mapKeyToNode for normal node.
- g1.cluster().mapKeyToNode(null, i);
-
- try {
- g2.cluster().mapKeyToNode(null, i);
-
- assert false;
- }
- catch (IgniteException e) {
- info("Caught expected exception: " + e);
- }
- }
- }
- finally {
- stopAllGrids();
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2ce02098/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiStartStopSelfTest.java
index 1ce0bcd..f309bdb 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiStartStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiStartStopSelfTest.java
@@ -46,7 +46,7 @@ public class TcpDiscoverySpiStartStopSelfTest extends GridSpiStartStopAbstractTe
public DiscoverySpiDataExchange getDataExchange() {
return new DiscoverySpiDataExchange() {
@Override public Map<Integer, Serializable> collect(UUID nodeId) {
- return null;
+ return Collections.emptyMap();
}
@Override public void onExchange(UUID joiningNodeId, UUID nodeId, Map<Integer, Serializable> data) {