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 2017/07/07 09:37:02 UTC
[01/50] [abbrv] ignite git commit: IGNITE-4536 two tests unmuted,
one test removed as obsolete (IGNITE-5592) - Fixes #2235.
Repository: ignite
Updated Branches:
refs/heads/master 651ffc544 -> d1d680237
IGNITE-4536 two tests unmuted, one test removed as obsolete (IGNITE-5592) - Fixes #2235.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/90b67fa1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/90b67fa1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/90b67fa1
Branch: refs/heads/master
Commit: 90b67fa1b72b096943499e26e402988840bdbe97
Parents: 44f3fac
Author: Sergey Chugunov <se...@gmail.com>
Authored: Tue Jul 4 20:47:09 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Jul 4 20:47:09 2017 +0300
----------------------------------------------------------------------
.../cache/GridCacheAbstractMetricsSelfTest.java | 24 --------------------
1 file changed, 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/90b67fa1/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
index 2e81b96..6aed380 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.cache;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
@@ -581,8 +580,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testMisses() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-4536");
-
IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
int keyCnt = keyCount();
@@ -625,8 +622,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testMissesOnEmptyCache() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-4536");
-
IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
assertEquals("Expected 0 read", 0, cache.localMetrics().getCacheGets());
@@ -678,25 +673,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
/**
* @throws Exception If failed.
*/
- public void testManualEvictions() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-4536");
-
- IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
-
- if (cache.getConfiguration(CacheConfiguration.class).getCacheMode() == CacheMode.PARTITIONED)
- return;
-
- cache.put(1, 1);
-
- cache.localEvict(Collections.singleton(1));
-
- assertEquals(0L, cache.localMetrics().getCacheRemovals());
- assertEquals(1L, cache.localMetrics().getCacheEvictions());
- }
-
- /**
- * @throws Exception If failed.
- */
public void testTxEvictions() throws Exception {
if (grid(0).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getAtomicityMode() != CacheAtomicityMode.ATOMIC)
checkTtl(true);
[38/50] [abbrv] ignite git commit: Fixed "IGNITE-5390 But in
IgniteCacheTxStoreSessionWriteBehindCoalescingTest"
Posted by vo...@apache.org.
Fixed "IGNITE-5390 But in IgniteCacheTxStoreSessionWriteBehindCoalescingTest"
Signed-off-by: nikolay_tikhonov <nt...@gridgain.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d8a50e47
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d8a50e47
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d8a50e47
Branch: refs/heads/master
Commit: d8a50e47a51718c9ef202375b324695b78225813
Parents: 1cf402f
Author: Alexander Belyak <al...@xored.com>
Authored: Thu Jul 6 14:28:22 2017 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Thu Jul 6 14:32:27 2017 +0300
----------------------------------------------------------------------
.../processors/cache/ClusterCachesInfo.java | 4 +
.../processors/cache/GridCacheAttributes.java | 7 ++
.../store/GridCacheStoreManagerAdapter.java | 1 +
.../cache/IgniteCacheAbstractTest.java | 17 ++++
...acheStoreSessionWriteBehindAbstractTest.java | 62 +++++++++-----
...TxStoreSessionWriteBehindCoalescingTest.java | 88 ++++++++++++++++++++
...ClientWriteBehindStoreNonCoalescingTest.java | 30 ++++---
.../testsuites/IgniteCacheTestSuite4.java | 2 +
8 files changed, 180 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d8a50e47/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index 5452bd2..5aca8c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -263,6 +263,10 @@ class ClusterCachesInfo {
"Write behind batch size", locAttr.writeBehindBatchSize(), rmtAttr.writeBehindBatchSize(),
false);
+ CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "writeBehindCoalescing",
+ "Write behind coalescing", locAttr.writeBehindCoalescing(), rmtAttr.writeBehindCoalescing(),
+ false);
+
CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "writeBehindEnabled",
"Write behind enabled", locAttr.writeBehindEnabled(), rmtAttr.writeBehindEnabled(), false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d8a50e47/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
index dca4286..32871ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
@@ -266,6 +266,13 @@ public class GridCacheAttributes implements Serializable {
}
/**
+ * @return Write coalescing flag.
+ */
+ public boolean writeBehindCoalescing() {
+ return ccfg.getWriteBehindCoalescing();
+ }
+
+ /**
* @return Interceptor class name.
*/
public String interceptorClassName() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d8a50e47/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
index 8ff2f5a..c02e2c7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
@@ -185,6 +185,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
store.setFlushThreadCount(cfg.getWriteBehindFlushThreadCount());
store.setFlushFrequency(cfg.getWriteBehindFlushFrequency());
store.setBatchSize(cfg.getWriteBehindBatchSize());
+ store.setWriteCoalescing(cfg.getWriteBehindCoalescing());
return store;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d8a50e47/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
index c5cb715..34a811b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
@@ -144,6 +144,9 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
cfg.setReadThrough(true);
cfg.setWriteThrough(true);
cfg.setLoadPreviousValue(true);
+
+ cfg.setWriteBehindEnabled(writeBehindEnabled());
+ cfg.setWriteBehindCoalescing(writeBehindCoalescing());
}
if (cacheMode() == PARTITIONED)
@@ -162,6 +165,20 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
}
/**
+ * @return write behind enabled flag.
+ */
+ protected boolean writeBehindEnabled() {
+ return false;
+ }
+
+ /**
+ * @return write behind coalescing flag.
+ */
+ protected boolean writeBehindCoalescing() {
+ return true;
+ }
+
+ /**
* @return Cache loader factory.
*/
protected Factory<? extends CacheLoader> loaderFactory() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d8a50e47/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionWriteBehindAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionWriteBehindAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionWriteBehindAbstractTest.java
index dcbb63f..7ad240d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionWriteBehindAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionWriteBehindAbstractTest.java
@@ -49,6 +49,9 @@ public abstract class IgniteCacheStoreSessionWriteBehindAbstractTest extends Ign
private static volatile CountDownLatch latch;
/** */
+ protected static volatile CountDownLatch entLatch;
+
+ /** */
private static volatile ExpectedData expData;
/** {@inheritDoc} */
@@ -66,36 +69,42 @@ public abstract class IgniteCacheStoreSessionWriteBehindAbstractTest extends Ign
return null;
}
- /** {@inheritDoc} */
+ /**
+ * @param igniteInstanceName Ignite instance name.
+ * @return Cache configuration.
+ * @throws Exception In case of error.
+ */
@SuppressWarnings("unchecked")
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+ protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
+ CacheConfiguration ccfg0 = super.cacheConfiguration(igniteInstanceName);
- assert cfg.getCacheConfiguration().length == 1;
-
- CacheConfiguration ccfg0 = cfg.getCacheConfiguration()[0];
ccfg0.setReadThrough(true);
ccfg0.setWriteThrough(true);
ccfg0.setWriteBehindBatchSize(10);
ccfg0.setWriteBehindFlushSize(10);
- ccfg0.setWriteBehindFlushFrequency(60_000);
+ ccfg0.setWriteBehindFlushFrequency(600);
ccfg0.setWriteBehindEnabled(true);
ccfg0.setCacheStoreFactory(singletonFactory(new TestStore()));
- CacheConfiguration ccfg1 = cacheConfiguration(igniteInstanceName);
+ return ccfg0;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
- ccfg1.setReadThrough(true);
- ccfg1.setWriteThrough(true);
- ccfg1.setWriteBehindBatchSize(10);
- ccfg1.setWriteBehindFlushSize(10);
- ccfg1.setWriteBehindFlushFrequency(60_000);
- ccfg1.setWriteBehindEnabled(true);
+ assert cfg.getCacheConfiguration().length == 1;
- ccfg1.setName(CACHE_NAME1);
+ CacheConfiguration ccfg0 = cacheConfiguration(igniteInstanceName);
+
+ ccfg0.setName(DEFAULT_CACHE_NAME);
+
+ CacheConfiguration ccfg1 = cacheConfiguration(igniteInstanceName);
- ccfg1.setCacheStoreFactory(singletonFactory(new TestStore()));
+ ccfg1.setName(CACHE_NAME1);
cfg.setCacheConfiguration(ccfg0, ccfg1);
@@ -120,6 +129,7 @@ public abstract class IgniteCacheStoreSessionWriteBehindAbstractTest extends Ign
try {
latch = new CountDownLatch(2);
+ entLatch = new CountDownLatch(11);
expData = new ExpectedData("writeAll", cacheName);
@@ -127,13 +137,17 @@ public abstract class IgniteCacheStoreSessionWriteBehindAbstractTest extends Ign
cache.put(i, i);
assertTrue(latch.await(10_000, TimeUnit.MILLISECONDS));
+
+ assertTrue(entLatch.await(10_000,TimeUnit.MILLISECONDS));
}
finally {
latch = null;
+ entLatch = null;
}
try {
latch = new CountDownLatch(2);
+ entLatch = new CountDownLatch(11);
expData = new ExpectedData("deleteAll", cacheName);
@@ -141,16 +155,20 @@ public abstract class IgniteCacheStoreSessionWriteBehindAbstractTest extends Ign
cache.remove(i);
assertTrue(latch.await(10_000, TimeUnit.MILLISECONDS));
+
+ assertTrue(entLatch.await(10_000,TimeUnit.MILLISECONDS));
}
finally {
latch = null;
+ entLatch = null;
}
}
/**
*
*/
- private class TestStore implements CacheStore<Object, Object> {
+ protected class TestStore implements CacheStore<Object, Object> {
+
/** Auto-injected store session. */
@CacheStoreSessionResource
private CacheStoreSession ses;
@@ -191,10 +209,13 @@ public abstract class IgniteCacheStoreSessionWriteBehindAbstractTest extends Ign
/** {@inheritDoc} */
@Override public void writeAll(Collection<Cache.Entry<?, ?>> entries) throws CacheWriterException {
log.info("writeAll: " + entries);
-
+
assertTrue("Unexpected entries: " + entries, entries.size() == 10 || entries.size() == 1);
checkSession("writeAll");
+
+ for (int i = 0; i < entries.size(); i++)
+ entLatch.countDown();
}
/** {@inheritDoc} */
@@ -209,6 +230,9 @@ public abstract class IgniteCacheStoreSessionWriteBehindAbstractTest extends Ign
assertTrue("Unexpected keys: " + keys, keys.size() == 10 || keys.size() == 1);
checkSession("deleteAll");
+
+ for (int i = 0; i < keys.size(); i++)
+ entLatch.countDown();
}
/**
@@ -221,7 +245,7 @@ public abstract class IgniteCacheStoreSessionWriteBehindAbstractTest extends Ign
/**
* @param mtd Called stored method.
*/
- private void checkSession(String mtd) {
+ protected void checkSession(String mtd) {
assertNotNull(ignite);
CacheStoreSession ses = session();
http://git-wip-us.apache.org/repos/asf/ignite/blob/d8a50e47/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java
new file mode 100644
index 0000000..58cc380
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionWriteBehindCoalescingTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.integration;
+
+import java.util.Collection;
+import javax.cache.Cache;
+import javax.cache.integration.CacheWriterException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+
+/**
+ * Integration test write behind cache store with {@link CacheConfiguration#getWriteBehindCoalescing()}={@code False}
+ * parameter.
+ */
+public class IgniteCacheTxStoreSessionWriteBehindCoalescingTest extends IgniteCacheStoreSessionWriteBehindAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected CacheAtomicityMode atomicityMode() {
+ return TRANSACTIONAL;
+ }
+
+ /**
+ * @param igniteInstanceName Ignite instance name.
+ * @return Cache configuration.
+ * @throws Exception In case of error.
+ */
+ @SuppressWarnings("unchecked")
+ protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
+ CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
+
+ ccfg.setWriteBehindCoalescing(false);
+
+ ccfg.setCacheStoreFactory(singletonFactory(new TestNonCoalescingStore()));
+
+ return ccfg;
+ }
+
+ /**
+ *
+ */
+ private class TestNonCoalescingStore extends TestStore {
+
+ /** {@inheritDoc} */
+ @Override public void writeAll(Collection<Cache.Entry<?, ?>> entries) throws CacheWriterException {
+ log.info("writeAll: " + entries);
+
+ assertTrue("Unexpected entries: " + entries, entries.size() <= 10);
+
+ checkSession("writeAll");
+
+ for (int i = 0; i < entries.size(); i++)
+ entLatch.countDown();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void delete(Object key) throws CacheWriterException {
+ fail();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void deleteAll(Collection<?> keys) throws CacheWriterException {
+ log.info("deleteAll: " + keys);
+
+ assertTrue("Unexpected keys: " + keys, keys.size() <= 10);
+
+ checkSession("deleteAll");
+
+ for (int i = 0; i < keys.size(); i++)
+ entLatch.countDown();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d8a50e47/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreNonCoalescingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreNonCoalescingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreNonCoalescingTest.java
index 6a75dbd..4ffa973 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreNonCoalescingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreNonCoalescingTest.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
+import java.util.Random;
import java.util.Set;
import javax.cache.Cache;
import javax.cache.configuration.Factory;
@@ -36,6 +37,7 @@ import org.apache.ignite.cache.store.CacheStoreAdapter;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteFuture;
@@ -70,6 +72,14 @@ public class IgnteCacheClientWriteBehindStoreNonCoalescingTest extends IgniteCac
return new TestIncrementStoreFactory();
}
+ /** {@inheritDoc} */
+ @Override protected boolean writeBehindEnabled() { return true;}
+
+ /** {@inheritDoc} */
+ @Override protected boolean writeBehindCoalescing() { return false;}
+
+ private static Random rnd = new Random();
+
/**
* @throws Exception If failed.
*/
@@ -81,35 +91,30 @@ public class IgnteCacheClientWriteBehindStoreNonCoalescingTest extends IgniteCac
assertEquals(cache.getConfiguration(CacheConfiguration.class).getCacheStoreFactory().getClass(),
TestIncrementStoreFactory.class);
- Set<Integer> keys = new HashSet<>();
-
- for (int i = 0; i < 1000; i++) {
- keys.add(i);
-
+ for (int i = 0; i < CacheConfiguration.DFLT_WRITE_BEHIND_FLUSH_SIZE * 2; i++) {
cache.put(i, i);
}
Collection<IgniteFuture<?>> futs = new ArrayList<>();
- for (int i = 0; i < 100; i++)
- futs.add(updateKeys(cache, keys));
+ for (int i = 0; i < 1000; i++)
+ futs.add(updateKey(cache));
for (IgniteFuture<?> fut : futs)
fut.get();
}
/**
- * Update specified keys in async mode.
+ * Update random key in async mode.
*
* @param cache Cache to use.
- * @param keys Keys to update.
* @return IgniteFuture.
*/
- private IgniteFuture<?> updateKeys(IgniteCache<Integer, Integer> cache, Set<Integer> keys) {
+ private IgniteFuture<?> updateKey(IgniteCache<Integer, Integer> cache) {
IgniteCache asyncCache = cache.withAsync();
// Using EntryProcessor.invokeAll to increment every value in place.
- asyncCache.invokeAll(keys, new EntryProcessor<Integer, Integer, Object>() {
+ asyncCache.invoke(rnd.nextInt(100), new EntryProcessor<Integer, Integer, Object>() {
@Override public Object process(MutableEntry<Integer, Integer> entry, Object... arguments)
throws EntryProcessorException {
entry.setValue(entry.getValue() + 1);
@@ -150,7 +155,8 @@ public class IgnteCacheClientWriteBehindStoreNonCoalescingTest extends IgniteCac
@Override public void write(Cache.Entry<? extends Object, ? extends Object> entry) {
Object oldVal = storeMap.put(entry.getKey(), entry.getValue());
- if (oldVal instanceof Integer && entry.getValue() instanceof Integer) {
+
+ if (oldVal != null) {
Integer oldInt = (Integer) oldVal;
Integer newInt = (Integer)entry.getValue();
http://git-wip-us.apache.org/repos/asf/ignite/blob/d8a50e47/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 1b35acb..45f575e 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -134,6 +134,7 @@ import org.apache.ignite.internal.processors.cache.integration.IgniteCacheTxNoLo
import org.apache.ignite.internal.processors.cache.integration.IgniteCacheTxNoReadThroughTest;
import org.apache.ignite.internal.processors.cache.integration.IgniteCacheTxNoWriteThroughTest;
import org.apache.ignite.internal.processors.cache.integration.IgniteCacheTxStoreSessionTest;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheTxStoreSessionWriteBehindCoalescingTest;
import org.apache.ignite.internal.processors.cache.integration.IgniteCacheTxStoreSessionWriteBehindTest;
import org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryLocalAtomicSwapDisabledSelfTest;
import org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryLocalTransactionalSelfTest;
@@ -172,6 +173,7 @@ public class IgniteCacheTestSuite4 extends TestSuite {
suite.addTestSuite(IgniteCacheTxStoreSessionTest.class);
suite.addTestSuite(IgniteCacheAtomicStoreSessionWriteBehindTest.class);
suite.addTestSuite(IgniteCacheTxStoreSessionWriteBehindTest.class);
+ suite.addTestSuite(IgniteCacheTxStoreSessionWriteBehindCoalescingTest.class);
suite.addTestSuite(IgniteCacheAtomicNoReadThroughTest.class);
suite.addTestSuite(IgniteCacheAtomicNearEnabledNoReadThroughTest.class);
[13/50] [abbrv] ignite git commit: Merge branch 'ignite-2.1' into
ignite-2.1.2-merge-ea11
Posted by vo...@apache.org.
Merge branch 'ignite-2.1' into ignite-2.1.2-merge-ea11
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f4ad01b7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f4ad01b7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f4ad01b7
Branch: refs/heads/master
Commit: f4ad01b7a768e0d4603d00509aabdab62525d8c8
Parents: b223076 b67b8c4
Author: Ivan Rakov <iv...@gmail.com>
Authored: Wed Jul 5 12:46:01 2017 +0300
Committer: Ivan Rakov <iv...@gmail.com>
Committed: Wed Jul 5 12:46:01 2017 +0300
----------------------------------------------------------------------
.../PersistentStoreConfiguration.java | 39 +-
.../org/apache/ignite/events/EventType.java | 12 +
.../ignite/events/WalSegmentArchivedEvent.java | 62 +
.../apache/ignite/internal/GridComponent.java | 4 +-
.../ignite/internal/GridPluginComponent.java | 2 +-
.../apache/ignite/internal/IgniteKernal.java | 33 +-
.../internal/jdbc/thin/JdbcThinConnection.java | 7 +-
.../internal/managers/GridManagerAdapter.java | 2 +-
.../internal/managers/discovery/DiscoCache.java | 17 +-
.../discovery/DiscoveryLocalJoinData.java | 104 ++
.../discovery/GridDiscoveryManager.java | 128 +-
.../pagemem/store/IgnitePageStoreManager.java | 3 +-
.../internal/pagemem/wal/record/WALRecord.java | 11 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../cache/CacheAffinitySharedManager.java | 67 +-
.../processors/cache/CacheGroupContext.java | 4 +-
.../processors/cache/CacheGroupData.java | 4 +-
.../cache/ChangeGlobalStateMessage.java | 120 --
.../processors/cache/ClusterCachesInfo.java | 490 +++++--
.../internal/processors/cache/ClusterState.java | 38 -
.../cache/DynamicCacheChangeRequest.java | 52 +-
.../processors/cache/ExchangeActions.java | 37 +-
.../processors/cache/GridCacheEventManager.java | 2 -
.../cache/GridCacheEvictionManager.java | 1 -
.../processors/cache/GridCacheIoManager.java | 13 +-
.../processors/cache/GridCacheMvccManager.java | 9 +-
.../GridCachePartitionExchangeManager.java | 423 +++---
.../processors/cache/GridCacheProcessor.java | 177 ++-
.../cache/GridCacheSharedContext.java | 60 +-
.../cache/GridCacheSharedManager.java | 6 -
.../cache/GridCacheSharedManagerAdapter.java | 16 -
.../processors/cache/PendingDiscoveryEvent.java | 61 +
.../processors/cache/StateChangeRequest.java | 77 ++
.../binary/CacheObjectBinaryProcessorImpl.java | 4 +-
.../distributed/GridCacheTxRecoveryFuture.java | 1 -
.../distributed/dht/GridDhtCacheAdapter.java | 1 -
.../cache/distributed/dht/GridDhtGetFuture.java | 1 -
.../distributed/dht/GridDhtGetSingleFuture.java | 2 -
.../dht/GridDhtPartitionTopologyImpl.java | 13 +-
.../dht/GridDhtTopologyFutureAdapter.java | 2 +-
.../dht/GridPartitionedSingleGetFuture.java | 3 -
.../GridNearAtomicAbstractUpdateFuture.java | 1 -
.../dht/preloader/GridDhtForceKeysFuture.java | 1 -
.../dht/preloader/GridDhtPartitionDemander.java | 2 +
.../GridDhtPartitionsExchangeFuture.java | 228 +++-
.../preloader/GridDhtPartitionsFullMessage.java | 44 +-
.../GridDhtPartitionsSingleMessage.java | 38 +-
.../dht/preloader/GridDhtPreloader.java | 2 +-
.../distributed/near/GridNearGetFuture.java | 2 -
.../near/GridNearTxPrepareRequest.java | 1 -
.../GridCacheDatabaseSharedManager.java | 105 +-
.../persistence/GridCacheOffheapManager.java | 5 +-
.../IgniteCacheDatabaseSharedManager.java | 74 +-
.../persistence/IgniteCacheSnapshotManager.java | 12 +-
.../persistence/file/FilePageStoreManager.java | 14 +-
.../wal/AbstractWalRecordsIterator.java | 289 ++++
.../cache/persistence/wal/FileInput.java | 16 +-
.../cache/persistence/wal/FileWALPointer.java | 4 +-
.../wal/FileWriteAheadLogManager.java | 594 ++++----
.../cache/persistence/wal/RecordSerializer.java | 5 +
.../persistence/wal/SegmentArchiveResult.java | 61 +
.../persistence/wal/SegmentEofException.java | 3 +-
.../wal/reader/IgniteWalIteratorFactory.java | 102 ++
.../wal/reader/StandaloneGridKernalContext.java | 499 +++++++
...ndaloneIgniteCacheDatabaseSharedManager.java | 30 +
.../reader/StandaloneWalRecordsIterator.java | 258 ++++
.../wal/serializer/RecordV1Serializer.java | 45 +-
.../query/GridCacheDistributedQueryManager.java | 4 +-
.../store/GridCacheStoreManagerAdapter.java | 1 -
.../cache/version/GridCacheVersionManager.java | 6 -
.../cacheobject/IgniteCacheObjectProcessor.java | 5 -
.../IgniteCacheObjectProcessorImpl.java | 5 -
.../cluster/ChangeGlobalStateFinishMessage.java | 86 ++
.../cluster/ChangeGlobalStateMessage.java | 140 ++
.../processors/cluster/ClusterProcessor.java | 3 +-
.../cluster/DiscoveryDataClusterState.java | 157 +++
.../cluster/GridClusterStateProcessor.java | 1122 ++++++---------
.../cluster/IgniteChangeGlobalStateSupport.java | 3 +-
.../datastructures/DataStructuresProcessor.java | 6 +-
.../datastructures/GridCacheAtomicLongImpl.java | 2 +-
.../GridCacheAtomicReferenceImpl.java | 2 +-
.../GridCacheAtomicSequenceImpl.java | 2 +-
.../GridCacheAtomicStampedImpl.java | 2 +-
.../GridCacheCountDownLatchImpl.java | 2 +-
.../datastructures/GridCacheLockImpl.java | 4 +-
.../datastructures/GridCacheQueueAdapter.java | 1 -
.../datastructures/GridCacheSemaphoreImpl.java | 2 +-
.../datastructures/GridCacheSetImpl.java | 1 -
.../internal/processors/igfs/IgfsImpl.java | 2 -
.../internal/processors/igfs/IgfsProcessor.java | 2 +-
.../processors/query/GridQueryProcessor.java | 4 +-
.../processors/rest/GridRestProcessor.java | 2 +-
.../cluster/GridChangeStateCommandHandler.java | 2 +-
.../service/GridServiceProcessor.java | 6 +-
.../processors/task/GridTaskProcessor.java | 2 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 12 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 10 +-
.../internal/TestRecordingCommunicationSpi.java | 10 +
...GridManagerLocalMessageListenerSelfTest.java | 4 +-
...unicationBalanceMultipleConnectionsTest.java | 5 +
.../cache/GridCacheAbstractMetricsSelfTest.java | 24 -
.../cache/IgniteActiveClusterTest.java | 182 ---
.../IgniteClusterActivateDeactivateTest.java | 1284 ++++++++++++++++++
...erActivateDeactivateTestWithPersistence.java | 197 +++
.../IgniteDaemonNodeMarshallerCacheTest.java | 10 -
.../IgniteSemaphoreAbstractSelfTest.java | 17 +-
...IgnitePersistentStoreDataStructuresTest.java | 2 +
.../wal/IgniteWalHistoryReservationsTest.java | 2 +-
.../db/wal/reader/IgniteWalReaderTest.java | 385 ++++++
.../db/wal/reader/MockWalIteratorFactory.java | 114 ++
.../pagemem/NoOpPageStoreManager.java | 12 +-
.../persistence/pagemem/NoOpWALManager.java | 23 +-
.../AbstractNodeJoinTemplate.java | 149 +-
.../IgniteChangeGlobalStateAbstractTest.java | 65 +-
.../IgniteChangeGlobalStateCacheTest.java | 2 +-
...IgniteChangeGlobalStateDataStreamerTest.java | 5 +-
...gniteChangeGlobalStateDataStructureTest.java | 6 +-
.../IgniteChangeGlobalStateFailOverTest.java | 26 +-
.../IgniteChangeGlobalStateTest.java | 158 +--
.../IgniteStandByClusterTest.java | 17 +-
.../join/JoinActiveNodeToActiveCluster.java | 62 +-
...ctiveNodeToActiveClusterWithPersistence.java | 17 +
.../IgniteStandByClientReconnectTest.java | 13 +-
...eStandByClientReconnectToNewClusterTest.java | 13 +-
...cpCommunicationSpiMultithreadedSelfTest.java | 2 +-
.../testframework/junits/GridAbstractTest.java | 4 +-
.../junits/common/GridCommonAbstractTest.java | 3 +
.../ignite/testsuites/IgnitePdsTestSuite2.java | 9 +-
.../testsuites/IgniteStandByClusterSuite.java | 5 +-
.../processors/hadoop/HadoopProcessor.java | 4 +-
...ileSystemShmemExternalDualAsyncSelfTest.java | 5 +
.../cache/IgniteCacheAbstractQuerySelfTest.java | 3 +-
.../spark/JavaEmbeddedIgniteRDDSelfTest.java | 5 +
133 files changed, 6410 insertions(+), 2577 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4ad01b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index f4524ef,624dec0..716482e
--- 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
@@@ -2122,12 -2107,9 +2107,12 @@@ public class GridCacheProcessor extend
if (exchActions == null)
return;
- if (exchActions.systemCachesStarting() && exchActions.newClusterState() == null) {
- if (exchActions.systemCachesStarting() && exchActions.stateChangeRequest() == null)
++ if (exchActions.systemCachesStarting() && exchActions.stateChangeRequest() == null) {
ctx.dataStructures().restoreStructuresState(ctx);
+ ctx.service().updateUtilityCache();
+ }
+
if (err == null) {
// Force checkpoint if there is any cache stop request
if (exchActions.cacheStopRequests().size() > 0) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4ad01b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4ad01b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4ad01b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f4ad01b7/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
[08/50] [abbrv] ignite git commit: Reworked cluster
activation/deactivation.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index d57c720..8cea13f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -18,49 +18,34 @@
package org.apache.ignite.internal.processors.cluster;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteCompute;
-import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.cluster.ClusterGroupAdapter;
-import org.apache.ignite.internal.managers.discovery.CustomEventListener;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import org.apache.ignite.internal.managers.discovery.DiscoCache;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
-import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheClientReconnectDiscoveryData;
-import org.apache.ignite.internal.processors.cache.CacheData;
-import org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData;
-import org.apache.ignite.internal.processors.cache.CacheJoinNodeDiscoveryData.CacheInfo;
-import org.apache.ignite.internal.processors.cache.CacheNodeCommonDiscoveryData;
-import org.apache.ignite.internal.processors.cache.ChangeGlobalStateMessage;
-import org.apache.ignite.internal.processors.cache.ClusterState;
-import org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch;
-import org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest;
import org.apache.ignite.internal.processors.cache.ExchangeActions;
import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.GridChangeGlobalStateMessageResponse;
+import org.apache.ignite.internal.processors.cache.StateChangeRequest;
import org.apache.ignite.internal.processors.cache.StoredCacheData;
-import org.apache.ignite.internal.processors.query.QuerySchema;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@ -72,34 +57,27 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteRunnable;
-import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.spi.discovery.DiscoveryDataBag;
-import org.apache.ignite.spi.discovery.DiscoveryDataBag.JoiningNodeDiscoveryData;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
-import static org.apache.ignite.internal.GridComponent.DiscoveryDataExchangeType.CACHE_PROC;
import static org.apache.ignite.internal.GridComponent.DiscoveryDataExchangeType.STATE_PROC;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
-import static org.apache.ignite.internal.processors.cache.ClusterState.ACTIVE;
-import static org.apache.ignite.internal.processors.cache.ClusterState.INACTIVE;
-import static org.apache.ignite.internal.processors.cache.ClusterState.TRANSITION;
-import static org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest.stopRequest;
/**
*
*/
public class GridClusterStateProcessor extends GridProcessorAdapter {
- /** Global status. */
- private volatile ClusterState globalState;
-
- /** Action context. */
- private volatile ChangeGlobalStateContext lastCgsCtx;
+ /** */
+ private volatile DiscoveryDataClusterState globalState;
/** Local action future. */
- private final AtomicReference<GridChangeGlobalStateFuture> cgsLocFut = new AtomicReference<>();
+ private final AtomicReference<GridChangeGlobalStateFuture> stateChangeFut = new AtomicReference<>();
+
+ /** Future initialized if node joins when cluster state change is in progress. */
+ private TransitionOnJoinWaitFuture joinFut;
/** Process. */
@GridToStringExclude
@@ -109,12 +87,6 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
@GridToStringExclude
private GridCacheSharedContext<?, ?> sharedCtx;
- /** */
- private final ConcurrentHashMap<String, CacheInfo> cacheData = new ConcurrentHashMap<>();
-
- /** */
- private volatile CacheJoinNodeDiscoveryData localCacheData;
-
/** Listener. */
private final GridLocalEventListener lsr = new GridLocalEventListener() {
@Override public void onEvent(Event evt) {
@@ -124,14 +96,15 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
assert e.type() == EVT_NODE_LEFT || e.type() == EVT_NODE_FAILED : this;
- final GridChangeGlobalStateFuture f = cgsLocFut.get();
+ final GridChangeGlobalStateFuture f = stateChangeFut.get();
- if (f != null)
+ if (f != null) {
f.initFut.listen(new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> fut) {
- f.onDiscoveryEvent(e);
+ f.onNodeLeft(e);
}
});
+ }
}
};
@@ -142,531 +115,417 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
super(ctx);
}
- /** {@inheritDoc} */
- @Override public void start() throws IgniteCheckedException {
- // Start first node as inactive if persistent enable.
- globalState = ctx.config().isPersistentStoreEnabled() ? INACTIVE :
- ctx.config().isActiveOnStart() ? ACTIVE : INACTIVE;
-
- ctx.discovery().setCustomEventListener(
- ChangeGlobalStateMessage.class, new CustomEventListener<ChangeGlobalStateMessage>() {
- @Override public void onCustomEvent(
- AffinityTopologyVersion topVer, ClusterNode snd, ChangeGlobalStateMessage msg) {
- assert topVer != null;
- assert snd != null;
- assert msg != null;
-
- boolean activate = msg.activate();
-
- ChangeGlobalStateContext actx = lastCgsCtx;
-
- if (actx != null && globalState == TRANSITION) {
- GridChangeGlobalStateFuture f = cgsLocFut.get();
-
- if (log.isDebugEnabled())
- log.debug("Concurrent " + prettyStr(activate) + " [id=" +
- ctx.localNodeId() + " topVer=" + topVer + " actx=" + actx + ", msg=" + msg + "]");
-
- if (f != null && f.requestId.equals(msg.requestId()))
- f.onDone(new IgniteCheckedException(
- "Concurrent change state, now in progress=" + (activate)
- + ", initiatingNodeId=" + actx.initiatingNodeId
- + ", you try=" + (prettyStr(activate)) + ", locNodeId=" + ctx.localNodeId()
- ));
-
- msg.concurrentChangeState();
- }
- else {
- if (log.isInfoEnabled())
- log.info("Create " + prettyStr(activate) + " context [id=" +
- ctx.localNodeId() + " topVer=" + topVer + ", reqId=" +
- msg.requestId() + ", initiatingNodeId=" + msg.initiatorNodeId() + "]");
-
- lastCgsCtx = new ChangeGlobalStateContext(
- msg.requestId(),
- msg.initiatorNodeId(),
- msg.getDynamicCacheChangeBatch(),
- msg.activate());
-
- globalState = TRANSITION;
- }
- }
- });
-
- ctx.event().addLocalEventListener(lsr, EVT_NODE_LEFT, EVT_NODE_FAILED);
- }
-
/**
- * @param data Joining node discovery data.
+ * @return Cluster state to be used on public API.
*/
- public void cacheProcessorStarted(CacheJoinNodeDiscoveryData data) {
- assert data != null;
+ public boolean publicApiActiveState() {
+ DiscoveryDataClusterState globalState = this.globalState;
- localCacheData = data;
+ assert globalState != null;
- cacheProc = ctx.cache();
- sharedCtx = cacheProc.context();
+ if (globalState.transition()) {
+ Boolean transitionRes = globalState.transitionResult();
- sharedCtx.io().addCacheHandler(
- 0, GridChangeGlobalStateMessageResponse.class,
- new CI2<UUID, GridChangeGlobalStateMessageResponse>() {
- @Override public void apply(UUID nodeId, GridChangeGlobalStateMessageResponse msg) {
- processChangeGlobalStateResponse(nodeId, msg);
- }
- });
+ if (transitionRes != null)
+ return transitionRes;
+ else
+ return false;
+ }
+ else
+ return globalState.active();
}
/** {@inheritDoc} */
- @Override public void stop(boolean cancel) throws IgniteCheckedException {
- super.stop(cancel);
-
- sharedCtx.io().removeHandler(false, 0, GridChangeGlobalStateMessageResponse.class);
- ctx.event().removeLocalEventListener(lsr, EVT_NODE_LEFT, EVT_NODE_FAILED);
-
- IgniteCheckedException stopErr = new IgniteInterruptedCheckedException(
- "Node is stopping: " + ctx.igniteInstanceName());
-
- GridChangeGlobalStateFuture f = cgsLocFut.get();
+ @Override public void start() throws IgniteCheckedException {
+ // Start first node as inactive if persistence is enabled.
+ boolean activeOnStart = !ctx.config().isPersistentStoreEnabled() && ctx.config().isActiveOnStart();
- if (f != null)
- f.onDone(stopErr);
+ globalState = DiscoveryDataClusterState.createState(activeOnStart);
- cgsLocFut.set(null);
+ ctx.event().addLocalEventListener(lsr, EVT_NODE_LEFT, EVT_NODE_FAILED);
}
/** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
- super.onKernalStart();
+ @Override public void onKernalStop(boolean cancel) {
+ GridChangeGlobalStateFuture fut = this.stateChangeFut.get();
- if (ctx.isDaemon())
- return;
+ if (fut != null)
+ fut.onDone(new IgniteCheckedException("Failed to wait for cluster state change, node is stopping."));
- List<ClusterNode> nodes = ctx.discovery().serverNodes(AffinityTopologyVersion.NONE);
-
- assert localCacheData != null;
-
- // First node started (coordinator).
- if (nodes.isEmpty() || nodes.get(0).isLocal())
- cacheData.putAll(localCacheData.caches());
-
- if (globalState == INACTIVE) { // Accept inactivate state after join.
- if (log != null && log.isInfoEnabled())
- log.info("Got inactivate state from cluster during node join.");
-
- // Revert start action if get INACTIVE state on join.
- sharedCtx.snapshot().onDeActivate(ctx);
-
- if (sharedCtx.pageStore() != null)
- sharedCtx.pageStore().onDeActivate(ctx);
-
- if (sharedCtx.wal() != null)
- sharedCtx.wal().onDeActivate(ctx);
-
- sharedCtx.database().onDeActivate(ctx);
- }
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public DiscoveryDataExchangeType discoveryDataType() {
- return DiscoveryDataExchangeType.STATE_PROC;
+ super.onKernalStop(cancel);
}
- /** {@inheritDoc} */
- @Override public void collectGridNodeData(DiscoveryDataBag dataBag) {
- if (!dataBag.commonDataCollectedFor(STATE_PROC.ordinal()))
- dataBag.addGridCommonData(STATE_PROC.ordinal(), globalState);
- }
+ /**
+ * @param discoCache Discovery data cache.
+ * @return If transition is in progress returns future which is completed when transition finishes.
+ */
+ @Nullable public IgniteInternalFuture<Boolean> onLocalJoin(DiscoCache discoCache) {
+ if (globalState.transition()) {
+ joinFut = new TransitionOnJoinWaitFuture(globalState, discoCache);
- /** {@inheritDoc} */
- @Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
- ClusterState state = (ClusterState)data.commonData();
+ return joinFut;
+ }
- if (state != null)
- globalState = state;
+ return null;
}
/**
- *
+ * @param node Failed node.
+ * @return Message if cluster state changed.
*/
- public IgniteInternalFuture<?> changeGlobalState(final boolean activate) {
- if (ctx.isDaemon()) {
- GridFutureAdapter<Void> fut = new GridFutureAdapter<>();
+ @Nullable public ChangeGlobalStateFinishMessage onNodeLeft(ClusterNode node) {
+ if (globalState.transition()) {
+ Set<UUID> nodes = globalState.transitionNodes();
- sendCompute(activate, fut);
+ if (nodes.remove(node.id()) && nodes.isEmpty()) {
+ U.warn(log, "Failed to change cluster state, all participating nodes failed. " +
+ "Switching to inactive state.");
- return fut;
- }
+ ChangeGlobalStateFinishMessage msg =
+ new ChangeGlobalStateFinishMessage(globalState.transitionRequestId(), false);
- if (cacheProc.transactions().tx() != null || sharedCtx.lockedTopologyVersion(null) != null)
- throw new IgniteException("Failed to " + prettyStr(activate) + " cluster (must invoke the " +
- "method outside of an active transaction).");
+ onStateFinishMessage(msg);
- if ((globalState == ACTIVE && activate) || (globalState == INACTIVE && !activate))
- return new GridFinishedFuture<>();
+ return msg;
+ }
+ }
- final UUID requestId = UUID.randomUUID();
+ return null;
+ }
- final GridChangeGlobalStateFuture cgsFut = new GridChangeGlobalStateFuture(requestId, activate, ctx);
+ /**
+ * @param msg Message.
+ */
+ public void onStateFinishMessage(ChangeGlobalStateFinishMessage msg) {
+ if (msg.requestId().equals(globalState.transitionRequestId())) {
+ log.info("Received state change finish message: " + msg.clusterActive());
- if (!cgsLocFut.compareAndSet(null, cgsFut)) {
- GridChangeGlobalStateFuture locF = cgsLocFut.get();
+ globalState = DiscoveryDataClusterState.createState(msg.clusterActive());
- if (locF.activate == activate)
- return locF;
+ ctx.cache().onStateChangeFinish(msg);
- return new GridFinishedFuture<>(new IgniteException(
- "Failed to " + prettyStr(activate) + ", because another state change operation is currently " +
- "in progress: " + prettyStr(locF.activate)));
- }
+ TransitionOnJoinWaitFuture joinFut = this.joinFut;
- if (globalState == ACTIVE && !activate && ctx.cache().context().snapshot().snapshotOperationInProgress()){
- return new GridFinishedFuture<>(new IgniteException(
- "Failed to " + prettyStr(activate) + ", because snapshot operation in progress."));
+ if (joinFut != null)
+ joinFut.onDone(false);
}
+ else
+ U.warn(log, "Received state finish message with unexpected ID: " + msg);
+ }
- if (ctx.clientNode())
- sendCompute(activate, cgsFut);
- else {
- try {
- List<DynamicCacheChangeRequest> reqs = new ArrayList<>();
-
- DynamicCacheChangeRequest changeGlobalStateReq = new DynamicCacheChangeRequest(
- requestId, activate ? ACTIVE : INACTIVE, ctx.localNodeId());
-
- reqs.add(changeGlobalStateReq);
-
- List<DynamicCacheChangeRequest> cacheReqs = activate ? startAllCachesRequests() : stopAllCachesRequests();
+ /**
+ * @param topVer Current topology version.
+ * @param msg Message.
+ * @param discoCache Current nodes.
+ * @return {@code True} if need start state change process.
+ */
+ public boolean onStateChangeMessage(AffinityTopologyVersion topVer,
+ ChangeGlobalStateMessage msg,
+ DiscoCache discoCache) {
+ if (globalState.transition()) {
+ if (globalState.active() != msg.activate()) {
+ GridChangeGlobalStateFuture fut = changeStateFuture(msg);
+
+ if (fut != null)
+ fut.onDone(concurrentStateChangeError(msg.activate()));
+ }
+ else {
+ final GridChangeGlobalStateFuture stateFut = changeStateFuture(msg);
- reqs.addAll(cacheReqs);
+ if (stateFut != null) {
+ IgniteInternalFuture<?> exchFut = ctx.cache().context().exchange().affinityReadyFuture(
+ globalState.transitionTopologyVersion());
- printCacheInfo(cacheReqs, activate);
+ if (exchFut == null)
+ exchFut = new GridFinishedFuture<>();
- ChangeGlobalStateMessage changeGlobalStateMsg = new ChangeGlobalStateMessage(
- requestId, ctx.localNodeId(), activate, new DynamicCacheChangeBatch(reqs));
+ exchFut.listen(new CI1<IgniteInternalFuture<?>>() {
+ @Override public void apply(IgniteInternalFuture<?> exchFut) {
+ stateFut.onDone();
+ }
+ });
+ }
+ }
+ }
+ else {
+ if (globalState.active() != msg.activate()) {
+ ExchangeActions exchangeActions;
try {
- ctx.discovery().sendCustomEvent(changeGlobalStateMsg);
-
- if (ctx.isStopping())
- cgsFut.onDone(new IgniteCheckedException("Failed to execute " + prettyStr(activate) + " request, " +
- "node is stopping."));
+ exchangeActions = ctx.cache().onStateChangeRequest(msg, topVer);
}
catch (IgniteCheckedException e) {
- U.error(log, "Failed to create or send global state change request: " + cgsFut, e);
-
- cgsFut.onDone(e);
- }
- }
- catch (IgniteCheckedException e) {
- cgsFut.onDone(e);
- }
- }
+ GridChangeGlobalStateFuture fut = changeStateFuture(msg);
- return cgsFut;
- }
+ if (fut != null)
+ fut.onDone(e);
- /**
- *
- */
- private void sendCompute(boolean activate, final GridFutureAdapter<Void> res) {
- AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
+ return false;
+ }
- IgniteCompute comp = ((ClusterGroupAdapter)ctx.cluster().get().forServers()).compute();
+ Set<UUID> nodeIds = U.newHashSet(discoCache.allNodes().size());
- if (log.isInfoEnabled())
- log.info("Sending " + prettyStr(activate) + " request from node [id=" +
- ctx.localNodeId() + " topVer=" + topVer + " isClient=" + ctx.isDaemon() +
- " isDaemon" + ctx.isDaemon() + "]");
+ for (ClusterNode node : discoCache.allNodes())
+ nodeIds.add(node.id());
- IgniteFuture<Void> fut = comp.runAsync(new ClientChangeGlobalStateComputeRequest(activate));
+ GridChangeGlobalStateFuture fut = changeStateFuture(msg);
- fut.listen(new CI1<IgniteFuture>() {
- @Override public void apply(IgniteFuture fut) {
- try {
- fut.get();
+ if (fut != null)
+ fut.setRemaining(nodeIds, topVer.nextMinorVersion());
- res.onDone();
- }
- catch (Exception e) {
- res.onDone(e);
- }
- }
- });
- }
- /**
- * @param reqs Requests to print.
- * @param active Active flag.
- */
- private void printCacheInfo(List<DynamicCacheChangeRequest> reqs, boolean active) {
- assert reqs != null;
+ log.info("Start state transition: " + msg.activate());
- StringBuilder sb = new StringBuilder();
+ globalState = DiscoveryDataClusterState.createTransitionState(msg.activate(),
+ msg.requestId(),
+ topVer,
+ nodeIds);
- sb.append("[");
+ AffinityTopologyVersion stateChangeTopVer = topVer.nextMinorVersion();
- for (int i = 0; i < reqs.size() - 1; i++)
- sb.append(reqs.get(i).cacheName()).append(", ");
+ StateChangeRequest req = new StateChangeRequest(msg, stateChangeTopVer);
- sb.append(reqs.get(reqs.size() - 1).cacheName());
+ exchangeActions.stateChangeRequest(req);
- sb.append("]");
+ msg.exchangeActions(exchangeActions);
- sb.append(" ").append(reqs.size())
- .append(" caches will be ")
- .append(active ? "started" : "stopped");
+ return true;
+ }
+ else {
+ // State already changed.
+ GridChangeGlobalStateFuture stateFut = changeStateFuture(msg);
- if (log.isInfoEnabled())
- log.info(sb.toString());
- }
+ if (stateFut != null)
+ stateFut.onDone();
+ }
+ }
- /**
- * @param req Cache being started.
- */
- public void onCacheStart(DynamicCacheChangeRequest req) {
- CacheInfo cacheInfo = cacheData.get(req.cacheName());
-
- if (cacheInfo == null)
- cacheData.put(req.cacheName(),
- new CacheInfo(
- new StoredCacheData(req.startCacheConfiguration()),
- req.cacheType(), req.sql(),
- 0L)
- );
+ return false;
}
/**
- * @param req Cache being stopped.
+ * @return Current cluster state, should be called only from discovery thread.
*/
- public void onCacheStop(DynamicCacheChangeRequest req) {
- CacheInfo cacheInfo = cacheData.get(req.cacheName());
-
- if (cacheInfo != null)
- cacheData.remove(req.cacheName());
+ public DiscoveryDataClusterState clusterState() {
+ return globalState;
}
/**
- * @return All caches map.
+ * @param msg State change message.
+ * @return Local future for state change process.
*/
- private Map<String, CacheConfiguration> allCaches() {
- Map<String, CacheConfiguration> cfgs = new HashMap<>();
-
- for (Map.Entry<String, CacheInfo> entry : cacheData.entrySet())
- if (cfgs.get(entry.getKey()) == null)
- cfgs.put(entry.getKey(), entry.getValue().cacheData().config());
-
- return cfgs;
+ @Nullable private GridChangeGlobalStateFuture changeStateFuture(ChangeGlobalStateMessage msg) {
+ return changeStateFuture(msg.initiatorNodeId(), msg.requestId());
}
/**
- * @return Collection of all caches start requests.
- * @throws IgniteCheckedException If failed to create requests.
+ * @param initiatorNode Node initiated state change process.
+ * @param reqId State change request ID.
+ * @return Local future for state change process.
*/
- private List<DynamicCacheChangeRequest> startAllCachesRequests() throws IgniteCheckedException {
- assert !ctx.config().isDaemon();
-
- Collection<CacheConfiguration> cacheCfgs = allCaches().values();
-
- final List<DynamicCacheChangeRequest> reqs = new ArrayList<>();
-
- if (sharedCtx.pageStore() != null && sharedCtx.database().persistenceEnabled()) {
- Map<String, StoredCacheData> ccfgs = sharedCtx.pageStore().readCacheConfigurations();
-
- for (Map.Entry<String, StoredCacheData> entry : ccfgs.entrySet())
- reqs.add(createRequest(entry.getValue().config()));
+ @Nullable private GridChangeGlobalStateFuture changeStateFuture(UUID initiatorNode, UUID reqId) {
+ assert initiatorNode != null;
+ assert reqId != null;
- for (CacheConfiguration cfg : cacheCfgs)
- if (!ccfgs.keySet().contains(cfg.getName()))
- reqs.add(createRequest(cfg));
+ if (initiatorNode.equals(ctx.localNodeId())) {
+ GridChangeGlobalStateFuture fut = stateChangeFut.get();
- return reqs;
+ if (fut != null && fut.requestId.equals(reqId))
+ return fut;
}
- else {
- for (CacheConfiguration cfg : cacheCfgs)
- reqs.add(createRequest(cfg));
- return reqs;
- }
+ return null;
}
/**
- * @return Collection of requests to stop caches.
+ * @param activate New state.
+ * @return State change error.
*/
- private List<DynamicCacheChangeRequest> stopAllCachesRequests() {
- Collection<CacheConfiguration> cacheCfgs = allCaches().values();
-
- List<DynamicCacheChangeRequest> reqs = new ArrayList<>(cacheCfgs.size());
-
- for (CacheConfiguration cfg : cacheCfgs) {
- DynamicCacheChangeRequest req = stopRequest(ctx, cfg.getName(), false, false);
-
- reqs.add(req);
- }
-
- return reqs;
+ private IgniteCheckedException concurrentStateChangeError(boolean activate) {
+ return new IgniteCheckedException("Failed to " + prettyStr(activate) +
+ ", because another state change operation is currently in progress: " + prettyStr(!activate));
}
/**
- * @param cfg Configuration to create request for.
- * @return Dynamic cache change request.
+ *
*/
- private DynamicCacheChangeRequest createRequest(CacheConfiguration cfg) {
- assert cfg != null;
- assert cfg.getName() != null;
-
- String cacheName = cfg.getName();
+ public void cacheProcessorStarted() {
+ cacheProc = ctx.cache();
+ sharedCtx = cacheProc.context();
- DynamicCacheChangeRequest req = new DynamicCacheChangeRequest(
- UUID.randomUUID(), cacheName, ctx.localNodeId());
+ sharedCtx.io().addCacheHandler(
+ 0, GridChangeGlobalStateMessageResponse.class,
+ new CI2<UUID, GridChangeGlobalStateMessageResponse>() {
+ @Override public void apply(UUID nodeId, GridChangeGlobalStateMessageResponse msg) {
+ processChangeGlobalStateResponse(nodeId, msg);
+ }
+ });
+ }
- req.startCacheConfiguration(cfg);
- req.template(cfg.getName().endsWith("*"));
- req.nearCacheConfiguration(cfg.getNearConfiguration());
- req.deploymentId(IgniteUuid.randomUuid());
- req.schema(new QuerySchema(cfg.getQueryEntities()));
- req.cacheType(cacheProc.cacheType(cacheName));
+ /** {@inheritDoc} */
+ @Override public void stop(boolean cancel) throws IgniteCheckedException {
+ super.stop(cancel);
- return req;
- }
+ if (sharedCtx != null)
+ sharedCtx.io().removeHandler(false, 0, GridChangeGlobalStateMessageResponse.class);
- /**
- *
- */
- public boolean active() {
- ChangeGlobalStateContext actx = lastCgsCtx;
+ ctx.event().removeLocalEventListener(lsr, EVT_NODE_LEFT, EVT_NODE_FAILED);
- if (actx != null && !actx.activate && globalState == TRANSITION)
- return true;
+ IgniteCheckedException stopErr = new IgniteCheckedException(
+ "Node is stopping: " + ctx.igniteInstanceName());
- if (actx != null && actx.activate && globalState == TRANSITION)
- return false;
+ GridChangeGlobalStateFuture f = stateChangeFut.get();
- return globalState == ACTIVE;
+ if (f != null)
+ f.onDone(stopErr);
}
- /**
- * @param cacheName Cache name to check.
- * @return Locally configured flag.
- */
- public boolean isLocallyConfigured(String cacheName){
- assert localCacheData != null;
+ /** {@inheritDoc} */
+ @Nullable @Override public DiscoveryDataExchangeType discoveryDataType() {
+ return DiscoveryDataExchangeType.STATE_PROC;
+ }
- return localCacheData.caches().containsKey(cacheName) || localCacheData.templates().containsKey(cacheName);
+ /** {@inheritDoc} */
+ @Override public void collectGridNodeData(DiscoveryDataBag dataBag) {
+ if (!dataBag.commonDataCollectedFor(STATE_PROC.ordinal()))
+ dataBag.addGridCommonData(STATE_PROC.ordinal(), globalState);
}
- /**
- * Invoked if cluster is inactive.
- *
- * @param dataBag Bag to collect data to.
- */
- public void collectGridNodeData0(DiscoveryDataBag dataBag) {
- if (!dataBag.commonDataCollectedFor(CACHE_PROC.ordinal()))
- dataBag.addGridCommonData(CACHE_PROC.ordinal(), cacheData);
+ /** {@inheritDoc} */
+ @Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) {
+ DiscoveryDataClusterState state = (DiscoveryDataClusterState)data.commonData();
+
+ if (state != null)
+ globalState = state;
}
/**
- * @param data Joining node discovery data.
+ * @param activate New cluster state.
+ * @return State change future.
*/
- public void onJoiningNodeDataReceived0(JoiningNodeDiscoveryData data) {
- if (data.hasJoiningNodeData()) {
- if (data.joiningNodeData() instanceof CacheJoinNodeDiscoveryData) {
- CacheJoinNodeDiscoveryData data0 = (CacheJoinNodeDiscoveryData)data.joiningNodeData();
+ public IgniteInternalFuture<?> changeGlobalState(final boolean activate) {
+ if (ctx.isDaemon() || ctx.clientNode()) {
+ GridFutureAdapter<Void> fut = new GridFutureAdapter<>();
- cacheData.putAll(data0.caches());
- }
- else if (data.joiningNodeData() instanceof CacheClientReconnectDiscoveryData) {
- CacheClientReconnectDiscoveryData data0 = (CacheClientReconnectDiscoveryData)data.joiningNodeData();
+ sendCompute(activate, fut);
- // No-op.
- }
+ return fut;
}
- }
- public void onGridDataReceived0(DiscoveryDataBag.GridDiscoveryData data) {
- // Receive data from active cluster.
- if (data.commonData() instanceof CacheNodeCommonDiscoveryData) {
- CacheNodeCommonDiscoveryData data0 = (CacheNodeCommonDiscoveryData)data.commonData();
+ if (cacheProc.transactions().tx() != null || sharedCtx.lockedTopologyVersion(null) != null) {
+ return new GridFinishedFuture<>(new IgniteCheckedException("Failed to " + prettyStr(activate) +
+ " cluster (must invoke the method outside of an active transaction)."));
+ }
- Map<String, CacheData> caches = data0.caches();
+ DiscoveryDataClusterState curState = globalState;
- Map<String, CacheInfo> cacheInfos = new HashMap<>();
+ if (!curState.transition() && curState.active() == activate)
+ return new GridFinishedFuture<>();
- for (Map.Entry<String, CacheData> entry : caches.entrySet()) {
- CacheData val = entry.getValue();
+ GridChangeGlobalStateFuture startedFut = null;
- CacheInfo info = new CacheInfo(
- new StoredCacheData(val.cacheConfiguration()),
- val.cacheType(),
- val.sql(),
- val.flags()
- );
+ GridChangeGlobalStateFuture fut = stateChangeFut.get();
- cacheInfos.put(entry.getKey(), info);
- }
+ while (fut == null) {
+ fut = new GridChangeGlobalStateFuture(UUID.randomUUID(), activate, ctx);
- cacheData.putAll(cacheInfos);
+ if (stateChangeFut.compareAndSet(null, fut)) {
+ startedFut = fut;
- } // Receive data from inactive cluster.
- else if (data.commonData() instanceof Map) {
- Map<String, CacheInfo> data0 = (Map<String, CacheInfo>)data.commonData();
+ break;
+ }
+ else
+ fut = stateChangeFut.get();
+ }
- cacheData.putAll(data0);
+ if (startedFut == null) {
+ if (fut.activate != activate) {
+ return new GridFinishedFuture<>(new IgniteCheckedException("Failed to " + prettyStr(activate) +
+ ", because another state change operation is currently in progress: " + prettyStr(fut.activate)));
+ }
+ else
+ return fut;
}
- cacheData.putAll(localCacheData.caches());
- }
+ List<StoredCacheData> storedCfgs = null;
- /**
- * @param exchActions Requests.
- * @param topVer Exchange topology version.
- */
- public boolean changeGlobalState(
- ExchangeActions exchActions,
- AffinityTopologyVersion topVer
- ) {
- assert exchActions != null;
- assert topVer != null;
+ if (activate && sharedCtx.database().persistenceEnabled()) {
+ try {
+ Map<String, StoredCacheData> cfgs = ctx.cache().context().pageStore().readCacheConfigurations();
+
+ if (!F.isEmpty(cfgs))
+ storedCfgs = new ArrayList<>(cfgs.values());
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to read stored cache configurations: " + e, e);
+
+ startedFut.onDone(e);
- if (exchActions.newClusterState() != null) {
- ChangeGlobalStateContext cgsCtx = lastCgsCtx;
+ return startedFut;
+ }
+ }
- assert cgsCtx != null : topVer;
+ ChangeGlobalStateMessage msg = new ChangeGlobalStateMessage(startedFut.requestId,
+ ctx.localNodeId(),
+ storedCfgs,
+ activate);
- cgsCtx.topologyVersion(topVer);
+ try {
+ ctx.discovery().sendCustomEvent(msg);
- return true;
+ if (ctx.isStopping())
+ startedFut.onDone(new IgniteCheckedException("Failed to execute " + prettyStr(activate) + " request, " +
+ "node is stopping."));
}
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to send global state change request: " + activate, e);
- return false;
+ startedFut.onDone(e);
+ }
+
+ return startedFut;
}
/**
- * Invoke from exchange future.
+ * @param activate New cluster state.
+ * @param resFut State change future.
*/
- public Exception onChangeGlobalState() {
- GridChangeGlobalStateFuture f = cgsLocFut.get();
+ private void sendCompute(boolean activate, final GridFutureAdapter<Void> resFut) {
+ AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
- ChangeGlobalStateContext cgsCtx = lastCgsCtx;
+ IgniteCompute comp = ((ClusterGroupAdapter)ctx.cluster().get().forServers()).compute();
- assert cgsCtx != null;
+ if (log.isInfoEnabled()) {
+ log.info("Sending " + prettyStr(activate) + " request from node [id=" + ctx.localNodeId() +
+ ", topVer=" + topVer +
+ ", client=" + ctx.clientNode() +
+ ", daemon" + ctx.isDaemon() + "]");
+ }
- if (f != null)
- f.setRemaining(cgsCtx.topVer);
+ IgniteFuture<Void> fut = comp.runAsync(new ClientChangeGlobalStateComputeRequest(activate));
- return cgsCtx.activate ? onActivate(cgsCtx) : onDeActivate(cgsCtx);
+ fut.listen(new CI1<IgniteFuture>() {
+ @Override public void apply(IgniteFuture fut) {
+ try {
+ fut.get();
+
+ resFut.onDone();
+ }
+ catch (Exception e) {
+ resFut.onDone(e);
+ }
+ }
+ });
}
/**
- * @param exs Exs.
+ * @param errs Errors.
+ * @param req State change request.
*/
- public void onFullResponseMessage(Map<UUID, Exception> exs) {
- assert !F.isEmpty(exs);
-
- ChangeGlobalStateContext actx = lastCgsCtx;
-
- actx.setFail();
+ public void onStateChangeError(Map<UUID, Exception> errs, StateChangeRequest req) {
+ assert !F.isEmpty(errs);
- // Revert change if activation request fail.
- if (actx.activate) {
+ // Revert caches start if activation request fail.
+ if (req.activate()) {
try {
cacheProc.onKernalStopCaches(true);
@@ -674,22 +533,10 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
sharedCtx.affinity().removeAllCacheInfo();
- ctx.discovery().cleanCachesAndGroups();
-
- if (!ctx.clientNode()) {
- sharedCtx.database().onDeActivate(ctx);
-
- if (sharedCtx.pageStore() != null)
- sharedCtx.pageStore().onDeActivate(ctx);
-
- if (sharedCtx.wal() != null)
- sharedCtx.wal().onDeActivate(ctx);
- }
+ if (!ctx.clientNode())
+ sharedCtx.deactivate();
}
catch (Exception e) {
- for (Map.Entry<UUID, Exception> entry : exs.entrySet())
- e.addSuppressed(entry.getValue());
-
U.error(log, "Failed to revert activation request changes", e);
}
}
@@ -697,110 +544,33 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
//todo https://issues.apache.org/jira/browse/IGNITE-5480
}
- globalState = actx.activate ? INACTIVE : ACTIVE;
-
- GridChangeGlobalStateFuture af = cgsLocFut.get();
+ GridChangeGlobalStateFuture fut = changeStateFuture(req.initiatorNodeId(), req.requestId());
- if (af != null && af.requestId.equals(actx.requestId)) {
+ if (fut != null) {
IgniteCheckedException e = new IgniteCheckedException(
- "Fail " + prettyStr(actx.activate),
+ "Failed to " + prettyStr(req.activate()) + " cluster",
null,
false
);
- for (Map.Entry<UUID, Exception> entry : exs.entrySet())
+ for (Map.Entry<UUID, Exception> entry : errs.entrySet())
e.addSuppressed(entry.getValue());
- af.onDone(e);
- }
- }
-
- /**
- *
- */
- private Exception onActivate(ChangeGlobalStateContext cgsCtx) {
- final boolean client = ctx.clientNode();
-
- if (log.isInfoEnabled())
- log.info("Start activation process [nodeId=" + ctx.localNodeId() + ", client=" + client +
- ", topVer=" + cgsCtx.topVer + "]");
-
- try {
- if (!client)
- sharedCtx.database().lock();
-
- IgnitePageStoreManager pageStore = sharedCtx.pageStore();
-
- if (pageStore != null)
- pageStore.onActivate(ctx);
-
- if (sharedCtx.wal() != null)
- sharedCtx.wal().onActivate(ctx);
-
- sharedCtx.database().onActivate(ctx);
-
- sharedCtx.snapshot().onActivate(ctx);
-
- if (log.isInfoEnabled())
- log.info("Successfully activated persistence managers [nodeId="
- + ctx.localNodeId() + ", client=" + client + ", topVer=" + cgsCtx.topVer + "]");
-
- return null;
- }
- catch (Exception e) {
- U.error(log, "Failed to activate persistence managers [nodeId=" + ctx.localNodeId() + ", client=" + client +
- ", topVer=" + cgsCtx.topVer + "]", e);
-
- if (!client)
- sharedCtx.database().unLock();
-
- return e;
- }
- }
-
- /**
- *
- */
- public Exception onDeActivate(ChangeGlobalStateContext cgsCtx) {
- final boolean client = ctx.clientNode();
-
- if (log.isInfoEnabled())
- log.info("Starting deactivation [id=" + ctx.localNodeId() + ", client=" +
- client + ", topVer=" + cgsCtx.topVer + "]");
-
- try {
- ctx.dataStructures().onDeActivate(ctx);
-
- ctx.service().onDeActivate(ctx);
-
- if (log.isInfoEnabled())
- log.info("Successfully deactivated persistence processors [id=" + ctx.localNodeId() + ", client=" +
- client + ", topVer=" + cgsCtx.topVer + "]");
-
- return null;
- }
- catch (Exception e) {
- U.error(log, "Failed to execute deactivation callback [nodeId=" + ctx.localNodeId() + ", client=" + client +
- ", topVer=" + cgsCtx.topVer + "]", e);
-
- return e;
+ fut.onDone(e);
}
}
/**
- *
+ * @param req State change request.
*/
- private void onFinalActivate(final ChangeGlobalStateContext cgsCtx) {
- IgniteInternalFuture<?> asyncActivateFut = ctx.closure().runLocalSafe(new Runnable() {
+ private void onFinalActivate(final StateChangeRequest req) {
+ ctx.closure().runLocalSafe(new Runnable() {
@Override public void run() {
boolean client = ctx.clientNode();
Exception e = null;
try {
- if (!ctx.config().isDaemon())
- ctx.cacheObjects().onUtilityCacheStarted();
-
ctx.service().onUtilityCacheStarted();
ctx.service().onActivate(ctx);
@@ -809,146 +579,114 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
if (log.isInfoEnabled())
log.info("Successfully performed final activation steps [nodeId="
- + ctx.localNodeId() + ", client=" + client + ", topVer=" + cgsCtx.topVer + "]");
+ + ctx.localNodeId() + ", client=" + client + ", topVer=" + req.topologyVersion() + "]");
}
catch (Exception ex) {
- e = ex;
+ e = new IgniteCheckedException("Failed to perform final activation steps", ex);
U.error(log, "Failed to perform final activation steps [nodeId=" + ctx.localNodeId() +
- ", client=" + client + ", topVer=" + lastCgsCtx.topVer + "]", ex);
+ ", client=" + client + ", topVer=" + req.topologyVersion() + "]", ex);
}
finally {
- globalState = ACTIVE;
-
- sendChangeGlobalStateResponse(cgsCtx.requestId, cgsCtx.initiatingNodeId, e);
+ globalState.setTransitionResult(req.requestId(), true);
- lastCgsCtx = null;
+ sendChangeGlobalStateResponse(req.requestId(), req.initiatorNodeId(), e);
}
}
});
-
- cgsCtx.setAsyncActivateFut(asyncActivateFut);
}
/**
- *
+ * @param req State change request.
*/
- public void onFinalDeActivate(ChangeGlobalStateContext cgsCtx) {
- final boolean client = ctx.clientNode();
-
- if (log.isInfoEnabled())
- log.info("Successfully performed final deactivation steps [nodeId="
- + ctx.localNodeId() + ", client=" + client + ", topVer=" + cgsCtx.topVer + "]");
-
- Exception ex = null;
-
- try {
- sharedCtx.snapshot().onDeActivate(ctx);
+ private void onFinalDeActivate(final StateChangeRequest req) {
+ globalState.setTransitionResult(req.requestId(), false);
- sharedCtx.database().onDeActivate(ctx);
-
- if (sharedCtx.pageStore() != null)
- sharedCtx.pageStore().onDeActivate(ctx);
-
- if (sharedCtx.wal() != null)
- sharedCtx.wal().onDeActivate(ctx);
-
- sharedCtx.affinity().removeAllCacheInfo();
- }
- catch (Exception e) {
- ex = e;
- }
- finally {
- globalState = INACTIVE;
- }
-
- sendChangeGlobalStateResponse(cgsCtx.requestId, cgsCtx.initiatingNodeId, ex);
-
- lastCgsCtx = null;
+ sendChangeGlobalStateResponse(req.requestId(), req.initiatorNodeId(), null);
}
/**
- *
+ * @param req State change request.
*/
- public void onExchangeDone() {
- ChangeGlobalStateContext cgsCtx = lastCgsCtx;
-
- assert cgsCtx != null;
-
- if (!cgsCtx.isFail()) {
- if (cgsCtx.activate)
- onFinalActivate(cgsCtx);
- else
- onFinalDeActivate(cgsCtx);
- }
+ public void onStateChangeExchangeDone(StateChangeRequest req) {
+ if (req.activate())
+ onFinalActivate(req);
else
- lastCgsCtx = null;
+ onFinalDeActivate(req);
}
/**
+ * @param reqId Request ID.
* @param initNodeId Initialize node id.
* @param ex Exception.
*/
- private void sendChangeGlobalStateResponse(UUID requestId, UUID initNodeId, Exception ex) {
- assert requestId != null;
+ private void sendChangeGlobalStateResponse(UUID reqId, UUID initNodeId, Exception ex) {
+ assert reqId != null;
assert initNodeId != null;
- try {
- GridChangeGlobalStateMessageResponse actResp = new GridChangeGlobalStateMessageResponse(requestId, ex);
+ GridChangeGlobalStateMessageResponse res = new GridChangeGlobalStateMessageResponse(reqId, ex);
+ try {
if (log.isDebugEnabled())
log.debug("Sending global state change response [nodeId=" + ctx.localNodeId() +
- ", topVer=" + ctx.discovery().topologyVersionEx() + ", response=" + actResp + "]");
+ ", topVer=" + ctx.discovery().topologyVersionEx() + ", res=" + res + "]");
if (ctx.localNodeId().equals(initNodeId))
- processChangeGlobalStateResponse(ctx.localNodeId(), actResp);
+ processChangeGlobalStateResponse(ctx.localNodeId(), res);
else
- sharedCtx.io().send(initNodeId, actResp, SYSTEM_POOL);
+ sharedCtx.io().send(initNodeId, res, SYSTEM_POOL);
+ }
+ catch (ClusterTopologyCheckedException e) {
+ if (log.isDebugEnabled()) {
+ log.debug("Failed to send change global state response, node left [node=" + initNodeId +
+ ", res=" + res + ']');
+ }
}
catch (IgniteCheckedException e) {
- log.error("Fail send change global state response to " + initNodeId, e);
+ U.error(log, "Failed to send change global state response [node=" + initNodeId + ", res=" + res + ']', e);
}
}
/**
+ * @param nodeId Node ID.
* @param msg Message.
*/
private void processChangeGlobalStateResponse(final UUID nodeId, final GridChangeGlobalStateMessageResponse msg) {
assert nodeId != null;
assert msg != null;
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled()) {
log.debug("Received activation response [requestId=" + msg.getRequestId() +
", nodeId=" + nodeId + "]");
-
- ClusterNode node = ctx.discovery().node(nodeId);
-
- if (node == null) {
- U.warn(log, "Received activation response from unknown node (will ignore) [requestId=" +
- msg.getRequestId() + ']');
-
- return;
}
UUID requestId = msg.getRequestId();
- final GridChangeGlobalStateFuture fut = cgsLocFut.get();
-
- if (fut != null && !fut.isDone() && requestId.equals(fut.requestId)) {
- fut.initFut.listen(new CI1<IgniteInternalFuture<?>>() {
- @Override public void apply(IgniteInternalFuture<?> f) {
- fut.onResponse(nodeId, msg);
- }
- });
+ final GridChangeGlobalStateFuture fut = stateChangeFut.get();
+
+ if (fut != null && requestId.equals(fut.requestId)) {
+ if (fut.initFut.isDone())
+ fut.onResponse(nodeId, msg);
+ else {
+ fut.initFut.listen(new CI1<IgniteInternalFuture<?>>() {
+ @Override public void apply(IgniteInternalFuture<?> f) {
+ // initFut is completed from discovery thread, process response from other thread.
+ ctx.getSystemExecutorService().execute(new Runnable() {
+ @Override public void run() {
+ fut.onResponse(nodeId, msg);
+ }
+ });
+ }
+ });
+ }
}
}
-
-
/**
* @param activate Activate.
+ * @return Activate flag string.
*/
- private String prettyStr(boolean activate) {
+ private static String prettyStr(boolean activate) {
return activate ? "activate" : "deactivate";
}
@@ -993,7 +731,9 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
private final IgniteLogger log;
/**
- *
+ * @param requestId State change request ID.
+ * @param activate New cluster state.
+ * @param ctx Context.
*/
GridChangeGlobalStateFuture(UUID requestId, boolean activate, GridKernalContext ctx) {
this.requestId = requestId;
@@ -1006,7 +746,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
/**
* @param event Event.
*/
- public void onDiscoveryEvent(DiscoveryEvent event) {
+ void onNodeLeft(DiscoveryEvent event) {
assert event != null;
if (isDone())
@@ -1024,29 +764,26 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
}
/**
- *
+ * @param nodesIds Node IDs.
+ * @param topVer Current topology version.
*/
- public void setRemaining(AffinityTopologyVersion topVer) {
- Collection<ClusterNode> nodes = ctx.discovery().nodes(topVer);
-
- List<UUID> ids = new ArrayList<>(nodes.size());
-
- for (ClusterNode n : nodes)
- ids.add(n.id());
-
- if (log.isDebugEnabled())
- log.debug("Setup remaining node [id=" + ctx.localNodeId() + ", client=" +
- ctx.clientNode() + ", topVer=" + ctx.discovery().topologyVersionEx() +
- ", nodes=" + Arrays.toString(ids.toArray()) + "]");
+ void setRemaining(Set<UUID> nodesIds, AffinityTopologyVersion topVer) {
+ if (log.isDebugEnabled()) {
+ log.debug("Setup remaining node [id=" + ctx.localNodeId() +
+ ", client=" + ctx.clientNode() +
+ ", topVer=" + topVer +
+ ", nodes=" + nodesIds + "]");
+ }
synchronized (mux) {
- remaining.addAll(ids);
+ remaining.addAll(nodesIds);
}
initFut.onDone();
}
/**
+ * @param nodeId Sender node ID.
* @param msg Activation message response.
*/
public void onResponse(UUID nodeId, GridChangeGlobalStateMessageResponse msg) {
@@ -1072,7 +809,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
*
*/
private void onAllReceived() {
- Throwable e = new Throwable();
+ IgniteCheckedException e = new IgniteCheckedException();
boolean fail = false;
@@ -1094,9 +831,13 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public boolean onDone(@Nullable Void res, @Nullable Throwable err) {
- ctx.state().cgsLocFut.set(null);
+ if (super.onDone(res, err)) {
+ ctx.state().stateChangeFut.compareAndSet(this, null);
+
+ return true;
+ }
- return super.onDone(res, err);
+ return false;
}
/** {@inheritDoc} */
@@ -1107,110 +848,65 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
/**
*
- *
*/
- private static class ChangeGlobalStateContext {
- /** Request id. */
- private final UUID requestId;
-
- /** Initiating node id. */
- private final UUID initiatingNodeId;
-
- /** Batch requests. */
- private final DynamicCacheChangeBatch batch;
+ private static class ClientChangeGlobalStateComputeRequest implements IgniteRunnable {
+ /** */
+ private static final long serialVersionUID = 0L;
- /** Activate. */
+ /** */
private final boolean activate;
- /** Topology version. */
- private AffinityTopologyVersion topVer;
-
- /** Fail. */
- private boolean fail;
-
- /** Async activate future. */
- private IgniteInternalFuture<?> asyncActivateFut;
+ /** Ignite. */
+ @IgniteInstanceResource
+ private Ignite ignite;
/**
- *
+ * @param activate New cluster state.
*/
- ChangeGlobalStateContext(
- UUID requestId,
- UUID initiatingNodeId,
- DynamicCacheChangeBatch batch,
- boolean activate
- ) {
- this.requestId = requestId;
- this.batch = batch;
+ private ClientChangeGlobalStateComputeRequest(boolean activate) {
this.activate = activate;
- this.initiatingNodeId = initiatingNodeId;
- }
-
- /**
- * @param topVer Topology version.
- */
- public void topologyVersion(AffinityTopologyVersion topVer) {
- this.topVer = topVer;
- }
-
- /**
- *
- */
- private void setFail() {
- fail = true;
- }
-
- /**
- *
- */
- private boolean isFail() {
- return fail;
- }
-
- /**
- *
- */
- public IgniteInternalFuture<?> getAsyncActivateFut() {
- return asyncActivateFut;
- }
-
- /**
- * @param asyncActivateFut Async activate future.
- */
- public void setAsyncActivateFut(IgniteInternalFuture<?> asyncActivateFut) {
- this.asyncActivateFut = asyncActivateFut;
}
/** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(ChangeGlobalStateContext.class, this);
+ @Override public void run() {
+ ignite.active(activate);
}
}
/**
*
*/
- private static class ClientChangeGlobalStateComputeRequest implements IgniteRunnable {
+ class TransitionOnJoinWaitFuture extends GridFutureAdapter<Boolean> {
/** */
- private static final long serialVersionUID = 0L;
-
- /** Activation. */
- private final boolean activation;
+ private DiscoveryDataClusterState transitionState;
- /** Ignite. */
- @IgniteInstanceResource
- private Ignite ignite;
+ /** */
+ private final Set<UUID> transitionNodes;
/**
- *
+ * @param state Current state.
+ * @param discoCache Discovery data cache.
*/
- private ClientChangeGlobalStateComputeRequest(boolean activation) {
- this.activation = activation;
+ TransitionOnJoinWaitFuture(DiscoveryDataClusterState state, DiscoCache discoCache) {
+ assert state.transition() : state;
+
+ transitionNodes = U.newHashSet(state.transitionNodes().size());
+
+ for (UUID nodeId : state.transitionNodes()) {
+ if (discoCache.node(nodeId) != null)
+ transitionNodes.add(nodeId);
+ }
}
/** {@inheritDoc} */
- @Override public void run() {
- ignite.active(activation);
+ @Override public boolean onDone(@Nullable Boolean res, @Nullable Throwable err) {
+ if (super.onDone(res, err)) {
+ joinFut = null;
+
+ return true;
+ }
+
+ return false;
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/IgniteChangeGlobalStateSupport.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/IgniteChangeGlobalStateSupport.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/IgniteChangeGlobalStateSupport.java
index 3dd9911..5d77f57 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/IgniteChangeGlobalStateSupport.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/IgniteChangeGlobalStateSupport.java
@@ -36,7 +36,6 @@ public interface IgniteChangeGlobalStateSupport {
* Called when cluster performing deactivation.
*
* @param kctx Kernal context.
- * @throws IgniteCheckedException If failed.
*/
- public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException;
+ public void onDeActivate(GridKernalContext kctx);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index 52cc9e9..4399fe2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -175,8 +175,8 @@ public final class DataStructuresProcessor extends GridProcessorAdapter implemen
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
- @Override public void onKernalStart() throws IgniteCheckedException {
- if (ctx.config().isDaemon() || !ctx.state().active())
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
+ if (ctx.config().isDaemon() || !active)
return;
onKernalStart0();
@@ -278,7 +278,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter implemen
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext ctx) throws IgniteCheckedException {
+ @Override public void onDeActivate(GridKernalContext ctx) {
if (log.isDebugEnabled())
log.debug("DeActivate data structure processor [nodeId=" + ctx.localNodeId() +
" topVer=" + ctx.discovery().topologyVersionEx() + " ]");
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
index c54f801..0bc0c63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java
@@ -368,7 +368,7 @@ public final class GridCacheAtomicLongImpl implements GridCacheAtomicLongEx, Ign
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void onDeActivate(GridKernalContext kctx) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java
index 64b68e3..42f16f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java
@@ -299,7 +299,7 @@ public final class GridCacheAtomicReferenceImpl<T> implements GridCacheAtomicRef
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void onDeActivate(GridKernalContext kctx) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
index 47fa49e..019de3c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java
@@ -451,7 +451,7 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc
/** {@inheritDoc} */
@Override public void onDeActivate(GridKernalContext kctx) {
-
+ // No-op.
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
index ac171a6..ed7a225 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java
@@ -343,7 +343,7 @@ public final class GridCacheAtomicStampedImpl<T, S> implements GridCacheAtomicSt
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void onDeActivate(GridKernalContext kctx) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java
index 585cb20..7f331c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java
@@ -340,7 +340,7 @@ public final class GridCacheCountDownLatchImpl implements GridCacheCountDownLatc
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void onDeActivate(GridKernalContext kctx) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheLockImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheLockImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheLockImpl.java
index 8d3a770..b798670 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheLockImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheLockImpl.java
@@ -1477,8 +1477,8 @@ public final class GridCacheLockImpl implements GridCacheLockEx, IgniteChangeGlo
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
-
+ @Override public void onDeActivate(GridKernalContext kctx) {
+ // No-op.
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java
index 2f6abb6..c567ac4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java
@@ -37,7 +37,6 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteQueue;
-import org.apache.ignite.cache.affinity.AffinityKeyMapped;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSemaphoreImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSemaphoreImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSemaphoreImpl.java
index c76aec4..4abefc9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSemaphoreImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSemaphoreImpl.java
@@ -968,7 +968,7 @@ public final class GridCacheSemaphoreImpl implements GridCacheSemaphoreEx, Ignit
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void onDeActivate(GridKernalContext kctx) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
index e336474..c27770f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java
@@ -35,7 +35,6 @@ import org.apache.ignite.IgniteCompute;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSet;
-import org.apache.ignite.cache.affinity.AffinityKeyMapped;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheIteratorConverter;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 8712756..7eb61d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -101,8 +101,6 @@ import static org.apache.ignite.events.EventType.EVT_IGFS_DIR_DELETED;
import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_DELETED;
import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_OPENED_READ;
import static org.apache.ignite.events.EventType.EVT_IGFS_META_UPDATED;
-import static org.apache.ignite.igfs.IgfsMode.DUAL_ASYNC;
-import static org.apache.ignite.igfs.IgfsMode.DUAL_SYNC;
import static org.apache.ignite.igfs.IgfsMode.PRIMARY;
import static org.apache.ignite.igfs.IgfsMode.PROXY;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
index 3c2f64d..244820f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
@@ -177,7 +177,7 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
if (ctx.config().isDaemon())
return;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/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 23ad63d..ce6c9fe 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
@@ -512,10 +512,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
cacheData.queryEntities(cacheDesc.schema().entities());
- CacheGroupDescriptor grpDesc = ctx.cache().cacheDescriptors().get(cacheData.config().getName()).groupDescriptor();
-
try {
- ctx.cache().context().pageStore().storeCacheData(grpDesc, cacheData);
+ ctx.cache().context().pageStore().storeCacheData(cacheData);
}
catch (IgniteCheckedException e) {
throw new IllegalStateException("Failed to persist cache data: " + cacheData.config().getName(), e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
index 716adf7..f528184 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
@@ -503,7 +503,7 @@ public class GridRestProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
if (isRestEnabled()) {
for (GridRestProtocol proto : protos)
proto.onKernalStart();
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cluster/GridChangeStateCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cluster/GridChangeStateCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cluster/GridChangeStateCommandHandler.java
index 909b524..6236026 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cluster/GridChangeStateCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cluster/GridChangeStateCommandHandler.java
@@ -64,7 +64,7 @@ public class GridChangeStateCommandHandler extends GridRestCommandHandlerAdapter
try {
if (req.command().equals(CLUSTER_CURRENT_STATE)) {
- Boolean currentState = ctx.state().active();
+ Boolean currentState = ctx.state().publicApiActiveState();
res.setResponse(currentState);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 12be63b..2eeee1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -211,8 +211,8 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
- @Override public void onKernalStart() throws IgniteCheckedException {
- if (ctx.isDaemon() || !ctx.state().active())
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
+ if (ctx.isDaemon() || !active)
return;
onKernalStart0();
@@ -363,7 +363,7 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void onDeActivate(GridKernalContext kctx) {
if (log.isDebugEnabled())
log.debug("DeActivate service processor [nodeId=" + ctx.localNodeId() +
" topVer=" + ctx.discovery().topologyVersionEx() + " ]");
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
index 7ac7b64..d0b88d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java
@@ -153,7 +153,7 @@ public class GridTaskProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
tasksMetaCache = ctx.security().enabled() && !ctx.isDaemon() ?
ctx.cache().<GridTaskNameHashKey, String>utilityCache() : null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index d5bacdb..5dbfe6e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -582,7 +582,8 @@ class ClientImpl extends TcpDiscoveryImpl {
* @param addr Address.
* @return Socket, connect response and client acknowledge support flag.
*/
- @Nullable private T3<SocketStream, Integer, Boolean> sendJoinRequest(boolean recon, InetSocketAddress addr) {
+ @Nullable private T3<SocketStream, Integer, Boolean> sendJoinRequest(boolean recon,
+ InetSocketAddress addr) {
assert addr != null;
if (log.isDebugEnabled())
@@ -603,6 +604,8 @@ class ClientImpl extends TcpDiscoveryImpl {
IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi, true);
+ DiscoveryDataPacket discoveryData = null;
+
while (true) {
boolean openSock = false;
@@ -645,9 +648,10 @@ class ClientImpl extends TcpDiscoveryImpl {
marshalCredentials(node);
}
- msg = new TcpDiscoveryJoinRequestMessage(
- node,
- spi.collectExchangeData(new DiscoveryDataPacket(getLocalNodeId())));
+ if (discoveryData == null)
+ discoveryData = spi.collectExchangeData(new DiscoveryDataPacket(getLocalNodeId()));
+
+ msg = new TcpDiscoveryJoinRequestMessage(node, discoveryData);
}
else
msg = new TcpDiscoveryClientReconnectMessage(getLocalNodeId(), rmtNodeId, lastMsgId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 03afff5..c2d9b7e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -846,8 +846,10 @@ class ServerImpl extends TcpDiscoveryImpl {
// Marshal credentials for backward compatibility and security.
marshalCredentials(locNode, locCred);
+ DiscoveryDataPacket discoveryData = spi.collectExchangeData(new DiscoveryDataPacket(getLocalNodeId()));
+
while (true) {
- if (!sendJoinRequestMessage()) {
+ if (!sendJoinRequestMessage(discoveryData)) {
if (log.isDebugEnabled())
log.debug("Join request message has not been sent (local node is the first in the topology).");
@@ -973,13 +975,13 @@ class ServerImpl extends TcpDiscoveryImpl {
* Address is provided by {@link org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder} and message is
* sent to first node connection succeeded to.
*
+ * @param discoveryData Discovery data.
* @return {@code true} if send succeeded.
* @throws IgniteSpiException If any error occurs.
*/
@SuppressWarnings({"BusyWait"})
- private boolean sendJoinRequestMessage() throws IgniteSpiException {
- TcpDiscoveryAbstractMessage joinReq = new TcpDiscoveryJoinRequestMessage(locNode,
- spi.collectExchangeData(new DiscoveryDataPacket(getLocalNodeId())));
+ private boolean sendJoinRequestMessage(DiscoveryDataPacket discoveryData) throws IgniteSpiException {
+ TcpDiscoveryAbstractMessage joinReq = new TcpDiscoveryJoinRequestMessage(locNode, discoveryData);
// Time when it has been detected, that addresses from IP finder do not respond.
long noResStart = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java b/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
index 98d2553..ab61687 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/TestRecordingCommunicationSpi.java
@@ -179,6 +179,16 @@ public class TestRecordingCommunicationSpi extends TcpCommunicationSpi {
/**
* @throws InterruptedException If interrupted.
*/
+ public void waitForBlocked() throws InterruptedException {
+ synchronized (this) {
+ while (blockedMsgs.isEmpty())
+ wait();
+ }
+ }
+
+ /**
+ * @throws InterruptedException If interrupted.
+ */
public void waitForRecorded() throws InterruptedException {
synchronized (this) {
while (recordedMsgs.isEmpty())
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerLocalMessageListenerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerLocalMessageListenerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerLocalMessageListenerSelfTest.java
index 5e85b62..b88eef9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerLocalMessageListenerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerLocalMessageListenerSelfTest.java
@@ -128,7 +128,7 @@ public class GridManagerLocalMessageListenerSelfTest extends GridCommonAbstractT
mgr.start();
- mgr.onKernalStart();
+ mgr.onKernalStart(true);
assertTrue(mgr.enabled());
}
@@ -143,7 +143,7 @@ public class GridManagerLocalMessageListenerSelfTest extends GridCommonAbstractT
assertTrue(mgr.enabled());
- mgr.onKernalStart();
+ mgr.onKernalStart(true);
mgr.onKernalStop(false);
[33/50] [abbrv] ignite git commit: IGNITE-4901 Decrease logging level
for DataStremer retry
Posted by vo...@apache.org.
IGNITE-4901 Decrease logging level for DataStremer retry
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c3401cbd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c3401cbd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c3401cbd
Branch: refs/heads/master
Commit: c3401cbd009d7b9cfc8aed0cc9c3f34fb5f433db
Parents: 740b0b2
Author: Alexey Kukushkin <Al...@yahoo.com>
Authored: Thu Jul 6 12:44:27 2017 +0300
Committer: Alexey Kukushkin <Al...@yahoo.com>
Committed: Thu Jul 6 12:44:27 2017 +0300
----------------------------------------------------------------------
.../datastreamer/DataStreamProcessor.java | 3 +-
.../datastreamer/DataStreamerImpl.java | 14 ++-
.../datastreamer/DataStreamerImplSelfTest.java | 123 ++++++++++++++++++-
3 files changed, 132 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3401cbd/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
index 789f0d2..84d536f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
@@ -22,6 +22,7 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
@@ -340,7 +341,7 @@ public class DataStreamProcessor<K, V> extends GridProcessorAdapter {
AffinityTopologyVersion topVer = fut.topologyVersion();
if (!allowOverwrite && !topVer.equals(req.topologyVersion())) {
- Exception err = new IgniteCheckedException(
+ Exception err = new ClusterTopologyCheckedException(
"DataStreamer will retry data transfer at stable topology " +
"[reqTop=" + req.topologyVersion() + ", topVer=" + topVer + ", node=remote]");
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3401cbd/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index ae441de..df51fac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -1782,10 +1782,16 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
try {
GridPeerDeployAware jobPda0 = jobPda;
- err = new IgniteCheckedException("DataStreamer request failed [node=" + nodeId + "]",
- (Throwable)U.unmarshal(ctx,
- errBytes,
- U.resolveClassLoader(jobPda0 != null ? jobPda0.classLoader() : null, ctx.config())));
+ final Throwable cause = U.unmarshal(
+ ctx,
+ errBytes,
+ U.resolveClassLoader(jobPda0 != null ? jobPda0.classLoader() : null, ctx.config()));
+
+ final String msg = "DataStreamer request failed [node=" + nodeId + "]";
+
+ err = cause instanceof ClusterTopologyCheckedException ?
+ new ClusterTopologyCheckedException(msg, cause) :
+ new IgniteCheckedException(msg, cause);
}
catch (IgniteCheckedException e) {
f.onDone(null, new IgniteCheckedException("Failed to unmarshal response.", e));
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3401cbd/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
index 6d10312..e72a9b4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.datastreamer;
+import java.io.StringWriter;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.Callable;
@@ -25,17 +26,29 @@ import javax.cache.CacheException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.CacheServerNotFoundException;
+import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.log4j.Appender;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.WriterAppender;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -50,12 +63,18 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
/** Number of keys to load via data streamer. */
private static final int KEYS_COUNT = 1000;
+ /** Next nodes after MAX_CACHE_COUNT start without cache */
+ private static final int MAX_CACHE_COUNT = 4;
+
/** Started grid counter. */
private static int cnt;
/** No nodes filter. */
private static volatile boolean noNodesFilter;
+ /** Indicates whether we need to make the topology stale */
+ private static boolean needStaleTop = false;
+
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
super.afterTest();
@@ -72,8 +91,9 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(discoSpi);
- // Forth node goes without cache.
- if (cnt < 4)
+ cfg.setCommunicationSpi(new StaleTopologyCommunicationSpi());
+
+ if (cnt < MAX_CACHE_COUNT)
cfg.setCacheConfiguration(cacheConfiguration());
cnt++;
@@ -232,6 +252,44 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
}
/**
+ * Cluster topology mismatch shall result in DataStreamer retrying cache update with the latest topology and
+ * no error logged to the console.
+ *
+ * @throws Exception if failed
+ */
+ public void testRetryWhenTopologyMismatch() throws Exception {
+ final int KEY = 1;
+ final String VAL = "1";
+
+ cnt = 0;
+
+ StringWriter logWriter = new StringWriter();
+ Appender logAppender = new WriterAppender(new SimpleLayout(), logWriter);
+
+ Logger.getRootLogger().addAppender(logAppender);
+
+ startGrids(MAX_CACHE_COUNT - 1); // cache-enabled nodes
+
+ try (Ignite ignite = startGrid(MAX_CACHE_COUNT);
+ IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
+
+ needStaleTop = true; // simulate stale topology for the next action
+
+ streamer.addData(KEY, VAL);
+ } finally {
+ needStaleTop = false;
+
+ logWriter.flush();
+
+ Logger.getRootLogger().removeAppender(logAppender);
+
+ logAppender.close();
+ }
+
+ assertFalse(logWriter.toString().contains("DataStreamer will retry data transfer at stable topology"));
+ }
+
+ /**
* Gets cache configuration.
*
* @return Cache configuration.
@@ -248,4 +306,63 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
return cacheCfg;
}
-}
+
+ /**
+ * Simulate stale (not up-to-date) topology
+ */
+ private static class StaleTopologyCommunicationSpi extends TcpCommunicationSpi {
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) {
+ // Send stale topology only in the first request to avoid indefinitely getting failures.
+ if (needStaleTop) {
+ if (msg instanceof GridIoMessage) {
+ GridIoMessage ioMsg = (GridIoMessage)msg;
+
+ Message appMsg = ioMsg.message();
+
+ if (appMsg != null && appMsg instanceof DataStreamerRequest) {
+ DataStreamerRequest req = (DataStreamerRequest)appMsg;
+
+ AffinityTopologyVersion validTop = req.topologyVersion();
+
+ // Simulate situation when a node did not receive the latest "node joined" topology update causing
+ // topology mismatch
+ AffinityTopologyVersion staleTop = new AffinityTopologyVersion(
+ validTop.topologyVersion() - 1,
+ validTop.minorTopologyVersion());
+
+ appMsg = new DataStreamerRequest(
+ req.requestId(),
+ req.responseTopicBytes(),
+ req.cacheName(),
+ req.updaterBytes(),
+ req.entries(),
+ req.ignoreDeploymentOwnership(),
+ req.skipStore(),
+ req.keepBinary(),
+ req.deploymentMode(),
+ req.sampleClassName(),
+ req.userVersion(),
+ req.participants(),
+ req.classLoaderId(),
+ req.forceLocalDeployment(),
+ staleTop);
+
+ msg = new GridIoMessage(
+ GridTestUtils.<Byte>getFieldValue(ioMsg, "plc"),
+ GridTestUtils.getFieldValue(ioMsg, "topic"),
+ GridTestUtils.<Integer>getFieldValue(ioMsg, "topicOrd"),
+ appMsg,
+ GridTestUtils.<Boolean>getFieldValue(ioMsg, "ordered"),
+ ioMsg.timeout(),
+ ioMsg.skipOnTimeout());
+
+ needStaleTop = false;
+ }
+ }
+ }
+
+ super.sendMessage(node, msg, ackC);
+ }
+ }
+}
\ No newline at end of file
[25/50] [abbrv] ignite git commit: IGNITE-5604 - Expand WAL iterator
buffer if record size is greater than current buffer size - Fixes #2244.
Posted by vo...@apache.org.
IGNITE-5604 - Expand WAL iterator buffer if record size is greater than current buffer size - Fixes #2244.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/69357c5d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/69357c5d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/69357c5d
Branch: refs/heads/master
Commit: 69357c5d8be431aa51fc3add9e345807fe984fee
Parents: 905e34d
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Wed Jul 5 19:24:47 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Jul 5 19:24:47 2017 +0300
----------------------------------------------------------------------
.../rendezvous/RendezvousAffinityFunction.java | 4 -
.../wal/AbstractWalRecordsIterator.java | 14 ++-
.../persistence/wal/ByteBufferExpander.java | 47 +++++++++
.../cache/persistence/wal/FileInput.java | 20 +++-
.../wal/FileWriteAheadLogManager.java | 2 +-
.../db/wal/IgniteWalRecoveryTest.java | 100 ++++++++++++++-----
6 files changed, 146 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/69357c5d/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
index 1bd0587..0fb20ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
@@ -17,10 +17,6 @@
package org.apache.ignite.cache.affinity.rendezvous;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
http://git-wip-us.apache.org/repos/asf/ignite/blob/69357c5d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/AbstractWalRecordsIterator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/AbstractWalRecordsIterator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/AbstractWalRecordsIterator.java
index 7dc0a28..f4bace1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/AbstractWalRecordsIterator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/AbstractWalRecordsIterator.java
@@ -22,7 +22,6 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
-import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;
import org.apache.ignite.IgniteCheckedException;
@@ -41,8 +40,8 @@ import org.jetbrains.annotations.Nullable;
* Iterator over WAL segments. This abstract class provides most functionality for reading records in log.
* Subclasses are to override segment switching functionality
*/
-public abstract class AbstractWalRecordsIterator extends GridCloseableIteratorAdapter<IgniteBiTuple<WALPointer, WALRecord>>
- implements WALIterator {
+public abstract class AbstractWalRecordsIterator
+ extends GridCloseableIteratorAdapter<IgniteBiTuple<WALPointer, WALRecord>> implements WALIterator {
/** */
private static final long serialVersionUID = 0L;
@@ -73,7 +72,7 @@ public abstract class AbstractWalRecordsIterator extends GridCloseableIteratorAd
@NotNull private final RecordSerializer serializer;
/** Utility buffer for reading records */
- private final ByteBuffer buf;
+ private final ByteBufferExpander buf;
/**
* @param log Logger
@@ -85,15 +84,14 @@ public abstract class AbstractWalRecordsIterator extends GridCloseableIteratorAd
@NotNull final IgniteLogger log,
@NotNull final GridCacheSharedContext sharedCtx,
@NotNull final RecordSerializer serializer,
- final int bufSize) {
+ final int bufSize
+ ) {
this.log = log;
this.sharedCtx = sharedCtx;
this.serializer = serializer;
// Do not allocate direct buffer for iterator.
- buf = ByteBuffer.allocate(bufSize);
- buf.order(ByteOrder.nativeOrder());
-
+ buf = new ByteBufferExpander(bufSize, ByteOrder.nativeOrder());
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/69357c5d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/ByteBufferExpander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/ByteBufferExpander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/ByteBufferExpander.java
new file mode 100644
index 0000000..75d3a98
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/ByteBufferExpander.java
@@ -0,0 +1,47 @@
+package org.apache.ignite.internal.processors.cache.persistence.wal;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * ByteBuffer wrapper for dynamically expand buffer size.
+ */
+public class ByteBufferExpander {
+ /** Byte buffer */
+ private ByteBuffer buf;
+
+ public ByteBufferExpander(int initSize, ByteOrder order) {
+ ByteBuffer buffer = ByteBuffer.allocate(initSize);
+ buffer.order(order);
+
+ this.buf = buffer;
+ }
+
+ /**
+ * Current byte buffer.
+ *
+ * @return Current byteBuffer.
+ */
+ public ByteBuffer buffer() {
+ return buf;
+ }
+
+ /**
+ * Expands current byte buffer to the requested size.
+ *
+ * @return ByteBuffer with requested size.
+ */
+ public ByteBuffer expand(int size) {
+ ByteBuffer newBuf = ByteBuffer.allocate(size);
+
+ newBuf.order(buf.order());
+
+ newBuf.put(buf);
+
+ newBuf.flip();
+
+ buf = newBuf;
+
+ return newBuf;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/69357c5d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileInput.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileInput.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileInput.java
index e2d7cba..00c7c02 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileInput.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileInput.java
@@ -42,6 +42,9 @@ public final class FileInput implements ByteBufferBackedDataInput {
/** */
private long pos;
+ /** */
+ private ByteBufferExpander expBuf;
+
/**
* @param ch Channel to read from
* @param buf Buffer for reading blocks of data into
@@ -58,6 +61,16 @@ public final class FileInput implements ByteBufferBackedDataInput {
}
/**
+ * @param ch Channel to read from
+ * @param expBuf ByteBufferWrapper with ability expand buffer dynamically.
+ */
+ public FileInput(FileChannel ch, ByteBufferExpander expBuf) throws IOException {
+ this(ch, expBuf.buffer());
+
+ this.expBuf = expBuf;
+ }
+
+ /**
* Clear buffer.
*/
private void clearBuffer() {
@@ -96,8 +109,11 @@ public final class FileInput implements ByteBufferBackedDataInput {
if (available >= requested)
return;
- if (buf.capacity() < requested)
- throw new IOException("Requested size is greater than buffer: " + requested);
+ if (buf.capacity() < requested) {
+ buf = expBuf.expand(requested);
+
+ assert available == buf.remaining();
+ }
buf.compact();
http://git-wip-us.apache.org/repos/asf/ignite/blob/69357c5d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index 8993112..162f43d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -2327,7 +2327,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
super(log,
cctx,
serializer,
- Math.min(16 * tlbSize, psCfg.getWalRecordIteratorBufferSize()));
+ psCfg.getWalRecordIteratorBufferSize());
this.walWorkDir = walWorkDir;
this.walArchiveDir = walArchiveDir;
this.psCfg = psCfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/69357c5d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
index 6b4907c..843fb5b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRecoveryTest.java
@@ -136,6 +136,8 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+ pCfg.setWalRecordIteratorBufferSize(1024 * 1024);
+
if (logOnly)
pCfg.setWalMode(WALMode.LOG_ONLY);
@@ -180,46 +182,79 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
* @throws Exception if failed.
*/
public void testWalBig() throws Exception {
- try {
- IgniteEx ignite = startGrid(1);
+ IgniteEx ignite = startGrid(1);
- ignite.active(true);
+ ignite.active(true);
- IgniteCache<Object, Object> cache = ignite.cache("partitioned");
+ IgniteCache<Object, Object> cache = ignite.cache("partitioned");
- Random rnd = new Random();
+ Random rnd = new Random();
- Map<Integer, IndexedObject> map = new HashMap<>();
+ Map<Integer, IndexedObject> map = new HashMap<>();
- for (int i = 0; i < 10_000; i++) {
- if (i % 1000 == 0)
- X.println(" >> " + i);
+ for (int i = 0; i < 10_000; i++) {
+ if (i % 1000 == 0)
+ X.println(" >> " + i);
- int k = rnd.nextInt(300_000);
- IndexedObject v = new IndexedObject(rnd.nextInt(10_000));
+ int k = rnd.nextInt(300_000);
+ IndexedObject v = new IndexedObject(rnd.nextInt(10_000));
- cache.put(k, v);
- map.put(k, v);
- }
+ cache.put(k, v);
+ map.put(k, v);
+ }
- // Check.
- for (Integer k : map.keySet())
- assertEquals(map.get(k), cache.get(k));
+ // Check.
+ for (Integer k : map.keySet())
+ assertEquals(map.get(k), cache.get(k));
- stopGrid(1);
+ stopGrid(1);
- ignite = startGrid(1);
+ ignite = startGrid(1);
- ignite.active(true);
+ ignite.active(true);
- cache = ignite.cache("partitioned");
+ cache = ignite.cache("partitioned");
- // Check.
- for (Integer k : map.keySet())
- assertEquals(map.get(k), cache.get(k));
+ // Check.
+ for (Integer k : map.keySet())
+ assertEquals(map.get(k), cache.get(k));
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testWalBigObjectNodeCancel() throws Exception {
+ final int MAX_SIZE_POWER = 21;
+
+ IgniteEx ignite = startGrid(1);
+
+ ignite.active(true);
+
+ IgniteCache<Object, Object> cache = ignite.cache("partitioned");
+
+ for (int i = 0; i < MAX_SIZE_POWER; ++i) {
+ int size = 1 << i;
+
+ cache.put("key_" + i, createTestData(size));
}
- finally {
- stopAllGrids();
+
+ stopGrid(1, true);
+
+ ignite = startGrid(1);
+
+ ignite.active(true);
+
+ cache = ignite.cache("partitioned");
+
+ // Check.
+ for (int i = 0; i < MAX_SIZE_POWER; ++i) {
+ int size = 1 << i;
+
+ int[] data = createTestData(size);
+
+ int[] val = (int[])cache.get("key_" + i);
+
+ assertTrue("Invalid data. [key=key_" + i + ']', Arrays.equals(data, val));
}
}
@@ -977,6 +1012,19 @@ public class IgniteWalRecoveryTest extends GridCommonAbstractTest {
}
/**
+ * @param size Size of data.
+ * @return Test data.
+ */
+ private int[] createTestData(int size) {
+ int[] data = new int[size];
+
+ for (int d = 0; d < size; ++d)
+ data[d] = d;
+
+ return data;
+ }
+
+ /**
*
*/
private static class LoadRunnable implements IgniteRunnable {
[39/50] [abbrv] ignite git commit: IGNITE-5502 .NET: Persistent Store
test
Posted by vo...@apache.org.
IGNITE-5502 .NET: Persistent Store test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9675061e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9675061e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9675061e
Branch: refs/heads/master
Commit: 9675061e3f1d190d46f55d1de6ce962b9da7dc8c
Parents: d8a50e4
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Jul 6 14:33:13 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jul 6 14:33:50 2017 +0300
----------------------------------------------------------------------
.../Cache/PersistentStoreTest.cs | 74 ++++++++++++++++++++
1 file changed, 74 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9675061e/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
index adb91ef..96ae47c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
@@ -17,7 +17,9 @@
namespace Apache.Ignite.Core.Tests.Cache
{
+ using System.IO;
using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.PersistentStore;
using NUnit.Framework;
@@ -26,6 +28,78 @@ namespace Apache.Ignite.Core.Tests.Cache
/// </summary>
public class PersistentStoreTest
{
+ /** Temp dir for WAL. */
+ private readonly string _tempDir = IgniteUtils.GetTempDirectoryName();
+
+ /// <summary>
+ /// Tears down the test.
+ /// </summary>
+ [TearDown]
+ public void TearDown()
+ {
+ Ignition.StopAll(true);
+
+ if (Directory.Exists(_tempDir))
+ {
+ Directory.Delete(_tempDir, true);
+ }
+ }
+
+ /// <summary>
+ /// Tests that cache data survives node restart.
+ /// </summary>
+ [Test]
+ public void TestCacheDataSurvivesNodeRestart()
+ {
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ PersistentStoreConfiguration = new PersistentStoreConfiguration
+ {
+ PersistentStorePath = Path.Combine(_tempDir, "Store"),
+ WalStorePath = Path.Combine(_tempDir, "WalStore"),
+ WalArchivePath = Path.Combine(_tempDir, "WalArchive")
+ }
+ };
+
+ const string cacheName = "persistentCache";
+
+ // Start Ignite, put data, stop.
+ using (var ignite = Ignition.Start(cfg))
+ {
+ ignite.SetActive(true);
+
+ var cache = ignite.CreateCache<int, int>(cacheName);
+
+ cache[1] = 1;
+ }
+
+ // Verify directories.
+ Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.PersistentStorePath));
+ Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.WalStorePath));
+ Assert.IsTrue(Directory.Exists(cfg.PersistentStoreConfiguration.WalArchivePath));
+
+ // Start Ignite, verify data survival.
+ using (var ignite = Ignition.Start(cfg))
+ {
+ ignite.SetActive(true);
+
+ var cache = ignite.GetCache<int, int>(cacheName);
+
+ Assert.AreEqual(1, cache[1]);
+ }
+
+ // Delete store directory.
+ Directory.Delete(_tempDir, true);
+
+ // Start Ignite, verify data loss.
+ using (var ignite = Ignition.Start(cfg))
+ {
+ ignite.SetActive(true);
+
+ Assert.IsFalse(ignite.GetCacheNames().Contains(cacheName));
+ }
+ }
+
/// <summary>
/// Tests the grid activation with persistence (inactive by default).
/// </summary>
[03/50] [abbrv] ignite git commit: IGNITE-5693 - Fixed semaphore
flaky test - Fixes #2239.
Posted by vo...@apache.org.
IGNITE-5693 - Fixed semaphore flaky test - Fixes #2239.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5b7165ca
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5b7165ca
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5b7165ca
Branch: refs/heads/master
Commit: 5b7165ca717de038249570c4213f050ba9b5aee7
Parents: 50bb090
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Tue Jul 4 20:57:56 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Jul 4 20:57:56 2017 +0300
----------------------------------------------------------------------
.../IgniteSemaphoreAbstractSelfTest.java | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5b7165ca/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
index d5f4e0e..445d469 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.util.lang.GridAbsPredicateX;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.PA;
import org.apache.ignite.lang.IgniteCallable;
@@ -437,8 +438,7 @@ public abstract class IgniteSemaphoreAbstractSelfTest extends IgniteAtomicsAbstr
* @param semaphoreName Semaphore name.
* @throws Exception If failed.
*/
- private void removeSemaphore(String semaphoreName)
- throws Exception {
+ private void removeSemaphore(final String semaphoreName) throws Exception {
IgniteSemaphore semaphore = grid(RND.nextInt(NODES_CNT)).semaphore(semaphoreName, 10, false, true);
assert semaphore != null;
@@ -454,8 +454,17 @@ public abstract class IgniteSemaphoreAbstractSelfTest extends IgniteAtomicsAbstr
semaphore0.close();
// Ensure semaphore is removed on all nodes.
- for (Ignite g : G.allGrids())
- assertNull(((IgniteKernal)g).context().dataStructures().semaphore(semaphoreName, null, 10, true, false));
+ assert GridTestUtils.waitForCondition(new GridAbsPredicateX() {
+ @Override public boolean applyx() throws IgniteCheckedException {
+ for (Ignite g : G.allGrids()) {
+ if (((IgniteKernal)g).context().dataStructures().semaphore(
+ semaphoreName, null, 10, true, false) != null)
+ return false;
+ }
+
+ return true;
+ }
+ }, 5_000);
checkRemovedSemaphore(semaphore);
}
[28/50] [abbrv] ignite git commit: Fixed missing SUID.
Posted by vo...@apache.org.
Fixed missing SUID.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dd30e584
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dd30e584
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dd30e584
Branch: refs/heads/master
Commit: dd30e584afd841f0fa0923cefbe49bee2fa1ede1
Parents: 09dff9b
Author: devozerov <vo...@gridgain.com>
Authored: Wed Jul 5 22:07:04 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Jul 5 22:07:04 2017 +0300
----------------------------------------------------------------------
.../internal/pagemem/snapshot/SnapshotCheckParameters.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dd30e584/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotCheckParameters.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotCheckParameters.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotCheckParameters.java
index e95e79d..58cb240 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotCheckParameters.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/SnapshotCheckParameters.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.ignite.internal.pagemem.snapshot;
import java.io.File;
@@ -25,6 +26,9 @@ import org.jetbrains.annotations.Nullable;
* Tuple for passing optional parameters of {@link SnapshotOperationType#CHECK}.
*/
public class SnapshotCheckParameters implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
/** Optional paths. */
private final Collection<File> optionalPaths;
[26/50] [abbrv] ignite git commit: Code style
Posted by vo...@apache.org.
Code style
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d82b2b81
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d82b2b81
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d82b2b81
Branch: refs/heads/master
Commit: d82b2b81a487e244584a7101c6d0e3bc0ad38151
Parents: f4ad01b
Author: Ivan Rakov <iv...@gmail.com>
Authored: Wed Jul 5 20:05:52 2017 +0300
Committer: Ivan Rakov <iv...@gmail.com>
Committed: Wed Jul 5 20:05:52 2017 +0300
----------------------------------------------------------------------
.../FinishSnapshotOperationAckDiscoveryMessage.java | 8 +++-----
.../cache/persistence/DbCheckpointListener.java | 14 +++++++++++++-
2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d82b2b81/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/FinishSnapshotOperationAckDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/FinishSnapshotOperationAckDiscoveryMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/FinishSnapshotOperationAckDiscoveryMessage.java
index 83c512a..f6758e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/FinishSnapshotOperationAckDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/snapshot/FinishSnapshotOperationAckDiscoveryMessage.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.pagemem.snapshot;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
@@ -77,10 +78,7 @@ public class FinishSnapshotOperationAckDiscoveryMessage implements DiscoveryCust
/** {@inheritDoc} */
@Override public String toString() {
- return "FinishSnapshotOperationAckDiscoveryMessage{" +
- "id=" + id +
- ", opId=" + opId +
- ", success=" + success +
- '}';
+ return S.toString(FinishSnapshotOperationAckDiscoveryMessage.class, this,
+ "id", id, "opId", opId, "success", success);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d82b2b81/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DbCheckpointListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DbCheckpointListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DbCheckpointListener.java
index daaccff..0b28b6a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DbCheckpointListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DbCheckpointListener.java
@@ -25,16 +25,28 @@ import org.apache.ignite.internal.util.typedef.T2;
*
*/
public interface DbCheckpointListener {
+ /**
+ * Context with information about current snapshots.
+ */
public interface Context {
+ /**
+ *
+ */
public boolean nextSnapshot();
+ /**
+ *
+ */
public Map<T2<Integer, Integer>, T2<Integer, Integer>> partitionStatMap();
+ /**
+ * @param cacheOrGrpName Cache or group name.
+ */
public boolean needToSnapshot(String cacheOrGrpName);
}
/**
* @throws IgniteCheckedException If failed.
*/
- public void onCheckpointBegin(Context context) throws IgniteCheckedException;
+ public void onCheckpointBegin(Context ctx) throws IgniteCheckedException;
}
[42/50] [abbrv] ignite git commit: 2.1 Do print stack traces if tx is
cancelled on node stop
Posted by vo...@apache.org.
2.1 Do print stack traces if tx is cancelled on node stop
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2f1270ee
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2f1270ee
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2f1270ee
Branch: refs/heads/master
Commit: 2f1270ee9b3edf8c50562e33275dfbd3807d608a
Parents: c396b0b
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jul 6 14:53:25 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jul 6 14:53:25 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheEntryEx.java | 14 +----
.../processors/cache/GridCacheMapEntry.java | 54 +++-----------------
.../GridDistributedTxRemoteAdapter.java | 13 ++++-
.../dht/GridDhtTransactionalCacheAdapter.java | 2 +-
.../near/GridNearTxFinishFuture.java | 2 +-
.../cache/transactions/IgniteTxAdapter.java | 28 +++++-----
.../cache/transactions/IgniteTxHandler.java | 2 +-
.../transactions/IgniteTxLocalAdapter.java | 12 ++++-
.../processors/cache/GridCacheTestEntryEx.java | 10 +---
9 files changed, 48 insertions(+), 89 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1270ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index 4e52680..b708b43 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -192,23 +192,11 @@ public interface GridCacheEntryEx {
/**
* Invalidates this entry.
*
- * @param curVer Current version to match ({@code null} means always match).
* @param newVer New version to set.
* @return {@code true} if entry is obsolete.
* @throws IgniteCheckedException If swap could not be released.
*/
- public boolean invalidate(@Nullable GridCacheVersion curVer, GridCacheVersion newVer) throws IgniteCheckedException;
-
- /**
- * Invalidates this entry if it passes given filter.
- *
- * @param filter Optional filter that entry should pass before invalidation.
- * @return {@code true} if entry was actually invalidated.
- * @throws IgniteCheckedException If swap could not be released.
- * @throws GridCacheEntryRemovedException If entry was removed.
- */
- public boolean invalidate(@Nullable CacheEntryPredicate[] filter)
- throws GridCacheEntryRemovedException, IgniteCheckedException;
+ public boolean invalidate(GridCacheVersion newVer) throws IgniteCheckedException;
/**
* @param obsoleteVer Version for eviction.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1270ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index eea8935..14bd1c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2226,20 +2226,18 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/** {@inheritDoc} */
- @Override public synchronized boolean invalidate(@Nullable GridCacheVersion curVer, GridCacheVersion newVer)
+ @Override public synchronized boolean invalidate(GridCacheVersion newVer)
throws IgniteCheckedException {
assert newVer != null;
- if (curVer == null || ver.equals(curVer)) {
- value(null);
+ value(null);
- ver = newVer;
- flags &= ~IS_EVICT_DISABLED;
+ ver = newVer;
+ flags &= ~IS_EVICT_DISABLED;
- removeValue();
+ removeValue();
- onInvalidate();
- }
+ onInvalidate();
return obsoleteVersionExtras() != null;
}
@@ -2251,46 +2249,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
// No-op.
}
- /** {@inheritDoc} */
- @Override public boolean invalidate(@Nullable CacheEntryPredicate[] filter)
- throws GridCacheEntryRemovedException, IgniteCheckedException {
- if (F.isEmptyOrNulls(filter)) {
- synchronized (this) {
- checkObsolete();
-
- invalidate(null, nextVersion());
-
- return true;
- }
- }
- else {
- // For optimistic checking.
- GridCacheVersion startVer;
-
- synchronized (this) {
- checkObsolete();
-
- startVer = ver;
- }
-
- if (!cctx.isAll(this, filter))
- return false;
-
- synchronized (this) {
- checkObsolete();
-
- if (startVer.equals(ver)) {
- invalidate(null, nextVersion());
-
- return true;
- }
- }
-
- // If version has changed then repeat the process.
- return invalidate(filter);
- }
- }
-
/**
* @param val New value.
* @param expireTime Expiration time.
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1270ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index 5e3020d..ea6461d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
@@ -29,6 +29,7 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.NodeStoppingException;
import org.apache.ignite.internal.pagemem.wal.StorageException;
import org.apache.ignite.internal.pagemem.wal.WALPointer;
import org.apache.ignite.internal.pagemem.wal.record.DataEntry;
@@ -61,6 +62,7 @@ import org.apache.ignite.internal.util.lang.GridTuple;
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
@@ -716,14 +718,21 @@ public abstract class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
}
}
catch (Throwable ex) {
+ boolean nodeStopping = X.hasCause(ex, NodeStoppingException.class);
+
// In case of error, we still make the best effort to commit,
// as there is no way to rollback at this point.
err = new IgniteTxHeuristicCheckedException("Commit produced a runtime exception " +
"(all transaction entries will be invalidated): " + CU.txString(this), ex);
- U.error(log, "Commit failed.", err);
+ if (nodeStopping) {
+ U.warn(log, "Failed to commit transaction, node is stopping [tx=" + this +
+ ", err=" + ex + ']');
+ }
+ else
+ U.error(log, "Commit failed.", err);
- uncommit();
+ uncommit(nodeStopping);
state(UNKNOWN);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1270ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index 5d31581..73942ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -1700,7 +1700,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
GridCacheEntryEx nearEntry = near().peekEx(key);
if (nearEntry != null)
- nearEntry.invalidate(null, ver);
+ nearEntry.invalidate(ver);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1270ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index 27cebf8..7f6f793 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -349,7 +349,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCacheCompoundIdentit
GridCacheEntryEx entry = cacheCtx.cache().peekEx(e.key());
if (entry != null)
- entry.invalidate(null, tx.xidVersion());
+ entry.invalidate(tx.xidVersion());
}
}
catch (Throwable t) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1270ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index ee8afb0..51956ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -412,24 +412,28 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement
/**
* Uncommits transaction by invalidating all of its entries. Courtesy to minimize inconsistency.
+ *
+ * @param nodeStopping {@code True} if tx was cancelled during node stop.
*/
@SuppressWarnings({"CatchGenericClass"})
- protected void uncommit() {
+ protected void uncommit(boolean nodeStopping) {
try {
- for (IgniteTxEntry e : writeMap().values()) {
- try {
- GridCacheEntryEx Entry = e.cached();
+ if (!nodeStopping) {
+ for (IgniteTxEntry e : writeMap().values()) {
+ try {
+ GridCacheEntryEx entry = e.cached();
- if (e.op() != NOOP)
- Entry.invalidate(null, xidVer);
- }
- catch (Throwable t) {
- U.error(log, "Failed to invalidate transaction entries while reverting a commit.", t);
+ if (e.op() != NOOP)
+ entry.invalidate(xidVer);
+ }
+ catch (Throwable t) {
+ U.error(log, "Failed to invalidate transaction entries while reverting a commit.", t);
- if (t instanceof Error)
- throw (Error)t;
+ if (t instanceof Error)
+ throw (Error)t;
- break;
+ break;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1270ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index 7efd6ec..c473bfe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -1595,7 +1595,7 @@ public class IgniteTxHandler {
GridCacheEntryEx nearEntry = near.peekEx(key);
if (nearEntry != null)
- nearEntry.invalidate(null, ver);
+ nearEntry.invalidate(ver);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1270ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index e4b850d..49b67da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -32,6 +32,7 @@ import javax.cache.processor.EntryProcessor;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.NodeStoppingException;
import org.apache.ignite.internal.pagemem.wal.StorageException;
import org.apache.ignite.internal.pagemem.wal.WALPointer;
import org.apache.ignite.internal.pagemem.wal.record.DataEntry;
@@ -828,11 +829,18 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
throw ex;
}
else {
+ boolean nodeStopping = X.hasCause(ex, NodeStoppingException.class);
+
IgniteCheckedException err = new IgniteTxHeuristicCheckedException("Failed to locally write to cache " +
"(all transaction entries will be invalidated, however there was a window when " +
"entries for this transaction were visible to others): " + this, ex);
- U.error(log, "Heuristic transaction failure.", err);
+ if (nodeStopping) {
+ U.warn(log, "Failed to commit transaction, node is stopping " +
+ "[tx=" + this + ", err=" + ex + ']');
+ }
+ else
+ U.error(log, "Heuristic transaction failure.", err);
COMMIT_ERR_UPD.compareAndSet(this, null, err);
@@ -840,7 +848,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
try {
// Courtesy to minimize damage.
- uncommit();
+ uncommit(nodeStopping);
}
catch (Throwable ex1) {
U.error(log, "Failed to uncommit transaction: " + this, ex1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f1270ee/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index a6c9cd4..0241165 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -353,7 +353,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
}
/** @inheritDoc */
- @Override public boolean invalidate(@Nullable GridCacheVersion curVer, GridCacheVersion newVer)
+ @Override public boolean invalidate(GridCacheVersion newVer)
throws IgniteCheckedException {
assert false;
@@ -361,14 +361,6 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
}
/** @inheritDoc */
- @Override public boolean invalidate(@Nullable CacheEntryPredicate[] filter)
- throws GridCacheEntryRemovedException, IgniteCheckedException {
- assert false;
-
- return false;
- }
-
- /** @inheritDoc */
@Override public boolean evictInternal(GridCacheVersion obsoleteVer,
@Nullable CacheEntryPredicate[] filter, boolean evictOffheap) {
assert false;
[12/50] [abbrv] ignite git commit: Merge remote-tracking branch
'origin/ignite-2.1' into ignite-2.1
Posted by vo...@apache.org.
Merge remote-tracking branch 'origin/ignite-2.1' into ignite-2.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b67b8c44
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b67b8c44
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b67b8c44
Branch: refs/heads/master
Commit: b67b8c4438f240038b61ca65b947394106b0e43b
Parents: 1337901 44fad24
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 5 11:20:54 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 5 11:20:54 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/jdbc/thin/JdbcThinConnection.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[29/50] [abbrv] ignite git commit: 2.1 Removed extra add in
pendingMsgs
Posted by vo...@apache.org.
2.1 Removed extra add in pendingMsgs
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/907d4a8e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/907d4a8e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/907d4a8e
Branch: refs/heads/master
Commit: 907d4a8e04ee96b78d4e53db69acf13d00798c91
Parents: dd30e58
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jul 6 11:11:38 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jul 6 11:11:38 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/cache/GridCacheIoManager.java | 5 -----
1 file changed, 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/907d4a8e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index f9d1114..1d2be13 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -244,11 +244,6 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
final int stripe = curThread instanceof IgniteThread ? ((IgniteThread)curThread).stripe() : -1;
- synchronized (pendingMsgs) {
- if (pendingMsgs.size() < 100)
- pendingMsgs.add(cacheMsg);
- }
-
fut.listen(new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> t) {
Runnable c = new Runnable() {
[09/50] [abbrv] ignite git commit: Reworked cluster
activation/deactivation.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index a1926ee..cea758a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -36,6 +36,7 @@ import java.util.concurrent.locks.ReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.events.CacheEvent;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
@@ -57,15 +58,14 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache;
import org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
-import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
import org.apache.ignite.internal.processors.cache.CachePartitionExchangeWorkerTask;
-import org.apache.ignite.internal.processors.cache.ClusterState;
import org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.ExchangeActions;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.StateChangeRequest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFutureAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridClientPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
@@ -73,7 +73,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartit
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObjectAdapter;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -214,9 +215,6 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
/** Change global state exceptions. */
private final Map<UUID, Exception> changeGlobalStateExceptions = new ConcurrentHashMap8<>();
- /** This exchange for change global state. */
- private boolean exchangeOnChangeGlobalState;
-
/** */
private ConcurrentMap<UUID, GridDhtPartitionsSingleMessage> msgs = new ConcurrentHashMap8<>();
@@ -463,10 +461,24 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
}
/**
- *
+ * @return {@code True} if cluster state change exchange.
+ */
+ private boolean stateChangeExchange() {
+ return exchActions != null && exchActions.stateChangeRequest() != null;
+ }
+
+ /**
+ * @return {@code True} if activate cluster exchange.
*/
- public ClusterState newClusterState() {
- return exchActions != null ? exchActions.newClusterState() : null;
+ public boolean activateCluster() {
+ return exchActions != null && exchActions.activate();
+ }
+
+ /**
+ * @return {@code True} if deactivate cluster exchange.
+ */
+ boolean deactivateCluster() {
+ return exchActions != null && exchActions.deactivate();
}
/**
@@ -519,6 +531,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
if (isDone())
return;
+ assert !cctx.kernalContext().isDaemon();
+
initTs = U.currentTimeMillis();
U.await(evtLatch);
@@ -557,7 +571,12 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
if (discoEvt.type() == EVT_DISCOVERY_CUSTOM_EVT) {
DiscoveryCustomMessage msg = ((DiscoveryCustomEvent)discoEvt).customMessage();
- if (msg instanceof DynamicCacheChangeBatch) {
+ if (msg instanceof ChangeGlobalStateMessage) {
+ assert exchActions != null && !exchActions.empty();
+
+ exchange = onClusterStateChangeRequest(crdNode);
+ }
+ else if (msg instanceof DynamicCacheChangeBatch) {
assert exchActions != null && !exchActions.empty();
exchange = onCacheChangeRequest(crdNode);
@@ -582,8 +601,26 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
cctx.affinity().initStartedCaches(crdNode, this, receivedCaches);
}
- else
- cctx.cache().startCachesOnLocalJoin(topVer);
+ else {
+ cctx.activate();
+
+ List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> caches =
+ cctx.cache().cachesToStartOnLocalJoin();
+
+ if (cctx.database().persistenceEnabled() &&
+ !cctx.kernalContext().clientNode()) {
+ List<DynamicCacheDescriptor> startDescs = new ArrayList<>();
+
+ if (caches != null) {
+ for (T2<DynamicCacheDescriptor, NearCacheConfiguration> c : caches)
+ startDescs.add(c.get1());
+ }
+
+ cctx.database().readCheckpointAndRestoreMemory(startDescs);
+ }
+
+ cctx.cache().startCachesOnLocalJoin(caches, topVer);
+ }
}
exchange = CU.clientNode(discoEvt.eventNode()) ?
@@ -710,21 +747,94 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
* @return Exchange type.
* @throws IgniteCheckedException If failed.
*/
- private ExchangeType onCacheChangeRequest(boolean crd) throws IgniteCheckedException {
+ private ExchangeType onClusterStateChangeRequest(boolean crd) throws IgniteCheckedException {
assert exchActions != null && !exchActions.empty() : this;
- GridClusterStateProcessor stateProc = cctx.kernalContext().state();
+ StateChangeRequest req = exchActions.stateChangeRequest();
+
+ assert req != null : exchActions;
+
+ if (req.activate()) {
+ if (log.isInfoEnabled()) {
+ log.info("Start activation process [nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]");
+ }
+
+ try {
+ cctx.activate();
+
+ if (cctx.database().persistenceEnabled() && !cctx.kernalContext().clientNode()) {
+ List<DynamicCacheDescriptor> startDescs = new ArrayList<>();
+
+ for (ExchangeActions.ActionData startReq : exchActions.cacheStartRequests())
+ startDescs.add(startReq.descriptor());
+
+ cctx.database().readCheckpointAndRestoreMemory(startDescs);
+ }
+
+ cctx.affinity().onCacheChangeRequest(this, crd, exchActions);
- if (exchangeOnChangeGlobalState = stateProc.changeGlobalState(exchActions, topologyVersion())) {
- changeGlobalStateE = stateProc.onChangeGlobalState();
+ if (log.isInfoEnabled()) {
+ log.info("Successfully activated caches [nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]");
+ }
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to activate node components [nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]", e);
- if (changeGlobalStateE != null) {
- if (crd)
- changeGlobalStateExceptions.put(cctx.localNodeId(), changeGlobalStateE);
+ changeGlobalStateE = e;
- return cctx.kernalContext().clientNode() ? ExchangeType.CLIENT : ExchangeType.ALL;
+ if (crd) {
+ synchronized (this) {
+ changeGlobalStateExceptions.put(cctx.localNodeId(), e);
+ }
+ }
}
}
+ else {
+ if (log.isInfoEnabled()) {
+ log.info("Start deactivation process [nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]");
+ }
+
+ try {
+ cctx.kernalContext().dataStructures().onDeActivate(cctx.kernalContext());
+
+ cctx.kernalContext().service().onDeActivate(cctx.kernalContext());
+
+ cctx.affinity().onCacheChangeRequest(this, crd, exchActions);
+
+ if (log.isInfoEnabled()) {
+ log.info("Successfully deactivated data structures, services and caches [" +
+ "nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]");
+ }
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to deactivate node components [nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]", e);
+
+ changeGlobalStateE = e;
+ }
+ }
+
+ return cctx.kernalContext().clientNode() ? ExchangeType.CLIENT : ExchangeType.ALL;
+ }
+
+ /**
+ * @param crd Coordinator flag.
+ * @return Exchange type.
+ * @throws IgniteCheckedException If failed.
+ */
+ private ExchangeType onCacheChangeRequest(boolean crd) throws IgniteCheckedException {
+ assert exchActions != null && !exchActions.empty() : this;
assert !exchActions.clientOnlyExchange() : exchActions;
@@ -1133,8 +1243,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
if (partHistReserved0 != null)
m.partitionHistoryCounters(partHistReserved0);
- if (exchangeOnChangeGlobalState && changeGlobalStateE != null)
- m.setException(changeGlobalStateE);
+ if (stateChangeExchange() && changeGlobalStateE != null)
+ m.setError(changeGlobalStateE);
if (log.isDebugEnabled())
log.debug("Sending local partitions [nodeId=" + node.id() + ", exchId=" + exchId + ", msg=" + m + ']');
@@ -1160,8 +1270,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
partHistSuppliers,
partsToReload);
- if (exchangeOnChangeGlobalState && !F.isEmpty(changeGlobalStateExceptions))
- m.setExceptionsMap(changeGlobalStateExceptions);
+ if (stateChangeExchange() && !F.isEmpty(changeGlobalStateExceptions))
+ m.setErrorsMap(changeGlobalStateExceptions);
return m;
}
@@ -1175,9 +1285,10 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
assert !nodes.contains(cctx.localNode());
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled()) {
log.debug("Sending full partition map [nodeIds=" + F.viewReadOnly(nodes, F.node2id()) +
", exchId=" + exchId + ", msg=" + m + ']');
+ }
for (ClusterNode node : nodes) {
try {
@@ -1291,8 +1402,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
if (exchActions != null && err == null)
exchActions.completeRequestFutures(cctx);
- if (exchangeOnChangeGlobalState && err == null)
- cctx.kernalContext().state().onExchangeDone();
+ if (stateChangeExchange() && err == null)
+ cctx.kernalContext().state().onStateChangeExchangeDone(exchActions.stateChangeRequest());
Map<T2<Integer, Integer>, Long> localReserved = partHistSuppliers.getReservations(cctx.localNodeId());
@@ -1368,6 +1479,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
crd = null;
partReleaseFut = null;
changeGlobalStateE = null;
+ exchActions = null;
}
/**
@@ -1444,8 +1556,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
pendingSingleUpdates++;
- if (exchangeOnChangeGlobalState && msg.getException() != null)
- changeGlobalStateExceptions.put(node.id(), msg.getException());
+ if (stateChangeExchange() && msg.getError() != null)
+ changeGlobalStateExceptions.put(node.id(), msg.getError());
allReceived = remaining.isEmpty();
}
@@ -1457,7 +1569,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
if (updateSingleMap) {
try {
// Do not update partition map, in case cluster transitioning to inactive state.
- if (!exchangeOnChangeGlobalState || exchActions.newClusterState() != ClusterState.INACTIVE)
+ if (!deactivateCluster())
updatePartitionSingleMap(node, msg);
}
finally {
@@ -1735,18 +1847,16 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
}
}
- if (discoEvt.type() == EVT_NODE_JOINED) {
- if (cctx.kernalContext().state().active())
- assignPartitionsStates();
- }
+ if (discoEvt.type() == EVT_NODE_JOINED)
+ assignPartitionsStates();
else if (discoEvt.type() == EVT_DISCOVERY_CUSTOM_EVT) {
assert discoEvt instanceof DiscoveryCustomEvent;
+ if (activateCluster())
+ assignPartitionsStates();
+
if (((DiscoveryCustomEvent)discoEvt).customMessage() instanceof DynamicCacheChangeBatch) {
if (exchActions != null) {
- if (exchActions.newClusterState() == ClusterState.ACTIVE)
- assignPartitionsStates();
-
Set<String> caches = exchActions.cachesToResetLostPartitions();
if (!F.isEmpty(caches))
@@ -1783,13 +1893,34 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
nodes = new ArrayList<>(srvNodes);
}
+ IgniteCheckedException err = null;
+
+ if (stateChangeExchange()) {
+ StateChangeRequest req = exchActions.stateChangeRequest();
+
+ assert req != null : exchActions;
+
+ boolean stateChangeErr = false;
+
+ if (!F.isEmpty(changeGlobalStateExceptions)) {
+ stateChangeErr = true;
+
+ err = new IgniteCheckedException("Cluster state change failed.");
+
+ cctx.kernalContext().state().onStateChangeError(changeGlobalStateExceptions, req);
+ }
+
+ boolean active = !stateChangeErr && req.activate();
+
+ ChangeGlobalStateFinishMessage msg = new ChangeGlobalStateFinishMessage(req.requestId(), active);
+
+ cctx.discovery().sendCustomEvent(msg);
+ }
+
if (!nodes.isEmpty())
sendAllPartitions(nodes);
- if (exchangeOnChangeGlobalState && !F.isEmpty(changeGlobalStateExceptions))
- cctx.kernalContext().state().onFullResponseMessage(changeGlobalStateExceptions);
-
- onDone(exchangeId().topologyVersion());
+ onDone(exchangeId().topologyVersion(), err);
}
}
catch (IgniteCheckedException e) {
@@ -1898,7 +2029,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
* @param msg Message.
*/
private void processMessage(ClusterNode node, GridDhtPartitionsFullMessage msg) {
- assert msg.exchangeId().equals(exchId) : msg;
+ assert exchId.equals(msg.exchangeId()) : msg;
assert msg.lastVersion() != null : msg;
synchronized (this) {
@@ -1919,10 +2050,15 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
updatePartitionFullMap(msg);
- if (exchangeOnChangeGlobalState && !F.isEmpty(msg.getExceptionsMap()))
- cctx.kernalContext().state().onFullResponseMessage(msg.getExceptionsMap());
+ IgniteCheckedException err = null;
- onDone(exchId.topologyVersion());
+ if (stateChangeExchange() && !F.isEmpty(msg.getErrorsMap())) {
+ err = new IgniteCheckedException("Cluster state change failed");
+
+ cctx.kernalContext().state().onStateChangeError(msg.getErrorsMap(), exchActions.stateChangeRequest());
+ }
+
+ onDone(exchId.topologyVersion(), err);
}
/**
@@ -2143,7 +2279,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
}
if (crd0.isLocal()) {
- if (exchangeOnChangeGlobalState && changeGlobalStateE != null)
+ if (stateChangeExchange() && changeGlobalStateE != null)
changeGlobalStateExceptions.put(crd0.id(), changeGlobalStateE);
if (allReceived) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
index 0beb935..75609b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
@@ -90,10 +90,10 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
/** Exceptions. */
@GridToStringInclude
@GridDirectTransient
- private Map<UUID, Exception> exs;
+ private Map<UUID, Exception> errs;
/** */
- private byte[] exsBytes;
+ private byte[] errsBytes;
/** */
@GridDirectTransient
@@ -224,17 +224,17 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
}
/**
- *
+ * @return Errors map.
*/
- public Map<UUID, Exception> getExceptionsMap() {
- return exs;
+ @Nullable Map<UUID, Exception> getErrorsMap() {
+ return errs;
}
/**
- * @param exs Exs.
+ * @param errs Errors map.
*/
- public void setExceptionsMap(Map<UUID, Exception> exs) {
- this.exs = new HashMap<>(exs);
+ void setErrorsMap(Map<UUID, Exception> errs) {
+ this.errs = new HashMap<>(errs);
}
/** {@inheritDoc} */
@@ -245,14 +245,14 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
(partCntrs != null && partCntrsBytes == null) ||
(partHistSuppliers != null && partHistSuppliersBytes == null) ||
(partsToReload != null && partsToReloadBytes == null) ||
- (exs != null && exsBytes == null);
+ (errs != null && errsBytes == null);
if (marshal) {
byte[] partsBytes0 = null;
byte[] partCntrsBytes0 = null;
byte[] partHistSuppliersBytes0 = null;
byte[] partsToReloadBytes0 = null;
- byte[] exsBytes0 = null;
+ byte[] errsBytes0 = null;
if (parts != null && partsBytes == null)
partsBytes0 = U.marshal(ctx, parts);
@@ -266,8 +266,8 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
if (partsToReload != null && partsToReloadBytes == null)
partsToReloadBytes0 = U.marshal(ctx, partsToReload);
- if (exs != null && exsBytes == null)
- exsBytes0 = U.marshal(ctx, exs);
+ if (errs != null && errsBytes == null)
+ errsBytes0 = U.marshal(ctx, errs);
if (compress) {
assert !compressed();
@@ -277,13 +277,13 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
byte[] partCntrsBytesZip = U.zip(partCntrsBytes0);
byte[] partHistSuppliersBytesZip = U.zip(partHistSuppliersBytes0);
byte[] partsToReloadBytesZip = U.zip(partsToReloadBytes0);
- byte[] exsBytesZip = U.zip(exsBytes0);
+ byte[] exsBytesZip = U.zip(errsBytes0);
partsBytes0 = partsBytesZip;
partCntrsBytes0 = partCntrsBytesZip;
partHistSuppliersBytes0 = partHistSuppliersBytesZip;
partsToReloadBytes0 = partsToReloadBytesZip;
- exsBytes0 = exsBytesZip;
+ errsBytes0 = exsBytesZip;
compressed(true);
}
@@ -296,7 +296,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
partCntrsBytes = partCntrsBytes0;
partHistSuppliersBytes = partHistSuppliersBytes0;
partsToReloadBytes = partsToReloadBytes0;
- exsBytes = exsBytes0;
+ errsBytes = errsBytes0;
}
}
@@ -379,15 +379,15 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
if (partCntrs == null)
partCntrs = new IgniteDhtPartitionCountersMap();
- if (exsBytes != null && exs == null) {
+ if (errsBytes != null && errs == null) {
if (compressed())
- exs = U.unmarshalZip(ctx.marshaller(), exsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ errs = U.unmarshalZip(ctx.marshaller(), errsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
else
- exs = U.unmarshal(ctx, exsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ errs = U.unmarshal(ctx, errsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
}
- if (exs == null)
- exs = new HashMap<>();
+ if (errs == null)
+ errs = new HashMap<>();
}
/** {@inheritDoc} */
@@ -412,7 +412,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
writer.incrementState();
case 6:
- if (!writer.writeByteArray("exsBytes", exsBytes))
+ if (!writer.writeByteArray("errsBytes", errsBytes))
return false;
writer.incrementState();
@@ -472,7 +472,7 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
reader.incrementState();
case 6:
- exsBytes = reader.readByteArray("exsBytes");
+ errsBytes = reader.readByteArray("errsBytes");
if (!reader.isLastRead())
return false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
index 1e5ea14..b4d25c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
@@ -76,10 +76,10 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/** Exception. */
@GridToStringInclude
@GridDirectTransient
- private Exception ex;
+ private Exception err;
/** */
- private byte[] exBytes;
+ private byte[] errBytes;
/** */
private boolean client;
@@ -220,15 +220,15 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
/**
* @param ex Exception.
*/
- public void setException(Exception ex) {
- this.ex = ex;
+ public void setError(Exception ex) {
+ this.err = ex;
}
/**
- *
+ * @return Not null exception if exchange processing failed.
*/
- public Exception getException() {
- return ex;
+ @Nullable public Exception getError() {
+ return err;
}
/** {@inheritDoc}
@@ -239,13 +239,13 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
boolean marshal = (parts != null && partsBytes == null) ||
(partCntrs != null && partCntrsBytes == null) ||
(partHistCntrs != null && partHistCntrsBytes == null) ||
- (ex != null && exBytes == null);
+ (err != null && errBytes == null);
if (marshal) {
byte[] partsBytes0 = null;
byte[] partCntrsBytes0 = null;
byte[] partHistCntrsBytes0 = null;
- byte[] exBytes0 = null;
+ byte[] errBytes0 = null;
if (parts != null && partsBytes == null)
partsBytes0 = U.marshal(ctx, parts);
@@ -256,8 +256,8 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
if (partHistCntrs != null && partHistCntrsBytes == null)
partHistCntrsBytes0 = U.marshal(ctx, partHistCntrs);
- if (ex != null && exBytes == null)
- exBytes0 = U.marshal(ctx, ex);
+ if (err != null && errBytes == null)
+ errBytes0 = U.marshal(ctx, err);
if (compress) {
assert !compressed();
@@ -266,12 +266,12 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
byte[] partsBytesZip = U.zip(partsBytes0);
byte[] partCntrsBytesZip = U.zip(partCntrsBytes0);
byte[] partHistCntrsBytesZip = U.zip(partHistCntrsBytes0);
- byte[] exBytesZip = U.zip(exBytes0);
+ byte[] exBytesZip = U.zip(errBytes0);
partsBytes0 = partsBytesZip;
partCntrsBytes0 = partCntrsBytesZip;
partHistCntrsBytes0 = partHistCntrsBytesZip;
- exBytes0 = exBytesZip;
+ errBytes0 = exBytesZip;
compressed(true);
}
@@ -283,7 +283,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
partsBytes = partsBytes0;
partCntrsBytes = partCntrsBytes0;
partHistCntrsBytes = partHistCntrsBytes0;
- exBytes = exBytes0;
+ errBytes = errBytes0;
}
}
@@ -312,11 +312,11 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
partHistCntrs = U.unmarshal(ctx, partHistCntrsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
}
- if (exBytes != null && ex == null) {
+ if (errBytes != null && err == null) {
if (compressed())
- ex = U.unmarshalZip(ctx.marshaller(), exBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ err = U.unmarshalZip(ctx.marshaller(), errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
else
- ex = U.unmarshal(ctx, exBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
+ err = U.unmarshal(ctx, errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
}
if (dupPartsData != null) {
@@ -368,7 +368,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
writer.incrementState();
case 7:
- if (!writer.writeByteArray("exBytes", exBytes))
+ if (!writer.writeByteArray("errBytes", errBytes))
return false;
writer.incrementState();
@@ -424,7 +424,7 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
reader.incrementState();
case 7:
- exBytes = reader.readByteArray("exBytes");
+ errBytes = reader.readByteArray("errBytes");
if (!reader.isLastRead())
return false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 66b5987..2b18c24 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -183,7 +183,7 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
// No assignments for disabled preloader.
GridDhtPartitionTopology top = grp.topology();
- if (!grp.rebalanceEnabled() || !grp.shared().kernalContext().state().active())
+ if (!grp.rebalanceEnabled())
return new GridDhtPreloaderAssignments(exchFut, top.topologyVersion());
int partCnt = grp.affinity().partitions();
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index 062ff6c..a49812e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -45,8 +45,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.CacheDistribu
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtFuture;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.GridLeanMap;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
index 41e6d70..29c7aad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
@@ -26,7 +26,6 @@ import java.util.UUID;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.F;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index b3ab1cd..c700ef4 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -65,7 +65,6 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.PersistenceMetrics;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.DataPageEvictionMode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.MemoryConfiguration;
@@ -100,11 +99,13 @@ import org.apache.ignite.internal.pagemem.wal.record.delta.PartitionDestroyRecor
import org.apache.ignite.internal.pagemem.wal.record.delta.PartitionMetaStateRecord;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
-import org.apache.ignite.internal.processors.cache.ClusterState;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.StoredCacheData;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.CheckpointMetricsTracker;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx;
@@ -113,9 +114,6 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionMetaIO;
import org.apache.ignite.internal.processors.cache.persistence.wal.FileWALPointer;
import org.apache.ignite.internal.processors.cache.persistence.wal.crc.PureJavaCrc32;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.processors.port.GridPortRecord;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.GridMultiCollectionWrapper;
@@ -352,9 +350,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
/** {@inheritDoc} */
@Override protected void start0() throws IgniteCheckedException {
- snapshotMgr = cctx.snapshot();
+ super.start0();
- assert !cctx.kernalContext().state().active() : "Cluster with persistent must starting as inactive.";
+ snapshotMgr = cctx.snapshot();
if (!cctx.kernalContext().clientNode()) {
IgnitePageStoreManager store = cctx.pageStore();
@@ -371,15 +369,13 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
fileLockHolder = new FileLockHolder(storeMgr.workDir().getPath(), cctx.kernalContext(), log);
persStoreMetrics.wal(cctx.wal());
-
- registrateMetricsMBean();
}
}
/**
- *
+ * @throws IgniteCheckedException If failed.
*/
- @Override public void initDataBase() throws IgniteCheckedException {
+ private void initDataBase() throws IgniteCheckedException {
Long cpBufSize = persistenceCfg.getCheckpointingPageBufferSize();
if (persistenceCfg.getCheckpointingThreads() > 1)
@@ -432,8 +428,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
checkpointPageBufSize = cpBufSize;
-
- super.start0();
}
/** {@inheritDoc} */
@@ -442,58 +436,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override protected void onKernalStart0(boolean reconnect) throws IgniteCheckedException {
- if (reconnect || cctx.kernalContext().clientNode() || !cctx.kernalContext().state().active())
- return;
-
- initDataBase();
-
- initCachesAndRestoreMemory();
- }
-
- /**
- *
- */
- private void initCachesAndRestoreMemory() throws IgniteCheckedException {
- Collection<String> cacheNames = new HashSet<>();
-
- // TODO IGNITE-5075 group descriptors.
- for (CacheConfiguration ccfg : cctx.kernalContext().config().getCacheConfiguration()) {
- if (CU.isSystemCache(ccfg.getName())) {
- storeMgr.initializeForCache(
- cctx.cache().cacheDescriptors().get(ccfg.getName()).groupDescriptor(),
- new StoredCacheData(ccfg)
- );
-
- cacheNames.add(ccfg.getName());
- }
- }
-
- for (CacheConfiguration ccfg : cctx.kernalContext().config().getCacheConfiguration())
- if (!CU.isSystemCache(ccfg.getName())) {
- DynamicCacheDescriptor cacheDesc = cctx.cache().cacheDescriptors().get(ccfg.getName());
-
- if (cacheDesc != null)
- storeMgr.initializeForCache(
- cacheDesc.groupDescriptor(),
- new StoredCacheData(ccfg)
- );
-
- cacheNames.add(ccfg.getName());
- }
-
- for (StoredCacheData cacheData : cctx.pageStore().readCacheConfigurations().values()) {
- if (!cacheNames.contains(cacheData.config().getName()))
- storeMgr.initializeForCache(
- cctx.cache().cacheDescriptors().get(
- cacheData.config().getName()).groupDescriptor(), cacheData);
- }
-
- readCheckpointAndRestoreMemory();
- }
-
- /** {@inheritDoc} */
- @Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void onActivate(GridKernalContext ctx) throws IgniteCheckedException {
if (log.isDebugEnabled())
log.debug("Activate database manager [id=" + cctx.localNodeId() +
" topVer=" + cctx.discovery().topologyVersionEx() + " ]");
@@ -504,16 +447,13 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
initDataBase();
registrateMetricsMBean();
-
- initCachesAndRestoreMemory();
}
- if (log.isDebugEnabled())
- log.debug("Restore state after activation [nodeId=" + cctx.localNodeId() + " ]");
+ super.onActivate(ctx);
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void onDeActivate(GridKernalContext kctx) {
if (log.isDebugEnabled())
log.debug("DeActivate database manager [id=" + cctx.localNodeId() +
" topVer=" + cctx.discovery().topologyVersionEx() + " ]");
@@ -530,7 +470,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/**
- *
+ * @throws IgniteCheckedException If failed.
*/
private void registrateMetricsMBean() throws IgniteCheckedException {
try {
@@ -564,13 +504,18 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
}
- /**
- *
- */
- private void readCheckpointAndRestoreMemory() throws IgniteCheckedException {
+ /** {@inheritDoc} */
+ @Override public void readCheckpointAndRestoreMemory(List<DynamicCacheDescriptor> cachesToStart) throws IgniteCheckedException {
checkpointReadLock();
try {
+ if (!F.isEmpty(cachesToStart)) {
+ for (DynamicCacheDescriptor desc : cachesToStart) {
+ if (CU.affinityNode(cctx.localNode(), desc.cacheConfiguration().getNodeFilter()))
+ storeMgr.initializeForCache(desc.groupDescriptor(), new StoredCacheData(desc.cacheConfiguration()));
+ }
+ }
+
CheckpointStatus status = readCheckpointStatus();
// First, bring memory to the last consistent checkpoint state if needed.
@@ -774,13 +719,10 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
boolean isSrvNode = !cctx.kernalContext().clientNode();
- boolean clusterStatusActive = cctx.kernalContext().state().active();
-
- boolean clusterInTransitionStateToActive = fut.newClusterState() == ClusterState.ACTIVE;
+ boolean clusterInTransitionStateToActive = fut.activateCluster();
// Before local node join event.
- if (clusterInTransitionStateToActive ||
- (joinEvt && locNode && isSrvNode && clusterStatusActive))
+ if (clusterInTransitionStateToActive || (joinEvt && locNode && isSrvNode))
restoreState();
if (cctx.kernalContext().query().moduleEnabled()) {
@@ -1579,9 +1521,10 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
Map<T2<Integer, Integer>, T2<Integer, Long>> partStates
) throws IgniteCheckedException {
for (CacheGroupContext grp : cctx.cache().cacheGroups()) {
- if (grp.isLocal())
+ if (grp.isLocal() || !grp.affinityNode()) {
// Local cache has no partitions and its states.
continue;
+ }
int grpId = grp.groupId();
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
index 4e322b9..7a38b61 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
@@ -135,10 +135,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
/** {@inheritDoc} */
@Override protected CacheDataStore createCacheDataStore0(final int p)
throws IgniteCheckedException {
- GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager)ctx.database();
-
- boolean exists = ctx.pageStore() != null
- && ctx.pageStore().exists(grp.groupId(), p);
+ boolean exists = ctx.pageStore() != null && ctx.pageStore().exists(grp.groupId(), p);
return new GridCacheDataStore(p, exists);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index f04c278..c5f174c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.management.JMException;
@@ -41,8 +42,10 @@ import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider;
import org.apache.ignite.internal.pagemem.PageMemory;
import org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
+import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
import org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.processors.cache.persistence.evict.FairFifoPageEvictionTracker;
import org.apache.ignite.internal.processors.cache.persistence.evict.NoOpPageEvictionTracker;
import org.apache.ignite.internal.processors.cache.persistence.evict.PageEvictionTracker;
@@ -51,7 +54,6 @@ import org.apache.ignite.internal.processors.cache.persistence.evict.RandomLruPa
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeList;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeListImpl;
import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseList;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.LT;
@@ -100,13 +102,6 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getMemoryConfiguration() == null)
return;
- init();
- }
-
- /**
- * @throws IgniteCheckedException If failed.
- */
- public void init() throws IgniteCheckedException {
MemoryConfiguration memCfg = cctx.kernalContext().config().getMemoryConfiguration();
assert memCfg != null;
@@ -114,14 +109,6 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
validateConfiguration(memCfg);
pageSize = memCfg.getPageSize();
-
- initPageMemoryPolicies(memCfg);
-
- registerMetricsMBeans();
-
- startMemoryPolicies();
-
- initPageMemoryDataStructures(memCfg);
}
/**
@@ -149,12 +136,12 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
) {
try {
U.registerMBean(
- cfg.getMBeanServer(),
- cfg.getIgniteInstanceName(),
- "MemoryMetrics",
- memPlcCfg.getName(),
- new MemoryMetricsMXBeanImpl(memMetrics, memPlcCfg),
- MemoryMetricsMXBean.class);
+ cfg.getMBeanServer(),
+ cfg.getIgniteInstanceName(),
+ "MemoryMetrics",
+ memPlcCfg.getName(),
+ new MemoryMetricsMXBeanImpl(memMetrics, memPlcCfg),
+ MemoryMetricsMXBean.class);
}
catch (JMException e) {
U.error(log, "Failed to register MBean for MemoryMetrics with name: '" + memMetrics.getName() + "'", e);
@@ -163,6 +150,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/**
* @param dbCfg Database config.
+ * @throws IgniteCheckedException If failed.
*/
protected void initPageMemoryDataStructures(MemoryConfiguration dbCfg) throws IgniteCheckedException {
freeListMap = U.newHashMap(memPlcMap.size());
@@ -554,13 +542,6 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @throws IgniteCheckedException If failed.
- */
- public void initDataBase() throws IgniteCheckedException {
- // No-op.
- }
-
- /**
* @return collection of all configured {@link MemoryPolicy policies}.
*/
public Collection<MemoryPolicy> memoryPolicies() {
@@ -592,6 +573,14 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
+ * @param cachesToStart Started caches.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void readCheckpointAndRestoreMemory(List<DynamicCacheDescriptor> cachesToStart) throws IgniteCheckedException {
+ // No-op.
+ }
+
+ /**
* @param memPlcName Name of {@link MemoryPolicy} to obtain {@link MemoryMetrics} for.
* @return {@link MemoryMetrics} snapshot for specified {@link MemoryPolicy} or {@code null} if
* no {@link MemoryPolicy} is configured for specified name.
@@ -947,11 +936,24 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/** {@inheritDoc} */
@Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
- start0();
+ if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getMemoryConfiguration() == null)
+ return;
+
+ MemoryConfiguration memCfg = cctx.kernalContext().config().getMemoryConfiguration();
+
+ assert memCfg != null;
+
+ initPageMemoryPolicies(memCfg);
+
+ registerMetricsMBeans();
+
+ startMemoryPolicies();
+
+ initPageMemoryDataStructures(memCfg);
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void onDeActivate(GridKernalContext kctx) {
stop0(false);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheSnapshotManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheSnapshotManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheSnapshotManager.java
index ad804cb..cce6f55 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheSnapshotManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheSnapshotManager.java
@@ -124,7 +124,7 @@ public class IgniteCacheSnapshotManager extends GridCacheSharedManagerAdapter im
FullPageId fullId,
PageMemory pageMem
) throws IgniteCheckedException {
-
+ // No-op.
}
/**
@@ -135,14 +135,16 @@ public class IgniteCacheSnapshotManager extends GridCacheSharedManagerAdapter im
ByteBuffer pageBuf,
Integer tag
) throws IgniteCheckedException {
-
+ // No-op.
}
+ /** {@inheritDoc} */
@Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
-
+ // No-op.
}
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
-
+ /** {@inheritDoc} */
+ @Override public void onDeActivate(GridKernalContext kctx) {
+ // No-op.
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
index f908512..28bf6e4 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
@@ -162,7 +162,7 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ @Override public void onDeActivate(GridKernalContext kctx) {
if (log.isDebugEnabled())
log.debug("DeActivate page store manager [id=" + cctx.localNodeId() +
" topVer=" + cctx.discovery().topologyVersionEx() + " ]");
@@ -208,18 +208,17 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
/** {@inheritDoc} */
@Override public void storeCacheData(
- CacheGroupDescriptor grpDesc,
StoredCacheData cacheData
) throws IgniteCheckedException {
- File cacheWorkDir = cacheWorkDirectory(grpDesc, cacheData.config());
+ File cacheWorkDir = cacheWorkDirectory(cacheData.config());
File file;
checkAndInitCacheWorkDir(cacheWorkDir);
assert cacheWorkDir.exists() : "Work directory does not exist: " + cacheWorkDir;
- if (grpDesc.sharedGroup())
+ if (cacheData.config().getGroupName() != null)
file = new File(cacheWorkDir, cacheData.config().getName() + CACHE_DATA_FILENAME);
else
file = new File(cacheWorkDir, CACHE_DATA_FILENAME);
@@ -333,14 +332,13 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
}
/**
- * @param grpDesc Cache group descriptor.
* @param ccfg Cache configuration.
* @return Cache work directory.
*/
- private File cacheWorkDirectory(CacheGroupDescriptor grpDesc, CacheConfiguration ccfg) {
+ private File cacheWorkDirectory(CacheConfiguration ccfg) {
String dirName;
- if (grpDesc.sharedGroup())
+ if (ccfg.getGroupName() != null)
dirName = CACHE_GRP_DIR_PREFIX + ccfg.getGroupName();
else
dirName = CACHE_DIR_PREFIX + ccfg.getName();
@@ -357,7 +355,7 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
private CacheStoreHolder initForCache(CacheGroupDescriptor grpDesc, CacheConfiguration ccfg) throws IgniteCheckedException {
assert !grpDesc.sharedGroup() || ccfg.getGroupName() != null : ccfg.getName();
- File cacheWorkDir = cacheWorkDirectory(grpDesc, ccfg);
+ File cacheWorkDir = cacheWorkDirectory(ccfg);
boolean dirExisted = checkAndInitCacheWorkDir(cacheWorkDir);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index f877a14..8993112 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -288,14 +288,6 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
}
}
- /** {@inheritDoc} */
- @Override protected void onKernalStart0(boolean reconnect) throws IgniteCheckedException {
- super.onKernalStart0(reconnect);
-
- if (!cctx.kernalContext().clientNode() && cctx.kernalContext().state().active())
- archiver.start();
- }
-
/**
* @return Consistent ID.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
index 63228a0..7f859a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java
@@ -560,7 +560,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
final Object topic = topic(cctx.nodeId(), req.id());
- cctx.io().addOrderedCacheHandler(topic, resHnd);
+ cctx.io().addOrderedCacheHandler(cctx.shared(), topic, resHnd);
fut.listen(new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> fut) {
@@ -744,7 +744,7 @@ public class GridCacheDistributedQueryManager<K, V> extends GridCacheQueryManage
final Object topic = topic(cctx.nodeId(), req.id());
- cctx.io().addOrderedCacheHandler(topic, resHnd);
+ cctx.io().addOrderedCacheHandler(cctx.shared(), topic, resHnd);
fut.listen(new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> fut) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
index 62ead23..8ff2f5a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
@@ -34,7 +34,6 @@ import javax.cache.integration.CacheWriterException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreSession;
import org.apache.ignite.cache.store.CacheStoreSessionListener;
import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
index bc2e49a..269925d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
@@ -88,12 +88,6 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
}
/** {@inheritDoc} */
- @Override protected void onKernalStart0(boolean reconnect) throws IgniteCheckedException {
- for (ClusterNode n : cctx.discovery().remoteNodes())
- onReceived(n.id(), n.metrics().getLastDataVersion());
- }
-
- /** {@inheritDoc} */
@Override protected void stop0(boolean cancel) {
cctx.gridEvents().removeLocalEventListener(discoLsnr, EVT_NODE_METRICS_UPDATED);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/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 1dd47ed..dad6728 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
@@ -44,11 +44,6 @@ public interface IgniteCacheObjectProcessor extends GridProcessor {
public void onContinuousProcessorStarted(GridKernalContext ctx) throws IgniteCheckedException;
/**
- * @throws IgniteCheckedException If failed.
- */
- public void onUtilityCacheStarted() throws IgniteCheckedException;
-
- /**
* @param typeName Type name.
* @return Type ID.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/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 67e14dc..70711e5 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
@@ -307,11 +307,6 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
}
/** {@inheritDoc} */
- @Override public void onUtilityCacheStarted() throws IgniteCheckedException {
- // No-op.
- }
-
- /** {@inheritDoc} */
@Override public int typeId(String typeName) {
return 0;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateFinishMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateFinishMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateFinishMessage.java
new file mode 100644
index 0000000..0771198
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateFinishMessage.java
@@ -0,0 +1,86 @@
+/*
+ * 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.cluster;
+
+import java.util.UUID;
+import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public class ChangeGlobalStateFinishMessage implements DiscoveryCustomMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Custom message ID. */
+ private IgniteUuid id = IgniteUuid.randomUuid();
+
+ /** State change request ID. */
+ private UUID reqId;
+
+ /** New cluster state. */
+ private boolean clusterActive;
+
+ /**
+ * @param reqId State change request ID.
+ * @param clusterActive New cluster state.
+ */
+ public ChangeGlobalStateFinishMessage(UUID reqId, boolean clusterActive) {
+ assert reqId != null;
+
+ this.reqId = reqId;
+ this.clusterActive = clusterActive;
+ }
+
+ /**
+ * @return State change request ID.
+ */
+ public UUID requestId() {
+ return reqId;
+ }
+
+ /**
+ * @return New cluster state.
+ */
+ public boolean clusterActive() {
+ return clusterActive;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteUuid id() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public DiscoveryCustomMessage ackMessage() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isMutable() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(ChangeGlobalStateFinishMessage.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateMessage.java
new file mode 100644
index 0000000..6579399
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateMessage.java
@@ -0,0 +1,140 @@
+/*
+ * 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.cluster;
+
+import java.util.List;
+import java.util.UUID;
+import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
+import org.apache.ignite.internal.processors.cache.ExchangeActions;
+import org.apache.ignite.internal.processors.cache.StoredCacheData;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Message represent request for change cluster global state.
+ */
+public class ChangeGlobalStateMessage implements DiscoveryCustomMessage {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Custom message ID. */
+ private IgniteUuid id = IgniteUuid.randomUuid();
+
+ /** Request ID */
+ private UUID reqId;
+
+ /** Initiator node ID. */
+ private UUID initiatingNodeId;
+
+ /** If true activate else deactivate. */
+ private boolean activate;
+
+ /** Configurations read from persistent store. */
+ private List<StoredCacheData> storedCfgs;
+
+ /** */
+ @GridToStringExclude
+ private transient ExchangeActions exchangeActions;
+
+ /**
+ * @param reqId State change request ID.
+ * @param initiatingNodeId Node initiated state change.
+ * @param storedCfgs Configurations read from persistent store.
+ * @param activate New cluster state.
+ */
+ public ChangeGlobalStateMessage(
+ UUID reqId,
+ UUID initiatingNodeId,
+ @Nullable List<StoredCacheData> storedCfgs,
+ boolean activate
+ ) {
+ assert reqId != null;
+ assert initiatingNodeId != null;
+
+ this.reqId = reqId;
+ this.initiatingNodeId = initiatingNodeId;
+ this.storedCfgs = storedCfgs;
+ this.activate = activate;
+ }
+
+ /**
+ * @return Configurations read from persistent store..
+ */
+ @Nullable public List<StoredCacheData> storedCacheConfigurations() {
+ return storedCfgs;
+ }
+
+ /**
+ * @return Cache updates to be executed on exchange. If {@code null} exchange is not needed.
+ */
+ @Nullable public ExchangeActions exchangeActions() {
+ return exchangeActions;
+ }
+
+ /**
+ * @param exchangeActions Cache updates to be executed on exchange.
+ */
+ void exchangeActions(ExchangeActions exchangeActions) {
+ assert exchangeActions != null && !exchangeActions.empty() : exchangeActions;
+
+ this.exchangeActions = exchangeActions;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteUuid id() {
+ return id;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public DiscoveryCustomMessage ackMessage() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isMutable() {
+ return false;
+ }
+
+ /**
+ * @return Node initiated state change.
+ */
+ public UUID initiatorNodeId() {
+ return initiatingNodeId;
+ }
+
+ /**
+ * @return New cluster state.
+ */
+ public boolean activate() {
+ return activate;
+ }
+
+ /**
+ * @return State change request ID.
+ */
+ public UUID requestId() {
+ return reqId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(ChangeGlobalStateMessage.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
index ad95a78..dc503fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
@@ -270,7 +270,6 @@ public class ClusterProcessor extends GridProcessorAdapter {
dataBag.addNodeSpecificData(CLUSTER_PROC.ordinal(), getDiscoveryData());
}
-
/**
* @return Discovery data.
*/
@@ -314,7 +313,7 @@ public class ClusterProcessor extends GridProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
if (notifyEnabled.get()) {
try {
verChecker = new GridUpdateNotifier(ctx.igniteInstanceName(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/DiscoveryDataClusterState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/DiscoveryDataClusterState.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/DiscoveryDataClusterState.java
new file mode 100644
index 0000000..71bf90b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/DiscoveryDataClusterState.java
@@ -0,0 +1,157 @@
+/*
+ * 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.cluster;
+
+import java.io.Serializable;
+import java.util.Set;
+import java.util.UUID;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Discovery data related to cluster state.
+ */
+public class DiscoveryDataClusterState implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private final boolean active;
+
+ /** */
+ private final UUID transitionReqId;
+
+ /** Topology version for state change exchange. */
+ @GridToStringInclude
+ private final AffinityTopologyVersion transitionTopVer;
+
+ /** Nodes participating in state change exchange. */
+ @GridToStringExclude
+ private final Set<UUID> transitionNodes;
+
+ /** Local flag for state transition result (global state is updated asynchronously by custom message). */
+ private transient volatile Boolean transitionRes;
+
+ /**
+ * @param active Current status.
+ * @return State instance.
+ */
+ static DiscoveryDataClusterState createState(boolean active) {
+ return new DiscoveryDataClusterState(active, null, null, null);
+ }
+
+ /**
+ * @param active New status.
+ * @param transitionReqId State change request ID.
+ * @param transitionTopVer State change topology version.
+ * @param transitionNodes Nodes participating in state change exchange.
+ * @return State instance.
+ */
+ static DiscoveryDataClusterState createTransitionState(boolean active,
+ UUID transitionReqId,
+ AffinityTopologyVersion transitionTopVer,
+ Set<UUID> transitionNodes) {
+ assert transitionReqId != null;
+ assert transitionTopVer != null;
+ assert !F.isEmpty(transitionNodes) : transitionNodes;
+
+ return new DiscoveryDataClusterState(active, transitionReqId, transitionTopVer, transitionNodes);
+ }
+
+ /**
+ * @param active New state.
+ * @param transitionReqId State change request ID.
+ * @param transitionTopVer State change topology version.
+ * @param transitionNodes Nodes participating in state change exchange.
+ */
+ private DiscoveryDataClusterState(boolean active,
+ @Nullable UUID transitionReqId,
+ @Nullable AffinityTopologyVersion transitionTopVer,
+ @Nullable Set<UUID> transitionNodes) {
+ this.active = active;
+ this.transitionReqId = transitionReqId;
+ this.transitionTopVer = transitionTopVer;
+ this.transitionNodes = transitionNodes;
+ }
+
+ /**
+ * @return Local flag for state transition result (global state is updated asynchronously by custom message).
+ */
+ @Nullable public Boolean transitionResult() {
+ return transitionRes;
+ }
+
+ /**
+ * Discovery cluster state is changed asynchronously by discovery message, this methods changes local status
+ * for public API calls.
+ *
+ * @param reqId Request ID.
+ * @param active New cluster state.
+ */
+ public void setTransitionResult(UUID reqId, boolean active) {
+ if (reqId.equals(transitionReqId)) {
+ assert transitionRes == null : this;
+
+ transitionRes = active;
+ }
+ }
+
+ /**
+ * @return State change request ID.
+ */
+ public UUID transitionRequestId() {
+ return transitionReqId;
+ }
+
+ /**
+ * @return {@code True} if state change is in progress.
+ */
+ public boolean transition() {
+ return transitionReqId != null;
+ }
+
+ /**
+ * @return State change exchange version.
+ */
+ public AffinityTopologyVersion transitionTopologyVersion() {
+ return transitionTopVer;
+ }
+
+ /**
+ * @return Current cluster state (or new state in case when transition is in progress).
+ */
+ public boolean active() {
+ return active;
+ }
+
+ /**
+ * @return Nodes participating in state change exchange.
+ */
+ public Set<UUID> transitionNodes() {
+ return transitionNodes;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DiscoveryDataClusterState.class, this);
+ }
+}
[02/50] [abbrv] ignite git commit: Muted hanging tests.
Posted by vo...@apache.org.
Muted hanging tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/50bb0901
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/50bb0901
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/50bb0901
Branch: refs/heads/master
Commit: 50bb0901255707dc9601159803363a36aeafecab
Parents: 90b67fa
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Tue Jul 4 18:10:25 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Jul 4 20:53:09 2017 +0300
----------------------------------------------------------------------
.../IgniteCommunicationBalanceMultipleConnectionsTest.java | 5 +++++
.../IgniteHadoopFileSystemShmemExternalDualAsyncSelfTest.java | 5 +++++
.../org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java | 5 +++++
3 files changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/50bb0901/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalanceMultipleConnectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalanceMultipleConnectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalanceMultipleConnectionsTest.java
index e95b1ec..444f086 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalanceMultipleConnectionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteCommunicationBalanceMultipleConnectionsTest.java
@@ -25,4 +25,9 @@ public class IgniteCommunicationBalanceMultipleConnectionsTest extends IgniteCom
@Override protected int connectionsPerNode() {
return 5;
}
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-5689");
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/50bb0901/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemShmemExternalDualAsyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemShmemExternalDualAsyncSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemShmemExternalDualAsyncSelfTest.java
index 5154642..edf0279 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemShmemExternalDualAsyncSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgniteHadoopFileSystemShmemExternalDualAsyncSelfTest.java
@@ -30,4 +30,9 @@ public class IgniteHadoopFileSystemShmemExternalDualAsyncSelfTest
public IgniteHadoopFileSystemShmemExternalDualAsyncSelfTest() {
super(DUAL_ASYNC, true);
}
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-5691");
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/50bb0901/modules/spark/src/test/java/org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/java/org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java b/modules/spark/src/test/java/org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java
index 49bb1ac..5477d43 100644
--- a/modules/spark/src/test/java/org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java
+++ b/modules/spark/src/test/java/org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java
@@ -100,6 +100,11 @@ public class JavaEmbeddedIgniteRDDSelfTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-5690");
+ }
+
+ /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
stopAllGrids();
}
[20/50] [abbrv] ignite git commit: ignite-2.1 Do not use 'compress'
flag for GridDhtPartitionsFullMessage send in discovery message.
Posted by vo...@apache.org.
ignite-2.1 Do not use 'compress' flag for GridDhtPartitionsFullMessage send in discovery message.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0357c51c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0357c51c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0357c51c
Branch: refs/heads/master
Commit: 0357c51c68540fc14de83ea36f0cfdc7ec987b80
Parents: 15da654
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 5 16:59:23 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 5 16:59:23 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCachePartitionExchangeManager.java | 7 +++++--
.../dht/preloader/GridDhtPartitionsExchangeFuture.java | 8 +++++---
2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0357c51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 22345d2..ac06295 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -955,7 +955,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
* @param nodes Nodes.
*/
private void sendAllPartitions(Collection<ClusterNode> nodes) {
- GridDhtPartitionsFullMessage m = createPartitionsFullMessage(null, null, null, null);
+ GridDhtPartitionsFullMessage m = createPartitionsFullMessage(true, null, null, null, null);
if (log.isDebugEnabled())
log.debug("Sending all partitions [nodeIds=" + U.nodeIds(nodes) + ", msg=" + m + ']');
@@ -978,11 +978,14 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
/**
+ * @param compress {@code True} if possible to compress message (properly work only if prepareMarshall/
+ * finishUnmarshall methods are called).
* @param exchId Non-null exchange ID if message is created for exchange.
* @param lastVer Last version.
* @return Message.
*/
public GridDhtPartitionsFullMessage createPartitionsFullMessage(
+ boolean compress,
@Nullable final GridDhtPartitionExchangeId exchId,
@Nullable GridCacheVersion lastVer,
@Nullable IgniteDhtPartitionHistorySuppliersMap partHistSuppliers,
@@ -995,7 +998,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
partsToReload
);
- m.compress(true);
+ m.compress(compress);
final Map<Object, T2<Integer, GridDhtPartitionFullMap>> dupData = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/0357c51c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index cea758a..2151101 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1259,12 +1259,14 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
}
/**
+ * @param compress Message compress flag.
* @return Message.
*/
- private GridDhtPartitionsFullMessage createPartitionsMessage() {
+ private GridDhtPartitionsFullMessage createPartitionsMessage(boolean compress) {
GridCacheVersion last = lastVer.get();
GridDhtPartitionsFullMessage m = cctx.exchange().createPartitionsFullMessage(
+ compress,
exchangeId(),
last != null ? last : cctx.versions().last(),
partHistSuppliers,
@@ -1281,7 +1283,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
* @throws IgniteCheckedException If failed.
*/
private void sendAllPartitions(Collection<ClusterNode> nodes) throws IgniteCheckedException {
- GridDhtPartitionsFullMessage m = createPartitionsMessage();
+ GridDhtPartitionsFullMessage m = createPartitionsMessage(true);
assert !nodes.contains(cctx.localNode());
@@ -1613,7 +1615,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
Map<Integer, Map<Integer, List<UUID>>> assignmentChange = fut.get();
- GridDhtPartitionsFullMessage m = createPartitionsMessage();
+ GridDhtPartitionsFullMessage m = createPartitionsMessage(false);
CacheAffinityChangeMessage msg = new CacheAffinityChangeMessage(exchId, m, assignmentChange);
[19/50] [abbrv] ignite git commit: IGNITE-5187: Improved
DynamicIndexAbstractConcurrentSelfTest reliability. This closes #2219.
Posted by vo...@apache.org.
IGNITE-5187: Improved DynamicIndexAbstractConcurrentSelfTest reliability. This closes #2219.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/15da654a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/15da654a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/15da654a
Branch: refs/heads/master
Commit: 15da654a3e5c2bbf14947f0d3dd08270a9ba6766
Parents: 0f9a895
Author: Alexander Paschenko <al...@gmail.com>
Authored: Wed Jul 5 15:15:35 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Jul 5 15:15:35 2017 +0300
----------------------------------------------------------------------
.../DynamicIndexAbstractConcurrentSelfTest.java | 81 +++++++++++---------
1 file changed, 45 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/15da654a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
index 3fb8a30..913d724 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
@@ -17,6 +17,17 @@
package org.apache.ignite.internal.processors.cache.index;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.Cache;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
@@ -37,21 +48,9 @@ import org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
-import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.T3;
import org.jetbrains.annotations.NotNull;
-import javax.cache.Cache;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
import static org.apache.ignite.internal.IgniteClientReconnectAbstractTest.TestTcpDiscoverySpi;
/**
@@ -66,7 +65,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
private static final int LARGE_CACHE_SIZE = 100_000;
/** Latches to block certain index operations. */
- private static final ConcurrentHashMap<UUID, T2<CountDownLatch, AtomicBoolean>> BLOCKS = new ConcurrentHashMap<>();
+ private static final ConcurrentHashMap<UUID, T3<CountDownLatch, AtomicBoolean, CountDownLatch>> BLOCKS = new ConcurrentHashMap<>();
/** Cache mode. */
private final CacheMode cacheMode;
@@ -80,7 +79,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
* @param cacheMode Cache mode.
* @param atomicityMode Atomicity mode.
*/
- protected DynamicIndexAbstractConcurrentSelfTest(CacheMode cacheMode, CacheAtomicityMode atomicityMode) {
+ DynamicIndexAbstractConcurrentSelfTest(CacheMode cacheMode, CacheAtomicityMode atomicityMode) {
this.cacheMode = cacheMode;
this.atomicityMode = atomicityMode;
}
@@ -93,10 +92,11 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
}
/** {@inheritDoc} */
+ @SuppressWarnings("ConstantConditions")
@Override protected void afterTest() throws Exception {
GridQueryProcessor.idxCls = null;
- for (T2<CountDownLatch, AtomicBoolean> block : BLOCKS.values())
+ for (T3<CountDownLatch, AtomicBoolean, CountDownLatch> block : BLOCKS.values())
block.get1().countDown();
BLOCKS.clear();
@@ -146,14 +146,14 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
put(srv1, 0, KEY_AFTER);
// Test migration between normal servers.
- blockIndexing(srv1Id);
+ CountDownLatch idxLatch = blockIndexing(srv1Id);
QueryIndex idx1 = index(IDX_NAME_1, field(FIELD_NAME_1));
IgniteInternalFuture<?> idxFut1 = queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME,
idx1, false);
- Thread.sleep(100);
+ idxLatch.countDown();
//srv1.close();
Ignition.stop(srv1.name(), true);
@@ -167,14 +167,14 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
assertSqlSimpleData(SQL_SIMPLE_FIELD_1, KEY_AFTER - SQL_ARG_1);
// Test migration from normal server to non-affinity server.
- blockIndexing(srv2Id);
+ idxLatch = blockIndexing(srv2Id);
QueryIndex idx2 = index(IDX_NAME_2, field(aliasUnescaped(FIELD_NAME_2)));
IgniteInternalFuture<?> idxFut2 =
queryProcessor(cli).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx2, false);
- Thread.sleep(100);
+ idxLatch.countDown();
//srv2.close();
Ignition.stop(srv2.name(), true);
@@ -202,7 +202,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
createSqlCache(srv1);
- blockIndexing(srv1);
+ CountDownLatch idxLatch = blockIndexing(srv1);
QueryIndex idx1 = index(IDX_NAME_1, field(FIELD_NAME_1));
QueryIndex idx2 = index(IDX_NAME_2, field(aliasUnescaped(FIELD_NAME_2)));
@@ -229,7 +229,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1));
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_2, field(aliasUnescaped(FIELD_NAME_2)));
- Thread.sleep(100);
+ idxLatch.countDown();
put(srv1, 0, KEY_AFTER);
@@ -250,7 +250,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
createSqlCache(srv1);
- blockIndexing(srv1);
+ CountDownLatch idxLatch = blockIndexing(srv1);
QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
@@ -267,7 +267,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
idxFut.get();
- Thread.sleep(100L);
+ idxLatch.countDown();
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1));
@@ -391,15 +391,16 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
put(srv1, 0, LARGE_CACHE_SIZE);
// Start index operation in blocked state.
- blockIndexing(srv1);
- blockIndexing(srv2);
+ CountDownLatch idxLatch1 = blockIndexing(srv1);
+ CountDownLatch idxLatch2 = blockIndexing(srv2);
QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
final IgniteInternalFuture<?> idxFut =
queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false);
- Thread.sleep(100);
+ idxLatch1.countDown();
+ idxLatch2.countDown();
// Start two more nodes and unblock index operation in the middle.
Ignition.start(serverConfiguration(3));
@@ -435,19 +436,19 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
Ignite cli = Ignition.start(clientConfiguration(4));
// Start cache and populate it with data.
- IgniteCache cache = createSqlCache(cli);
+ createSqlCache(cli);
put(cli, KEY_AFTER);
// Start index operation and block it on coordinator.
- blockIndexing(srv1);
+ CountDownLatch idxLatch = blockIndexing(srv1);
QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
final IgniteInternalFuture<?> idxFut =
queryProcessor(srv1).dynamicIndexCreate(CACHE_NAME, CACHE_NAME, TBL_NAME, idx, false);
- Thread.sleep(100);
+ idxLatch.countDown();
// Destroy cache (drop table).
destroySqlCache(cli);
@@ -967,10 +968,10 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
* @param node Node.
*/
@SuppressWarnings("SuspiciousMethodCalls")
- private static void blockIndexing(Ignite node) {
+ private static CountDownLatch blockIndexing(Ignite node) {
UUID nodeId = ((IgniteEx)node).localNode().id();
- blockIndexing(nodeId);
+ return blockIndexing(nodeId);
}
/**
@@ -979,10 +980,14 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
* @param nodeId Node.
*/
@SuppressWarnings("SuspiciousMethodCalls")
- private static void blockIndexing(UUID nodeId) {
+ private static CountDownLatch blockIndexing(UUID nodeId) {
assertFalse(BLOCKS.contains(nodeId));
- BLOCKS.put(nodeId, new T2<>(new CountDownLatch(1), new AtomicBoolean()));
+ CountDownLatch idxLatch = new CountDownLatch(1);
+
+ BLOCKS.put(nodeId, new T3<>(new CountDownLatch(1), new AtomicBoolean(), idxLatch));
+
+ return idxLatch;
}
/**
@@ -1001,8 +1006,9 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
*
* @param nodeId Node ID.
*/
+ @SuppressWarnings("ConstantConditions")
private static void unblockIndexing(UUID nodeId) {
- T2<CountDownLatch, AtomicBoolean> blocker = BLOCKS.remove(nodeId);
+ T3<CountDownLatch, AtomicBoolean, CountDownLatch> blocker = BLOCKS.remove(nodeId);
assertNotNull(blocker);
@@ -1014,12 +1020,15 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
*
* @param nodeId Node ID.
*/
+ @SuppressWarnings("ConstantConditions")
private static void awaitIndexing(UUID nodeId) {
- T2<CountDownLatch, AtomicBoolean> blocker = BLOCKS.get(nodeId);
+ T3<CountDownLatch, AtomicBoolean, CountDownLatch> blocker = BLOCKS.get(nodeId);
if (blocker != null) {
assertTrue(blocker.get2().compareAndSet(false, true));
+ blocker.get3().countDown();
+
while (true) {
try {
blocker.get1().await();
[11/50] [abbrv] ignite git commit: Reworked cluster
activation/deactivation.
Posted by vo...@apache.org.
Reworked cluster activation/deactivation.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1337901f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1337901f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1337901f
Branch: refs/heads/master
Commit: 1337901f04c866e20093b20449c0872f089fb64b
Parents: 54572c3
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 5 11:19:43 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 5 11:19:43 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/GridComponent.java | 4 +-
.../ignite/internal/GridPluginComponent.java | 2 +-
.../apache/ignite/internal/IgniteKernal.java | 33 +-
.../internal/managers/GridManagerAdapter.java | 2 +-
.../internal/managers/discovery/DiscoCache.java | 17 +-
.../discovery/DiscoveryLocalJoinData.java | 104 ++
.../discovery/GridDiscoveryManager.java | 128 +-
.../pagemem/store/IgnitePageStoreManager.java | 3 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../cache/CacheAffinitySharedManager.java | 67 +-
.../processors/cache/CacheGroupContext.java | 4 +-
.../processors/cache/CacheGroupData.java | 4 +-
.../cache/ChangeGlobalStateMessage.java | 120 --
.../processors/cache/ClusterCachesInfo.java | 490 +++++--
.../internal/processors/cache/ClusterState.java | 38 -
.../cache/DynamicCacheChangeRequest.java | 52 +-
.../processors/cache/ExchangeActions.java | 37 +-
.../processors/cache/GridCacheEventManager.java | 2 -
.../cache/GridCacheEvictionManager.java | 1 -
.../processors/cache/GridCacheIoManager.java | 13 +-
.../processors/cache/GridCacheMvccManager.java | 9 +-
.../GridCachePartitionExchangeManager.java | 423 +++---
.../processors/cache/GridCacheProcessor.java | 177 ++-
.../cache/GridCacheSharedContext.java | 60 +-
.../cache/GridCacheSharedManager.java | 6 -
.../cache/GridCacheSharedManagerAdapter.java | 16 -
.../processors/cache/PendingDiscoveryEvent.java | 61 +
.../processors/cache/StateChangeRequest.java | 77 ++
.../binary/CacheObjectBinaryProcessorImpl.java | 4 +-
.../distributed/GridCacheTxRecoveryFuture.java | 1 -
.../distributed/dht/GridDhtCacheAdapter.java | 1 -
.../cache/distributed/dht/GridDhtGetFuture.java | 1 -
.../distributed/dht/GridDhtGetSingleFuture.java | 2 -
.../dht/GridDhtPartitionTopologyImpl.java | 13 +-
.../dht/GridDhtTopologyFutureAdapter.java | 2 +-
.../dht/GridPartitionedSingleGetFuture.java | 3 -
.../GridNearAtomicAbstractUpdateFuture.java | 1 -
.../dht/preloader/GridDhtForceKeysFuture.java | 1 -
.../dht/preloader/GridDhtPartitionDemander.java | 2 +
.../GridDhtPartitionsExchangeFuture.java | 228 +++-
.../preloader/GridDhtPartitionsFullMessage.java | 44 +-
.../GridDhtPartitionsSingleMessage.java | 38 +-
.../dht/preloader/GridDhtPreloader.java | 2 +-
.../distributed/near/GridNearGetFuture.java | 2 -
.../near/GridNearTxPrepareRequest.java | 1 -
.../GridCacheDatabaseSharedManager.java | 105 +-
.../persistence/GridCacheOffheapManager.java | 5 +-
.../IgniteCacheDatabaseSharedManager.java | 64 +-
.../persistence/IgniteCacheSnapshotManager.java | 12 +-
.../persistence/file/FilePageStoreManager.java | 14 +-
.../wal/FileWriteAheadLogManager.java | 8 -
.../query/GridCacheDistributedQueryManager.java | 4 +-
.../store/GridCacheStoreManagerAdapter.java | 1 -
.../cache/version/GridCacheVersionManager.java | 6 -
.../cacheobject/IgniteCacheObjectProcessor.java | 5 -
.../IgniteCacheObjectProcessorImpl.java | 5 -
.../cluster/ChangeGlobalStateFinishMessage.java | 86 ++
.../cluster/ChangeGlobalStateMessage.java | 140 ++
.../processors/cluster/ClusterProcessor.java | 3 +-
.../cluster/DiscoveryDataClusterState.java | 157 +++
.../cluster/GridClusterStateProcessor.java | 1122 ++++++---------
.../cluster/IgniteChangeGlobalStateSupport.java | 3 +-
.../datastructures/DataStructuresProcessor.java | 6 +-
.../datastructures/GridCacheAtomicLongImpl.java | 2 +-
.../GridCacheAtomicReferenceImpl.java | 2 +-
.../GridCacheAtomicSequenceImpl.java | 2 +-
.../GridCacheAtomicStampedImpl.java | 2 +-
.../GridCacheCountDownLatchImpl.java | 2 +-
.../datastructures/GridCacheLockImpl.java | 4 +-
.../datastructures/GridCacheQueueAdapter.java | 1 -
.../datastructures/GridCacheSemaphoreImpl.java | 2 +-
.../datastructures/GridCacheSetImpl.java | 1 -
.../internal/processors/igfs/IgfsImpl.java | 2 -
.../internal/processors/igfs/IgfsProcessor.java | 2 +-
.../processors/query/GridQueryProcessor.java | 4 +-
.../processors/rest/GridRestProcessor.java | 2 +-
.../cluster/GridChangeStateCommandHandler.java | 2 +-
.../service/GridServiceProcessor.java | 6 +-
.../processors/task/GridTaskProcessor.java | 2 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 12 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 10 +-
.../internal/TestRecordingCommunicationSpi.java | 10 +
...GridManagerLocalMessageListenerSelfTest.java | 4 +-
.../cache/IgniteActiveClusterTest.java | 182 ---
.../IgniteClusterActivateDeactivateTest.java | 1284 ++++++++++++++++++
...erActivateDeactivateTestWithPersistence.java | 197 +++
.../IgniteDaemonNodeMarshallerCacheTest.java | 10 -
.../pagemem/NoOpPageStoreManager.java | 12 +-
.../persistence/pagemem/NoOpWALManager.java | 23 +-
.../AbstractNodeJoinTemplate.java | 149 +-
.../IgniteChangeGlobalStateAbstractTest.java | 65 +-
.../IgniteChangeGlobalStateCacheTest.java | 2 +-
...IgniteChangeGlobalStateDataStreamerTest.java | 5 +-
...gniteChangeGlobalStateDataStructureTest.java | 6 +-
.../IgniteChangeGlobalStateFailOverTest.java | 26 +-
.../IgniteChangeGlobalStateTest.java | 158 +--
.../IgniteStandByClusterTest.java | 17 +-
.../join/JoinActiveNodeToActiveCluster.java | 62 +-
...ctiveNodeToActiveClusterWithPersistence.java | 17 +
.../IgniteStandByClientReconnectTest.java | 13 +-
...eStandByClientReconnectToNewClusterTest.java | 13 +-
...cpCommunicationSpiMultithreadedSelfTest.java | 2 +-
.../testframework/junits/GridAbstractTest.java | 4 +-
.../junits/common/GridCommonAbstractTest.java | 3 +
.../testsuites/IgniteStandByClusterSuite.java | 5 +-
.../processors/hadoop/HadoopProcessor.java | 4 +-
106 files changed, 4180 insertions(+), 2197 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/GridComponent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridComponent.java b/modules/core/src/main/java/org/apache/ignite/internal/GridComponent.java
index 0505929..93ffe95 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridComponent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridComponent.java
@@ -84,9 +84,11 @@ public interface GridComponent {
* Callback that notifies that kernal has successfully started,
* including all managers and processors.
*
+ * @param active Cluster active flag (note: should be used carefully since state can
+ * change concurrently).
* @throws IgniteCheckedException Thrown in case of any errors.
*/
- public void onKernalStart() throws IgniteCheckedException;
+ public void onKernalStart(boolean active) throws IgniteCheckedException;
/**
* Callback to notify that kernal is about to stop.
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/GridPluginComponent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridPluginComponent.java b/modules/core/src/main/java/org/apache/ignite/internal/GridPluginComponent.java
index cc1ae71..fd59d24 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridPluginComponent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridPluginComponent.java
@@ -61,7 +61,7 @@ public class GridPluginComponent implements GridComponent {
}
/** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
plugin.onIgniteStart();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 31ee3e2..0c17b32 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -98,6 +98,7 @@ import org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager;
import org.apache.ignite.internal.managers.collision.GridCollisionManager;
import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.deployment.GridDeploymentManager;
+import org.apache.ignite.internal.managers.discovery.DiscoveryLocalJoinData;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.managers.failover.GridFailoverManager;
@@ -207,7 +208,6 @@ import static org.apache.ignite.internal.IgniteComponentType.HADOOP_HELPER;
import static org.apache.ignite.internal.IgniteComponentType.IGFS;
import static org.apache.ignite.internal.IgniteComponentType.IGFS_HELPER;
import static org.apache.ignite.internal.IgniteComponentType.SCHEDULE;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_ACTIVE_ON_START;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_BUILD_DATE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_BUILD_VER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_CLIENT_MODE;
@@ -818,8 +818,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
List<PluginProvider> plugins = U.allPluginProviders();
- final boolean activeOnStart = cfg.isActiveOnStart();
-
// Spin out SPIs & managers.
try {
ctx = new GridKernalContextImpl(log,
@@ -994,11 +992,28 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
// Suggest Operation System optimizations.
ctx.performance().addAll(OsConfigurationSuggestions.getSuggestions());
+ DiscoveryLocalJoinData joinData = ctx.discovery().localJoin();
+
+ IgniteInternalFuture<Boolean> transitionWaitFut = joinData.transitionWaitFuture();
+
+ boolean active;
+
+ if (transitionWaitFut != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Join cluster while cluster state transition is in progress, " +
+ "waiting when transition finish.");
+ }
+
+ active = transitionWaitFut.get();
+ }
+ else
+ active = joinData.active();
+
// Notify discovery manager the first to make sure that topology is discovered.
- ctx.discovery().onKernalStart();
+ ctx.discovery().onKernalStart(active);
// Notify IO manager the second so further components can send and receive messages.
- ctx.io().onKernalStart();
+ ctx.io().onKernalStart(active);
// Start plugins.
for (PluginProvider provider : ctx.plugins().allProviders())
@@ -1021,7 +1036,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
if (!skipDaemon(comp)) {
try {
- comp.onKernalStart();
+ comp.onKernalStart(active);
}
catch (IgniteNeedReconnectException e) {
assert ctx.discovery().reconnectSupported();
@@ -1486,7 +1501,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
add(ATTR_MARSHALLER_USE_DFLT_SUID,
getBoolean(IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID, OptimizedMarshaller.USE_DFLT_SUID));
add(ATTR_LATE_AFFINITY_ASSIGNMENT, cfg.isLateAffinityAssignment());
- add(ATTR_ACTIVE_ON_START, cfg.isActiveOnStart());
if (cfg.getMarshaller() instanceof BinaryMarshaller) {
add(ATTR_MARSHALLER_COMPACT_FOOTER, cfg.getBinaryConfiguration() == null ?
@@ -3395,7 +3409,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
guard();
try {
- return context().state().active();
+ return context().state().publicApiActiveState();
}
finally {
unguard();
@@ -3694,10 +3708,11 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
* @throws IgniteException if cluster in inActive state
*/
private void checkClusterState() throws IgniteException {
- if (!ctx.state().active())
+ if (!ctx.state().publicApiActiveState()) {
throw new IgniteException("Can not perform the operation because the cluster is inactive. Note, that " +
"the cluster is considered inactive by default if Ignite Persistent Store is used to let all the nodes " +
"join the cluster. To activate the cluster call Ignite.activate(true).");
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
index 7dfeffb..a151eb5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/GridManagerAdapter.java
@@ -362,7 +362,7 @@ public abstract class GridManagerAdapter<T extends IgniteSpi> implements GridMan
}
/** {@inheritDoc} */
- @Override public final void onKernalStart() throws IgniteCheckedException {
+ @Override public final void onKernalStart(boolean active) throws IgniteCheckedException {
for (final IgniteSpi spi : spis) {
try {
spi.onContextInitialized(new IgniteSpiContext() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
index 2b3c4fc..4c1077b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
@@ -37,6 +38,9 @@ import org.jetbrains.annotations.Nullable;
*
*/
public class DiscoCache {
+ /** */
+ private final DiscoveryDataClusterState state;
+
/** Local node. */
private final ClusterNode loc;
@@ -78,6 +82,7 @@ public class DiscoCache {
private final Set<UUID> alives = new GridConcurrentHashSet<>();
/**
+ * @param state Current cluster state.
* @param loc Local node.
* @param rmtNodes Remote nodes.
* @param allNodes All nodes.
@@ -91,7 +96,9 @@ public class DiscoCache {
* @param nodeMap Node map.
* @param alives Alive nodes.
*/
- DiscoCache(ClusterNode loc,
+ DiscoCache(
+ DiscoveryDataClusterState state,
+ ClusterNode loc,
List<ClusterNode> rmtNodes,
List<ClusterNode> allNodes,
List<ClusterNode> srvNodes,
@@ -103,6 +110,7 @@ public class DiscoCache {
Map<Integer, List<ClusterNode>> cacheGrpAffNodes,
Map<UUID, ClusterNode> nodeMap,
Set<UUID> alives) {
+ this.state = state;
this.loc = loc;
this.rmtNodes = rmtNodes;
this.allNodes = allNodes;
@@ -117,6 +125,13 @@ public class DiscoCache {
this.alives.addAll(alives);
}
+ /**
+ * @return Current cluster state.
+ */
+ public DiscoveryDataClusterState state() {
+ return state;
+ }
+
/** @return Local node. */
public ClusterNode localNode() {
return loc;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryLocalJoinData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryLocalJoinData.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryLocalJoinData.java
new file mode 100644
index 0000000..a1f2aa7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoveryLocalJoinData.java
@@ -0,0 +1,104 @@
+/*
+ * 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.events.DiscoveryEvent;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Information about local join event.
+ */
+public class DiscoveryLocalJoinData {
+ /** */
+ private final DiscoveryEvent evt;
+
+ /** */
+ private final DiscoCache discoCache;
+
+ /** */
+ private final AffinityTopologyVersion joinTopVer;
+
+ /** */
+ private final IgniteInternalFuture<Boolean> transitionWaitFut;
+
+ /** */
+ private final boolean active;
+
+ /**
+ * @param evt Event.
+ * @param discoCache Discovery data cache.
+ * @param transitionWaitFut Future if cluster state transition is in progress.
+ * @param active Cluster active status.
+ */
+ public DiscoveryLocalJoinData(DiscoveryEvent evt,
+ DiscoCache discoCache,
+ @Nullable IgniteInternalFuture<Boolean> transitionWaitFut,
+ boolean active) {
+ assert evt != null && evt.topologyVersion() > 0 : evt;
+
+ this.evt = evt;
+ this.discoCache = discoCache;
+ this.transitionWaitFut = transitionWaitFut;
+ this.active = active;
+
+ joinTopVer = new AffinityTopologyVersion(evt.topologyVersion(), 0);
+ }
+
+ /**
+ * @return Future if cluster state transition is in progress.
+ */
+ @Nullable public IgniteInternalFuture<Boolean> transitionWaitFuture() {
+ return transitionWaitFut;
+ }
+
+ /**
+ * @return Cluster state.
+ */
+ public boolean active() {
+ return active;
+ }
+
+ /**
+ * @return Event.
+ */
+ public DiscoveryEvent event() {
+ return evt;
+ }
+
+ /**
+ * @return Discovery data cache.
+ */
+ public DiscoCache discoCache() {
+ return discoCache;
+ }
+
+ /**
+ * @return Join topology version.
+ */
+ public AffinityTopologyVersion joinTopologyVersion() {
+ return joinTopVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DiscoveryLocalJoinData.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/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 c38e37a..9f5bd3f 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
@@ -75,8 +75,11 @@ import org.apache.ignite.internal.processors.cache.ClientCacheChangeDummyDiscove
import org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
-import org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage;
+import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
+import org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor;
import org.apache.ignite.internal.processors.jobmetrics.GridJobMetrics;
import org.apache.ignite.internal.processors.security.SecurityContext;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
@@ -90,7 +93,6 @@ import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.P1;
-import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -133,7 +135,6 @@ import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
import static org.apache.ignite.events.EventType.EVT_NODE_METRICS_UPDATED;
import static org.apache.ignite.events.EventType.EVT_NODE_SEGMENTED;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_ACTIVE_ON_START;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_LATE_AFFINITY_ASSIGNMENT;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
@@ -144,6 +145,7 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SECURITY_COMP
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SERVICES_COMPATIBILITY_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_USER_NAME;
import static org.apache.ignite.internal.IgniteVersionUtils.VER;
+import static org.apache.ignite.internal.events.DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT;
import static org.apache.ignite.internal.processors.security.SecurityUtils.SERVICE_PERMISSIONS_SINCE;
import static org.apache.ignite.internal.processors.security.SecurityUtils.isSecurityCompatibilityMode;
import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.NOOP;
@@ -238,7 +240,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
private long segChkFreq;
/** Local node join to topology event. */
- private GridFutureAdapter<T2<DiscoveryEvent, DiscoCache>> locJoin = new GridFutureAdapter<>();
+ private GridFutureAdapter<DiscoveryLocalJoinData> locJoin = new GridFutureAdapter<>();
/** GC CPU load. */
private volatile double gcCpuLoad;
@@ -570,7 +572,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
if (type != EVT_NODE_SEGMENTED &&
type != EVT_CLIENT_NODE_DISCONNECTED &&
type != EVT_CLIENT_NODE_RECONNECTED &&
- type != DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT) {
+ type != EVT_DISCOVERY_CUSTOM_EVT) {
minorTopVer = 0;
verChanged = true;
@@ -586,15 +588,50 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
updateClientNodes(node.id());
}
+ DiscoCache discoCache = null;
+
+ boolean locJoinEvt = type == EVT_NODE_JOINED && node.id().equals(locNode.id());
+
+ IgniteInternalFuture<Boolean> transitionWaitFut = null;
+
+ ChangeGlobalStateFinishMessage stateFinishMsg = null;
+
+ if (locJoinEvt) {
+ discoCache = createDiscoCache(ctx.state().clusterState(), locNode, topSnapshot);
+
+ transitionWaitFut = ctx.state().onLocalJoin(discoCache);
+ }
+ else if (type == EVT_NODE_FAILED || type == EVT_NODE_LEFT)
+ stateFinishMsg = ctx.state().onNodeLeft(node);
+
final AffinityTopologyVersion nextTopVer;
- if (type == DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT) {
+ if (type == EVT_DISCOVERY_CUSTOM_EVT) {
assert customMsg != null;
- boolean incMinorTopVer = ctx.cache().onCustomEvent(
- customMsg,
- new AffinityTopologyVersion(topVer, minorTopVer),
- node);
+ boolean incMinorTopVer;
+
+ if (customMsg instanceof ChangeGlobalStateMessage) {
+ incMinorTopVer = ctx.state().onStateChangeMessage(
+ new AffinityTopologyVersion(topVer, minorTopVer),
+ (ChangeGlobalStateMessage)customMsg,
+ discoCache());
+ }
+ else if (customMsg instanceof ChangeGlobalStateFinishMessage) {
+ ctx.state().onStateFinishMessage((ChangeGlobalStateFinishMessage)customMsg);
+
+ discoCache = createDiscoCache(ctx.state().clusterState(), locNode, topSnapshot);
+
+ topSnap.set(new Snapshot(topSnap.get().topVer, discoCache));
+
+ incMinorTopVer = false;
+ }
+ else {
+ incMinorTopVer = ctx.cache().onCustomEvent(
+ customMsg,
+ new AffinityTopologyVersion(topVer, minorTopVer),
+ node);
+ }
if (incMinorTopVer) {
minorTopVer++;
@@ -603,17 +640,13 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
nextTopVer = new AffinityTopologyVersion(topVer, minorTopVer);
-
- if (verChanged)
- ctx.cache().onDiscoveryEvent(type, node, nextTopVer);
}
- else {
+ else
nextTopVer = new AffinityTopologyVersion(topVer, minorTopVer);
- ctx.cache().onDiscoveryEvent(type, node, nextTopVer);
- }
+ ctx.cache().onDiscoveryEvent(type, customMsg, node, nextTopVer, ctx.state().clusterState());
- if (type == DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT) {
+ if (type == EVT_DISCOVERY_CUSTOM_EVT) {
for (Class cls = customMsg.getClass(); cls != null; cls = cls.getSuperclass()) {
List<CustomEventListener<DiscoveryCustomMessage>> list = customEvtLsnrs.get(cls);
@@ -630,13 +663,12 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
}
- final DiscoCache discoCache;
-
// Put topology snapshot into discovery history.
// There is no race possible between history maintenance and concurrent discovery
// event notifications, since SPI notifies manager about all events from this listener.
if (verChanged) {
- discoCache = createDiscoCache(locNode, topSnapshot);
+ if (discoCache == null)
+ discoCache = createDiscoCache(ctx.state().clusterState(), locNode, topSnapshot);
discoCacheHist.put(nextTopVer, discoCache);
@@ -650,8 +682,10 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
// Current version.
discoCache = discoCache();
+ final DiscoCache discoCache0 = discoCache;
+
// If this is a local join event, just save it and do not notify listeners.
- if (type == EVT_NODE_JOINED && node.id().equals(locNode.id())) {
+ if (locJoinEvt) {
if (gridStartTime == 0)
gridStartTime = getSpi().getGridStartTime();
@@ -668,7 +702,15 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
discoEvt.topologySnapshot(topVer, new ArrayList<>(F.view(topSnapshot, FILTER_DAEMON)));
- locJoin.onDone(new T2<>(discoEvt, discoCache));
+ discoWrk.discoCache = discoCache;
+
+ if (!isLocDaemon && !ctx.clientDisconnected())
+ ctx.cache().context().exchange().onLocalJoin(discoEvt, discoCache);
+
+ locJoin.onDone(new DiscoveryLocalJoinData(discoEvt,
+ discoCache,
+ transitionWaitFut,
+ ctx.state().clusterState().active()));
return;
}
@@ -697,7 +739,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
topHist.clear();
topSnap.set(new Snapshot(AffinityTopologyVersion.ZERO,
- createDiscoCache(locNode, Collections.<ClusterNode>emptySet())));
+ createDiscoCache(ctx.state().clusterState(), locNode, Collections.<ClusterNode>emptySet())));
}
else if (type == EVT_CLIENT_NODE_RECONNECTED) {
assert locNode.isClient() : locNode;
@@ -709,12 +751,14 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
((IgniteKernal)ctx.grid()).onReconnected(clusterRestarted);
+ ctx.cache().context().exchange().onLocalJoin(localJoinEvent(), discoCache);
+
ctx.cluster().clientReconnectFuture().listen(new CI1<IgniteFuture<?>>() {
@Override public void apply(IgniteFuture<?> fut) {
try {
fut.get();
- discoWrk.addEvent(type, nextTopVer, node, discoCache, topSnapshot, null);
+ discoWrk.addEvent(type, nextTopVer, node, discoCache0, topSnapshot, null);
}
catch (IgniteException ignore) {
// No-op.
@@ -727,6 +771,9 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
if (type == EVT_CLIENT_NODE_DISCONNECTED || type == EVT_NODE_SEGMENTED || !ctx.clientDisconnected())
discoWrk.addEvent(type, nextTopVer, node, discoCache, topSnapshot, customMsg);
+
+ if (stateFinishMsg != null)
+ discoWrk.addEvent(EVT_DISCOVERY_CUSTOM_EVT, nextTopVer, node, discoCache, topSnapshot, stateFinishMsg);
}
});
@@ -826,7 +873,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
* @return {@code True} if should not process message.
*/
private boolean skipMessage(int type, @Nullable DiscoveryCustomMessage customMsg) {
- if (type == DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT) {
+ if (type == EVT_DISCOVERY_CUSTOM_EVT) {
assert customMsg != null && customMsg.id() != null : customMsg;
if (rcvdCustomMsgs.contains(customMsg.id())) {
@@ -1157,7 +1204,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
locMarshStrSerVer2;
boolean locDelayAssign = locNode.attribute(ATTR_LATE_AFFINITY_ASSIGNMENT);
- boolean locActiveOnStart = locNode.attribute(ATTR_ACTIVE_ON_START);
Boolean locSrvcCompatibilityEnabled = locNode.attribute(ATTR_SERVICES_COMPATIBILITY_MODE);
Boolean locSecurityCompatibilityEnabled = locNode.attribute(ATTR_SECURITY_COMPATIBILITY_MODE);
@@ -1971,7 +2017,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
/** @return Event that represents a local node joined to topology. */
public DiscoveryEvent localJoinEvent() {
try {
- return locJoin.get().get1();
+ return locJoin.get().event();
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
@@ -1981,7 +2027,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
/**
* @return Tuple that consists of a local join event and discovery cache at the join time.
*/
- public T2<DiscoveryEvent, DiscoCache> localJoin() {
+ public DiscoveryLocalJoinData localJoin() {
try {
return locJoin.get();
}
@@ -2016,7 +2062,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
public void clientCacheStartEvent(UUID reqId,
@Nullable Map<String, DynamicCacheChangeRequest> startReqs,
@Nullable Set<String> cachesToClose) {
- discoWrk.addEvent(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT,
+ discoWrk.addEvent(EVT_DISCOVERY_CUSTOM_EVT,
AffinityTopologyVersion.NONE,
localNode(),
null,
@@ -2098,11 +2144,14 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
/**
* Called from discovery thread.
*
+ * @param state Current state.
* @param loc Local node.
* @param topSnapshot Topology snapshot.
* @return Newly created discovery cache.
*/
- @NotNull private DiscoCache createDiscoCache(ClusterNode loc, Collection<ClusterNode> topSnapshot) {
+ @NotNull private DiscoCache createDiscoCache(DiscoveryDataClusterState state,
+ ClusterNode loc,
+ Collection<ClusterNode> topSnapshot) {
HashSet<UUID> alives = U.newHashSet(topSnapshot.size());
HashMap<UUID, ClusterNode> nodeMap = U.newHashMap(topSnapshot.size());
@@ -2177,6 +2226,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
return new DiscoCache(
+ state,
loc,
Collections.unmodifiableList(rmtNodes),
Collections.unmodifiableList(allNodes),
@@ -2318,7 +2368,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
discoWrk.addEvent(EVT_NODE_SEGMENTED,
AffinityTopologyVersion.NONE,
node,
- createDiscoCache(node, empty),
+ createDiscoCache(null, node, empty),
empty,
null);
@@ -2339,6 +2389,9 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
/** Worker for discovery events. */
private class DiscoveryWorker extends GridWorker {
+ /** */
+ private DiscoCache discoCache;
+
/** Event queue. */
private final BlockingQueue<GridTuple6<Integer, AffinityTopologyVersion, ClusterNode,
DiscoCache, Collection<ClusterNode>, DiscoveryCustomMessage>> evts = new LinkedBlockingQueue<>();
@@ -2457,6 +2510,9 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
boolean segmented = false;
+ if (evt.get4() != null)
+ discoCache = evt.get4();
+
switch (type) {
case EVT_NODE_JOINED: {
assert !discoOrdered || topVer.topologyVersion() == node.order() : "Invalid topology version [topVer=" + topVer +
@@ -2570,8 +2626,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
break;
}
- case DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT: {
- if (ctx.event().isRecordable(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT)) {
+ case EVT_DISCOVERY_CUSTOM_EVT: {
+ if (ctx.event().isRecordable(EVT_DISCOVERY_CUSTOM_EVT)) {
DiscoveryCustomEvent customEvt = new DiscoveryCustomEvent();
customEvt.node(ctx.discovery().localNode());
@@ -2581,6 +2637,12 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
customEvt.affinityTopologyVersion(topVer);
customEvt.customMessage(evt.get6());
+ if (evt.get4() == null) {
+ assert discoCache != null : evt.get6();
+
+ evt.set4(discoCache);
+ }
+
ctx.event().record(customEvt, evt.get4());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/IgnitePageStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/IgnitePageStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/IgnitePageStoreManager.java
index 468d35d..fa6e9e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/IgnitePageStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/store/IgnitePageStoreManager.java
@@ -183,11 +183,10 @@ public interface IgnitePageStoreManager extends GridCacheSharedManager, IgniteCh
public Map<String, StoredCacheData> readCacheConfigurations() throws IgniteCheckedException;
/**
- * @param grpDesc Cache group descriptor.
* @param cacheData Cache configuration.
* @throws IgniteCheckedException If failed.
*/
- public void storeCacheData(CacheGroupDescriptor grpDesc, StoredCacheData cacheData) throws IgniteCheckedException;
+ public void storeCacheData(StoredCacheData cacheData) throws IgniteCheckedException;
/**
* @param grpId Cache group ID.
* @return {@code True} if index store for given cache group existed before node started.
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
index 690ba0e..d6f78ab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
@@ -65,7 +65,7 @@ public abstract class GridProcessorAdapter implements GridProcessor {
}
/** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index 9516f84..8d08c3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -41,6 +41,7 @@ import org.apache.ignite.events.Event;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
import org.apache.ignite.internal.managers.discovery.DiscoCache;
+import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache;
@@ -52,6 +53,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartit
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
+import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -108,6 +111,9 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
/** */
private final ThreadLocal<ClientCacheChangeDiscoveryMessage> clientCacheChanges = new ThreadLocal<>();
+ /** Caches initialized flag (initialized when join activate cluster or after activation. */
+ private boolean cachesInitialized;
+
/** Discovery listener. */
private final GridLocalEventListener discoLsnr = new GridLocalEventListener() {
@Override public void onEvent(Event evt) {
@@ -140,10 +146,19 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* Callback invoked from discovery thread when discovery message is received.
*
* @param type Event type.
+ * @param customMsg Custom message instance.
* @param node Event node.
* @param topVer Topology version.
+ * @param state Cluster state.
*/
- void onDiscoveryEvent(int type, ClusterNode node, AffinityTopologyVersion topVer) {
+ void onDiscoveryEvent(int type,
+ @Nullable DiscoveryCustomMessage customMsg,
+ ClusterNode node,
+ AffinityTopologyVersion topVer,
+ DiscoveryDataClusterState state) {
+ if (state.transition() || !state.active())
+ return;
+
if (type == EVT_NODE_JOINED && node.isLocal()) {
// Clean-up in case of client reconnect.
caches.clear();
@@ -153,6 +168,15 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
lastAffVer = null;
caches.init(cctx.cache().cacheGroupDescriptors(), cctx.cache().cacheDescriptors());
+
+ cachesInitialized = true;
+ }
+ else if (customMsg instanceof ChangeGlobalStateFinishMessage) {
+ if (!cachesInitialized && ((ChangeGlobalStateFinishMessage)customMsg).clusterActive()) {
+ caches.init(cctx.cache().cacheGroupDescriptors(), cctx.cache().cacheDescriptors());
+
+ cachesInitialized = true;
+ }
}
if (!CU.clientNode(node) && (type == EVT_NODE_FAILED || type == EVT_NODE_JOINED || type == EVT_NODE_LEFT)) {
@@ -404,7 +428,10 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
DynamicCacheChangeRequest startReq = startReqs.get(desc.cacheName());
- cctx.cache().prepareCacheStart(desc, startReq.nearCacheConfiguration(), topVer);
+ cctx.cache().prepareCacheStart(desc.cacheConfiguration(),
+ desc,
+ startReq.nearCacheConfiguration(),
+ topVer);
startedInfos.put(desc.cacheId(), startReq.nearCacheConfiguration() != null);
@@ -683,19 +710,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
NearCacheConfiguration nearCfg = null;
- if (exchActions.newClusterState() == ClusterState.ACTIVE) {
- if (CU.isSystemCache(req.cacheName()))
- startCache = true;
- else if (!cctx.localNode().isClient()) {
- startCache = cctx.cacheContext(action.descriptor().cacheId()) == null &&
- CU.affinityNode(cctx.localNode(), req.startCacheConfiguration().getNodeFilter());
-
- nearCfg = req.nearCacheConfiguration();
- }
- else // Only static cache configured on client must be started.
- startCache = cctx.kernalContext().state().isLocallyConfigured(req.cacheName());
- }
- else if (cctx.localNodeId().equals(req.initiatingNodeId())) {
+ if (req.locallyConfigured() || (cctx.localNodeId().equals(req.initiatingNodeId()) && !exchActions.activate())) {
startCache = true;
nearCfg = req.nearCacheConfiguration();
@@ -703,7 +718,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
else {
// Cache should not be started
assert cctx.cacheContext(cacheDesc.cacheId()) == null
- : "Starting cache has not null context: " + cacheDesc.cacheName();
+ : "Starting cache has not null context: " + cacheDesc.cacheName();
IgniteCacheProxy cacheProxy = cctx.cache().jcacheProxy(req.cacheName());
@@ -711,27 +726,29 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
if (cacheProxy != null) {
// Cache should be in restarting mode
assert cacheProxy.isRestarting()
- : "Cache has non restarting proxy " + cacheProxy;
+ : "Cache has non restarting proxy " + cacheProxy;
startCache = true;
}
- else
- startCache = CU.affinityNode(cctx.localNode(), cacheDesc.groupDescriptor().config().getNodeFilter());
+ else {
+ startCache = CU.affinityNode(cctx.localNode(),
+ cacheDesc.groupDescriptor().config().getNodeFilter());
+ }
}
try {
// Save configuration before cache started.
- if (cctx.pageStore() != null && !cctx.localNode().isClient())
+ if (cctx.pageStore() != null && !cctx.kernalContext().clientNode()) {
cctx.pageStore().storeCacheData(
- cacheDesc.groupDescriptor(),
new StoredCacheData(req.startCacheConfiguration())
);
+ }
if (startCache) {
- cctx.cache().prepareCacheStart(cacheDesc, nearCfg, fut.topologyVersion());
-
- if (exchActions.newClusterState() == null)
- cctx.kernalContext().state().onCacheStart(req);
+ cctx.cache().prepareCacheStart(req.startCacheConfiguration(),
+ cacheDesc,
+ nearCfg,
+ fut.topologyVersion());
if (fut.cacheAddedOnExchange(cacheDesc.cacheId(), cacheDesc.receivedFrom())) {
if (fut.discoCache().cacheGroupAffinityNodes(cacheDesc.groupId()).isEmpty())
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
index c3ddc5f..14eb362 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
@@ -683,6 +683,8 @@ public class CacheGroupContext {
aff.cancelFutures(err);
+ preldr.onKernalStop();
+
offheapMgr.stop();
ctx.io().removeCacheGroupHandlers(grpId);
@@ -853,8 +855,6 @@ public class CacheGroupContext {
preldr = new GridCachePreloaderAdapter(this);
if (ctx.kernalContext().config().getPersistentStoreConfiguration() != null) {
- ClassLoader clsLdr = U.gridClassLoader();
-
try {
offheapMgr = new GridCacheOffheapManager();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
index a290caf..99b7b1e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
@@ -78,8 +78,8 @@ public class CacheGroupData implements Serializable {
Map<String, Integer> caches,
long flags) {
assert cacheCfg != null;
- assert grpId != 0;
- assert deploymentId != null;
+ assert grpId != 0 : cacheCfg.getName();
+ assert deploymentId != null : cacheCfg.getName();
this.cacheCfg = cacheCfg;
this.grpName = grpName;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ChangeGlobalStateMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ChangeGlobalStateMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ChangeGlobalStateMessage.java
deleted file mode 100644
index 4d1a50b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ChangeGlobalStateMessage.java
+++ /dev/null
@@ -1,120 +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 java.util.UUID;
-import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteUuid;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Message represent request for change cluster global state.
- */
-public class ChangeGlobalStateMessage implements DiscoveryCustomMessage {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Custom message ID. */
- private IgniteUuid id = IgniteUuid.randomUuid();
-
- /** Request ID */
- private UUID requestId;
-
- /** Initiator node ID. */
- private UUID initiatingNodeId;
-
- /** If true activate else deactivate. */
- private boolean activate;
-
- /** Batch contains all requests for start or stop caches. */
- private DynamicCacheChangeBatch changeGlobalStateBatch;
-
- /** If happened concurrent activate/deactivate then processed only first message, other message must be skip. */
- private boolean concurrentChangeState;
-
- /**
- *
- */
- public ChangeGlobalStateMessage(
- UUID requestId,
- UUID initiatingNodeId,
- boolean activate,
- DynamicCacheChangeBatch changeGlobalStateBatch
- ) {
- this.requestId = requestId;
- this.initiatingNodeId = initiatingNodeId;
- this.activate = activate;
- this.changeGlobalStateBatch = changeGlobalStateBatch;
- }
-
- /**
- *
- */
- public DynamicCacheChangeBatch getDynamicCacheChangeBatch() {
- return changeGlobalStateBatch;
- }
-
- /** {@inheritDoc} */
- @Override public IgniteUuid id() {
- return id;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public DiscoveryCustomMessage ackMessage() {
- return !concurrentChangeState ? changeGlobalStateBatch : null;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isMutable() {
- return false;
- }
-
- /**
- *
- */
- public UUID initiatorNodeId() {
- return initiatingNodeId;
- }
-
- /**
- *
- */
- public boolean activate() {
- return activate;
- }
-
- /**
- *
- */
- public UUID requestId() {
- return requestId;
- }
-
- /**
- *
- */
- public void concurrentChangeState() {
- this.concurrentChangeState = true;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(ChangeGlobalStateMessage.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index 8f124b2..5452bd2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -40,6 +40,9 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage;
+import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
import org.apache.ignite.internal.processors.query.QuerySchema;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
@@ -93,10 +96,13 @@ class ClusterCachesInfo {
private List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> locJoinStartCaches;
/** */
- private Map<UUID, CacheClientReconnectDiscoveryData> clientReconnectReqs;
+ private Map<String, T2<CacheConfiguration, NearCacheConfiguration>> locCfgsForActivation;
/** */
- private volatile Exception onJoinCacheException;
+ private Map<UUID, CacheClientReconnectDiscoveryData> clientReconnectReqs;
+
+ /** {@code True} if joined cluster while cluster state change was in progress. */
+ private boolean joinOnTransition;
/**
* @param ctx Context.
@@ -113,14 +119,25 @@ class ClusterCachesInfo {
*/
void onStart(CacheJoinNodeDiscoveryData joinDiscoData) throws IgniteCheckedException {
this.joinDiscoData = joinDiscoData;
- }
- /**
- *
- * @return Exception if cache has conflict.
- */
- Exception onJoinCacheException(){
- return onJoinCacheException;
+ Map<String, CacheConfiguration> grpCfgs = new HashMap<>();
+
+ for (CacheJoinNodeDiscoveryData.CacheInfo info : joinDiscoData.caches().values()) {
+ if (info.cacheData().config().getGroupName() == null)
+ continue;
+
+ CacheConfiguration ccfg = grpCfgs.get(info.cacheData().config().getGroupName());
+
+ if (ccfg == null)
+ grpCfgs.put(info.cacheData().config().getGroupName(), info.cacheData().config());
+ else
+ validateCacheGroupConfiguration(ccfg, info.cacheData().config());
+ }
+
+ String conflictErr = processJoiningNode(joinDiscoData, ctx.localNodeId(), true);
+
+ if (conflictErr != null)
+ throw new IgniteCheckedException("Failed to start configured cache. " + conflictErr);
}
/**
@@ -142,7 +159,9 @@ class ClusterCachesInfo {
if (gridData != null && gridData.conflictErr != null)
throw new IgniteCheckedException(gridData.conflictErr);
- if (joinDiscoData != null && gridData != null) {
+ if (gridData != null && gridData.joinDiscoData != null) {
+ CacheJoinNodeDiscoveryData joinDiscoData = gridData.joinDiscoData;
+
for (CacheJoinNodeDiscoveryData.CacheInfo locCacheInfo : joinDiscoData.caches().values()) {
CacheConfiguration locCfg = locCacheInfo.cacheData().config();
@@ -165,9 +184,9 @@ class ClusterCachesInfo {
}
}
- joinDiscoData = null;
gridData = null;
}
+
/**
* Checks that remote caches has configuration compatible with the local.
*
@@ -308,22 +327,64 @@ class ClusterCachesInfo {
}
}
}
-
/**
* @param batch Cache change request.
* @param topVer Topology version.
* @return {@code True} if minor topology version should be increased.
*/
boolean onCacheChangeRequested(DynamicCacheChangeBatch batch, AffinityTopologyVersion topVer) {
- ExchangeActions exchangeActions = new ExchangeActions();
+ DiscoveryDataClusterState state = ctx.state().clusterState();
+
+ if (state.active() && !state.transition()) {
+ ExchangeActions exchangeActions = new ExchangeActions();
+
+ CacheChangeProcessResult res = processCacheChangeRequests(exchangeActions,
+ batch.requests(),
+ topVer,
+ false);
- boolean incMinorTopVer = false;
+ if (res.needExchange) {
+ assert !exchangeActions.empty() : exchangeActions;
- List<DynamicCacheDescriptor> addedDescs = new ArrayList<>();
+ batch.exchangeActions(exchangeActions);
+ }
+
+ return res.needExchange;
+ }
+ else {
+ IgniteCheckedException err = new IgniteCheckedException("Failed to start/stop cache, cluster state change " +
+ "is in progress.");
+
+ for (DynamicCacheChangeRequest req : batch.requests()) {
+ if (req.template()) {
+ ctx.cache().completeTemplateAddFuture(req.startCacheConfiguration().getName(),
+ req.deploymentId());
+ }
+ else
+ ctx.cache().completeCacheStartFuture(req, false, err);
+ }
+
+ return false;
+ }
+ }
+
+ /**
+ * @param exchangeActions Exchange actions to update.
+ * @param reqs Requests.
+ * @param topVer Topology version.
+ * @param persistedCfgs {@code True} if process start of persisted caches during cluster activation.
+ * @return Process result.
+ */
+ private CacheChangeProcessResult processCacheChangeRequests(
+ ExchangeActions exchangeActions,
+ Collection<DynamicCacheChangeRequest> reqs,
+ AffinityTopologyVersion topVer,
+ boolean persistedCfgs) {
+ CacheChangeProcessResult res = new CacheChangeProcessResult();
final List<T2<DynamicCacheChangeRequest, AffinityTopologyVersion>> reqsToComplete = new ArrayList<>();
- for (DynamicCacheChangeRequest req : batch.requests()) {
+ for (DynamicCacheChangeRequest req : reqs) {
if (req.template()) {
CacheConfiguration ccfg = req.startCacheConfiguration();
@@ -347,17 +408,18 @@ class ClusterCachesInfo {
assert old == null;
- addedDescs.add(templateDesc);
+ res.addedDescs.add(templateDesc);
}
- ctx.cache().completeTemplateAddFuture(ccfg.getName(), req.deploymentId());
+ if (!persistedCfgs)
+ ctx.cache().completeTemplateAddFuture(ccfg.getName(), req.deploymentId());
continue;
}
assert !req.clientStartOnly() : req;
- DynamicCacheDescriptor desc = req.globalStateChange() ? null : registeredCaches.get(req.cacheName());
+ DynamicCacheDescriptor desc = registeredCaches.get(req.cacheName());
boolean needExchange = false;
@@ -373,22 +435,32 @@ class ClusterCachesInfo {
if (conflictErr != null) {
U.warn(log, "Ignore cache start request. " + conflictErr);
- ctx.cache().completeCacheStartFuture(req, false, new IgniteCheckedException("Failed to start " +
- "cache. " + conflictErr));
+ IgniteCheckedException err = new IgniteCheckedException("Failed to start " +
+ "cache. " + conflictErr);
+
+ if (persistedCfgs)
+ res.errs.add(err);
+ else
+ ctx.cache().completeCacheStartFuture(req, false, err);
continue;
}
if (req.clientStartOnly()) {
+ assert !persistedCfgs;
+
ctx.cache().completeCacheStartFuture(req, false, new IgniteCheckedException("Failed to start " +
"client cache (a cache with the given name is not started): " + req.cacheName()));
}
else {
SchemaOperationException err = QueryUtils.checkQueryEntityConflicts(
- req.startCacheConfiguration(), ctx.cache().cacheDescriptors().values());
+ req.startCacheConfiguration(), registeredCaches.values());
if (err != null) {
- ctx.cache().completeCacheStartFuture(req, false, err);
+ if (persistedCfgs)
+ res.errs.add(err);
+ else
+ ctx.cache().completeCacheStartFuture(req, false, err);
continue;
}
@@ -430,11 +502,13 @@ class ClusterCachesInfo {
ccfg.getName(),
ccfg.getNearConfiguration() != null);
- ctx.discovery().addClientNode(req.cacheName(),
- req.initiatingNodeId(),
- req.nearCacheConfiguration() != null);
+ if (!persistedCfgs) {
+ ctx.discovery().addClientNode(req.cacheName(),
+ req.initiatingNodeId(),
+ req.nearCacheConfiguration() != null);
+ }
- addedDescs.add(startDesc);
+ res.addedDescs.add(startDesc);
exchangeActions.addCacheToStart(req, startDesc);
@@ -442,6 +516,7 @@ class ClusterCachesInfo {
}
}
else {
+ assert !persistedCfgs;
assert req.initiatingNodeId() != null : req;
if (req.failIfExists()) {
@@ -489,8 +564,6 @@ class ClusterCachesInfo {
}
}
}
- else if (req.globalStateChange())
- exchangeActions.newClusterState(req.state());
else if (req.resetLostPartitions()) {
if (desc != null) {
needExchange = true;
@@ -559,18 +632,18 @@ class ClusterCachesInfo {
assert false : req;
if (!needExchange) {
- if (!clientCacheStart && req.initiatingNodeId().equals(ctx.localNodeId()))
+ if (!clientCacheStart && ctx.localNodeId().equals(req.initiatingNodeId()))
reqsToComplete.add(new T2<>(req, waitTopVer));
}
else
- incMinorTopVer = true;
+ res.needExchange = true;
}
- if (!F.isEmpty(addedDescs)) {
- AffinityTopologyVersion startTopVer = incMinorTopVer ? topVer.nextMinorVersion() : topVer;
+ if (!F.isEmpty(res.addedDescs)) {
+ AffinityTopologyVersion startTopVer = res.needExchange ? topVer.nextMinorVersion() : topVer;
- for (DynamicCacheDescriptor desc : addedDescs) {
- assert desc.template() || incMinorTopVer;
+ for (DynamicCacheDescriptor desc : res.addedDescs) {
+ assert desc.template() || res.needExchange;
desc.startTopologyVersion(startTopVer);
}
@@ -602,13 +675,7 @@ class ClusterCachesInfo {
});
}
- if (incMinorTopVer) {
- assert !exchangeActions.empty() : exchangeActions;
-
- batch.exchangeActions(exchangeActions);
- }
-
- return incMinorTopVer;
+ return res;
}
/**
@@ -669,7 +736,7 @@ class ClusterCachesInfo {
return new CacheClientReconnectDiscoveryData(cacheGrpsInfo, cachesInfo);
}
else {
- assert ctx.config().isDaemon() || joinDiscoData != null || !ctx.state().active();
+ assert ctx.config().isDaemon() || joinDiscoData != null;
return joinDiscoData;
}
@@ -720,31 +787,6 @@ class ClusterCachesInfo {
return started != null ? started : Collections.<DynamicCacheDescriptor>emptyList();
}
- public void addJoinInfo() {
- try {
- Map<String, CacheConfiguration> grpCfgs = new HashMap<>();
-
- for (CacheJoinNodeDiscoveryData.CacheInfo info : joinDiscoData.caches().values()) {
- if (info.cacheData().config().getGroupName() == null)
- continue;
-
- CacheConfiguration ccfg = grpCfgs.get(info.cacheData().config().getGroupName());
-
- if (ccfg == null)
- grpCfgs.put(info.cacheData().config().getGroupName(), info.cacheData().config());
- else
- validateCacheGroupConfiguration(ccfg, info.cacheData().config());
- }
-
- String conflictErr = processJoiningNode(joinDiscoData, ctx.localNodeId(), true);
-
- if (conflictErr != null)
- onJoinCacheException = new IgniteCheckedException("Failed to start configured cache. " + conflictErr);
- }catch (IgniteCheckedException e){
- onJoinCacheException = e;
- }
- }
-
/**
* Discovery event callback, executed from discovery thread.
*
@@ -771,10 +813,7 @@ class ClusterCachesInfo {
if (node.id().equals(ctx.discovery().localNode().id())) {
if (gridData == null) { // First node starts.
- assert joinDiscoData != null || !ctx.state().active();
-
- if (ctx.state().active())
- addJoinInfo();
+ assert joinDiscoData != null;
initStartCachesForLocalJoin(true);
}
@@ -864,7 +903,7 @@ class ClusterCachesInfo {
if (ctx.isDaemon() || data.commonData() == null)
return;
- assert joinDiscoData != null || disconnectedState() || !ctx.state().active();
+ assert joinDiscoData != null || disconnectedState();
assert data.commonData() instanceof CacheNodeCommonDiscoveryData : data;
CacheNodeCommonDiscoveryData cachesData = (CacheNodeCommonDiscoveryData)data.commonData();
@@ -965,7 +1004,7 @@ class ClusterCachesInfo {
}
}
- gridData = new GridData(cachesData, conflictErr);
+ gridData = new GridData(joinDiscoData, cachesData, conflictErr);
if (!disconnectedState())
initStartCachesForLocalJoin(false);
@@ -977,11 +1016,20 @@ class ClusterCachesInfo {
* @param firstNode {@code True} if first node in cluster starts.
*/
private void initStartCachesForLocalJoin(boolean firstNode) {
- assert locJoinStartCaches == null;
+ assert F.isEmpty(locJoinStartCaches) : locJoinStartCaches;
+
+ if (ctx.state().clusterState().transition()) {
+ joinOnTransition = true;
- locJoinStartCaches = new ArrayList<>();
+ return;
+ }
if (joinDiscoData != null) {
+ locJoinStartCaches = new ArrayList<>();
+ locCfgsForActivation = new HashMap<>();
+
+ boolean active = ctx.state().clusterState().active();
+
for (DynamicCacheDescriptor desc : registeredCaches.values()) {
if (firstNode && !joinDiscoData.caches().containsKey(desc.cacheName()))
continue;
@@ -997,13 +1045,13 @@ class ClusterCachesInfo {
DynamicCacheDescriptor desc0 = new DynamicCacheDescriptor(ctx,
locCfg.cacheData().config(),
- desc.cacheType(),
- desc.groupDescriptor(),
- desc.template(),
- desc.receivedFrom(),
- desc.staticallyConfigured(),
- desc.sql(),
- desc.deploymentId(),
+ desc.cacheType(),
+ desc.groupDescriptor(),
+ desc.template(),
+ desc.receivedFrom(),
+ desc.staticallyConfigured(),
+ desc.sql(),
+ desc.deploymentId(),
new QuerySchema(locCfg.cacheData().queryEntities()));
desc0.startTopologyVersion(desc.startTopologyVersion());
@@ -1016,14 +1064,126 @@ class ClusterCachesInfo {
if (locCfg != null ||
joinDiscoData.startCaches() ||
CU.affinityNode(ctx.discovery().localNode(), desc.groupDescriptor().config().getNodeFilter())) {
- // Move system and internal caches first.
- if (desc.cacheType().userCache())
- locJoinStartCaches.add(new T2<>(desc, nearCfg));
+ if (active) {
+ // Move system and internal caches first.
+ if (desc.cacheType().userCache())
+ locJoinStartCaches.add(new T2<>(desc, nearCfg));
+ else
+ locJoinStartCaches.add(0, new T2<>(desc, nearCfg));
+ }
else
- locJoinStartCaches.add(0, new T2<>(desc, nearCfg));
+ locCfgsForActivation.put(desc.cacheName(), new T2<>(desc.cacheConfiguration(), nearCfg));
+ }
+ }
+ }
+ }
+
+ /**
+ * @param msg Message.
+ */
+ void onStateChangeFinish(ChangeGlobalStateFinishMessage msg) {
+ if (joinOnTransition) {
+ initStartCachesForLocalJoin(false);
+
+ joinOnTransition = false;
+ }
+ }
+
+ /**
+ * @param msg Message.
+ * @param topVer Current topology version.
+ * @return Exchange action.
+ * @throws IgniteCheckedException If configuration validation failed.
+ */
+ ExchangeActions onStateChangeRequest(ChangeGlobalStateMessage msg, AffinityTopologyVersion topVer)
+ throws IgniteCheckedException {
+ ExchangeActions exchangeActions = new ExchangeActions();
+
+ if (msg.activate()) {
+ for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+ desc.startTopologyVersion(topVer);
+
+ T2<CacheConfiguration, NearCacheConfiguration> locCfg = !F.isEmpty(locCfgsForActivation) ?
+ locCfgsForActivation.get(desc.cacheName()) : null;
+
+ DynamicCacheChangeRequest req = new DynamicCacheChangeRequest(msg.requestId(),
+ desc.cacheName(),
+ msg.initiatorNodeId());
+
+ req.startCacheConfiguration(desc.cacheConfiguration());
+ req.cacheType(desc.cacheType());
+
+ if (locCfg != null) {
+ if (locCfg.get1() != null)
+ req.startCacheConfiguration(locCfg.get1());
+
+ req.nearCacheConfiguration(locCfg.get2());
+
+ req.locallyConfigured(true);
+ }
+
+ exchangeActions.addCacheToStart(req, desc);
+ }
+
+ for (CacheGroupDescriptor grpDesc : registeredCacheGroups().values())
+ exchangeActions.addCacheGroupToStart(grpDesc);
+
+ List<StoredCacheData> storedCfgs = msg.storedCacheConfigurations();
+
+ if (storedCfgs != null) {
+ List<DynamicCacheChangeRequest> reqs = new ArrayList<>();
+
+ IgniteUuid deplymentId = IgniteUuid.fromUuid(msg.requestId());
+
+ for (StoredCacheData storedCfg : storedCfgs) {
+ CacheConfiguration ccfg = storedCfg.config();
+
+ if (!registeredCaches.containsKey(ccfg.getName())) {
+ DynamicCacheChangeRequest req = new DynamicCacheChangeRequest(msg.requestId(),
+ ccfg.getName(),
+ msg.initiatorNodeId());
+
+ req.deploymentId(deplymentId);
+ req.startCacheConfiguration(ccfg);
+ req.cacheType(ctx.cache().cacheType(ccfg.getName()));
+ req.schema(new QuerySchema(storedCfg.queryEntities()));
+
+ reqs.add(req);
+ }
+ }
+
+ CacheChangeProcessResult res = processCacheChangeRequests(exchangeActions, reqs, topVer, true);
+
+ if (!res.errs.isEmpty()) {
+ IgniteCheckedException err = new IgniteCheckedException("Failed to activate cluster.");
+
+ for (IgniteCheckedException err0 : res.errs)
+ err.addSuppressed(err0);
+
+ throw err;
}
}
}
+ else {
+ locCfgsForActivation = new HashMap<>();
+
+ for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+ DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx,
+ desc.cacheName(),
+ desc.sql(),
+ false);
+
+ exchangeActions.addCacheToStop(req, desc);
+
+ if (ctx.discovery().cacheClientNode(ctx.discovery().localNode(), desc.cacheName()))
+ locCfgsForActivation.put(desc.cacheName(), new T2<>((CacheConfiguration)null, (NearCacheConfiguration)null));
+ }
+
+ for (CacheGroupDescriptor grpDesc : registeredCacheGroups().values())
+ exchangeActions.addCacheGroupToStop(grpDesc, false);
+ }
+
+ return exchangeActions;
}
/**
@@ -1053,16 +1213,20 @@ class ClusterCachesInfo {
* @param clientNodeId Client node ID.
*/
private void processClientReconnectData(CacheClientReconnectDiscoveryData clientData, UUID clientNodeId) {
- for (CacheClientReconnectDiscoveryData.CacheInfo cacheInfo : clientData.clientCaches().values()) {
- String cacheName = cacheInfo.config().getName();
+ DiscoveryDataClusterState state = ctx.state().clusterState();
+
+ if (state.active() && !state.transition()) {
+ for (CacheClientReconnectDiscoveryData.CacheInfo cacheInfo : clientData.clientCaches().values()) {
+ String cacheName = cacheInfo.config().getName();
- if (surviveReconnect(cacheName))
- ctx.discovery().addClientNode(cacheName, clientNodeId, false);
- else {
- DynamicCacheDescriptor desc = registeredCaches.get(cacheName);
+ if (surviveReconnect(cacheName))
+ ctx.discovery().addClientNode(cacheName, clientNodeId, false);
+ else {
+ DynamicCacheDescriptor desc = registeredCaches.get(cacheName);
- if (desc != null && desc.deploymentId().equals(cacheInfo.deploymentId()))
- ctx.discovery().addClientNode(cacheName, clientNodeId, cacheInfo.nearCache());
+ if (desc != null && desc.deploymentId().equals(cacheInfo.deploymentId()))
+ ctx.discovery().addClientNode(cacheName, clientNodeId, cacheInfo.nearCache());
+ }
}
}
}
@@ -1371,6 +1535,7 @@ class ClusterCachesInfo {
*/
void onDisconnect() {
cachesOnDisconnect = new CachesOnDisconnect(
+ ctx.state().clusterState(),
new HashMap<>(registeredCacheGrps),
new HashMap<>(registeredCaches));
@@ -1382,57 +1547,82 @@ class ClusterCachesInfo {
}
/**
+ * @param active {@code True} if reconnected to active cluster.
+ * @param transition {@code True} if reconnected while state transition in progress.
* @return Information about stopped caches and cache groups.
*/
- ClusterCachesReconnectResult onReconnected() {
+ ClusterCachesReconnectResult onReconnected(boolean active, boolean transition) {
assert disconnectedState();
Set<String> stoppedCaches = new HashSet<>();
Set<Integer> stoppedCacheGrps = new HashSet<>();
- for (Map.Entry<Integer, CacheGroupDescriptor> e : cachesOnDisconnect.cacheGrps.entrySet()) {
- CacheGroupDescriptor locDesc = e.getValue();
-
- CacheGroupDescriptor desc;
- boolean stopped = true;
+ if (!active) {
+ joinOnTransition = transition;
- if (locDesc.sharedGroup()) {
- desc = cacheGroupByName(locDesc.groupName());
+ if (F.isEmpty(locCfgsForActivation)) {
+ locCfgsForActivation = new HashMap<>();
- if (desc != null && desc.deploymentId().equals(locDesc.deploymentId()))
- stopped = false;
+ for (IgniteInternalCache cache : ctx.cache().caches()) {
+ locCfgsForActivation.put(cache.name(),
+ new T2<>((CacheConfiguration)null, cache.configuration().getNearConfiguration()));
+ }
}
- else {
- desc = nonSharedCacheGroupByCacheName(locDesc.config().getName());
- if (desc != null &&
- (surviveReconnect(locDesc.config().getName()) || desc.deploymentId().equals(locDesc.deploymentId())))
- stopped = false;
- }
+ for (Map.Entry<Integer, CacheGroupDescriptor> e : cachesOnDisconnect.cacheGrps.entrySet())
+ stoppedCacheGrps.add(e.getValue().groupId());
- if (stopped)
- stoppedCacheGrps.add(locDesc.groupId());
- else
- assert locDesc.groupId() == desc.groupId();
+ for (Map.Entry<String, DynamicCacheDescriptor> e : cachesOnDisconnect.caches.entrySet())
+ stoppedCaches.add(e.getKey());
}
+ else {
+ for (Map.Entry<Integer, CacheGroupDescriptor> e : cachesOnDisconnect.cacheGrps.entrySet()) {
+ CacheGroupDescriptor locDesc = e.getValue();
- for (Map.Entry<String, DynamicCacheDescriptor> e : cachesOnDisconnect.caches.entrySet()) {
- DynamicCacheDescriptor desc = e.getValue();
+ CacheGroupDescriptor desc;
+ boolean stopped = true;
- String cacheName = e.getKey();
+ if (locDesc.sharedGroup()) {
+ desc = cacheGroupByName(locDesc.groupName());
- boolean stopped;
+ if (desc != null && desc.deploymentId().equals(locDesc.deploymentId()))
+ stopped = false;
+ }
+ else {
+ desc = nonSharedCacheGroupByCacheName(locDesc.config().getName());
- if (!surviveReconnect(cacheName) || !ctx.state().active()) {
- DynamicCacheDescriptor newDesc = registeredCaches.get(cacheName);
+ if (desc != null &&
+ (surviveReconnect(locDesc.config().getName()) || desc.deploymentId().equals(locDesc.deploymentId())))
+ stopped = false;
+ }
- stopped = newDesc == null || !desc.deploymentId().equals(newDesc.deploymentId());
+ if (stopped)
+ stoppedCacheGrps.add(locDesc.groupId());
+ else
+ assert locDesc.groupId() == desc.groupId();
}
- else
- stopped = false;
- if (stopped)
- stoppedCaches.add(cacheName);
+ for (Map.Entry<String, DynamicCacheDescriptor> e : cachesOnDisconnect.caches.entrySet()) {
+ DynamicCacheDescriptor desc = e.getValue();
+
+ String cacheName = e.getKey();
+
+ boolean stopped;
+
+ if (!surviveReconnect(cacheName)) {
+ DynamicCacheDescriptor newDesc = registeredCaches.get(cacheName);
+
+ stopped = newDesc == null || !desc.deploymentId().equals(newDesc.deploymentId());
+ }
+ else
+ stopped = false;
+
+ if (stopped)
+ stoppedCaches.add(cacheName);
+ }
+
+ if (!cachesOnDisconnect.clusterActive())
+ initStartCachesForLocalJoin(false);
}
if (clientReconnectReqs != null) {
@@ -1450,7 +1640,7 @@ class ClusterCachesInfo {
/**
* @return {@code True} if client node is currently in disconnected state.
*/
- public boolean disconnectedState() {
+ private boolean disconnectedState() {
return cachesOnDisconnect != null;
}
@@ -1465,27 +1655,23 @@ class ClusterCachesInfo {
/**
*
*/
- void clearCaches() {
- registeredCacheGrps.clear();
-
- registeredCaches.clear();
- }
-
- /**
- *
- */
private static class GridData {
/** */
+ private final CacheJoinNodeDiscoveryData joinDiscoData;
+
+ /** */
private final CacheNodeCommonDiscoveryData gridData;
/** */
private final String conflictErr;
/**
+ * @param joinDiscoData Discovery data collected for local node join.
* @param gridData Grid data.
* @param conflictErr Cache configuration conflict error.
*/
- GridData(CacheNodeCommonDiscoveryData gridData, String conflictErr) {
+ GridData(CacheJoinNodeDiscoveryData joinDiscoData, CacheNodeCommonDiscoveryData gridData, String conflictErr) {
+ this.joinDiscoData = joinDiscoData;
this.gridData = gridData;
this.conflictErr = conflictErr;
}
@@ -1496,18 +1682,46 @@ class ClusterCachesInfo {
*/
private static class CachesOnDisconnect {
/** */
+ final DiscoveryDataClusterState state;
+
+ /** */
final Map<Integer, CacheGroupDescriptor> cacheGrps;
/** */
final Map<String, DynamicCacheDescriptor> caches;
/**
+ * @param state Cluster state.
* @param cacheGrps Cache groups.
* @param caches Caches.
*/
- CachesOnDisconnect(Map<Integer, CacheGroupDescriptor> cacheGrps, Map<String, DynamicCacheDescriptor> caches) {
+ CachesOnDisconnect(DiscoveryDataClusterState state,
+ Map<Integer, CacheGroupDescriptor> cacheGrps,
+ Map<String, DynamicCacheDescriptor> caches) {
+ this.state = state;
this.cacheGrps = cacheGrps;
this.caches = caches;
}
+
+ /**
+ * @return {@code True} if cluster was in active state.
+ */
+ boolean clusterActive() {
+ return state.active() && !state.transition();
+ }
+ }
+
+ /**
+ *
+ */
+ private static class CacheChangeProcessResult {
+ /** */
+ private boolean needExchange;
+
+ /** */
+ private final List<DynamicCacheDescriptor> addedDescs = new ArrayList<>();
+
+ /** */
+ private final List<IgniteCheckedException> errs = new ArrayList<>();
}
}
[45/50] [abbrv] ignite git commit: 2.1 Added test.
Posted by vo...@apache.org.
2.1 Added test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/64d6c98d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/64d6c98d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/64d6c98d
Branch: refs/heads/master
Commit: 64d6c98d88656132e89977806ca0e9152eb62427
Parents: 9c6a65e
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jul 6 15:55:21 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jul 6 15:55:21 2017 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheGroupsTest.java | 60 ++++++++++++++++++++
1 file changed, 60 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/64d6c98d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
index 7b420cc..d3269c3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
@@ -3631,6 +3631,66 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testDataCleanup() throws Exception {
+ Ignite node = startGrid(0);
+
+ IgniteCache cache0 = node.createCache(cacheConfiguration(GROUP1, "c0", PARTITIONED, ATOMIC, 1, false));
+
+ for (int i = 0; i < 100; i++)
+ assertNull(cache0.get(i));
+
+ for (int i = 0; i < 100; i++)
+ cache0.put(i, i);
+
+ List<CacheConfiguration> ccfgs = new ArrayList<>();
+
+ ccfgs.add(cacheConfiguration(GROUP1, "c1", PARTITIONED, ATOMIC, 1, false));
+ ccfgs.add(cacheConfiguration(GROUP1, "c1", PARTITIONED, ATOMIC, 1, true));
+ ccfgs.add(cacheConfiguration(GROUP1, "c1", PARTITIONED, TRANSACTIONAL, 1, false));
+ ccfgs.add(cacheConfiguration(GROUP1, "c1", PARTITIONED, TRANSACTIONAL, 1, true));
+
+ for (CacheConfiguration ccfg : ccfgs) {
+ IgniteCache cache = node.createCache(ccfg);
+
+ for (int i = 0; i < 100; i++)
+ assertNull(cache.get(i));
+
+ for (int i = 0; i < 100; i++)
+ cache.put(i, i);
+
+ for (int i = 0; i < 100; i++)
+ assertEquals(i, cache.get(i));
+
+ node.destroyCache(ccfg.getName());
+
+ cache = node.createCache(ccfg);
+
+ for (int i = 0; i < 100; i++)
+ assertNull(cache.get(i));
+
+ node.destroyCache(ccfg.getName());
+ }
+
+ for (int i = 0; i < 100; i++)
+ assertEquals(i, cache0.get(i));
+
+ node.destroyCache(cache0.getName());
+
+ cache0 = node.createCache(cacheConfiguration(GROUP1, "c0", PARTITIONED, ATOMIC, 1, false));
+
+ for (int i = 0; i < 100; i++)
+ assertNull(cache0.get(i));
+
+ for (int i = 0; i < 100; i++)
+ cache0.put(i, i);
+
+ for (int i = 0; i < 100; i++)
+ assertEquals(i, cache0.get(i));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testRestartsAndCacheCreateDestroy() throws Exception {
final int SRVS = 5;
[22/50] [abbrv] ignite git commit: ignite-2.1
Posted by vo...@apache.org.
ignite-2.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ad42f620
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ad42f620
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ad42f620
Branch: refs/heads/master
Commit: ad42f6205b3956dca0ee54e85ce385e6591ec7a9
Parents: 7504b38
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 5 17:41:30 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 5 17:41:30 2017 +0300
----------------------------------------------------------------------
.../yardstick/IgniteBenchmarkArguments.java | 46 ++++
.../cache/IgniteStreamerBenchmark.java | 234 +++++++++++++++++++
2 files changed, 280 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad42f620/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index d3b860c..5ec6c54 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -18,6 +18,7 @@
package org.apache.ignite.yardstick;
import com.beust.jcommander.Parameter;
+import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.PersistentStoreConfiguration;
@@ -28,6 +29,7 @@ import org.apache.ignite.transactions.TransactionIsolation;
import java.util.ArrayList;
import java.util.List;
+import org.apache.ignite.yardstick.cache.IgniteStreamerBenchmark;
import org.jetbrains.annotations.Nullable;
/**
@@ -222,6 +224,22 @@ public class IgniteBenchmarkArguments {
@Parameter(names = {"-pds", "--persistentStore"}, description = "Persistent store flag")
private boolean persistentStoreEnabled;
+ /** */
+ @Parameter(names = {"-stcp", "--streamerCachesPrefix"}, description = "Cache name prefix for streamer benchmark")
+ private String streamerCachesPrefix = "streamer";
+
+ /** */
+ @Parameter(names = {"-stci", "--streamerCachesIndex"}, description = "First cache index for streamer benchmark")
+ private int streamerCacheIndex;
+
+ /** */
+ @Parameter(names = {"-stcc", "--streamerConcCaches"}, description = "Number of concurrently loaded caches for streamer benchmark")
+ private int streamerConcurrentCaches = 1;
+
+ /** */
+ @Parameter(names = {"-stbs", "--streamerBufSize"}, description = "Data streamer buffer size")
+ private int streamerBufSize = IgniteDataStreamer.DFLT_PER_NODE_BUFFER_SIZE;
+
/**
* @return {@code True} if need set {@link PersistentStoreConfiguration}.
*/
@@ -552,6 +570,34 @@ public class IgniteBenchmarkArguments {
"-txc=" + txConcurrency + "-rd=" + restartDelay + "-rs=" + restartSleep;
}
+ /**
+ * @return Cache name prefix for caches to be used in {@link IgniteStreamerBenchmark}.
+ */
+ public String streamerCachesPrefix() {
+ return streamerCachesPrefix;
+ }
+
+ /**
+ * @return First cache index for {@link IgniteStreamerBenchmark}.
+ */
+ public int streamerCacheIndex() {
+ return streamerCacheIndex;
+ }
+
+ /**
+ * @return Number of concurrently loaded caches for {@link IgniteStreamerBenchmark}.
+ */
+ public int streamerConcurrentCaches() {
+ return streamerConcurrentCaches;
+ }
+
+ /**
+ * @return Streamer buffer size {@link IgniteStreamerBenchmark} (see {@link IgniteDataStreamer#perNodeBufferSize()}.
+ */
+ public int streamerBufferSize() {
+ return streamerBufSize;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return GridToStringBuilder.toString(IgniteBenchmarkArguments.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ad42f620/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteStreamerBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteStreamerBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteStreamerBenchmark.java
new file mode 100644
index 0000000..9e253e1
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteStreamerBenchmark.java
@@ -0,0 +1,234 @@
+/*
+ * 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.yardstick.cache;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
+import org.apache.ignite.yardstick.cache.model.SampleValue;
+import org.yardstickframework.BenchmarkConfiguration;
+import org.yardstickframework.BenchmarkUtils;
+
+/**
+ *
+ */
+public class IgniteStreamerBenchmark extends IgniteAbstractBenchmark {
+ /** */
+ private List<String> cacheNames;
+
+ /** */
+ private ExecutorService executor;
+
+ /** */
+ private int entries;
+
+ /** {@inheritDoc} */
+ @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+ super.setUp(cfg);
+
+ entries = args.range();
+
+ if (entries <= 0)
+ throw new IllegalArgumentException("Invalid number of entries: " + entries);
+
+ if (cfg.threads() != 1)
+ throw new IllegalArgumentException("IgniteStreamerBenchmark should be run with single thread. " +
+ "Internally it starts multiple threads.");
+
+ String cacheNamePrefix = args.streamerCachesPrefix();
+
+ if (cacheNamePrefix == null || cacheNamePrefix.isEmpty())
+ throw new IllegalArgumentException("Streamer caches prefix not set.");
+
+ List<String> caches = new ArrayList<>();
+
+ for (String cacheName : ignite().cacheNames()) {
+ if (cacheName.startsWith(cacheNamePrefix))
+ caches.add(cacheName);
+ }
+
+ if (caches.isEmpty())
+ throw new IllegalArgumentException("Failed to find for IgniteStreamerBenchmark caches " +
+ "starting with '" + cacheNamePrefix + "'");
+
+ BenchmarkUtils.println("Found " + caches.size() + " caches for IgniteStreamerBenchmark: " + caches);
+
+ if (args.streamerCacheIndex() >= caches.size()) {
+ throw new IllegalArgumentException("Invalid streamer cache index: " + args.streamerCacheIndex() +
+ ", there are only " + caches.size() + " caches.");
+ }
+
+ if (args.streamerCacheIndex() + args.streamerConcurrentCaches() > caches.size()) {
+ throw new IllegalArgumentException("There are no enough caches [cacheIndex=" + args.streamerCacheIndex() +
+ ", concurrentCaches=" + args.streamerConcurrentCaches() +
+ ", totalCaches=" + caches.size() + ']');
+ }
+
+ Collections.sort(caches);
+
+ cacheNames = new ArrayList<>(caches.subList(args.streamerCacheIndex(),
+ args.streamerCacheIndex() + args.streamerConcurrentCaches()));
+
+ executor = Executors.newFixedThreadPool(args.streamerConcurrentCaches());
+
+ BenchmarkUtils.println("IgniteStreamerBenchmark start [cacheIndex=" + args.streamerCacheIndex() +
+ ", concurrentCaches=" + args.streamerConcurrentCaches() +
+ ", entries=" + entries +
+ ", bufferSize=" + args.streamerBufferSize() +
+ ", cachesToUse=" + cacheNames + ']');
+
+ if (cfg.warmup() > 0) {
+ BenchmarkUtils.println("IgniteStreamerBenchmark start warmup [warmupTimeMillis=" + cfg.warmup() + ']');
+
+ final long warmupEnd = System.currentTimeMillis() + cfg.warmup();
+
+ final AtomicBoolean stop = new AtomicBoolean();
+
+ try {
+ List<Future<Void>> futs = new ArrayList<>();
+
+ for (final String cacheName : cacheNames) {
+ futs.add(executor.submit(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ Thread.currentThread().setName("streamer-" + cacheName);
+
+ BenchmarkUtils.println("IgniteStreamerBenchmark start warmup for cache " +
+ "[name=" + cacheName + ']');
+
+ final int KEYS = Math.min(100_000, entries);
+
+ int key = 1;
+
+ try (IgniteDataStreamer<Object, Object> streamer = ignite().dataStreamer(cacheName)) {
+ streamer.perNodeBufferSize(args.streamerBufferSize());
+
+ while (System.currentTimeMillis() < warmupEnd && !stop.get()) {
+ for (int i = 0; i < 10; i++) {
+ streamer.addData(-key++, new SampleValue(key));
+
+ if (key >= KEYS)
+ key = 1;
+ }
+
+ streamer.flush();
+ }
+ }
+
+ BenchmarkUtils.println("IgniteStreamerBenchmark finished warmup for cache " +
+ "[name=" + cacheName + ']');
+
+ return null;
+ }
+ }));
+ }
+
+ for (Future<Void> fut : futs)
+ fut.get();
+ }
+ finally {
+ stop.set(true);
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> map) throws Exception {
+ BenchmarkUtils.println("IgniteStreamerBenchmark start test.");
+
+ long start = System.currentTimeMillis();
+
+ final AtomicBoolean stop = new AtomicBoolean();
+
+ try {
+ List<Future<Void>> futs = new ArrayList<>();
+
+ for (final String cacheName : cacheNames) {
+ futs.add(executor.submit(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ Thread.currentThread().setName("streamer-" + cacheName);
+
+ long start = System.currentTimeMillis();
+
+ BenchmarkUtils.println("IgniteStreamerBenchmark start load cache [name=" + cacheName + ']');
+
+ try (IgniteDataStreamer<Object, Object> streamer = ignite().dataStreamer(cacheName)) {
+ for (int i = 0; i < entries; i++) {
+ streamer.addData(i, new SampleValue(i));
+
+ if (i > 0 && i % 1000 == 0) {
+ if (stop.get())
+ break;
+
+ if (i % 100_000 == 0) {
+ BenchmarkUtils.println("IgniteStreamerBenchmark cache load progress [name=" + cacheName +
+ ", entries=" + i +
+ ", timeMillis=" + (System.currentTimeMillis() - start) + ']');
+ }
+ }
+ }
+ }
+
+ long time = System.currentTimeMillis() - start;
+
+ BenchmarkUtils.println("IgniteStreamerBenchmark finished load cache [name=" + cacheName +
+ ", entries=" + entries +
+ ", bufferSize=" + args.streamerBufferSize() +
+ ", totalTimeMillis=" + time + ']');
+
+ return null;
+ }
+ }));
+ }
+
+ for (Future<Void> fut : futs)
+ fut.get();
+ }
+ finally {
+ stop.set(true);
+ }
+
+ long time = System.currentTimeMillis() - start;
+
+ BenchmarkUtils.println("IgniteStreamerBenchmark finished [totalTimeMillis=" + time +
+ ", entries=" + entries +
+ ", bufferSize=" + args.streamerBufferSize() + ']');
+
+ for (String cacheName : cacheNames) {
+ BenchmarkUtils.println("Cache size [cacheName=" + cacheName +
+ ", size=" + ignite().cache(cacheName).size() + ']');
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void tearDown() throws Exception {
+ if (executor != null)
+ executor.shutdown();
+
+ super.tearDown();
+ }
+}
[46/50] [abbrv] ignite git commit: Added missing header to
ByteBufferExpander.
Posted by vo...@apache.org.
Added missing header to ByteBufferExpander.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0b4b5dc0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0b4b5dc0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0b4b5dc0
Branch: refs/heads/master
Commit: 0b4b5dc0e6763f4cf27ed8c9d38c6f4b10037ef6
Parents: 64d6c98
Author: devozerov <vo...@gridgain.com>
Authored: Fri Jul 7 11:00:52 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jul 7 11:00:52 2017 +0300
----------------------------------------------------------------------
.../cache/persistence/wal/ByteBufferExpander.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0b4b5dc0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/ByteBufferExpander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/ByteBufferExpander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/ByteBufferExpander.java
index 75d3a98..829cd5c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/ByteBufferExpander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/ByteBufferExpander.java
@@ -1,3 +1,20 @@
+/*
+ * 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.persistence.wal;
import java.nio.ByteBuffer;
[07/50] [abbrv] ignite git commit: Reworked cluster
activation/deactivation.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteActiveClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteActiveClusterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteActiveClusterTest.java
deleted file mode 100644
index cf68767..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteActiveClusterTest.java
+++ /dev/null
@@ -1,182 +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 java.util.concurrent.Callable;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- *
- */
-public class IgniteActiveClusterTest extends GridCommonAbstractTest {
- /** */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private boolean client;
-
- /** */
- private boolean active = true;
-
- /** */
- private CacheConfiguration ccfg;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
-
- cfg.setClientMode(client);
-
- cfg.setActiveOnStart(active);
-
- if (ccfg != null) {
- cfg.setCacheConfiguration(ccfg);
-
- ccfg = null;
- }
-
- return cfg;
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testActivate() throws Exception {
- active = false;
-
- for (int i = 0; i < 3; i++) {
- ccfg = cacheConfiguration(DEFAULT_CACHE_NAME);
-
- startGrid(i);
- }
-
- ignite(0).active(true);
-
- startGrid(3);
-
- for (int i = 0; i < 4; i++) {
- IgniteCache<Integer, Integer> cache = ignite(i).cache(DEFAULT_CACHE_NAME);
-
- for (int j = 0; j < 10; j++) {
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- Integer key = rnd.nextInt(1000);
-
- cache.put(key, j);
-
- assertEquals((Integer)j, cache.get(key));
- }
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testJoinAndActivate() throws Exception {
- for (int iter = 0; iter < 3; iter++) {
- log.info("Iteration: " + iter);
-
- active = false;
-
- for (int i = 0; i < 3; i++) {
- ccfg = cacheConfiguration(DEFAULT_CACHE_NAME);
-
- startGrid(i);
- }
-
- final int START_NODES = 3;
-
- final CyclicBarrier b = new CyclicBarrier(START_NODES + 1);
-
- IgniteInternalFuture<?> fut1 = GridTestUtils.runAsync(new Callable<Void>() {
- @Override public Void call() throws Exception {
- b.await();
-
- Thread.sleep(ThreadLocalRandom.current().nextLong(100) + 1);
-
- ignite(0).active(true);
-
- return null;
- }
- });
-
- final AtomicInteger nodeIdx = new AtomicInteger(3);
-
- IgniteInternalFuture<?> fut2 = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
- @Override public Void call() throws Exception {
- int idx = nodeIdx.getAndIncrement();
-
- b.await();
-
- startGrid(idx);
-
- return null;
- }
- }, START_NODES, "start-node");
-
- fut1.get();
- fut2.get();
-
- for (int i = 0; i < 6; i++) {
- IgniteCache<Integer, Integer> cache = ignite(i).cache(DEFAULT_CACHE_NAME);
-
- for (int j = 0; j < 10; j++) {
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- Integer key = rnd.nextInt(1000);
-
- cache.put(key, j);
-
- assertEquals((Integer)j, cache.get(key));
- }
- }
-
- stopAllGrids();
- }
- }
-
- /**
- * @param name Cache name.
- * @return Cache configuration.
- */
- private CacheConfiguration cacheConfiguration(String name) {
- CacheConfiguration ccfg = new CacheConfiguration(name);
-
- ccfg.setWriteSynchronizationMode(FULL_SYNC);
- ccfg.setAtomicityMode(TRANSACTIONAL);
- ccfg.setBackups(3);
-
- return ccfg;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
new file mode 100644
index 0000000..8a604be
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
@@ -0,0 +1,1284 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ static final String CACHE_NAME_PREFIX = "cache-";
+
+ /** */
+ boolean client;
+
+ /** */
+ private boolean active = true;
+
+ /** */
+ CacheConfiguration[] ccfgs;
+
+ /** */
+ private boolean testSpi;
+
+ /** */
+ private boolean testDiscoSpi;
+
+ /** */
+ private boolean testReconnectSpi;
+
+ /** */
+ private Class[] testSpiRecord;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ if (testReconnectSpi) {
+ TcpDiscoverySpi spi = new IgniteClientReconnectAbstractTest.TestTcpDiscoverySpi();
+
+ cfg.setDiscoverySpi(spi);
+
+ spi.setJoinTimeout(2 * 60_000);
+ }
+ else if (testDiscoSpi)
+ cfg.setDiscoverySpi(new TestTcpDiscoverySpi());
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ cfg.setConsistentId(igniteInstanceName);
+
+ cfg.setClientMode(client);
+
+ cfg.setActiveOnStart(active);
+
+ if (ccfgs != null) {
+ cfg.setCacheConfiguration(ccfgs);
+
+ ccfgs = null;
+ }
+
+ MemoryConfiguration memCfg = new MemoryConfiguration();
+ memCfg.setPageSize(1024);
+ memCfg.setDefaultMemoryPolicySize(10 * 1024 * 1024);
+
+ cfg.setMemoryConfiguration(memCfg);
+
+ if (persistenceEnabled()) {
+ PersistentStoreConfiguration pCfg = new PersistentStoreConfiguration();
+
+ pCfg.setWalMode(WALMode.LOG_ONLY);
+
+ cfg.setPersistentStoreConfiguration(pCfg);
+ }
+
+ if (testSpi) {
+ TestRecordingCommunicationSpi spi = new TestRecordingCommunicationSpi();
+
+ if (testSpiRecord != null)
+ spi.record(testSpiRecord);
+
+ cfg.setCommunicationSpi(spi);
+ }
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
+ /**
+ * @return {@code True} if test with persistence.
+ */
+ protected boolean persistenceEnabled() {
+ return false;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateSimple_SingleNode() throws Exception {
+ activateSimple(1, 0, 0);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateSimple_5_Servers() throws Exception {
+ activateSimple(5, 0, 0);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateSimple_5_Servers2() throws Exception {
+ activateSimple(5, 0, 4);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateSimple_5_Servers_5_Clients() throws Exception {
+ activateSimple(5, 4, 0);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateSimple_5_Servers_5_Clients_FromClient() throws Exception {
+ activateSimple(5, 4, 6);
+ }
+
+ /**
+ * @param srvs Number of servers.
+ * @param clients Number of clients.
+ * @param activateFrom Index of node stating activation.
+ * @throws Exception If failed.
+ */
+ private void activateSimple(int srvs, int clients, int activateFrom) throws Exception {
+ active = false;
+
+ final int CACHES = 2;
+
+ for (int i = 0; i < srvs + clients; i++) {
+ client = i >= srvs;
+
+ ccfgs = cacheConfigurations1();
+
+ startGrid(i);
+
+ checkNoCaches(i);
+ }
+
+ for (int i = 0; i < srvs + clients; i++)
+ assertFalse(ignite(i).active());
+
+ ignite(activateFrom).active(false); // Should be no-op.
+
+ ignite(activateFrom).active(true);
+
+ for (int i = 0; i < srvs + clients; i++)
+ assertTrue(ignite(i).active());
+
+ for (int i = 0; i < srvs + clients; i++) {
+ for (int c = 0; c < 2; c++)
+ checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+
+ checkCache(ignite(i), CU.UTILITY_CACHE_NAME, true);
+ }
+
+ checkCaches(srvs + clients, CACHES);
+
+ client = false;
+
+ startGrid(srvs + clients);
+
+ for (int c = 0; c < 2; c++)
+ checkCache(ignite(srvs + clients), CACHE_NAME_PREFIX + c, true);
+
+ checkCaches(srvs + clients + 1, CACHES);
+
+ client = true;
+
+ startGrid(srvs + clients + 1);
+
+ for (int c = 0; c < 2; c++)
+ checkCache(ignite(srvs + clients + 1), CACHE_NAME_PREFIX + c, false);
+
+ checkCaches(srvs + clients + 2, CACHES);
+ }
+
+ /**
+ * @param nodes Number of nodes.
+ * @param caches Number of caches.
+ */
+ final void checkCaches(int nodes, int caches) {
+ for (int i = 0; i < nodes; i++) {
+ for (int c = 0; c < caches; c++) {
+ IgniteCache<Integer, Integer> cache = ignite(i).cache(CACHE_NAME_PREFIX + c);
+
+ for (int j = 0; j < 10; j++) {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ Integer key = rnd.nextInt(1000);
+
+ cache.put(key, j);
+
+ assertEquals((Integer)j, cache.get(key));
+ }
+ }
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinWhileActivate1_Server() throws Exception {
+ joinWhileActivate1(false, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinWhileActivate1_WithCache_Server() throws Exception {
+ joinWhileActivate1(false, true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinWhileActivate1_Client() throws Exception {
+ joinWhileActivate1(true, false);
+ }
+
+ /**
+ * @param startClient If {@code true} joins client node, otherwise server.
+ * @param withNewCache If {@code true} joining node has new cache in configuration.
+ * @throws Exception If failed.
+ */
+ private void joinWhileActivate1(final boolean startClient, final boolean withNewCache) throws Exception {
+ IgniteInternalFuture<?> activeFut = startNodesAndBlockStatusChange(2, 0, 0, false);
+
+ IgniteInternalFuture<?> startFut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ client = startClient;
+
+ ccfgs = withNewCache ? cacheConfigurations2() : cacheConfigurations1();
+
+ startGrid(2);
+
+ return null;
+ }
+ });
+
+ TestRecordingCommunicationSpi spi1 = TestRecordingCommunicationSpi.spi(ignite(1));
+
+ spi1.stopBlock();
+
+ activeFut.get();
+ startFut.get();
+
+ for (int c = 0; c < 2; c++)
+ checkCache(ignite(2), CACHE_NAME_PREFIX + c, true);
+
+ if (withNewCache) {
+ for (int i = 0; i < 3; i++) {
+ for (int c = 0; c < 4; c++)
+ checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+ }
+ }
+
+ awaitPartitionMapExchange();
+
+ checkCaches(3, withNewCache ? 4 : 2);
+
+ client = false;
+
+ startGrid(3);
+
+ checkCaches(4, withNewCache ? 4 : 2);
+
+ client = true;
+
+ startGrid(4);
+
+ checkCaches(5, withNewCache ? 4 : 2);
+ }
+
+ /**
+ * @param srvs Number of servers.
+ * @param clients Number of clients.
+ * @param stateChangeFrom Index of node initiating changes.
+ * @param initiallyActive If {@code true} start cluster in active state (otherwise in inactive).
+ * @param blockMsgNodes Nodes whcis block exchange messages.
+ * @return State change future.
+ * @throws Exception If failed.
+ */
+ private IgniteInternalFuture<?> startNodesAndBlockStatusChange(int srvs,
+ int clients,
+ final int stateChangeFrom,
+ final boolean initiallyActive,
+ int... blockMsgNodes) throws Exception {
+ active = initiallyActive;
+ testSpi = true;
+
+ startWithCaches1(srvs, clients);
+
+ if (initiallyActive && persistenceEnabled())
+ ignite(0).active(true);
+
+ if (blockMsgNodes.length == 0)
+ blockMsgNodes = new int[]{1};
+
+ final AffinityTopologyVersion STATE_CHANGE_TOP_VER = new AffinityTopologyVersion(srvs + clients, 1);
+
+ List<TestRecordingCommunicationSpi> spis = new ArrayList<>();
+
+ for (int idx : blockMsgNodes) {
+ TestRecordingCommunicationSpi spi = TestRecordingCommunicationSpi.spi(ignite(idx));
+
+ spis.add(spi);
+
+ blockExchangeSingleMessage(spi, STATE_CHANGE_TOP_VER);
+ }
+
+ IgniteInternalFuture<?> stateChangeFut = GridTestUtils.runAsync(new Runnable() {
+ @Override public void run() {
+ ignite(stateChangeFrom).active(!initiallyActive);
+ }
+ });
+
+ for (TestRecordingCommunicationSpi spi : spis)
+ spi.waitForBlocked();
+
+ U.sleep(500);
+
+ assertFalse(stateChangeFut.isDone());
+
+ return stateChangeFut;
+ }
+
+ /**
+ * @param spi SPI.
+ * @param topVer Exchange topology version.
+ */
+ private void blockExchangeSingleMessage(TestRecordingCommunicationSpi spi, final AffinityTopologyVersion topVer) {
+ spi.blockMessages(new IgniteBiPredicate<ClusterNode, Message>() {
+ @Override public boolean apply(ClusterNode clusterNode, Message msg) {
+ if (msg instanceof GridDhtPartitionsSingleMessage) {
+ GridDhtPartitionsSingleMessage pMsg = (GridDhtPartitionsSingleMessage)msg;
+
+ if (pMsg.exchangeId() != null && pMsg.exchangeId().topologyVersion().equals(topVer))
+ return true;
+ }
+
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinWhileDeactivate1_Server() throws Exception {
+ joinWhileDeactivate1(false, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinWhileDeactivate1_WithCache_Server() throws Exception {
+ joinWhileDeactivate1(false, true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinWhileDeactivate1_Client() throws Exception {
+ joinWhileDeactivate1(true, false);
+ }
+
+ /**
+ * @param startClient If {@code true} joins client node, otherwise server.
+ * @param withNewCache If {@code true} joining node has new cache in configuration.
+ * @throws Exception If failed.
+ */
+ private void joinWhileDeactivate1(final boolean startClient, final boolean withNewCache) throws Exception {
+ IgniteInternalFuture<?> activeFut = startNodesAndBlockStatusChange(2, 0, 0, true);
+
+ IgniteInternalFuture<?> startFut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ client = startClient;
+
+ ccfgs = withNewCache ? cacheConfigurations2() : cacheConfigurations1();
+
+ startGrid(2);
+
+ return null;
+ }
+ });
+
+ TestRecordingCommunicationSpi spi1 = TestRecordingCommunicationSpi.spi(ignite(1));
+
+ spi1.stopBlock();
+
+ activeFut.get();
+ startFut.get();
+
+ checkNoCaches(3);
+
+ ignite(2).active(true);
+
+ for (int c = 0; c < 2; c++)
+ checkCache(ignite(2), CACHE_NAME_PREFIX + c, true);
+
+ if (withNewCache) {
+ for (int i = 0; i < 3; i++) {
+ for (int c = 0; c < 4; c++)
+ checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+ }
+ }
+
+ awaitPartitionMapExchange();
+
+ checkCaches(3, withNewCache ? 4 : 2);
+
+ client = false;
+
+ startGrid(3);
+
+ checkCaches(4, withNewCache ? 4 : 2);
+
+ client = true;
+
+ startGrid(4);
+
+ checkCaches(5, withNewCache ? 4 : 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testConcurrentJoinAndActivate() throws Exception {
+ for (int iter = 0; iter < 3; iter++) {
+ log.info("Iteration: " + iter);
+
+ active = false;
+
+ for (int i = 0; i < 3; i++) {
+ ccfgs = cacheConfigurations1();
+
+ startGrid(i);
+ }
+
+ final int START_NODES = 3;
+
+ final CyclicBarrier b = new CyclicBarrier(START_NODES + 1);
+
+ IgniteInternalFuture<?> fut1 = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ b.await();
+
+ Thread.sleep(ThreadLocalRandom.current().nextLong(100) + 1);
+
+ ignite(0).active(true);
+
+ return null;
+ }
+ });
+
+ final AtomicInteger nodeIdx = new AtomicInteger(3);
+
+ IgniteInternalFuture<?> fut2 = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int idx = nodeIdx.getAndIncrement();
+
+ b.await();
+
+ startGrid(idx);
+
+ return null;
+ }
+ }, START_NODES, "start-node");
+
+ fut1.get();
+ fut2.get();
+
+ checkCaches(6, 2);
+
+ afterTest();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeactivateSimple_SingleNode() throws Exception {
+ deactivateSimple(1, 0, 0);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeactivateSimple_5_Servers() throws Exception {
+ deactivateSimple(5, 0, 0);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeactivateSimple_5_Servers2() throws Exception {
+ deactivateSimple(5, 0, 4);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeactivateSimple_5_Servers_5_Clients() throws Exception {
+ deactivateSimple(5, 4, 0);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeactivateSimple_5_Servers_5_Clients_FromClient() throws Exception {
+ deactivateSimple(5, 4, 6);
+ }
+
+ /**
+ * @param srvs Number of servers.
+ * @param clients Number of clients.
+ * @param deactivateFrom Index of node stating deactivation.
+ * @throws Exception If failed.
+ */
+ private void deactivateSimple(int srvs, int clients, int deactivateFrom) throws Exception {
+ active = true;
+
+ final int CACHES = 2;
+
+ for (int i = 0; i < srvs + clients; i++) {
+ client = i >= srvs;
+
+ ccfgs = cacheConfigurations1();
+
+ startGrid(i);
+ }
+
+ if (persistenceEnabled())
+ ignite(deactivateFrom).active(true);
+
+ ignite(deactivateFrom).active(true); // Should be no-op.
+
+ checkCaches(srvs + clients, CACHES);
+
+ for (int i = 0; i < srvs + clients; i++)
+ assertTrue(ignite(i).active());
+
+ ignite(deactivateFrom).active(false);
+
+ for (int i = 0; i < srvs + clients; i++)
+ assertFalse(ignite(i).active());
+
+ checkNoCaches(srvs + clients);
+
+ client = false;
+
+ startGrid(srvs + clients);
+
+ checkNoCaches(srvs + clients + 1);
+
+ client = true;
+
+ startGrid(srvs + clients + 1);
+
+ checkNoCaches(srvs + clients + 2);
+
+ for (int i = 0; i < srvs + clients + 2; i++)
+ assertFalse(ignite(i).active());
+
+ ignite(deactivateFrom).active(true);
+
+ for (int i = 0; i < srvs + clients + 2; i++) {
+ assertTrue(ignite(i).active());
+
+ checkCache(ignite(i), CU.UTILITY_CACHE_NAME, true);
+ }
+
+ for (int i = 0; i < srvs; i++) {
+ for (int c = 0; c < 2; c++)
+ checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+ }
+
+ checkCaches1(srvs + clients + 2);
+ }
+
+ /**
+ * @param srvs Number of servers.
+ * @param clients Number of clients.
+ * @throws Exception If failed.
+ */
+ private void startWithCaches1(int srvs, int clients) throws Exception {
+ for (int i = 0; i < srvs + clients; i++) {
+ ccfgs = cacheConfigurations1();
+
+ client = i >= srvs;
+
+ startGrid(i);
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientReconnectClusterActive() throws Exception {
+ testReconnectSpi = true;
+
+ ccfgs = cacheConfigurations1();
+
+ final int SRVS = 3;
+ final int CLIENTS = 3;
+
+ startWithCaches1(SRVS, CLIENTS);
+
+ if (persistenceEnabled())
+ ignite(0).active(true);
+
+ Ignite srv = ignite(0);
+ Ignite client = ignite(SRVS);
+
+ checkCache(client, CU.UTILITY_CACHE_NAME, true);
+
+ checkCaches1(SRVS + CLIENTS);
+
+ IgniteClientReconnectAbstractTest.reconnectClientNode(log, client, srv, null);
+
+ checkCaches1(SRVS + CLIENTS);
+
+ this.client = false;
+
+ startGrid(SRVS + CLIENTS);
+
+ this.client = true;
+
+ startGrid(SRVS + CLIENTS + 1);
+
+ checkCaches1(SRVS + CLIENTS + 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientReconnectClusterInactive() throws Exception {
+ testReconnectSpi = true;
+
+ active = false;
+
+ final int SRVS = 3;
+ final int CLIENTS = 3;
+
+ startWithCaches1(SRVS, CLIENTS);
+
+ Ignite srv = ignite(0);
+ Ignite client = ignite(SRVS);
+
+ checkNoCaches(SRVS + CLIENTS);
+
+ IgniteClientReconnectAbstractTest.reconnectClientNode(log, client, srv, null);
+
+ checkNoCaches(SRVS + CLIENTS);
+
+ ignite(0).active(true);
+
+ checkCache(client, CU.UTILITY_CACHE_NAME, true);
+
+ checkCaches1(SRVS + CLIENTS);
+
+ this.client = false;
+
+ startGrid(SRVS + CLIENTS);
+
+ this.client = true;
+
+ startGrid(SRVS + CLIENTS + 1);
+
+ checkCaches1(SRVS + CLIENTS);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientReconnectClusterDeactivated() throws Exception {
+ clientReconnectClusterDeactivated(false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientReconnectClusterDeactivateInProgress() throws Exception {
+ clientReconnectClusterDeactivated(true);
+ }
+
+ /**
+ * @param transition If {@code true} client reconnects while cluster state transition is in progress.
+ * @throws Exception If failed.
+ */
+ private void clientReconnectClusterDeactivated(final boolean transition) throws Exception {
+ testReconnectSpi = true;
+ testSpi = transition;
+
+ final int SRVS = 3;
+ final int CLIENTS = 3;
+
+ startWithCaches1(SRVS, CLIENTS);
+
+ final Ignite srv = ignite(0);
+ Ignite client = ignite(SRVS);
+
+ if (persistenceEnabled())
+ ignite(0).active(true);
+
+ checkCache(client, CU.UTILITY_CACHE_NAME, true);
+
+ checkCaches1(SRVS + CLIENTS);
+
+ final AffinityTopologyVersion STATE_CHANGE_TOP_VER = new AffinityTopologyVersion(SRVS + CLIENTS + 1, 1);
+
+ final TestRecordingCommunicationSpi spi1 = transition ? TestRecordingCommunicationSpi.spi(ignite(1)) : null;
+
+ final AtomicReference<IgniteInternalFuture> stateFut = new AtomicReference<>();
+
+ IgniteClientReconnectAbstractTest.reconnectClientNode(log, client, srv, new Runnable() {
+ @Override public void run() {
+ if (transition) {
+ blockExchangeSingleMessage(spi1, STATE_CHANGE_TOP_VER);
+
+ stateFut.set(GridTestUtils.runAsync(new Runnable() {
+ @Override public void run() {
+ srv.active(false);
+ }
+ }, "deactivate"));
+
+ try {
+ U.sleep(500);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ else
+ srv.active(false);
+ }
+ });
+
+ checkCache(client, CACHE_NAME_PREFIX + 0, false);
+
+ if (transition) {
+ assertFalse(stateFut.get().isDone());
+
+ assertFalse(client.active());
+
+ spi1.waitForBlocked();
+
+ spi1.stopBlock();
+
+ stateFut.get().get();
+ }
+
+ checkNoCaches(SRVS + CLIENTS);
+
+ ignite(0).active(true);
+
+ checkCache(client, CU.UTILITY_CACHE_NAME, true);
+
+ assertTrue(client.active());
+
+ checkCaches1(SRVS + CLIENTS);
+
+ checkCache(client, CACHE_NAME_PREFIX + 0, true);
+
+ this.client = false;
+
+ startGrid(SRVS + CLIENTS);
+
+ this.client = true;
+
+ startGrid(SRVS + CLIENTS + 1);
+
+ checkCaches1(SRVS + CLIENTS + 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientReconnectClusterActivated() throws Exception {
+ clientReconnectClusterActivated(false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientReconnectClusterActivateInProgress() throws Exception {
+ clientReconnectClusterActivated(true);
+ }
+
+ /**
+ * @param transition If {@code true} client reconnects while cluster state transition is in progress.
+ * @throws Exception If failed.
+ */
+ private void clientReconnectClusterActivated(final boolean transition) throws Exception {
+ testReconnectSpi = true;
+ testSpi = transition;
+
+ active = false;
+
+ final int SRVS = 3;
+ final int CLIENTS = 3;
+
+ startWithCaches1(SRVS, CLIENTS);
+
+ final Ignite srv = ignite(0);
+ Ignite client = ignite(SRVS);
+
+ checkNoCaches(SRVS + CLIENTS);
+
+ final AffinityTopologyVersion STATE_CHANGE_TOP_VER = new AffinityTopologyVersion(SRVS + CLIENTS + 1, 1);
+
+ final TestRecordingCommunicationSpi spi1 = transition ? TestRecordingCommunicationSpi.spi(ignite(1)) : null;
+
+ final AtomicReference<IgniteInternalFuture> stateFut = new AtomicReference<>();
+
+ IgniteClientReconnectAbstractTest.reconnectClientNode(log, client, srv, new Runnable() {
+ @Override public void run() {
+ if (transition) {
+ blockExchangeSingleMessage(spi1, STATE_CHANGE_TOP_VER);
+
+ stateFut.set(GridTestUtils.runAsync(new Runnable() {
+ @Override public void run() {
+ srv.active(true);
+ }
+ }, "activate"));
+
+ try {
+ U.sleep(500);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ else
+ srv.active(true);
+ }
+ });
+
+ checkCache(client, CACHE_NAME_PREFIX + 0, !transition);
+
+ if (transition) {
+ assertFalse(stateFut.get().isDone());
+
+ assertFalse(client.active());
+
+ spi1.waitForBlocked();
+
+ spi1.stopBlock();
+
+ stateFut.get().get();
+ }
+
+ checkCache(client, CU.UTILITY_CACHE_NAME, true);
+
+ checkCaches1(SRVS + CLIENTS);
+
+ checkCache(client, CACHE_NAME_PREFIX + 0, true);
+
+ this.client = false;
+
+ startGrid(SRVS + CLIENTS);
+
+ this.client = true;
+
+ startGrid(SRVS + CLIENTS + 1);
+
+ checkCaches1(SRVS + CLIENTS + 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInactiveTopologyChanges() throws Exception {
+ testSpi = true;
+
+ testSpiRecord = new Class[]{GridDhtPartitionsSingleMessage.class, GridDhtPartitionsFullMessage.class};
+
+ active = false;
+
+ final int SRVS = 4;
+ final int CLIENTS = 4;
+
+ startWithCaches1(SRVS, CLIENTS);
+
+ checkRecordedMessages(false);
+
+ for (int i = 0; i < 2; i++) {
+ stopGrid(i);
+
+ client = false;
+
+ startGrid(i);
+ }
+
+ checkRecordedMessages(false);
+
+ for (int i = 0; i < 2; i++) {
+ stopGrid(SRVS + i);
+
+ client = true;
+
+ startGrid(SRVS + i);
+ }
+
+ checkRecordedMessages(false);
+
+ ignite(0).active(true);
+
+ checkCaches1(SRVS + CLIENTS);
+
+ checkRecordedMessages(true);
+
+ client = false;
+
+ startGrid(SRVS + CLIENTS);
+
+ client = true;
+
+ startGrid(SRVS + CLIENTS + 1);
+
+ checkRecordedMessages(true);
+
+ checkCaches1(SRVS + CLIENTS + 2);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateFailover1() throws Exception {
+ stateChangeFailover1(true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeactivateFailover1() throws Exception {
+ stateChangeFailover1(false);
+ }
+
+ /**
+ * @param activate If {@code true} tests activation, otherwise deactivation.
+ * @throws Exception If failed.
+ */
+ private void stateChangeFailover1(boolean activate) throws Exception {
+ // Nodes 1 and 4 do not reply to coordinator.
+ IgniteInternalFuture<?> fut = startNodesAndBlockStatusChange(4, 4, 3, !activate, 1, 4);
+
+ client = false;
+
+ // Start one more node while transition is in progress.
+ IgniteInternalFuture startFut = GridTestUtils.runAsync(new Callable() {
+ @Override public Object call() throws Exception {
+ startGrid(8);
+
+ return null;
+ }
+ }, "start-node");
+
+ U.sleep(500);
+
+ stopGrid(getTestIgniteInstanceName(1), true, false);
+ stopGrid(getTestIgniteInstanceName(4), true, false);
+
+ fut.get();
+
+ startFut.get();
+
+ client = false;
+
+ startGrid(1);
+
+ client = true;
+
+ startGrid(4);
+
+ if (!activate) {
+ checkNoCaches(9);
+
+ ignite(0).active(true);
+ }
+
+ checkCaches1(9);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateFailover2() throws Exception {
+ stateChangeFailover2(true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeactivateFailover2() throws Exception {
+ stateChangeFailover2(false);
+ }
+
+ /**
+ * @param activate If {@code true} tests activation, otherwise deactivation.
+ * @throws Exception If failed.
+ */
+ private void stateChangeFailover2(boolean activate) throws Exception {
+ // Nodes 1 and 4 do not reply to coordinator.
+ IgniteInternalFuture<?> fut = startNodesAndBlockStatusChange(4, 4, 3, !activate, 1, 4);
+
+ client = false;
+
+ // Start one more nodes while transition is in progress.
+ IgniteInternalFuture startFut1 = GridTestUtils.runAsync(new Callable() {
+ @Override public Object call() throws Exception {
+ startGrid(8);
+
+ return null;
+ }
+ }, "start-node1");
+ IgniteInternalFuture startFut2 = GridTestUtils.runAsync(new Callable() {
+ @Override public Object call() throws Exception {
+ startGrid(9);
+
+ return null;
+ }
+ }, "start-node2");
+
+ U.sleep(500);
+
+ // Stop coordinator.
+ stopGrid(0);
+
+ stopGrid(getTestIgniteInstanceName(1), true, false);
+ stopGrid(getTestIgniteInstanceName(4), true, false);
+
+ fut.get();
+
+ startFut1.get();
+ startFut2.get();
+
+ client = false;
+
+ startGrid(0);
+ startGrid(1);
+
+ client = true;
+
+ startGrid(4);
+
+ if (!activate) {
+ checkNoCaches(10);
+
+ ignite(0).active(true);
+ }
+
+ checkCaches1(10);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateFailover3() throws Exception {
+ stateChangeFailover3(true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDeactivateFailover3() throws Exception {
+ stateChangeFailover3(false);
+ }
+
+ /**
+ * @param activate If {@code true} tests activation, otherwise deactivation.
+ * @throws Exception If failed.
+ */
+ private void stateChangeFailover3(boolean activate) throws Exception {
+ testDiscoSpi = true;
+
+ startNodesAndBlockStatusChange(4, 0, 0, !activate);
+
+ client = false;
+
+ IgniteInternalFuture startFut1 = GridTestUtils.runAsync(new Callable() {
+ @Override public Object call() throws Exception {
+ startGrid(4);
+
+ return null;
+ }
+ }, "start-node1");
+
+ IgniteInternalFuture startFut2 = GridTestUtils.runAsync(new Callable() {
+ @Override public Object call() throws Exception {
+ startGrid(5);
+
+ return null;
+ }
+ }, "start-node2");
+
+ U.sleep(1000);
+
+ // Stop all nodes participating in state change and not allow last node to finish exchange.
+ for (int i = 0; i < 4; i++)
+ ((TestTcpDiscoverySpi)ignite(i).configuration().getDiscoverySpi()).simulateNodeFailure();
+
+ for (int i = 0; i < 4; i++)
+ stopGrid(getTestIgniteInstanceName(i), true, false);
+
+ startFut1.get();
+ startFut2.get();
+
+ assertFalse(ignite(4).active());
+ assertFalse(ignite(5).active());
+
+ ignite(4).active(true);
+
+ for (int i = 0; i < 4; i++)
+ startGrid(i);
+
+ checkCaches1(6);
+ }
+
+ /**
+ * @param exp If {@code true} there should be recorded messages.
+ */
+ private void checkRecordedMessages(boolean exp) {
+ for (Ignite node : G.allGrids()) {
+ List<Object> recorded =
+ TestRecordingCommunicationSpi.spi(node).recordedMessages(false);
+
+ if (exp)
+ assertFalse(F.isEmpty(recorded));
+ else
+ assertTrue(F.isEmpty(recorded));
+ }
+ }
+
+ /**
+ * @param nodes Expected nodes number.
+ */
+ private void checkCaches1(int nodes) {
+ checkCaches(nodes, 2);
+ }
+
+ /**
+ * @return Cache configurations.
+ */
+ final CacheConfiguration[] cacheConfigurations1() {
+ CacheConfiguration[] ccfgs = new CacheConfiguration[2];
+
+ ccfgs[0] = cacheConfiguration(CACHE_NAME_PREFIX + 0, ATOMIC);
+ ccfgs[1] = cacheConfiguration(CACHE_NAME_PREFIX + 1, TRANSACTIONAL);
+
+ return ccfgs;
+ }
+
+ /**
+ * @return Cache configurations.
+ */
+ final CacheConfiguration[] cacheConfigurations2() {
+ CacheConfiguration[] ccfgs = new CacheConfiguration[4];
+
+ ccfgs[0] = cacheConfiguration(CACHE_NAME_PREFIX + 0, ATOMIC);
+ ccfgs[1] = cacheConfiguration(CACHE_NAME_PREFIX + 1, TRANSACTIONAL);
+ ccfgs[2] = cacheConfiguration(CACHE_NAME_PREFIX + 2, ATOMIC);
+ ccfgs[3] = cacheConfiguration(CACHE_NAME_PREFIX + 3, TRANSACTIONAL);
+
+ return ccfgs;
+ }
+
+ /**
+ * @param name Cache name.
+ * @param atomicityMode Atomicity mode.
+ * @return Cache configuration.
+ */
+ protected final CacheConfiguration cacheConfiguration(String name, CacheAtomicityMode atomicityMode) {
+ CacheConfiguration ccfg = new CacheConfiguration(name);
+
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setAtomicityMode(atomicityMode);
+ ccfg.setBackups(1);
+
+ return ccfg;
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param node Node.
+ * @param exp {@code True} if expect that cache is started on node.
+ */
+ void checkCache(Ignite node, String cacheName, boolean exp) {
+ GridCacheAdapter cache = ((IgniteKernal)node).context().cache().internalCache(cacheName);
+
+ if (exp)
+ assertNotNull("Cache not found [cache=" + cacheName + ", node=" + node.name() + ']', cache);
+ else
+ assertNull("Unexpected cache found [cache=" + cacheName + ", node=" + node.name() + ']', cache);
+ }
+
+ /**
+ * @param nodes Number of nodes.
+ */
+ final void checkNoCaches(int nodes) {
+ for (int i = 0; i < nodes; i++) {
+ GridCacheProcessor cache = ((IgniteKernal)ignite(i)).context().cache();
+
+ assertTrue(cache.caches().isEmpty());
+ assertTrue(cache.internalCaches().isEmpty());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
new file mode 100644
index 0000000..4a19aa8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
@@ -0,0 +1,197 @@
+/*
+ * 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 java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.testframework.GridTestUtils;
+
+/**
+ *
+ */
+public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteClusterActivateDeactivateTest {
+ /** {@inheritDoc} */
+ @Override protected boolean persistenceEnabled() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ GridTestUtils.deleteDbFiles();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ GridTestUtils.deleteDbFiles();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateCachesRestore_SingleNode() throws Exception {
+ activateCachesRestore(1, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateCachesRestore_SingleNode_WithNewCaches() throws Exception {
+ activateCachesRestore(1, true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateCachesRestore_5_Servers() throws Exception {
+ activateCachesRestore(5, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateCachesRestore_5_Servers_WithNewCaches() throws Exception {
+ activateCachesRestore(5, false);
+ }
+
+ /**
+ * @param srvs Number of server nodes.
+ * @param withNewCaches If {@code true} then after restart has new caches in configuration.
+ * @throws Exception If failed.
+ */
+ private void activateCachesRestore(int srvs, boolean withNewCaches) throws Exception {
+ Ignite srv = startGrids(srvs);
+
+ srv.active(true);
+
+ srv.createCaches(Arrays.asList(cacheConfigurations1()));
+
+ Map<Integer, Integer> cacheData = new LinkedHashMap<>();
+
+ for (int i = 1; i <= 100; i++) {
+ for (CacheConfiguration ccfg : cacheConfigurations1()) {
+ srv.cache(ccfg.getName()).put(-i, i);
+
+ cacheData.put(-i, i);
+ }
+ }
+
+ stopAllGrids();
+
+ for (int i = 0; i < srvs; i++) {
+ if (withNewCaches)
+ ccfgs = cacheConfigurations2();
+
+ startGrid(i);
+ }
+
+ srv = ignite(0);
+
+ checkNoCaches(srvs);
+
+ srv.active(true);
+
+ final int CACHES = withNewCaches ? 4 : 2;
+
+ for (int i = 0; i < srvs; i++) {
+ for (int c = 0; c < CACHES; c++)
+ checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+ }
+
+ for (CacheConfiguration ccfg : cacheConfigurations1())
+ checkCacheData(cacheData, ccfg.getName());
+
+ checkCaches(srvs, CACHES);
+
+ int nodes = srvs;
+
+ client = false;
+
+ startGrid(nodes++);
+
+ for (int i = 0; i < nodes; i++) {
+ for (int c = 0; c < CACHES; c++)
+ checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+ }
+
+ checkCaches(nodes, CACHES);
+
+ client = true;
+
+ startGrid(nodes++);
+
+ for (int c = 0; c < CACHES; c++)
+ checkCache(ignite(nodes - 1), CACHE_NAME_PREFIX + c, false);
+
+ checkCaches(nodes, CACHES);
+
+ for (int i = 0; i < nodes; i++) {
+ for (int c = 0; c < CACHES; c++)
+ checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+ }
+
+ for (CacheConfiguration ccfg : cacheConfigurations1())
+ checkCacheData(cacheData, ccfg.getName());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testActivateCacheRestoreConfigurationConflict() throws Exception {
+ final int SRVS = 3;
+
+ Ignite srv = startGrids(SRVS);
+
+ srv.active(true);
+
+ CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ srv.createCache(ccfg);
+
+ stopAllGrids();
+
+ ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME + 1);
+
+ ccfg.setGroupName(DEFAULT_CACHE_NAME);
+
+ ccfgs = new CacheConfiguration[]{ccfg};
+
+ startGrids(SRVS);
+
+ try {
+ ignite(0).active(true);
+
+ fail();
+ }
+ catch (IgniteException e) {
+ // Expected error.
+ }
+
+ for (int i = 0; i < SRVS; i++)
+ assertFalse(ignite(i).active());
+
+ checkNoCaches(SRVS);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/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
index fdf5350..566860d 100644
--- 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
@@ -22,9 +22,6 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -107,13 +104,6 @@ public class IgniteDaemonNodeMarshallerCacheTest extends GridCommonAbstractTest
awaitPartitionMapExchange();
- // Workaround for IGNITE-1365.
- IgniteInternalFuture<?> fut = ((IgniteKernal) daemonNode).context().cache().context().exchange().
- affinityReadyFuture(new AffinityTopologyVersion(2, 0));
-
- if (fut != null)
- fut.get();
-
TestClass1 res1 = daemonNode.compute(daemonNode.cluster().forRemotes()).call(new TestCallable1());
assertNotNull(res1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpPageStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpPageStoreManager.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpPageStoreManager.java
index 4dfe69b..665bb56 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpPageStoreManager.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpPageStoreManager.java
@@ -152,11 +152,6 @@ public class NoOpPageStoreManager implements IgnitePageStoreManager {
}
/** {@inheritDoc} */
- @Override public void onKernalStart(boolean reconnect) throws IgniteCheckedException {
- // No-op.
- }
-
- /** {@inheritDoc} */
@Override public void onKernalStop(boolean cancel) {
// No-op.
}
@@ -177,8 +172,7 @@ public class NoOpPageStoreManager implements IgnitePageStoreManager {
}
/** {@inheritDoc} */
- @Override public void storeCacheData(CacheGroupDescriptor grpDesc,
- StoredCacheData cacheData) throws IgniteCheckedException {
+ @Override public void storeCacheData(StoredCacheData cacheData) throws IgniteCheckedException {
// No-op.
}
@@ -189,11 +183,11 @@ public class NoOpPageStoreManager implements IgnitePageStoreManager {
/** {@inheritDoc} */
@Override public void onActivate(GridKernalContext kctx) {
-
+ // No-op.
}
/** {@inheritDoc} */
@Override public void onDeActivate(GridKernalContext kctx) {
-
+ // No-op.
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpWALManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpWALManager.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpWALManager.java
index 0ef593f..72450b8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpWALManager.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/NoOpWALManager.java
@@ -43,7 +43,7 @@ public class NoOpWALManager implements IgniteWriteAheadLogManager {
/** {@inheritDoc} */
@Override public void resumeLogging(WALPointer ptr) throws IgniteCheckedException {
-
+ // No-op.
}
/** {@inheritDoc} */
@@ -83,42 +83,37 @@ public class NoOpWALManager implements IgniteWriteAheadLogManager {
/** {@inheritDoc} */
@Override public void start(GridCacheSharedContext cctx) throws IgniteCheckedException {
-
+ // No-op.
}
/** {@inheritDoc} */
@Override public void stop(boolean cancel) {
-
- }
-
- /** {@inheritDoc} */
- @Override public void onKernalStart(boolean reconnect) throws IgniteCheckedException {
-
+ // No-op.
}
/** {@inheritDoc} */
@Override public void onKernalStop(boolean cancel) {
-
+ // No-op.
}
/** {@inheritDoc} */
@Override public void onDisconnected(IgniteFuture reconnectFut) {
-
+ // No-op.
}
/** {@inheritDoc} */
@Override public void printMemoryStats() {
-
+ // No-op.
}
/** {@inheritDoc} */
@Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
-
+ // No-op.
}
/** {@inheritDoc} */
- @Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
-
+ @Override public void onDeActivate(GridKernalContext kctx) {
+ // No-op.
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
index 9fa6f7c..675aca5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
@@ -53,123 +53,160 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
/** Cache 2. */
protected static final String cache2 = "cache2";
- //Todo Cache with node filter.
+ /** */
protected static final String cache3 = "cache3";
+ /** */
protected static final String cache4 = "cache4";
- protected static final String cache5 = "cache5";
+ /** */
+ private static final String cache5 = "cache5";
/** Caches info. */
- public static final String CACHES_INFO = "cachesInfo";
+ private static final String CACHES_INFO = "cachesInfo";
/** Registered caches. */
- public static final String REGISTERED_CACHES = "registeredCaches";
+ private static final String REGISTERED_CACHES = "registeredCaches";
/** Caches. */
public static final String CACHES = "caches";
/**
- * @param ig Ig.
+ * @param ig Node.
+ * @return Cache descriptors.
*/
protected static Map<String, DynamicCacheDescriptor> cacheDescriptors(IgniteEx ig) {
return field((Object)field(ig.context().cache(), CACHES_INFO), REGISTERED_CACHES);
}
/**
- * @param ig Ig.
+ * @param ig Node.
+ * @return Node caches.
*/
protected static Map<String, GridCacheAdapter> caches(IgniteEx ig){
return field(ig.context().cache(), CACHES);
}
/**
- *
+ * @return Test builder.
+ * @throws Exception If failed.
*/
public abstract JoinNodeTestPlanBuilder withOutConfigurationTemplate() throws Exception;
/**
- *
+ * @return Test builder.
+ * @throws Exception If failed.
*/
public abstract JoinNodeTestPlanBuilder staticCacheConfigurationOnJoinTemplate() throws Exception;
/**
- *
+ * @return Test builder.
+ * @throws Exception If failed.
*/
public abstract JoinNodeTestPlanBuilder staticCacheConfigurationInClusterTemplate() throws Exception;
/**
- *
+ * @return Test builder.
+ * @throws Exception If failed.
*/
public abstract JoinNodeTestPlanBuilder staticCacheConfigurationSameOnBothTemplate() throws Exception;
/**
- *
+ * @return Test builder.
+ * @throws Exception If failed.
*/
public abstract JoinNodeTestPlanBuilder staticCacheConfigurationDifferentOnBothTemplate() throws Exception;
// Client node join.
+ /**
+ * @return Test builder.
+ * @throws Exception If failed.
+ */
public abstract JoinNodeTestPlanBuilder joinClientWithOutConfigurationTemplate() throws Exception;
+ /**
+ * @return Test builder.
+ * @throws Exception If failed.
+ */
public abstract JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationOnJoinTemplate() throws Exception;
+ /**
+ * @return Test builder.
+ * @throws Exception If failed.
+ */
public abstract JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationInClusterTemplate() throws Exception;
+ /**
+ * @return Test builder.
+ * @throws Exception If failed.
+ */
public abstract JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationSameOnBothTemplate() throws Exception;
+ /**
+ * @return Test builder.
+ * @throws Exception If failed.
+ */
public abstract JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationDifferentOnBothTemplate() throws Exception;
/**
- *
+ * @throws Exception If failed.
*/
public abstract void testJoinWithOutConfiguration() throws Exception;
/**
- *
+ * @throws Exception If failed.
*/
public abstract void testStaticCacheConfigurationOnJoin() throws Exception;
/**
+ * @throws Exception If failed.
*
*/
public abstract void testStaticCacheConfigurationInCluster() throws Exception;
/**
+ * @throws Exception If failed.
*
*/
public abstract void testStaticCacheConfigurationSameOnBoth() throws Exception;
/**
+ * @throws Exception If failed.
*
*/
public abstract void testStaticCacheConfigurationDifferentOnBoth() throws Exception;
/**
+ * @throws Exception If failed.
*
*/
public abstract void testJoinClientWithOutConfiguration() throws Exception;
/**
+ * @throws Exception If failed.
*
*/
public abstract void testJoinClientStaticCacheConfigurationOnJoin() throws Exception;
/**
+ * @throws Exception If failed.
*
*/
public abstract void testJoinClientStaticCacheConfigurationInCluster() throws Exception;
/**
+ * @throws Exception If failed.
*
*/
public abstract void testJoinClientStaticCacheConfigurationSameOnBoth() throws Exception;
/**
- *
+ * @throws Exception If failed.
*/
public abstract void testJoinClientStaticCacheConfigurationDifferentOnBoth() throws Exception;
+ /** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
super.beforeTest();
@@ -178,6 +215,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
}
+ /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
super.afterTest();
@@ -188,6 +226,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
/**
* @param idx Index.
+ * @return Ignite instance name.
*/
protected String name(int idx) {
return getTestIgniteInstanceName(idx);
@@ -195,6 +234,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
/**
* @param name Name.
+ * @return Igntie configuration.
+ * @throws Exception If failed.
*/
protected IgniteConfiguration cfg(String name) throws Exception {
try {
@@ -206,7 +247,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @return Test builder.
*/
protected JoinNodeTestPlanBuilder builder() {
return JoinNodeTestPlanBuilder.builder();
@@ -214,13 +255,14 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
/**
* @param cfgs Cfgs.
+ * @return Configurations.
*/
- protected static <T> T[] buildConfiguration(T... cfgs) {
+ private static <T> T[] buildConfiguration(T... cfgs) {
return cfgs;
}
/**
- *
+ * @return Cache configuration.
*/
protected CacheConfiguration atomicCfg() {
return new CacheConfiguration(cache1)
@@ -228,6 +270,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
+ * @return Cache configuration.
*
*/
protected CacheConfiguration transactionCfg() {
@@ -236,7 +279,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @return Cache configurations.
*/
protected CacheConfiguration[] allCacheConfigurations() {
return buildConfiguration(atomicCfg(), transactionCfg());
@@ -309,6 +352,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
/** After de activate. */
private Runnable afterDeActivate = Noop;
+ /** */
private IgniteCallable<List<CacheConfiguration>> dynamicCacheStart =
new IgniteCallable<List<CacheConfiguration>>() {
@Override public List<CacheConfiguration> call() throws Exception {
@@ -316,6 +360,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
};
+ /** */
private IgniteCallable<List<String>> dynamicCacheStop =
new IgniteCallable<List<String>>() {
@Override public List<String> call() throws Exception {
@@ -323,15 +368,19 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
};
+ /** */
private Runnable afterDynamicCacheStarted = Noop;
+ /** */
private Runnable afterDynamicCacheStopped = Noop;
/** End. */
private Runnable end = Noop;
/**
- *
+ * @param cfgs Configurations.
+ * @return Test builder.
+ * @throws Exception If failed.
*/
public JoinNodeTestPlanBuilder clusterConfiguration(IgniteConfiguration... cfgs) throws Exception {
clusterCfg = cfgs;
@@ -359,7 +408,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @param cfg Configuration.
+ * @return Test builder.
*/
public JoinNodeTestPlanBuilder nodeConfiguration(IgniteConfiguration cfg) {
nodeCfg = cfg;
@@ -382,6 +432,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
/**
* @param func Func.
+ * @return Test builder.
*/
public JoinNodeTestPlanBuilder nodeConfiguration(
IgniteClosure<IgniteConfiguration, IgniteConfiguration> func
@@ -393,7 +444,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @param r Cluster start callback.
+ * @return Test builder.
*/
public JoinNodeTestPlanBuilder afterClusterStarted(Runnable r) {
strPlanBuilder.append("Check after cluster start\n");
@@ -404,7 +456,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @param r Node join callback.
+ * @return Test builder.
*/
public JoinNodeTestPlanBuilder afterNodeJoin(Runnable r) {
strPlanBuilder.append("Check after node join")
@@ -416,7 +469,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @param state State after join.
+ * @return Test builder.
*/
public JoinNodeTestPlanBuilder stateAfterJoin(boolean state) {
strPlanBuilder.append("Check state on all nodes after join, must be ")
@@ -429,7 +483,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @param r Activate callback.
+ * @return Test builder.
*/
public JoinNodeTestPlanBuilder afterActivate(Runnable r) {
strPlanBuilder.append("Check after activate")
@@ -441,7 +496,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @param r Deactivate callback.
+ * @return Test builder.
*/
public JoinNodeTestPlanBuilder afterDeActivate(Runnable r) {
strPlanBuilder.append("Check after deActivate")
@@ -452,6 +508,10 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
return this;
}
+ /**
+ * @param caches Callback.
+ * @return Test builder.
+ */
public JoinNodeTestPlanBuilder dynamicCacheStart(IgniteCallable<List<CacheConfiguration>> caches){
strPlanBuilder.append("Dynamic caches start")
.append("\n");
@@ -461,6 +521,10 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
return this;
}
+ /**
+ * @param r Cache start callback.
+ * @return Test builder.
+ */
public JoinNodeTestPlanBuilder afterDynamicCacheStarted(Runnable r){
strPlanBuilder.append("Check after dynamic caches start")
.append("\n");
@@ -470,6 +534,10 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
return this;
}
+ /**
+ * @param caches Callback.
+ * @return Test builder.
+ */
public JoinNodeTestPlanBuilder dynamicCacheStop(IgniteCallable<List<String>> caches){
strPlanBuilder.append("Dynamic caches stop")
.append("\n");
@@ -479,6 +547,10 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
return this;
}
+ /**
+ * @param r Callback.
+ * @return Test builder.
+ */
public JoinNodeTestPlanBuilder afterDynamicCacheStopped(Runnable r){
strPlanBuilder.append("Check after dynamic caches stop")
.append("\n");
@@ -490,6 +562,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
/**
* @param end End.
+ * @return Test builder.
*/
public JoinNodeTestPlanBuilder setEnd(Runnable end) {
strPlanBuilder.append("Check before stop")
@@ -501,7 +574,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @throws Exception If failed.
*/
public void execute() throws Exception {
try {
@@ -611,12 +684,19 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
}
+ /**
+ * @param ig Node.
+ * @return Next minor version.
+ */
private AffinityTopologyVersion nextMinorVersion(IgniteEx ig){
AffinityTopologyVersion cur = ig.context().discovery().topologyVersionEx();
- return new AffinityTopologyVersion(cur.topologyVersion(), cur.minorTopologyVersion() + 1);
+ return cur.nextMinorVersion();
}
+ /**
+ * @param ver Version.
+ */
private void awaitTopologyVersion(final AffinityTopologyVersion ver){
onAllNode(new CI1<IgniteEx>() {
@Override public void apply(IgniteEx ig) {
@@ -643,7 +723,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @return Started nodes.
*/
protected List<IgniteEx> grids() {
List<IgniteEx> res = new ArrayList<>();
@@ -655,14 +735,14 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @return Test builder.
*/
public static JoinNodeTestPlanBuilder builder() {
return new JoinNodeTestPlanBuilder();
}
/**
- *
+ * @return Callback.
*/
public Runnable checkCacheOnlySystem() {
return onAllNode(new IgniteInClosure<IgniteEx>() {
@@ -686,15 +766,11 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @return Callback.
*/
public Runnable checkCacheEmpty() {
return onAllNode(new IgniteInClosure<IgniteEx>() {
@Override public void apply(IgniteEx ig) {
- Map<String, DynamicCacheDescriptor> desc = cacheDescriptors(ig);
-
- Assert.assertTrue(desc.isEmpty());
-
Assert.assertNull(ig.context().cache().cache(cache1));
Assert.assertNull(ig.context().cache().cache(cache2));
@@ -706,7 +782,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
}
/**
- *
+ * @return Callback.
*/
public Runnable checkCacheNotEmpty() {
return onAllNode(new IgniteInClosure<IgniteEx>() {
@@ -735,6 +811,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
/**
* @param cls Closure.
+ * @return Callback.
*/
private Runnable onAllNode(final IgniteInClosure<IgniteEx> cls) {
return new Runnable() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
index a06e0ce..4e575cc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
@@ -47,13 +47,10 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
private static final String clientSuffix = "-client";
/** Primary ip finder. */
- protected final TcpDiscoveryIpFinder primaryIpFinder = new TcpDiscoveryVmIpFinder(true);
+ private final TcpDiscoveryIpFinder primaryIpFinder = new TcpDiscoveryVmIpFinder(true);
/** Back up ip finder. */
- protected final TcpDiscoveryIpFinder backUpIpFinder = new TcpDiscoveryVmIpFinder(true);
-
- /** Consistent id count. */
- private int consistentIdCnt;
+ private final TcpDiscoveryIpFinder backUpIpFinder = new TcpDiscoveryVmIpFinder(true);
/** Nodes. */
protected Map<String, Ignite> nodes = new ConcurrentHashMap<>();
@@ -91,28 +88,28 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
}
/**
- *
+ * @return Number of server nodes in primary cluster.
*/
protected int primaryNodes() {
return 3;
}
/**
- *
+ * @return Number of client nodes in primary cluster.
*/
protected int primaryClientNodes() {
return 3;
}
/**
- *
+ * @return Number of server nodes in backup cluster.
*/
protected int backUpNodes() {
return 3;
}
/**
- *
+ * @return Number of client nodes in backup cluster.
*/
protected int backUpClientNodes() {
return 3;
@@ -120,6 +117,7 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
/**
* @param idx idx.
+ * @return Primary cluster node.
*/
protected Ignite primary(int idx) {
return nodes.get("node" + idx + primarySuffix);
@@ -127,29 +125,33 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
/**
* @param idx idx.
+ * @return Primary cluster client node.
*/
- protected Ignite primaryClient(int idx) {
+ Ignite primaryClient(int idx) {
return nodes.get("node" + idx + primarySuffix + clientSuffix);
}
/**
* @param idx idx.
+ * @return Backup cluster node.
*/
- protected Ignite backUp(int idx) {
+ Ignite backUp(int idx) {
return nodes.get("node" + idx + backUpSuffix);
}
/**
* @param idx idx.
+ * @return Backup cluster client node.
*/
- protected Ignite backUpClient(int idx) {
+ Ignite backUpClient(int idx) {
return nodes.get("node" + idx + backUpSuffix + clientSuffix);
}
/**
* @param cnt Count.
+ * @throws Exception If failed.
*/
- protected void startPrimaryNodes(int cnt) throws Exception {
+ private void startPrimaryNodes(int cnt) throws Exception {
for (int i = 0; i < cnt; i++)
startPrimary(i);
@@ -159,8 +161,9 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
/**
* @param idx Index.
+ * @throws Exception If failed.
*/
- protected void startPrimary(int idx) throws Exception {
+ private void startPrimary(int idx) throws Exception {
String node = "node" + idx;
String name = node + primarySuffix;
@@ -176,22 +179,26 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
/**
* @param cnt Count.
+ * @throws Exception If failed.
*/
- protected void startBackUpNodes(int cnt) throws Exception {
+ private void startBackUpNodes(int cnt) throws Exception {
for (int i = 0; i < cnt; i++)
startBackUp(i);
}
/**
* @param idx Index.
+ * @throws Exception If failed.
*/
- protected void startBackUp(int idx) throws Exception {
+ void startBackUp(int idx) throws Exception {
String node = "node" + idx;
String name = node + backUpSuffix;
IgniteConfiguration cfg = getConfiguration(name);
+
cfg.setConsistentId(node);
+
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(backUpIpFinder);
Ignite ig = startGrid(name, cfg);
@@ -201,16 +208,19 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
/**
* @param cnt Count.
+ * @throws Exception If failed.
*/
- protected void startPrimaryClientNodes(int cnt) throws Exception {
+ void startPrimaryClientNodes(int cnt) throws Exception {
for (int i = 0; i < cnt; i++) {
String node = "node" + i;
String name = node + primarySuffix + clientSuffix;
IgniteConfiguration cfg = getConfiguration(name);
+
cfg.setConsistentId(node);
cfg.setClientMode(true);
+
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(primaryIpFinder);
Ignite ig = startGrid(name, cfg);
@@ -221,8 +231,9 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
/**
* @param cnt Count.
+ * @throws Exception If failed.
*/
- protected void startBackUpClientNodes(int cnt) throws Exception {
+ private void startBackUpClientNodes(int cnt) throws Exception {
for (int i = 0; i < cnt; i++) {
String node = "node" + i;
@@ -241,9 +252,9 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
}
/**
- *
+ * @return All nodes from backup cluster.
*/
- protected Iterable<Ignite> allBackUpNodes() {
+ Iterable<Ignite> allBackUpNodes() {
List<Ignite> r = new ArrayList<>();
for (String name : this.nodes.keySet())
@@ -254,11 +265,10 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
}
/**
- *
+ * @param includeClient If {@code true} then allow to return client.
+ * @return Random node from backup topology.
*/
- protected Ignite randomBackUp(boolean includeClient) {
- int nodes = 0;
-
+ Ignite randomBackUp(boolean includeClient) {
List<Ignite> igs = new ArrayList<>();
for (String name : this.nodes.keySet())
@@ -281,7 +291,7 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
/**
* @param i Idx.
*/
- protected void stopPrimary(int i) {
+ void stopPrimary(int i) {
String name = "node" + i + primarySuffix;
nodes.get(name).close();
@@ -292,7 +302,7 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
/**
*
*/
- protected void stopAllPrimary() {
+ void stopAllPrimary() {
stopAll(primarySuffix);
}
@@ -357,10 +367,9 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
}
/**
- *
+ * @return Test class name.
*/
protected String testName() {
return getClass().getSimpleName();
}
-
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateCacheTest.java
index 2f2385d..938b3c8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateCacheTest.java
@@ -62,7 +62,7 @@ public class IgniteChangeGlobalStateCacheTest extends IgniteChangeGlobalStateAbs
}
/**
- *
+ * @throws Exception If failed.
*/
public void testMoreKeyValueAfterActivate() throws Exception {
String cacheName = "my-cache";
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStreamerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStreamerTest.java
index d3e8298..16be316 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStreamerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStreamerTest.java
@@ -36,10 +36,9 @@ public class IgniteChangeGlobalStateDataStreamerTest extends IgniteChangeGlobalS
}
/**
- *
+ * @throws Exception If failed.
*/
- public void testDeActivateAndActivateDataStreamer() throws InterruptedException {
-
+ public void testDeActivateAndActivateDataStreamer() throws Exception {
Ignite ig1 = primary(0);
Ignite ig2 = primary(1);
Ignite ig3 = primary(2);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStructureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStructureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStructureTest.java
index 9013226..8902a36 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStructureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStructureTest.java
@@ -35,9 +35,9 @@ import static org.apache.ignite.testframework.GridTestUtils.runAsync;
*/
public class IgniteChangeGlobalStateDataStructureTest extends IgniteChangeGlobalStateAbstractTest {
/**
- *
+ * @throws Exception If failed.
*/
- public void testDeActivateAndActivateAtomicLong() throws Exception{
+ public void testDeActivateAndActivateAtomicLong() throws Exception {
String lName = "myLong";
Ignite ig1 = primary(0);
@@ -106,7 +106,7 @@ public class IgniteChangeGlobalStateDataStructureTest extends IgniteChangeGlobal
}
/**
- *
+ * @throws Exception If failed.
*/
public void testDeActivateAndActivateCountDownLatch() throws Exception {
final AtomicInteger cnt = new AtomicInteger();
[41/50] [abbrv] ignite git commit: IGNITE-5528 - IS_EVICT_DISABLED
flag is not cleared on cache store exception. This closes #2183.
Posted by vo...@apache.org.
IGNITE-5528 - IS_EVICT_DISABLED flag is not cleared on cache store exception. This closes #2183.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4a169dc5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4a169dc5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4a169dc5
Branch: refs/heads/master
Commit: 4a169dc5625f6f9794c17bfcf5bc1a318c91a996
Parents: 9675061
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Jun 20 07:59:09 2017 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Thu Jul 6 14:37:59 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 62 ++++---
.../processors/cache/GridCacheEntryEx.java | 3 +-
.../processors/cache/GridCacheMapEntry.java | 2 +-
...titionEvictionDuringReadThroughSelfTest.java | 160 +++++++++++++++++++
.../testsuites/IgniteCacheTestSuite5.java | 3 +
5 files changed, 205 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a169dc5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 5937a48..9213be3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -2086,35 +2086,18 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
});
- if (loaded.size() != loadKeys.size()) {
- boolean needTouch =
- tx0 == null || (!tx0.implicit() && tx0.isolation() == READ_COMMITTED);
-
- for (Map.Entry<KeyCacheObject, EntryGetResult> e : loadKeys.entrySet()) {
- if (loaded.contains(e.getKey()))
- continue;
-
- if (needTouch || e.getValue().reserved()) {
- GridCacheEntryEx entry = peekEx(e.getKey());
-
- if (entry != null) {
- if (e.getValue().reserved())
- entry.clearReserveForLoad(e.getValue().version());
-
- if (needTouch)
- ctx.evicts().touch(entry, topVer);
- }
- }
- }
- }
+ clearReservationsIfNeeded(topVer, loadKeys, loaded, tx0);
return map;
}
}), true),
new C2<Map<K, V>, Exception, IgniteInternalFuture<Map<K, V>>>() {
@Override public IgniteInternalFuture<Map<K, V>> apply(Map<K, V> map, Exception e) {
- if (e != null)
+ if (e != null) {
+ clearReservationsIfNeeded(topVer, loadKeys, loaded, tx0);
+
return new GridFinishedFuture<>(e);
+ }
if (tx0 == null || (!tx0.implicit() && tx0.isolation() == READ_COMMITTED)) {
Collection<KeyCacheObject> notFound = new HashSet<>(loadKeys.keySet());
@@ -2181,6 +2164,41 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
}
+ /**
+ * @param topVer Affinity topology version for which load was performed.
+ * @param loadKeys Keys to load.
+ * @param loaded Actually loaded keys.
+ * @param tx0 Transaction within which the load was run, if any.
+ */
+ private void clearReservationsIfNeeded(
+ AffinityTopologyVersion topVer,
+ Map<KeyCacheObject, EntryGetResult> loadKeys,
+ Collection<KeyCacheObject> loaded,
+ IgniteTxLocalAdapter tx0
+ ) {
+ if (loaded.size() != loadKeys.size()) {
+ boolean needTouch =
+ tx0 == null || (!tx0.implicit() && tx0.isolation() == READ_COMMITTED);
+
+ for (Map.Entry<KeyCacheObject, EntryGetResult> e : loadKeys.entrySet()) {
+ if (loaded.contains(e.getKey()))
+ continue;
+
+ if (needTouch || e.getValue().reserved()) {
+ GridCacheEntryEx entry = peekEx(e.getKey());
+
+ if (entry != null) {
+ if (e.getValue().reserved())
+ entry.clearReserveForLoad(e.getValue().version());
+
+ if (needTouch)
+ ctx.evicts().touch(entry, topVer);
+ }
+ }
+ }
+ }
+ }
+
/** {@inheritDoc} */
@Override public final V getAndPut(K key, V val) throws IgniteCheckedException {
return getAndPut(key, val, null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a169dc5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index 4e52680..5aabd30 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -332,9 +332,8 @@ public interface GridCacheEntryEx {
/**
* @param ver Expected entry version.
- * @throws IgniteCheckedException If failed.
*/
- public void clearReserveForLoad(GridCacheVersion ver) throws IgniteCheckedException;
+ public void clearReserveForLoad(GridCacheVersion ver);
/**
* Reloads entry from underlying storage.
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a169dc5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index eea8935..673945a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2699,7 +2699,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/** {@inheritDoc} */
- @Override public synchronized void clearReserveForLoad(GridCacheVersion ver) throws IgniteCheckedException {
+ @Override public synchronized void clearReserveForLoad(GridCacheVersion ver) {
if (obsoleteVersionExtras() != null)
return;
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a169dc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java
new file mode 100644
index 0000000..d5351f7
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionEvictionDuringReadThroughSelfTest.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import java.util.LinkedHashSet;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.Cache;
+import javax.cache.configuration.Factory;
+import javax.cache.expiry.CreatedExpiryPolicy;
+import javax.cache.expiry.Duration;
+import javax.cache.integration.CacheLoaderException;
+import javax.cache.integration.CacheWriterException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreAdapter;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class GridCachePartitionEvictionDuringReadThroughSelfTest extends GridCommonAbstractTest {
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration<Integer, Integer> ccfg =
+ new CacheConfiguration<Integer, Integer>()
+ .setName("config")
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+ .setBackups(0) // No need for backup, just load from the store if needed
+ .setCacheStoreFactory(new CacheStoreFactory())
+ .setEvictionPolicy(new LruEvictionPolicy(100))
+ .setNearConfiguration(new NearCacheConfiguration<Integer, Integer>()
+ .setNearEvictionPolicy(new LruEvictionPolicy<Integer, Integer>()));
+
+ ccfg.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MINUTES, 1)))
+ .setReadThrough(true)
+ .setWriteThrough(false);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testPartitionRent() throws Exception {
+ startGrid(0);
+
+ final AtomicBoolean done = new AtomicBoolean();
+
+ IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Integer>() {
+ @Override
+ public Integer call() throws Exception {
+ LinkedHashSet<Integer> set = new LinkedHashSet<>();
+
+ set.add(1);
+ set.add(2);
+ set.add(3);
+ set.add(4);
+ set.add(5);
+
+ while (!done.get()) {
+ try {
+ grid(0).<Integer, Integer>cache("config").getAll(set);
+ }
+ catch (Throwable ignore) {
+ // No-op.
+ }
+ }
+
+ return null;
+ }
+ }, 4, "loader");
+
+ IgniteInternalFuture<Void> startFut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ for (int i = 1; i < 5; i++) {
+ startGrid(i);
+
+ awaitPartitionMapExchange();
+ }
+
+ return null;
+ }
+ });
+
+ startFut.get();
+
+ done.set(true);
+
+ fut.get();
+ }
+
+ /**
+ *
+ */
+ private static class CacheStoreFactory implements Factory<CacheStore<Integer, Integer>> {
+ /** {@inheritDoc} */
+ @Override public CacheStore<Integer, Integer> create() {
+ return new HangingCacheStore();
+ }
+ }
+
+ /**
+ *
+ */
+ private static class HangingCacheStore extends CacheStoreAdapter<Integer, Integer> {
+ /** */
+ private CountDownLatch releaseLatch = new CountDownLatch(1);
+
+ /** {@inheritDoc} */
+ @Override public Integer load(Integer key) throws CacheLoaderException {
+ if (key == 3)
+ throw new CacheLoaderException();
+
+ return key;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void write(Cache.Entry<? extends Integer, ? extends Integer> entry) throws CacheWriterException {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public void delete(Object key) throws CacheWriterException {
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a169dc5/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
index 1ab516a..1395b95 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheStoreCollectionTes
import org.apache.ignite.internal.processors.cache.PartitionsExchangeOnDiscoveryHistoryOverflowTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentNodeJoinValidationTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentTest;
+import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionEvictionDuringReadThroughSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheGroupsPartitionLossPolicySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCachePartitionLossPolicySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheTxIteratorSelfTest;
@@ -92,6 +93,8 @@ public class IgniteCacheTestSuite5 extends TestSuite {
suite.addTestSuite(GridCachePartitionExchangeManagerHistSizeTest.class);
+ suite.addTestSuite(GridCachePartitionEvictionDuringReadThroughSelfTest.class);
+
return suite;
}
}
[34/50] [abbrv] ignite git commit: Merge branch 'ignite-2.1.2' of
https://github.com/gridgain/apache-ignite into ignite-2.1.2
Posted by vo...@apache.org.
Merge branch 'ignite-2.1.2' of https://github.com/gridgain/apache-ignite into ignite-2.1.2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3f6c1743
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3f6c1743
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3f6c1743
Branch: refs/heads/master
Commit: 3f6c1743b3ead0d861075f60d7d00ab238178333
Parents: c3401cb 6e371ec
Author: Alexey Kukushkin <Al...@yahoo.com>
Authored: Thu Jul 6 12:44:47 2017 +0300
Committer: Alexey Kukushkin <Al...@yahoo.com>
Committed: Thu Jul 6 12:44:47 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/query/GridQueryProcessor.java | 4 +++-
.../java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 1 -
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[27/50] [abbrv] ignite git commit: Merge remote-tracking branch
'community/ignite-2.1.2-merge-ea11' into ignite-2.1.2
Posted by vo...@apache.org.
Merge remote-tracking branch 'community/ignite-2.1.2-merge-ea11' into ignite-2.1.2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/09dff9bb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/09dff9bb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/09dff9bb
Branch: refs/heads/master
Commit: 09dff9bb15468a7481107f66ea046ffa5eb6e7df
Parents: 69357c5 d82b2b8
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Jul 5 20:26:50 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Jul 5 20:26:50 2017 +0300
----------------------------------------------------------------------
...ishSnapshotOperationAckDiscoveryMessage.java | 7 ++
.../snapshot/SnapshotCheckParameters.java | 71 ++++++++++++++++++++
.../pagemem/snapshot/SnapshotOperation.java | 26 +++++--
.../processors/cache/GridCacheProcessor.java | 20 +++++-
.../dht/GridDhtPartitionTopologyImpl.java | 5 +-
.../cache/persistence/DbCheckpointListener.java | 16 ++++-
.../GridCacheDatabaseSharedManager.java | 4 ++
.../persistence/GridCacheOffheapManager.java | 41 ++++++-----
.../service/GridServiceProcessor.java | 9 ++-
9 files changed, 170 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
[15/50] [abbrv] ignite git commit: Merge branch 'ignite-2.1' into
ignite-2.1.2
Posted by vo...@apache.org.
Merge branch 'ignite-2.1' into ignite-2.1.2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/aa21a9b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/aa21a9b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/aa21a9b5
Branch: refs/heads/master
Commit: aa21a9b59ec0266b4fee16e02d2796e6e0d1a9b5
Parents: 9743fa3 f9f13cf
Author: devozerov <vo...@gridgain.com>
Authored: Wed Jul 5 14:18:32 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Jul 5 14:18:32 2017 +0300
----------------------------------------------------------------------
.../jdbc2/JdbcPreparedStatementSelfTest.java | 35 +
.../jdbc/JdbcPreparedStatementSelfTest.java | 35 +
.../thin/JdbcThinPreparedStatementSelfTest.java | 35 +
.../PersistentStoreConfiguration.java | 39 +-
.../org/apache/ignite/events/EventType.java | 12 +
.../ignite/events/WalSegmentArchivedEvent.java | 62 +
.../apache/ignite/internal/GridComponent.java | 4 +-
.../ignite/internal/GridPluginComponent.java | 2 +-
.../apache/ignite/internal/IgniteKernal.java | 33 +-
.../internal/jdbc/JdbcPreparedStatement.java | 6 +-
.../internal/jdbc/thin/JdbcThinConnection.java | 7 +-
.../jdbc/thin/JdbcThinPreparedStatement.java | 2 -
.../internal/jdbc2/JdbcPreparedStatement.java | 12 +-
.../internal/managers/GridManagerAdapter.java | 2 +-
.../internal/managers/discovery/DiscoCache.java | 17 +-
.../discovery/DiscoveryLocalJoinData.java | 104 ++
.../discovery/GridDiscoveryManager.java | 128 +-
.../pagemem/store/IgnitePageStoreManager.java | 3 +-
.../internal/pagemem/wal/record/WALRecord.java | 11 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../cache/CacheAffinitySharedManager.java | 67 +-
.../processors/cache/CacheGroupContext.java | 4 +-
.../processors/cache/CacheGroupData.java | 4 +-
.../cache/ChangeGlobalStateMessage.java | 120 --
.../processors/cache/ClusterCachesInfo.java | 493 +++++--
.../internal/processors/cache/ClusterState.java | 38 -
.../cache/DynamicCacheChangeRequest.java | 52 +-
.../processors/cache/ExchangeActions.java | 37 +-
.../processors/cache/GridCacheEventManager.java | 2 -
.../cache/GridCacheEvictionManager.java | 1 -
.../processors/cache/GridCacheIoManager.java | 13 +-
.../processors/cache/GridCacheMvccManager.java | 9 +-
.../GridCachePartitionExchangeManager.java | 423 +++---
.../processors/cache/GridCacheProcessor.java | 193 +--
.../cache/GridCacheSharedContext.java | 60 +-
.../cache/GridCacheSharedManager.java | 6 -
.../cache/GridCacheSharedManagerAdapter.java | 16 -
.../processors/cache/PendingDiscoveryEvent.java | 61 +
.../processors/cache/StateChangeRequest.java | 77 ++
.../binary/CacheObjectBinaryProcessorImpl.java | 4 +-
.../distributed/GridCacheTxRecoveryFuture.java | 1 -
.../distributed/dht/GridDhtCacheAdapter.java | 1 -
.../cache/distributed/dht/GridDhtGetFuture.java | 1 -
.../distributed/dht/GridDhtGetSingleFuture.java | 2 -
.../dht/GridDhtPartitionTopologyImpl.java | 13 +-
.../dht/GridDhtTopologyFutureAdapter.java | 2 +-
.../dht/GridPartitionedSingleGetFuture.java | 3 -
.../GridNearAtomicAbstractUpdateFuture.java | 1 -
.../dht/preloader/GridDhtForceKeysFuture.java | 1 -
.../dht/preloader/GridDhtPartitionDemander.java | 2 +
.../GridDhtPartitionsExchangeFuture.java | 228 +++-
.../preloader/GridDhtPartitionsFullMessage.java | 44 +-
.../GridDhtPartitionsSingleMessage.java | 38 +-
.../dht/preloader/GridDhtPreloader.java | 2 +-
.../distributed/near/GridNearGetFuture.java | 2 -
.../near/GridNearTxPrepareRequest.java | 1 -
.../GridCacheDatabaseSharedManager.java | 111 +-
.../persistence/GridCacheOffheapManager.java | 5 +-
.../IgniteCacheDatabaseSharedManager.java | 74 +-
.../persistence/IgniteCacheSnapshotManager.java | 20 +-
.../persistence/file/FilePageStoreManager.java | 14 +-
.../persistence/tree/io/TrackingPageIO.java | 12 +-
.../wal/AbstractWalRecordsIterator.java | 289 ++++
.../cache/persistence/wal/FileInput.java | 16 +-
.../cache/persistence/wal/FileWALPointer.java | 4 +-
.../wal/FileWriteAheadLogManager.java | 594 ++++----
.../cache/persistence/wal/RecordSerializer.java | 5 +
.../persistence/wal/SegmentArchiveResult.java | 61 +
.../persistence/wal/SegmentEofException.java | 3 +-
.../wal/reader/IgniteWalIteratorFactory.java | 102 ++
.../wal/reader/StandaloneGridKernalContext.java | 499 +++++++
...ndaloneIgniteCacheDatabaseSharedManager.java | 30 +
.../reader/StandaloneWalRecordsIterator.java | 258 ++++
.../wal/serializer/RecordV1Serializer.java | 45 +-
.../query/GridCacheDistributedQueryManager.java | 4 +-
.../store/GridCacheStoreManagerAdapter.java | 1 -
.../cache/version/GridCacheVersionManager.java | 6 -
.../cacheobject/IgniteCacheObjectProcessor.java | 5 -
.../IgniteCacheObjectProcessorImpl.java | 5 -
.../cluster/ChangeGlobalStateFinishMessage.java | 86 ++
.../cluster/ChangeGlobalStateMessage.java | 140 ++
.../processors/cluster/ClusterProcessor.java | 3 +-
.../cluster/DiscoveryDataClusterState.java | 157 +++
.../cluster/GridClusterStateProcessor.java | 1129 ++++++---------
.../cluster/IgniteChangeGlobalStateSupport.java | 3 +-
.../datastructures/DataStructuresProcessor.java | 6 +-
.../datastructures/GridCacheAtomicLongImpl.java | 2 +-
.../GridCacheAtomicReferenceImpl.java | 2 +-
.../GridCacheAtomicSequenceImpl.java | 2 +-
.../GridCacheAtomicStampedImpl.java | 2 +-
.../GridCacheCountDownLatchImpl.java | 2 +-
.../datastructures/GridCacheLockImpl.java | 4 +-
.../datastructures/GridCacheQueueAdapter.java | 1 -
.../datastructures/GridCacheSemaphoreImpl.java | 2 +-
.../datastructures/GridCacheSetImpl.java | 1 -
.../internal/processors/igfs/IgfsImpl.java | 2 -
.../internal/processors/igfs/IgfsProcessor.java | 2 +-
.../utils/PlatformConfigurationUtils.java | 8 +-
.../processors/query/GridQueryProcessor.java | 4 +-
.../processors/rest/GridRestProcessor.java | 2 +-
.../cluster/GridChangeStateCommandHandler.java | 2 +-
.../service/GridServiceProcessor.java | 6 +-
.../processors/task/GridTaskProcessor.java | 2 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 12 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 10 +-
.../internal/TestRecordingCommunicationSpi.java | 10 +
...GridManagerLocalMessageListenerSelfTest.java | 4 +-
.../cache/GridCacheAbstractMetricsSelfTest.java | 24 -
.../cache/IgniteActiveClusterTest.java | 182 ---
.../IgniteClusterActivateDeactivateTest.java | 1284 ++++++++++++++++++
...erActivateDeactivateTestWithPersistence.java | 197 +++
.../IgniteDaemonNodeMarshallerCacheTest.java | 10 -
.../IgniteSemaphoreAbstractSelfTest.java | 17 +-
...IgnitePersistentStoreDataStructuresTest.java | 2 +
.../wal/IgniteWalHistoryReservationsTest.java | 2 +-
.../db/wal/reader/IgniteWalReaderTest.java | 385 ++++++
.../db/wal/reader/MockWalIteratorFactory.java | 114 ++
.../pagemem/NoOpPageStoreManager.java | 12 +-
.../persistence/pagemem/NoOpWALManager.java | 23 +-
.../AbstractNodeJoinTemplate.java | 149 +-
.../IgniteChangeGlobalStateAbstractTest.java | 65 +-
.../IgniteChangeGlobalStateCacheTest.java | 2 +-
...IgniteChangeGlobalStateDataStreamerTest.java | 5 +-
...gniteChangeGlobalStateDataStructureTest.java | 6 +-
.../IgniteChangeGlobalStateFailOverTest.java | 26 +-
.../IgniteChangeGlobalStateTest.java | 158 +--
.../IgniteStandByClusterTest.java | 17 +-
.../join/JoinActiveNodeToActiveCluster.java | 62 +-
...ctiveNodeToActiveClusterWithPersistence.java | 17 +
.../IgniteStandByClientReconnectTest.java | 13 +-
...eStandByClientReconnectToNewClusterTest.java | 13 +-
...cpCommunicationSpiMultithreadedSelfTest.java | 2 +-
.../testframework/junits/GridAbstractTest.java | 4 +-
.../junits/common/GridCommonAbstractTest.java | 3 +
.../ignite/testsuites/IgnitePdsTestSuite2.java | 9 +-
.../testsuites/IgniteStandByClusterSuite.java | 5 +-
.../processors/hadoop/HadoopProcessor.java | 4 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 3 +-
.../Cache/CacheConfigurationTest.cs | 21 +
.../Apache.Ignite.Core.Tests/EventsTest.cs | 19 +-
.../Cache/Configuration/CacheConfiguration.cs | 75 +-
.../Apache.Ignite.Core/IgniteConfiguration.cs | 7 +-
.../Impl/Events/RemoteListenEventFilter.cs | 3 +
143 files changed, 6651 insertions(+), 2631 deletions(-)
----------------------------------------------------------------------
[17/50] [abbrv] ignite git commit: Diagnostic info for
GridDhtTxFinishFuture.
Posted by vo...@apache.org.
Diagnostic info for GridDhtTxFinishFuture.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/58a937e5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/58a937e5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/58a937e5
Branch: refs/heads/master
Commit: 58a937e5310c62ccb557d8da959bc4ffa8bcca62
Parents: aa21a9b
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 5 14:24:51 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 5 14:24:51 2017 +0300
----------------------------------------------------------------------
.../internal/IgniteDiagnosticMessage.java | 4 ++-
.../distributed/dht/GridDhtTxFinishFuture.java | 33 +++++++++++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/58a937e5/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
index 075b0fe..6e6bac0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
@@ -413,7 +413,9 @@ public class IgniteDiagnosticMessage implements Message {
for (IgniteInternalTx tx : ctx.cache().context().tm().activeTransactions()) {
if (dhtVer.equals(tx.xidVersion()) || nearVer.equals(tx.nearXidVersion())) {
sb.append(U.nl())
- .append(" [ver=").append(tx.xidVersion())
+ .append(" ")
+ .append(tx.getClass().getSimpleName())
+ .append(" [ver=").append(tx.xidVersion())
.append(", nearVer=").append(tx.nearXidVersion())
.append(", topVer=").append(tx.topologyVersion())
.append(", state=").append(tx.state())
http://git-wip-us.apache.org/repos/asf/ignite/blob/58a937e5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
index 8a31bac..d8180b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
@@ -26,6 +26,8 @@ import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteDiagnosticAware;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.NodeStoppingException;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
@@ -35,6 +37,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxMapping;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -53,7 +56,7 @@ import static org.apache.ignite.transactions.TransactionState.COMMITTING;
*
*/
public final class GridDhtTxFinishFuture<K, V> extends GridCacheCompoundIdentityFuture<IgniteInternalTx>
- implements GridCacheFuture<IgniteInternalTx> {
+ implements GridCacheFuture<IgniteInternalTx>, IgniteDiagnosticAware {
/** */
private static final long serialVersionUID = 0L;
@@ -554,6 +557,34 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCacheCompoundIdentity
}
/** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public void addDiagnosticRequest(IgniteDiagnosticPrepareContext ctx) {
+ if (!isDone()) {
+ for (IgniteInternalFuture fut : futures()) {
+ if (!fut.isDone()) {
+ MiniFuture f = (MiniFuture)fut;
+
+ if (!f.node().isLocal()) {
+ GridCacheVersion dhtVer = tx.xidVersion();
+ GridCacheVersion nearVer = tx.nearXidVersion();
+
+ ctx.remoteTxInfo(f.node().id(), dhtVer, nearVer, "GridDhtTxFinishFuture " +
+ "waiting for response [node=" + f.node().id() +
+ ", topVer=" + tx.topologyVersion() +
+ ", dhtVer=" + dhtVer +
+ ", nearVer=" + nearVer +
+ ", futId=" + futId +
+ ", miniId=" + f.futId +
+ ", tx=" + tx + ']');
+
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() {
@SuppressWarnings("unchecked")
[49/50] [abbrv] ignite git commit: Merge branch 'ignite-5710' into
ignite-2.1.2
Posted by vo...@apache.org.
Merge branch 'ignite-5710' into ignite-2.1.2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/31e9d3b1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/31e9d3b1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/31e9d3b1
Branch: refs/heads/master
Commit: 31e9d3b1701f083d1276a9ef24eb10dba6d7eb12
Parents: 3259e2b 516e73a
Author: vsisko <vs...@gridgain.com>
Authored: Fri Jul 7 15:29:28 2017 +0700
Committer: vsisko <vs...@gridgain.com>
Committed: Fri Jul 7 15:29:28 2017 +0700
----------------------------------------------------------------------
.../frontend/app/data/pom-dependencies.json | 5 ++++-
.../configuration/generator/Maven.service.js | 21 +++++++++++++-------
2 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
[35/50] [abbrv] ignite git commit: IGNITE-5533: Proper index cleanup
in H2 database during DROP TALBE. This closes #2167.
Posted by vo...@apache.org.
IGNITE-5533: Proper index cleanup in H2 database during DROP TALBE. This closes #2167.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/333e32b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/333e32b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/333e32b5
Branch: refs/heads/master
Commit: 333e32b58fd6e7341fcc14b862140f244b575315
Parents: 3f6c174
Author: Alexander Paschenko <al...@gmail.com>
Authored: Thu Jul 6 13:00:33 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jul 6 13:00:33 2017 +0300
----------------------------------------------------------------------
.../processors/query/h2/opt/GridH2Table.java | 49 +++++++++++++++++-
.../cache/index/H2DynamicTableSelfTest.java | 53 ++++++++++++++++++++
2 files changed, 101 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/333e32b5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index d656cc3..76d0258 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -40,7 +40,9 @@ import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteBiTuple;
import org.h2.command.ddl.CreateTableData;
+import org.h2.engine.DbObject;
import org.h2.engine.Session;
+import org.h2.engine.SysProperties;
import org.h2.index.Index;
import org.h2.index.IndexType;
import org.h2.index.SpatialIndex;
@@ -48,6 +50,7 @@ import org.h2.message.DbException;
import org.h2.result.Row;
import org.h2.result.SearchRow;
import org.h2.result.SortOrder;
+import org.h2.schema.SchemaObject;
import org.h2.table.IndexColumn;
import org.h2.table.TableBase;
import org.h2.table.TableType;
@@ -76,6 +79,9 @@ public class GridH2Table extends TableBase {
/** */
private final int pkIndexPos;
+ /** Total number of system indexes. */
+ private final int sysIdxsCnt;
+
/** */
private final Map<String, GridH2IndexBase> tmpIdxs = new HashMap<>();
@@ -184,6 +190,8 @@ public class GridH2Table extends TableBase {
pkIndexPos = hasHashIndex ? 2 : 1;
+ sysIdxsCnt = idxs.size();
+
final int segments = desc != null ? desc.context().config().getQueryParallelism() :
// Get index segments count from PK index. Null desc can be passed from tests.
index(pkIndexPos).segmentsCount();
@@ -449,6 +457,45 @@ public class GridH2Table extends TableBase {
// No-op.
}
+ /** {@inheritDoc} */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ @Override public void removeChildrenAndResources(Session ses) {
+ lock(true);
+
+ try {
+ super.removeChildrenAndResources(ses);
+
+ // Clear all user indexes registered in schema.
+ while (idxs.size() > sysIdxsCnt) {
+ Index idx = idxs.get(sysIdxsCnt);
+
+ if (idx.getName() != null && idx.getSchema().findIndex(ses, idx.getName()) == idx) {
+ // This call implicitly removes both idx and its proxy, if any, from idxs.
+ database.removeSchemaObject(ses, idx);
+
+ // We have to call destroy here if we are who has removed this index from the table.
+ if (idx instanceof GridH2IndexBase)
+ ((GridH2IndexBase)idx).destroy();
+ }
+ }
+
+ if (SysProperties.CHECK) {
+ for (SchemaObject obj : database.getAllSchemaObjects(DbObject.INDEX)) {
+ Index idx = (Index) obj;
+ if (idx.getTable() == this)
+ DbException.throwInternalError("index not dropped: " + idx.getName());
+ }
+ }
+
+ database.removeMeta(ses, getId());
+ invalidate();
+
+ }
+ finally {
+ unlock(true);
+ }
+ }
+
/**
* Destroy the table.
*/
@@ -791,7 +838,7 @@ public class GridH2Table extends TableBase {
Index cloneIdx = createDuplicateIndexIfNeeded(idx);
ArrayList<Index> newIdxs = new ArrayList<>(
- idxs.size() + ((cloneIdx == null) ? 1 : 2));
+ idxs.size() + ((cloneIdx == null) ? 1 : 2));
newIdxs.addAll(idxs);
http://git-wip-us.apache.org/repos/asf/ignite/blob/333e32b5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index 5975b4e..b0e69f1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -694,6 +694,59 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
}
/**
+ * Tests behavior on sequential create and drop of a table and its index.
+ */
+ public void testTableAndIndexRecreate() {
+ execute("drop table if exists \"PUBLIC\".t");
+
+ // First let's check behavior without index name set
+ execute("create table \"PUBLIC\".t (a int primary key, b varchar(30))");
+
+ fillRecreatedTable();
+
+ execute("create index on \"PUBLIC\".t (b desc)");
+ execute("drop table \"PUBLIC\".t");
+
+ assertNull(client().cache("t"));
+
+ execute("create table \"PUBLIC\".t (a int primary key, b varchar(30))");
+
+ fillRecreatedTable();
+
+ execute("create index on \"PUBLIC\".t (b desc)");
+ execute("drop table \"PUBLIC\".t");
+
+ assertNull(client().cache("t"));
+
+ // And now let's do the same for the named index
+ execute("create table \"PUBLIC\".t (a int primary key, b varchar(30))");
+
+ fillRecreatedTable();
+
+ execute("create index namedIdx on \"PUBLIC\".t (b desc)");
+ execute("drop table \"PUBLIC\".t");
+
+ assertNull(client().cache("t"));
+
+ execute("create table \"PUBLIC\".t (a int primary key, b varchar(30))");
+
+ fillRecreatedTable();
+
+ execute("create index namedIdx on \"PUBLIC\".t (b desc)");
+ execute("drop table \"PUBLIC\".t");
+ }
+
+ /**
+ * Fill re-created table with data.
+ */
+ private void fillRecreatedTable() {
+ for (int j = 1; j < 10; j++) {
+ String s = Integer.toString(j);
+ execute("insert into \"PUBLIC\".t (a,b) values (" + s + ", '" + s + "')");
+ }
+ }
+
+ /**
* Check that dynamic cache created with {@code CREATE TABLE} is correctly configured affinity wise.
* @param cacheName Cache name to check.
* @param affKeyFieldName Expected affinity key field name.
[30/50] [abbrv] ignite git commit: IGNITE-5401 Fix in
MarshallerConextImpl. This closes #2205.
Posted by vo...@apache.org.
IGNITE-5401 Fix in MarshallerConextImpl. This closes #2205.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/740b0b2b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/740b0b2b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/740b0b2b
Branch: refs/heads/master
Commit: 740b0b2bdb37154857363c1d94ec88d867bd8b65
Parents: 907d4a8
Author: Sergey Chugunov <se...@gmail.com>
Authored: Thu Jul 6 12:20:55 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jul 6 12:20:55 2017 +0300
----------------------------------------------------------------------
.../jdbc2/JdbcAbstractDmlStatementSelfTest.java | 12 +
.../jdbc2/JdbcDynamicIndexAbstractSelfTest.java | 2 -
.../JdbcThinDynamicIndexAbstractSelfTest.java | 2 -
.../ignite/internal/MarshallerContextImpl.java | 10 +-
.../GridMarshallerMappingProcessor.java | 16 +-
...iteMarshallerCacheClassNameConflictTest.java | 11 +-
.../IgniteMarshallerCacheFSRestoreTest.java | 217 +++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +
8 files changed, 248 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/740b0b2b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
index a001eb3..f220b47 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
@@ -139,6 +140,17 @@ public abstract class JdbcAbstractDmlStatementSelfTest extends GridCommonAbstrac
conn.close();
assertTrue(conn.isClosed());
+
+ cleanUpWorkingDir();
+ }
+
+ /**
+ * Clean up working directory.
+ */
+ private void cleanUpWorkingDir() throws Exception {
+ String workDir = U.defaultWorkDirectory();
+
+ deleteRecursively(U.resolveWorkDirectory(workDir, "marshaller", false));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/740b0b2b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java
index d4da1f3..7bbda6f 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java
@@ -242,8 +242,6 @@ public abstract class JdbcDynamicIndexAbstractSelfTest extends JdbcAbstractDmlSt
* Test that changes in cache affect index, and vice versa.
*/
public void testIndexState() throws SQLException {
- fail("https://issues.apache.org/jira/browse/IGNITE-5373");
-
IgniteCache<String, Person> cache = cache();
assertSize(3);
http://git-wip-us.apache.org/repos/asf/ignite/blob/740b0b2b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDynamicIndexAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDynamicIndexAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDynamicIndexAbstractSelfTest.java
index 7404ebd..3f762fc 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDynamicIndexAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinDynamicIndexAbstractSelfTest.java
@@ -254,8 +254,6 @@ public abstract class JdbcThinDynamicIndexAbstractSelfTest extends JdbcThinAbstr
* @throws SQLException If failed.
*/
public void testIndexState() throws SQLException {
- fail("https://issues.apache.org/jira/browse/IGNITE-5373");
-
IgniteCache<String, Person> cache = cache();
assertSize(3);
http://git-wip-us.apache.org/repos/asf/ignite/blob/740b0b2b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index cad06c3..6f15507 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -316,18 +316,14 @@ public class MarshallerContextImpl implements MarshallerContext {
*
* @param item type mapping to propose
* @return null if cache doesn't contain any mappings for given (platformId, typeId) pair,
- * previous class name otherwise.
+ * previous {@link MappedName mapped name} otherwise.
*/
- public String onMappingProposed(MarshallerMappingItem item) {
+ public MappedName onMappingProposed(MarshallerMappingItem item) {
ConcurrentMap<Integer, MappedName> cache = getCacheFor(item.platformId());
MappedName newName = new MappedName(item.className(), false);
- MappedName oldName;
- if ((oldName = cache.putIfAbsent(item.typeId(), newName)) == null)
- return null;
- else
- return oldName.className();
+ return cache.putIfAbsent(item.typeId(), newName);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/740b0b2b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/GridMarshallerMappingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/GridMarshallerMappingProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/GridMarshallerMappingProcessor.java
index c23d068..df0c720 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/GridMarshallerMappingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/marshaller/GridMarshallerMappingProcessor.java
@@ -113,7 +113,7 @@ public class GridMarshallerMappingProcessor extends GridProcessorAdapter {
marshallerCtx.onMarshallerProcessorStarted(ctx, transport);
- discoMgr.setCustomEventListener(MappingProposedMessage.class, new MarshallerMappingExchangeListener());
+ discoMgr.setCustomEventListener(MappingProposedMessage.class, new MappingProposedListener());
discoMgr.setCustomEventListener(MappingAcceptedMessage.class, new MappingAcceptedListener());
@@ -233,7 +233,7 @@ public class GridMarshallerMappingProcessor extends GridProcessorAdapter {
/**
*
*/
- private final class MarshallerMappingExchangeListener implements CustomEventListener<MappingProposedMessage> {
+ private final class MappingProposedListener implements CustomEventListener<MappingProposedMessage> {
/** {@inheritDoc} */
@Override public void onCustomEvent(
AffinityTopologyVersion topVer,
@@ -246,13 +246,15 @@ public class GridMarshallerMappingProcessor extends GridProcessorAdapter {
if (!msg.inConflict()) {
MarshallerMappingItem item = msg.mappingItem();
- String conflictingName = marshallerCtx.onMappingProposed(item);
+ MappedName existingName = marshallerCtx.onMappingProposed(item);
- if (conflictingName != null) {
- if (conflictingName.equals(item.className()))
+ if (existingName != null) {
+ String existingClsName = existingName.className();
+
+ if (existingClsName.equals(item.className()) && !existingName.accepted())
msg.markDuplicated();
- else
- msg.conflictingWithClass(conflictingName);
+ else if (!existingClsName.equals(item.className()))
+ msg.conflictingWithClass(existingClsName);
}
}
else {
http://git-wip-us.apache.org/repos/asf/ignite/blob/740b0b2b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
index c8a0e76..80d0fd1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
@@ -55,9 +55,6 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
*/
public class IgniteMarshallerCacheClassNameConflictTest extends GridCommonAbstractTest {
/** */
- private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
- /** */
private volatile boolean bbClsRejected;
/** */
@@ -79,7 +76,7 @@ public class IgniteMarshallerCacheClassNameConflictTest extends GridCommonAbstra
IgniteConfiguration cfg = super.getConfiguration(gridName);
TcpDiscoverySpi disco = new TestTcpDiscoverySpi();
- disco.setIpFinder(ipFinder);
+ disco.setIpFinder(LOCAL_IP_FINDER);
cfg.setDiscoverySpi(disco);
@@ -207,7 +204,7 @@ public class IgniteMarshallerCacheClassNameConflictTest extends GridCommonAbstra
DiscoveryCustomMessage customMsg = spiCustomMsg == null ? null
: (DiscoveryCustomMessage) U.field(spiCustomMsg, "delegate");
- if (customMsg != null)
+ if (customMsg != null) {
//don't want to make this class public, using equality of class name instead of instanceof operator
if ("MappingProposedMessage".equals(customMsg.getClass().getSimpleName())) {
String conflClsName = U.field(customMsg, "conflictingClsName");
@@ -219,8 +216,10 @@ public class IgniteMarshallerCacheClassNameConflictTest extends GridCommonAbstra
aaClsRejected = true;
}
}
+ }
- delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg);
+ if (delegate != null)
+ delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/740b0b2b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java
new file mode 100644
index 0000000..38fa324
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheFSRestoreTest.java
@@ -0,0 +1,217 @@
+/*
+ * 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 java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.StandardCharsets;
+import java.util.Collection;
+import java.util.Map;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
+import org.apache.ignite.internal.processors.marshaller.MappingProposedMessage;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage;
+import org.apache.ignite.spi.discovery.DiscoverySpiListener;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public class IgniteMarshallerCacheFSRestoreTest extends GridCommonAbstractTest {
+ /** */
+ private volatile boolean isDuplicateObserved = true;
+
+ /**
+ *
+ */
+ private static class SimpleValue {
+ /** */
+ private final int iF;
+
+ /** */
+ private final String sF;
+
+ /**
+ * @param iF Int field.
+ * @param sF String field.
+ */
+ SimpleValue(int iF, String sF) {
+ this.iF = iF;
+ this.sF = sF;
+ }
+ }
+
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ TcpDiscoverySpi discoSpi = new TestTcpDiscoverySpi();
+ discoSpi.setIpFinder(LOCAL_IP_FINDER);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ CacheConfiguration singleCacheConfig = new CacheConfiguration()
+ .setName(DEFAULT_CACHE_NAME)
+ .setCacheMode(CacheMode.PARTITIONED)
+ .setBackups(1)
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC);
+
+ cfg.setCacheConfiguration(singleCacheConfig);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ cleanUpWorkDir();
+ }
+
+ /**
+ *
+ */
+ private void cleanUpWorkDir() throws Exception {
+ String workDir = U.defaultWorkDirectory();
+
+ deleteRecursively(U.resolveWorkDirectory(workDir, "marshaller", false));
+ }
+
+ /**
+ * Test checks a scenario when in multinode cluster one node may read marshaller mapping
+ * from file storage and add it directly to marshaller context with accepted=true flag,
+ * when another node sends a proposed request for the same mapping.
+ *
+ * In that case the request must not be marked as duplicate and must be processed in a regular way.
+ * No hangs must take place.
+ *
+ * @see <a href="https://issues.apache.org/jira/browse/IGNITE-5401">IGNITE-5401</a> Take a look at JIRA ticket for more information about context of this test.
+ *
+ * This test must never hang on proposing of MarshallerMapping.
+ */
+ public void testFileMappingReadAndPropose() throws Exception {
+ prepareMarshallerFileStore();
+
+ IgniteEx ignite0 = startGrid(0);
+ IgniteEx ignite1 = startGrid(1);
+
+ BinaryObject obj0 = ignite0.binary().builder(SimpleValue.class.getName())
+ .setField("iF", 10)
+ .setField("sF", "str0")
+ .build();
+
+ BinaryObject obj1 = ignite0.binary().builder(SimpleValue.class.getName())
+ .setField("iF", 20)
+ .setField("sF", "str1")
+ .build();
+
+ IgniteCache<Object, Object> binCache = ignite0.cache(DEFAULT_CACHE_NAME).withKeepBinary();
+
+ binCache.put(1, obj0);
+ binCache.put(2, obj1);
+
+ ignite0.cache(DEFAULT_CACHE_NAME).remove(1);
+
+ ignite1.cache(DEFAULT_CACHE_NAME).put(3, new SimpleValue(30, "str2"));
+
+ assertFalse(isDuplicateObserved);
+ }
+
+ /**
+ *
+ */
+ private void prepareMarshallerFileStore() throws Exception {
+ String typeName = SimpleValue.class.getName();
+ int typeId = typeName.toLowerCase().hashCode();
+
+ String fileName = typeId + ".classname0";
+
+ File marshStoreDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "marshaller", false);
+
+ try(FileOutputStream out = new FileOutputStream(new File(marshStoreDir, fileName))) {
+ try (Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8)) {
+ writer.write(typeName);
+
+ writer.flush();
+ }
+ }
+ }
+
+ /** */
+ private class TestTcpDiscoverySpi extends TcpDiscoverySpi {
+
+ /** */
+ private class DiscoverySpiListenerWrapper implements DiscoverySpiListener {
+ /** */
+ private DiscoverySpiListener delegate;
+
+ /**
+ * @param delegate Delegate.
+ */
+ private DiscoverySpiListenerWrapper(DiscoverySpiListener delegate) {
+ this.delegate = delegate;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onDiscovery(
+ int type,
+ long topVer,
+ ClusterNode node,
+ Collection<ClusterNode> topSnapshot,
+ @Nullable Map<Long, Collection<ClusterNode>> topHist,
+ @Nullable DiscoverySpiCustomMessage spiCustomMsg
+ ) {
+ DiscoveryCustomMessage customMsg = spiCustomMsg == null ? null
+ : (DiscoveryCustomMessage) U.field(spiCustomMsg, "delegate");
+
+ if (customMsg != null) {
+ //don't want to make this class public, using equality of class name instead of instanceof operator
+ if ("MappingProposedMessage".equals(customMsg.getClass().getSimpleName())) {
+ try {
+ isDuplicateObserved = U.invoke(MappingProposedMessage.class, customMsg, "duplicated");
+ }
+ catch (Exception e) {
+ log().error("Error when examining MappingProposedMessage.", e);
+ }
+ }
+ }
+
+ if (delegate != null)
+ delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onLocalNodeInitialized(ClusterNode locNode) {
+ // No-op.
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void setListener(@Nullable DiscoverySpiListener lsnr) {
+ super.setListener(new DiscoverySpiListenerWrapper(lsnr));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/740b0b2b/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 de509ab..d79e868 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
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.processors.cache.IgniteDaemonNodeMarshallerCac
import org.apache.ignite.internal.processors.cache.IgniteMarshallerCacheClassNameConflictTest;
import org.apache.ignite.internal.processors.cache.IgniteMarshallerCacheClientRequestsMappingOnMissTest;
import org.apache.ignite.internal.processors.cache.IgniteMarshallerCacheConcurrentReadWriteTest;
+import org.apache.ignite.internal.processors.cache.IgniteMarshallerCacheFSRestoreTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteRejectConnectOnNodeStopTest;
import org.apache.ignite.internal.processors.closure.GridClosureProcessorSelfTest;
import org.apache.ignite.internal.processors.closure.GridClosureSerializationTest;
@@ -173,6 +174,7 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTestSuite(FreeListImplSelfTest.class);
suite.addTestSuite(MemoryMetricsSelfTest.class);
+ suite.addTestSuite(IgniteMarshallerCacheFSRestoreTest.class);
suite.addTestSuite(IgniteMarshallerCacheClassNameConflictTest.class);
suite.addTestSuite(IgniteMarshallerCacheClientRequestsMappingOnMissTest.class);
[31/50] [abbrv] ignite git commit: 2.1 Unused imports
Posted by vo...@apache.org.
2.1 Unused imports
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c84328d4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c84328d4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c84328d4
Branch: refs/heads/master
Commit: c84328d46776de62a341c64a463d3d0e429768a4
Parents: 740b0b2
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jul 6 12:30:52 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jul 6 12:30:52 2017 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c84328d4/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index c2d9b7e..d75aae9 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -143,7 +143,6 @@ import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
import static org.apache.ignite.events.EventType.EVT_NODE_METRICS_UPDATED;
import static org.apache.ignite.events.EventType.EVT_NODE_SEGMENTED;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_ACTIVE_ON_START;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_LATE_AFFINITY_ASSIGNMENT;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_COMPACT_FOOTER;
[21/50] [abbrv] ignite git commit: ignite-2.1 Do not use 'compress'
flag for GridDhtPartitionsFullMessage send in discovery message.
Posted by vo...@apache.org.
ignite-2.1 Do not use 'compress' flag for GridDhtPartitionsFullMessage send in discovery message.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7504b38a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7504b38a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7504b38a
Branch: refs/heads/master
Commit: 7504b38a603e593fbb190e9e1e9da262cbb8f855
Parents: 0357c51
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 5 17:07:54 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 5 17:07:54 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCachePartitionExchangeManager.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7504b38a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index ac06295..b3cbd17 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -1018,7 +1018,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (locMap != null) {
addFullPartitionsMap(m,
dupData,
- true,
+ compress,
grp.groupId(),
locMap,
affCache.similarAffinityKey());
@@ -1036,7 +1036,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (map != null) {
addFullPartitionsMap(m,
dupData,
- true,
+ compress,
top.groupId(),
map,
top.similarAffinityKey());
[04/50] [abbrv] ignite git commit: IGNITE-5340: Improved
IgniteCacheAbstractQuerySelfTest to better test non-standard index names.
This closes #2206.
Posted by vo...@apache.org.
IGNITE-5340: Improved IgniteCacheAbstractQuerySelfTest to better test non-standard index names. This closes #2206.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/54572c30
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/54572c30
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/54572c30
Branch: refs/heads/master
Commit: 54572c3023dc03a55621fbb4754888b081791e31
Parents: 5b7165c
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Jul 5 10:30:48 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Jul 5 10:30:48 2017 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheAbstractQuerySelfTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/54572c30/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index f3dbbb1..e58f983 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@ -179,7 +179,8 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
qryEntity.addQueryField("id", Integer.class.getName(), null);
qryEntity.addQueryField("name", String.class.getName(), null);
qryEntity.setTableName("Type2");
- qryEntity.setIndexes(Arrays.asList(new QueryIndex("id")));
+ qryEntity.setIndexes(Arrays.asList(new QueryIndex("id")
+ .setName("index~!@#$%^&*()_=-+;[]{}|?,.*`:nameWithNonLetterSymbols")));
entityList.add(qryEntity);
[36/50] [abbrv] ignite git commit: IGNITE-5441 .NET: Propagate
CacheStore exception stack traces to the caller node
Posted by vo...@apache.org.
IGNITE-5441 .NET: Propagate CacheStore exception stack traces to the caller node
This closes #2247
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c396b0bc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c396b0bc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c396b0bc
Branch: refs/heads/master
Commit: c396b0bcfa5f959013c94ece47dc1111fa650d97
Parents: 333e32b
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Jul 6 13:03:50 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jul 6 13:03:50 2017 +0300
----------------------------------------------------------------------
.../Cache/CacheAbstractTest.cs | 26 +++++++++-----------
.../Cache/PersistentStoreTest.cs | 1 -
.../Cache/Store/CacheStoreTest.cs | 21 +++++++++++++---
.../Apache.Ignite.Core/Common/JavaException.cs | 15 ++++++++++-
.../Apache.Ignite.Core/Impl/ExceptionUtils.cs | 5 ++--
5 files changed, 44 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c396b0bc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index 351c25c..9e44720 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -2091,26 +2091,22 @@ namespace Apache.Ignite.Core.Tests.Cache
() => cache.Invoke(key, new T { ThrowErrNonSerializable = true }, arg), "ExpectedException");
}
+ /// <summary>
+ /// Asserts that specified action throws a CacheEntryProcessorException.
+ /// </summary>
private static void AssertThrowsCacheEntryProcessorException(Action action, string containsText = null)
{
- try
- {
- action();
+ var ex = Assert.Throws<CacheEntryProcessorException>(() => action());
- Assert.Fail();
+ Assert.IsInstanceOf<JavaException>(ex.InnerException);
+
+ if (string.IsNullOrEmpty(containsText))
+ {
+ Assert.AreEqual(AddArgCacheEntryProcessor.ExceptionText, ex.GetBaseException().Message);
}
- catch (Exception ex)
+ else
{
- Assert.IsInstanceOf<CacheEntryProcessorException>(ex);
-
- if (string.IsNullOrEmpty(containsText))
- {
- Assert.IsNotNull(ex.InnerException);
- Assert.AreEqual(AddArgCacheEntryProcessor.ExceptionText, ex.InnerException.Message);
- }
- else
- Assert.IsTrue(ex.ToString().Contains(containsText),
- "Expected: " + containsText + ", actual: " + ex);
+ Assert.IsTrue(ex.ToString().Contains(containsText), "Expected: " + containsText + ", actual: " + ex);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c396b0bc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
index cc72147..adb91ef 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistentStoreTest.cs
@@ -18,7 +18,6 @@
namespace Apache.Ignite.Core.Tests.Cache
{
using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.PersistentStore;
using NUnit.Framework;
http://git-wip-us.apache.org/repos/asf/ignite/blob/c396b0bc/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index 12c442d..e05f4bd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@ -24,6 +24,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Store;
+ using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl;
using NUnit.Framework;
@@ -203,6 +204,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
Assert.AreEqual(1, cache.GetSize());
}
+ /// <summary>
+ /// Tests that exceptions from user code are propagated properly.
+ /// </summary>
[Test]
public void TestExceptions()
{
@@ -211,7 +215,18 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
cache.Put(1, "val");
CacheTestStore.ThrowError = true;
- CheckCustomStoreError(Assert.Throws<CacheStoreException>(() => cache.Put(-2, "fail")).InnerException);
+
+ var ex = Assert.Throws<CacheStoreException>(() => cache.Put(-2, "fail"));
+
+ Assert.IsTrue(ex.ToString().Contains(
+ "at Apache.Ignite.Core.Tests.Cache.Store.CacheTestStore.ThrowIfNeeded")); // Check proper stack trace.
+
+ Assert.IsNotNull(ex.InnerException); // RollbackException.
+
+ var javaEx = ex.InnerException.InnerException as JavaException;
+ Assert.IsNotNull(javaEx);
+
+ CheckCustomStoreError(javaEx.InnerException);
// TODO: IGNITE-4535
//cache.LocalEvict(new[] {1});
@@ -599,11 +614,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
/// </summary>
private static void CheckCustomStoreError(Exception err)
{
- var customErr = err as CacheTestStore.CustomStoreException ??
- err.InnerException as CacheTestStore.CustomStoreException;
+ var customErr = err.GetBaseException() as CacheTestStore.CustomStoreException;
Assert.IsNotNull(customErr);
-
Assert.AreEqual(customErr.Message, customErr.Details);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c396b0bc/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs
index 1988335..e6c6f7b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Common/JavaException.cs
@@ -62,7 +62,20 @@ namespace Apache.Ignite.Core.Common
/// <param name="javaMessage">Java exception message.</param>
/// <param name="stackTrace">Java stack trace.</param>
public JavaException(string javaClassName, string javaMessage, string stackTrace)
- : base(stackTrace ?? javaMessage)
+ : this(javaClassName, javaMessage, stackTrace, null)
+ {
+ // No-op.
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JavaException" /> class.
+ /// </summary>
+ /// <param name="javaClassName">Java exception class name.</param>
+ /// <param name="javaMessage">Java exception message.</param>
+ /// <param name="stackTrace">Java stack trace.</param>
+ /// <param name="cause">The cause.</param>
+ public JavaException(string javaClassName, string javaMessage, string stackTrace, Exception cause)
+ : base(stackTrace ?? javaMessage, cause)
{
// Send stackTrace to base ctor because it has all information, including class names and messages.
// Store ClassName and Message separately for mapping purposes.
http://git-wip-us.apache.org/repos/asf/ignite/blob/c396b0bc/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
index dd70f5a..ebfcc28 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
@@ -121,9 +121,8 @@ namespace Apache.Ignite.Core.Impl
public static Exception GetException(Ignite ignite, string clsName, string msg, string stackTrace,
BinaryReader reader = null, Exception innerException = null)
{
- // Set JavaException as inner only if there is no InnerException.
- if (innerException == null)
- innerException = new JavaException(clsName, msg, stackTrace);
+ // Set JavaException as immediate inner.
+ innerException = new JavaException(clsName, msg, stackTrace, innerException);
ExceptionFactory ctor;
[48/50] [abbrv] ignite git commit: ignite-5075 Fixed row size
calculation in canUpdateOldRow
Posted by vo...@apache.org.
ignite-5075 Fixed row size calculation in canUpdateOldRow
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3259e2bb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3259e2bb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3259e2bb
Branch: refs/heads/master
Commit: 3259e2bb9d6532dd78e71314dc55a7a021090f36
Parents: 0b4b5dc
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jul 7 11:27:31 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jul 7 11:27:31 2017 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheOffheapManagerImpl.java | 7 +++++--
.../cache/persistence/freelist/FreeListImpl.java | 11 ++++++-----
2 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3259e2bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index b51fc10..6d16b60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -1179,12 +1179,15 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
if (oldRow.expireTime() != dataRow.expireTime())
return false;
- int oldLen = FreeListImpl.getRowSize(oldRow);
+ // Use grp.sharedGroup() flag since it is possible cacheId is not yet set here.
+ boolean sizeWithCacheId = grp.sharedGroup();
+
+ int oldLen = FreeListImpl.getRowSize(oldRow, sizeWithCacheId);
if (oldLen > updateValSizeThreshold)
return false;
- int newLen = FreeListImpl.getRowSize(dataRow);
+ int newLen = FreeListImpl.getRowSize(dataRow, sizeWithCacheId);
return oldLen == newLen;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3259e2bb/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
index 139c6f3..844bc02 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
@@ -101,7 +101,7 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
throws IgniteCheckedException {
DataPageIO io = (DataPageIO)iox;
- int rowSize = getRowSize(row);
+ int rowSize = getRowSize(row, row.cacheId() != 0);
boolean updated = io.updateRow(pageAddr, itemId, pageSize(), null, row, rowSize);
@@ -147,7 +147,7 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
throws IgniteCheckedException {
DataPageIO io = (DataPageIO)iox;
- int rowSize = getRowSize(row);
+ int rowSize = getRowSize(row, row.cacheId() != 0);
int oldFreeSpace = io.getFreeSpace(pageAddr);
assert oldFreeSpace > 0 : oldFreeSpace;
@@ -453,7 +453,7 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
/** {@inheritDoc} */
@Override public void insertDataRow(CacheDataRow row) throws IgniteCheckedException {
- int rowSize = getRowSize(row);
+ int rowSize = getRowSize(row, row.cacheId() != 0);
int written = 0;
@@ -579,17 +579,18 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
/**
* @param row Row.
+ * @param withCacheId If {@code true} adds cache ID size.
* @return Entry size on page.
* @throws IgniteCheckedException If failed.
*/
- public static int getRowSize(CacheDataRow row) throws IgniteCheckedException {
+ public static int getRowSize(CacheDataRow row, boolean withCacheId) throws IgniteCheckedException {
KeyCacheObject key = row.key();
CacheObject val = row.value();
int keyLen = key.valueBytesLength(null);
int valLen = val.valueBytesLength(null);
- return keyLen + valLen + CacheVersionIO.size(row.version(), false) + 8 + (row.cacheId() == 0 ? 0 : 4);
+ return keyLen + valLen + CacheVersionIO.size(row.version(), false) + 8 + (withCacheId ? 4 : 0);
}
/** {@inheritDoc} */
[24/50] [abbrv] ignite git commit: Added onActivate/onDeactivate
callbacks for plugins
Posted by vo...@apache.org.
Added onActivate/onDeactivate callbacks for plugins
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/905e34d4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/905e34d4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/905e34d4
Branch: refs/heads/master
Commit: 905e34d4eee40f9c31288eb9563812f6e9ab888d
Parents: 29d532e
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Wed Jul 5 19:16:01 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Jul 5 19:16:01 2017 +0300
----------------------------------------------------------------------
.../cache/GridCacheSharedContext.java | 5 +
.../org.apache.ignite.plugin.PluginProvider | 3 +-
.../IgniteStandByClusterTest.java | 164 +++++++++++++++++++
3 files changed, 171 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/905e34d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
index 9adca8d..40b263f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
@@ -66,6 +66,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.plugin.PluginProvider;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
@@ -223,6 +224,10 @@ public class GridCacheSharedContext<K, V> {
stateAwareMgrs.add(dbMgr);
stateAwareMgrs.add(snpMgr);
+
+ for (PluginProvider prv : kernalCtx.plugins().allProviders())
+ if (prv instanceof IgniteChangeGlobalStateSupport)
+ stateAwareMgrs.add(((IgniteChangeGlobalStateSupport)prv));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/905e34d4/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
index f030386..5b6ed7d 100644
--- a/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
+++ b/modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider
@@ -1,2 +1,3 @@
org.apache.ignite.platform.plugin.PlatformTestPluginProvider
-org.apache.ignite.spi.discovery.tcp.TestReconnectPluginProvider
\ No newline at end of file
+org.apache.ignite.spi.discovery.tcp.TestReconnectPluginProvider
+org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteStandByClusterTest$StanByClusterTestProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/905e34d4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
index 2678e51..30fff08 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
@@ -17,24 +17,39 @@
package org.apache.ignite.internal.processors.cache.persistence.standbycluster;
+import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.plugin.CachePluginContext;
+import org.apache.ignite.plugin.CachePluginProvider;
+import org.apache.ignite.plugin.ExtensionRegistry;
+import org.apache.ignite.plugin.IgnitePlugin;
+import org.apache.ignite.plugin.PluginContext;
+import org.apache.ignite.plugin.PluginProvider;
+import org.apache.ignite.plugin.PluginValidationException;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
/**
@@ -270,6 +285,58 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception if fail.
+ */
+ public void testActivateDeActivateCallbackForPluginProviders() throws Exception {
+ IgniteEx ig1 = startGrid(getConfiguration("node1"));
+ IgniteEx ig2 = startGrid(getConfiguration("node2"));
+ IgniteEx ig3 = startGrid(getConfiguration("node3"));
+
+ assertTrue(!ig1.active());
+ assertTrue(!ig2.active());
+ assertTrue(!ig3.active());
+
+ ig1.active(true);
+
+ checkPlugin(ig1,1,0);
+ checkPlugin(ig2,1,0);
+ checkPlugin(ig3,1,0);
+
+ ig2.active(false);
+
+ ig3.active(true);
+
+ checkPlugin(ig1,2,1);
+ checkPlugin(ig2,2,1);
+ checkPlugin(ig3,2,1);
+
+ ig1.active(false);
+
+ ig2.active(true);
+
+ checkPlugin(ig1,3,2);
+ checkPlugin(ig2,3,2);
+ checkPlugin(ig3,3,2);
+
+ }
+
+ /**
+ * @param ig ignite.
+ * @param act Expected activation counter.
+ * @param deAct Expected deActivation counter.
+ */
+ private void checkPlugin(Ignite ig, int act, int deAct) {
+ IgnitePlugin pl = ig.plugin(StanByClusterTestProvider.NAME);
+
+ assertNotNull(pl);
+
+ StanByClusterTestProvider plugin = (StanByClusterTestProvider)pl;
+
+ assertEquals(act, plugin.actCnt.get());
+ assertEquals(deAct, plugin.deActCnt.get());
+ }
+
+ /**
*
*/
private static class NodeFilterIgnoreByName implements IgnitePredicate<ClusterNode> {
@@ -292,6 +359,103 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
/**
*
*/
+ public static class StanByClusterTestProvider implements PluginProvider, IgnitePlugin, IgniteChangeGlobalStateSupport {
+ /** */
+ static final String NAME = "StanByClusterTestProvider";
+
+ /** */
+ final AtomicInteger actCnt = new AtomicInteger();
+
+ /** */
+ final AtomicInteger deActCnt = new AtomicInteger();
+
+ /** {@inheritDoc} */
+ @Override public String name() {
+ return NAME;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String version() {
+ return "1.0";
+ }
+
+ /** {@inheritDoc} */
+ @Override public String copyright() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void initExtensions(
+ PluginContext ctx,
+ ExtensionRegistry registry
+ ) throws IgniteCheckedException {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public CachePluginProvider createCacheProvider(CachePluginContext ctx) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void start(PluginContext ctx) throws IgniteCheckedException {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public void stop(boolean cancel) throws IgniteCheckedException {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onIgniteStart() throws IgniteCheckedException {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onIgniteStop(boolean cancel) {
+
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Serializable provideDiscoveryData(UUID nodeId) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void receiveDiscoveryData(UUID nodeId, Serializable data) {
+
+ }
+
+ /** {@inheritDoc} */
+ @Override public void validateNewNode(ClusterNode node) throws PluginValidationException {
+
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object createComponent(PluginContext ctx, Class cls) {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgnitePlugin plugin() {
+ return this;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
+ actCnt.incrementAndGet();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onDeActivate(GridKernalContext kctx) {
+ deActCnt.incrementAndGet();
+ }
+ }
+
+ /**
+ *
+ */
@Override protected void beforeTest() throws Exception {
super.beforeTest();
[23/50] [abbrv] ignite git commit: IGNITE-5576: Added Compute::Run()
for C++
Posted by vo...@apache.org.
IGNITE-5576: Added Compute::Run() for C++
(cherry picked from commit 80c95ff79f344daf1fca3f094733a24bac2a218d)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/29d532e8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/29d532e8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/29d532e8
Branch: refs/heads/master
Commit: 29d532e8be971ccac40ece00fc84a6a6bffdad0f
Parents: ad42f62
Author: Igor Sapego <is...@gridgain.com>
Authored: Wed Jul 5 18:51:27 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Wed Jul 5 18:51:58 2017 +0300
----------------------------------------------------------------------
.../core-test/config/cache-query-default.xml | 18 ++
.../cpp/core-test/src/compute_test.cpp | 176 +++++++++++++++++++
.../cpp/core/include/ignite/compute/compute.h | 35 +++-
.../include/ignite/impl/compute/compute_impl.h | 42 +++++
.../ignite/impl/compute/compute_job_holder.h | 73 ++++++++
.../ignite/impl/compute/compute_job_result.h | 112 ++++++++++++
.../ignite/impl/compute/compute_task_holder.h | 85 +++++++++
7 files changed, 539 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/29d532e8/modules/platforms/cpp/core-test/config/cache-query-default.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/config/cache-query-default.xml b/modules/platforms/cpp/core-test/config/cache-query-default.xml
index 38636e5..16f601d 100644
--- a/modules/platforms/cpp/core-test/config/cache-query-default.xml
+++ b/modules/platforms/cpp/core-test/config/cache-query-default.xml
@@ -94,6 +94,12 @@
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="writeSynchronizationMode" value="FULL_SYNC"/>
+ <property name="affinity">
+ <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
+ <property name="partitions" value="256"/>
+ </bean>
+ </property>
+
<property name="queryEntities">
<list>
<bean class="org.apache.ignite.cache.QueryEntity">
@@ -115,6 +121,12 @@
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="writeSynchronizationMode" value="FULL_SYNC"/>
+ <property name="affinity">
+ <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
+ <property name="partitions" value="256"/>
+ </bean>
+ </property>
+
<!-- Configure type metadata to enable queries. -->
<property name="queryEntities">
<list>
@@ -132,6 +144,12 @@
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="writeSynchronizationMode" value="FULL_SYNC"/>
+ <property name="affinity">
+ <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
+ <property name="partitions" value="256"/>
+ </bean>
+ </property>
+
<!-- Configure type metadata to enable queries. -->
<property name="queryEntities">
<list>
http://git-wip-us.apache.org/repos/asf/ignite/blob/29d532e8/modules/platforms/cpp/core-test/src/compute_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/compute_test.cpp b/modules/platforms/cpp/core-test/src/compute_test.cpp
index d3b1183..8c57ef1 100644
--- a/modules/platforms/cpp/core-test/src/compute_test.cpp
+++ b/modules/platforms/cpp/core-test/src/compute_test.cpp
@@ -146,6 +146,49 @@ struct Func2 : ComputeFunc<std::string>
IgniteError err;
};
+struct Func3 : ComputeFunc<void>
+{
+ Func3() :
+ a(), b(), err()
+ {
+ // No-op.
+ }
+
+ Func3(int32_t a, int32_t b) :
+ a(a), b(b), err()
+ {
+ // No-op.
+ }
+
+ Func3(IgniteError err) :
+ a(), b(), err(err)
+ {
+ // No-op.
+ }
+
+ virtual void Call()
+ {
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(200));
+
+ if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+ throw err;
+
+ std::stringstream tmp;
+
+ tmp << a << '.' << b;
+
+ res = tmp.str();
+ }
+
+ int32_t a;
+ int32_t b;
+ IgniteError err;
+
+ static std::string res;
+};
+
+std::string Func3::res;
+
namespace ignite
{
namespace binary
@@ -235,6 +278,49 @@ namespace ignite
dst.err = reader.ReadObject<IgniteError>("err");
}
};
+
+ template<>
+ struct BinaryType<Func3>
+ {
+ static int32_t GetTypeId()
+ {
+ return GetBinaryStringHashCode("Func3");
+ }
+
+ static void GetTypeName(std::string& dst)
+ {
+ dst = "Func3";
+ }
+
+ static int32_t GetFieldId(const char* name)
+ {
+ return GetBinaryStringHashCode(name);
+ }
+
+ static bool IsNull(const Func3& obj)
+ {
+ return false;
+ }
+
+ static void GetNull(Func3& dst)
+ {
+ dst = Func3(0, 0);
+ }
+
+ static void Write(BinaryWriter& writer, const Func3& obj)
+ {
+ writer.WriteInt32("a", obj.a);
+ writer.WriteInt32("b", obj.b);
+ writer.WriteObject<IgniteError>("err", obj.err);
+ }
+
+ static void Read(BinaryReader& reader, Func3& dst)
+ {
+ dst.a = reader.ReadInt32("a");
+ dst.b = reader.ReadInt32("b");
+ dst.err = reader.ReadObject<IgniteError>("err");
+ }
+ };
}
}
@@ -244,6 +330,7 @@ IGNITE_EXPORTED_CALL void IgniteModuleInit1(IgniteBindingContext& context)
binding.RegisterComputeFunc<Func1>();
binding.RegisterComputeFunc<Func2>();
+ binding.RegisterComputeFunc<Func3>();
}
BOOST_FIXTURE_TEST_SUITE(ComputeTestSuite, ComputeTestSuiteFixture)
@@ -334,4 +421,93 @@ BOOST_AUTO_TEST_CASE(IgniteCallTestRemoteError)
BOOST_CHECK_EXCEPTION(res.GetValue(), IgniteError, IsTestError);
}
+BOOST_AUTO_TEST_CASE(IgniteRunSyncLocal)
+{
+ Compute compute = node.GetCompute();
+
+ BOOST_CHECKPOINT("Running");
+ compute.Run(Func3(8, 5));
+
+ BOOST_CHECK_EQUAL(Func3::res, "8.5");
+}
+
+BOOST_AUTO_TEST_CASE(IgniteRunAsyncLocal)
+{
+ Compute compute = node.GetCompute();
+
+ BOOST_CHECKPOINT("Running");
+ Future<void> res = compute.RunAsync(Func3(312, 245));
+
+ BOOST_CHECK(!res.IsReady());
+
+ BOOST_CHECKPOINT("Waiting with timeout");
+ res.WaitFor(100);
+
+ BOOST_CHECK(!res.IsReady());
+
+ res.GetValue();
+
+ BOOST_CHECK_EQUAL(Func3::res, "312.245");
+}
+
+BOOST_AUTO_TEST_CASE(IgniteRunSyncLocalError)
+{
+ Compute compute = node.GetCompute();
+
+ BOOST_CHECKPOINT("Running");
+
+ BOOST_CHECK_EXCEPTION(compute.Run(Func3(MakeTestError())), IgniteError, IsTestError);
+}
+
+BOOST_AUTO_TEST_CASE(IgniteRunAsyncLocalError)
+{
+ Compute compute = node.GetCompute();
+
+ BOOST_CHECKPOINT("Running");
+ Future<void> res = compute.RunAsync(Func3(MakeTestError()));
+
+ BOOST_CHECK(!res.IsReady());
+
+ BOOST_CHECKPOINT("Waiting with timeout");
+ res.WaitFor(100);
+
+ BOOST_CHECK(!res.IsReady());
+
+ BOOST_CHECK_EXCEPTION(res.GetValue(), IgniteError, IsTestError);
+}
+
+BOOST_AUTO_TEST_CASE(IgniteRunTestRemote)
+{
+ Ignite node2 = MakeNode("ComputeNode2");
+ Compute compute = node.GetCompute();
+
+ BOOST_CHECKPOINT("Running");
+ compute.CallAsync<std::string>(Func2(8, 5));
+
+ compute.Run(Func3(42, 24));
+
+ BOOST_CHECK_EQUAL(Func3::res, "42.24");
+}
+
+BOOST_AUTO_TEST_CASE(IgniteRunTestRemoteError)
+{
+ Ignite node2 = MakeNode("ComputeNode2");
+ Compute compute = node.GetCompute();
+
+ BOOST_CHECKPOINT("Running");
+ compute.CallAsync<std::string>(Func2(8, 5));
+
+ Future<void> res = compute.RunAsync(Func3(MakeTestError()));
+
+ BOOST_CHECK(!res.IsReady());
+
+ BOOST_CHECKPOINT("Waiting with timeout");
+ res.WaitFor(100);
+
+ BOOST_CHECK(!res.IsReady());
+
+ BOOST_CHECK_EXCEPTION(res.GetValue(), IgniteError, IsTestError);
+}
+
+
BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/29d532e8/modules/platforms/cpp/core/include/ignite/compute/compute.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/compute/compute.h b/modules/platforms/cpp/core/include/ignite/compute/compute.h
index b079569..75c8c85 100644
--- a/modules/platforms/cpp/core/include/ignite/compute/compute.h
+++ b/modules/platforms/cpp/core/include/ignite/compute/compute.h
@@ -94,7 +94,7 @@ namespace ignite
* @tparam R Call return type. BinaryType should be specialized for
* the type if it is not primitive. Should not be void. For
* non-returning methods see Compute::Run().
- * @tparam F Compute function type. Should implement ComputeFunc
+ * @tparam F Compute function type. Should implement ComputeFunc<R>
* class.
* @param func Compute function to call.
* @return Computation result.
@@ -113,7 +113,7 @@ namespace ignite
* @tparam R Call return type. BinaryType should be specialized for
* the type if it is not primitive. Should not be void. For
* non-returning methods see Compute::Run().
- * @tparam F Compute function type. Should implement ComputeFunc
+ * @tparam F Compute function type. Should implement ComputeFunc<R>
* class.
* @param func Compute function to call.
* @return Future that can be used to access computation result once
@@ -126,6 +126,37 @@ namespace ignite
return impl.Get()->CallAsync<R, F>(func);
}
+ /**
+ * Runs provided ComputeFunc on a node within the underlying cluster
+ * group.
+ *
+ * @tparam F Compute function type. Should implement ComputeFunc<void>
+ * class.
+ * @param action Compute function to call.
+ * @throw IgniteError in case of error.
+ */
+ template<typename F>
+ void Run(const F& action)
+ {
+ return impl.Get()->RunAsync<F>(action).GetValue();
+ }
+
+ /**
+ * Asyncronuously runs provided ComputeFunc on a node within the
+ * underlying cluster group.
+ *
+ * @tparam F Compute function type. Should implement ComputeFunc<void>
+ * class.
+ * @param action Compute function to call.
+ * @return Future that can be used to wait for action to complete.
+ * @throw IgniteError in case of error.
+ */
+ template<typename F>
+ Future<void> RunAsync(const F& action)
+ {
+ return impl.Get()->RunAsync<F>(action);
+ }
+
private:
/** Implementation. */
common::concurrent::SharedPointer<impl::compute::ComputeImpl> impl;
http://git-wip-us.apache.org/repos/asf/ignite/blob/29d532e8/modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h b/modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
index 389c571..63f9a46 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
@@ -108,6 +108,48 @@ namespace ignite
return promise.GetFuture();
}
+ /**
+ * Asyncronuously runs provided ComputeFunc on a node within
+ * the underlying cluster group.
+ *
+ * @tparam F Compute action type. Should implement ComputeAction
+ * class.
+ * @param action Compute action to call.
+ * @return Future that can be used to wait for action to complete.
+ * @throw IgniteError in case of error.
+ */
+ template<typename F>
+ Future<void> RunAsync(const F& action)
+ {
+ common::concurrent::SharedPointer<interop::InteropMemory> mem = GetEnvironment().AllocateMemory();
+ interop::InteropOutputStream out(mem.Get());
+ binary::BinaryWriterImpl writer(&out, GetEnvironment().GetTypeManager());
+
+ common::concurrent::SharedPointer<ComputeJobHolder> job(new ComputeJobHolderImpl<F, void>(action));
+
+ int64_t jobHandle = GetEnvironment().GetHandleRegistry().Allocate(job);
+
+ ComputeTaskHolderImpl<F, void>* taskPtr = new ComputeTaskHolderImpl<F, void>(jobHandle);
+ common::concurrent::SharedPointer<ComputeTaskHolder> task(taskPtr);
+
+ int64_t taskHandle = GetEnvironment().GetHandleRegistry().Allocate(task);
+
+ writer.WriteInt64(taskHandle);
+ writer.WriteInt32(1);
+ writer.WriteInt64(jobHandle);
+ writer.WriteObject<F>(action);
+
+ out.Synchronize();
+
+ jobject target = InStreamOutObject(Operation::Unicast, *mem.Get());
+ std::auto_ptr<common::Cancelable> cancelable(new CancelableImpl(GetEnvironmentPointer(), target));
+
+ common::Promise<void>& promise = taskPtr->GetPromise();
+ promise.SetCancelTarget(cancelable);
+
+ return promise.GetFuture();
+ }
+
private:
IGNITE_NO_COPY_ASSIGNMENT(ComputeImpl);
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/29d532e8/modules/platforms/cpp/core/include/ignite/impl/compute/compute_job_holder.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/compute/compute_job_holder.h b/modules/platforms/cpp/core/include/ignite/impl/compute/compute_job_holder.h
index e218e36..9f35a11 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/compute/compute_job_holder.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/compute/compute_job_holder.h
@@ -132,6 +132,79 @@ namespace ignite
/** Job. */
JobType job;
};
+
+ /**
+ * Compute job holder. Internal class.
+ * Specialisation for void return type
+ *
+ * @tparam F Actual job type.
+ */
+ template<typename F>
+ class ComputeJobHolderImpl<F, void> : public ComputeJobHolder
+ {
+ public:
+ typedef F JobType;
+
+ /**
+ * Constructor.
+ *
+ * @param job Job.
+ */
+ ComputeJobHolderImpl(JobType job) :
+ job(job)
+ {
+ // No-op.
+ }
+
+ /**
+ * Destructor.
+ */
+ virtual ~ComputeJobHolderImpl()
+ {
+ // No-op.
+ }
+
+ const ComputeJobResult<void>& GetResult()
+ {
+ return res;
+ }
+
+ virtual void ExecuteLocal()
+ {
+ try
+ {
+ job.Call();
+ res.SetResult();
+ }
+ catch (const IgniteError& err)
+ {
+ res.SetError(err);
+ }
+ catch (const std::exception& err)
+ {
+ res.SetError(IgniteError(IgniteError::IGNITE_ERR_STD, err.what()));
+ }
+ catch (...)
+ {
+ res.SetError(IgniteError(IgniteError::IGNITE_ERR_UNKNOWN,
+ "Unknown error occurred during call."));
+ }
+ }
+
+ virtual void ExecuteRemote(binary::BinaryWriterImpl& writer)
+ {
+ ExecuteLocal();
+
+ res.Write(writer);
+ }
+
+ private:
+ /** Result. */
+ ComputeJobResult<void> res;
+
+ /** Job. */
+ JobType job;
+ };
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/29d532e8/modules/platforms/cpp/core/include/ignite/impl/compute/compute_job_result.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/compute/compute_job_result.h b/modules/platforms/cpp/core/include/ignite/impl/compute/compute_job_result.h
index 5bcb762..0874522 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/compute/compute_job_result.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/compute/compute_job_result.h
@@ -27,6 +27,8 @@
#include <sstream>
#include <ignite/common/promise.h>
+#include <ignite/impl/binary/binary_reader_impl.h>
+#include <ignite/impl/binary/binary_writer_impl.h>
namespace ignite
{
@@ -154,6 +156,116 @@ namespace ignite
/** Erorr. */
IgniteError err;
};
+
+ /**
+ * Used to hold compute job result.
+ */
+ template<>
+ class ComputeJobResult<void>
+ {
+ public:
+ /**
+ * Default constructor.
+ */
+ ComputeJobResult() :
+ err()
+ {
+ // No-op.
+ }
+
+ /**
+ * Mark as complete.
+ */
+ void SetResult()
+ {
+ err = IgniteError();
+ }
+
+ /**
+ * Set error.
+ *
+ * @param error Error to set.
+ */
+ void SetError(const IgniteError error)
+ {
+ err = error;
+ }
+
+ /**
+ * Set promise to a state which corresponds to result.
+ *
+ * @param promise Promise, which state to set.
+ */
+ void SetPromise(common::Promise<void>& promise)
+ {
+ if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+ promise.SetError(err);
+ else
+ promise.SetValue();
+ }
+
+ /**
+ * Write using writer.
+ *
+ * @param writer Writer.
+ */
+ void Write(binary::BinaryWriterImpl& writer)
+ {
+ if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+ {
+ // Fail
+ writer.WriteBool(false);
+
+ // Native Exception
+ writer.WriteBool(true);
+
+ writer.WriteObject<IgniteError>(err);
+ }
+ else
+ {
+ // Success
+ writer.WriteBool(true);
+
+ writer.WriteNull();
+ }
+ }
+
+ /**
+ * Read using reader.
+ *
+ * @param reader Reader.
+ */
+ void Read(binary::BinaryReaderImpl& reader)
+ {
+ bool success = reader.ReadBool();
+
+ if (success)
+ err = IgniteError();
+ else
+ {
+ bool native = reader.ReadBool();
+
+ if (native)
+ err = reader.ReadObject<IgniteError>();
+ else
+ {
+ std::stringstream buf;
+
+ buf << reader.ReadObject<std::string>() << " : ";
+ buf << reader.ReadObject<std::string>() << ", ";
+ buf << reader.ReadObject<std::string>();
+
+ std::string msg = buf.str();
+
+ err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, msg.c_str());
+ }
+ }
+ }
+
+ private:
+ /** Erorr. */
+ IgniteError err;
+ };
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/29d532e8/modules/platforms/cpp/core/include/ignite/impl/compute/compute_task_holder.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/compute/compute_task_holder.h b/modules/platforms/cpp/core/include/ignite/impl/compute/compute_task_holder.h
index bdd7513..f627f27 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/compute/compute_task_holder.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/compute/compute_task_holder.h
@@ -206,6 +206,91 @@ namespace ignite
/** Task result promise. */
common::Promise<ResultType> promise;
};
+
+ /**
+ * Compute task holder type-specific implementation.
+ */
+ template<typename F>
+ class ComputeTaskHolderImpl<F, void> : public ComputeTaskHolder
+ {
+ public:
+ typedef F JobType;
+
+ /**
+ * Constructor.
+ *
+ * @param handle Job handle.
+ */
+ ComputeTaskHolderImpl(int64_t handle) :
+ ComputeTaskHolder(handle)
+ {
+ // No-op.
+ }
+
+ /**
+ * Destructor.
+ */
+ virtual ~ComputeTaskHolderImpl()
+ {
+ // No-op.
+ }
+
+ /**
+ * Process local job result.
+ *
+ * @param job Job.
+ * @return Policy.
+ */
+ virtual int32_t JobResultLocal(ComputeJobHolder& job)
+ {
+ typedef ComputeJobHolderImpl<JobType, void> ActualComputeJobHolder;
+
+ ActualComputeJobHolder& job0 = static_cast<ActualComputeJobHolder&>(job);
+
+ res = job0.GetResult();
+
+ return ComputeJobResultPolicy::WAIT;
+ }
+
+ /**
+ * Process remote job result.
+ *
+ * @param job Job.
+ * @param reader Reader for stream with result.
+ * @return Policy.
+ */
+ virtual int32_t JobResultRemote(ComputeJobHolder& job, binary::BinaryReaderImpl& reader)
+ {
+ res.Read(reader);
+
+ return ComputeJobResultPolicy::WAIT;
+ }
+
+ /**
+ * Reduce results of related jobs.
+ */
+ virtual void Reduce()
+ {
+ res.SetPromise(promise);
+ }
+
+ /**
+ * Get result promise.
+ *
+ * @return Reference to result promise.
+ */
+ common::Promise<void>& GetPromise()
+ {
+ return promise;
+ }
+
+ private:
+ /** Result. */
+ ComputeJobResult<void> res;
+
+ /** Task result promise. */
+ common::Promise<void> promise;
+ };
}
}
}
[50/50] [abbrv] ignite git commit: Merge branch 'ignite-2.1'
Posted by vo...@apache.org.
Merge branch 'ignite-2.1'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d1d68023
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d1d68023
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d1d68023
Branch: refs/heads/master
Commit: d1d6802378d874b039f775fe787f78c507661bb2
Parents: 651ffc5 31e9d3b
Author: devozerov <vo...@gridgain.com>
Authored: Fri Jul 7 12:36:13 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jul 7 12:36:13 2017 +0300
----------------------------------------------------------------------
.../jdbc2/JdbcAbstractDmlStatementSelfTest.java | 12 +
.../jdbc2/JdbcDynamicIndexAbstractSelfTest.java | 2 -
.../jdbc2/JdbcPreparedStatementSelfTest.java | 35 +
.../jdbc/JdbcPreparedStatementSelfTest.java | 35 +
.../JdbcThinDynamicIndexAbstractSelfTest.java | 2 -
.../thin/JdbcThinPreparedStatementSelfTest.java | 35 +
.../rendezvous/RendezvousAffinityFunction.java | 4 -
.../PersistentStoreConfiguration.java | 39 +-
.../org/apache/ignite/events/EventType.java | 12 +
.../ignite/events/WalSegmentArchivedEvent.java | 62 +
.../apache/ignite/internal/GridComponent.java | 4 +-
.../ignite/internal/GridPluginComponent.java | 2 +-
.../internal/IgniteDiagnosticMessage.java | 12 +-
.../IgniteDiagnosticPrepareContext.java | 3 +
.../apache/ignite/internal/IgniteKernal.java | 33 +-
.../ignite/internal/MarshallerContextImpl.java | 10 +-
.../internal/jdbc/JdbcPreparedStatement.java | 6 +-
.../internal/jdbc/thin/JdbcThinConnection.java | 7 +-
.../jdbc/thin/JdbcThinPreparedStatement.java | 2 -
.../internal/jdbc2/JdbcPreparedStatement.java | 12 +-
.../internal/managers/GridManagerAdapter.java | 2 +-
.../internal/managers/discovery/DiscoCache.java | 17 +-
.../discovery/DiscoveryLocalJoinData.java | 104 ++
.../discovery/GridDiscoveryManager.java | 128 +-
...ishSnapshotOperationAckDiscoveryMessage.java | 7 +
.../snapshot/SnapshotCheckParameters.java | 75 +
.../pagemem/snapshot/SnapshotOperation.java | 26 +-
.../pagemem/store/IgnitePageStoreManager.java | 3 +-
.../internal/pagemem/wal/record/WALRecord.java | 11 +-
.../processors/GridProcessorAdapter.java | 2 +-
.../cache/CacheAffinitySharedManager.java | 67 +-
.../processors/cache/CacheGroupContext.java | 4 +-
.../processors/cache/CacheGroupData.java | 4 +-
.../cache/ChangeGlobalStateMessage.java | 120 --
.../processors/cache/ClusterCachesInfo.java | 497 +++++--
.../internal/processors/cache/ClusterState.java | 38 -
.../cache/DynamicCacheChangeRequest.java | 52 +-
.../processors/cache/ExchangeActions.java | 37 +-
.../processors/cache/GridCacheAdapter.java | 62 +-
.../processors/cache/GridCacheAttributes.java | 7 +
.../processors/cache/GridCacheEntryEx.java | 17 +-
.../processors/cache/GridCacheEventManager.java | 2 -
.../cache/GridCacheEvictionManager.java | 1 -
.../processors/cache/GridCacheIoManager.java | 43 +-
.../processors/cache/GridCacheMapEntry.java | 56 +-
.../processors/cache/GridCacheMvccManager.java | 9 +-
.../GridCachePartitionExchangeManager.java | 441 +++---
.../processors/cache/GridCacheProcessor.java | 211 +--
.../cache/GridCacheSharedContext.java | 65 +-
.../cache/GridCacheSharedManager.java | 6 -
.../cache/GridCacheSharedManagerAdapter.java | 16 -
.../cache/GridDeferredAckMessageSender.java | 3 +-
.../cache/IgniteCacheOffheapManagerImpl.java | 7 +-
.../processors/cache/PendingDiscoveryEvent.java | 61 +
.../processors/cache/StateChangeRequest.java | 77 ++
.../binary/CacheObjectBinaryProcessorImpl.java | 4 +-
.../distributed/GridCacheTxRecoveryFuture.java | 1 -
.../GridDistributedTxRemoteAdapter.java | 13 +-
.../distributed/dht/GridDhtCacheAdapter.java | 1 -
.../cache/distributed/dht/GridDhtGetFuture.java | 1 -
.../distributed/dht/GridDhtGetSingleFuture.java | 2 -
.../dht/GridDhtPartitionTopologyImpl.java | 18 +-
.../dht/GridDhtTopologyFutureAdapter.java | 2 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 2 +-
.../distributed/dht/GridDhtTxFinishFuture.java | 33 +-
.../dht/GridPartitionedSingleGetFuture.java | 3 -
.../GridNearAtomicAbstractUpdateFuture.java | 1 -
.../dht/preloader/GridDhtForceKeysFuture.java | 1 -
.../dht/preloader/GridDhtPartitionDemander.java | 2 +
.../GridDhtPartitionsExchangeFuture.java | 236 +++-
.../preloader/GridDhtPartitionsFullMessage.java | 44 +-
.../GridDhtPartitionsSingleMessage.java | 38 +-
.../dht/preloader/GridDhtPreloader.java | 2 +-
.../distributed/near/GridNearGetFuture.java | 2 -
.../near/GridNearTxFinishFuture.java | 2 +-
.../near/GridNearTxPrepareRequest.java | 1 -
.../cache/persistence/DbCheckpointListener.java | 16 +-
.../GridCacheDatabaseSharedManager.java | 115 +-
.../persistence/GridCacheOffheapManager.java | 46 +-
.../IgniteCacheDatabaseSharedManager.java | 74 +-
.../persistence/IgniteCacheSnapshotManager.java | 20 +-
.../persistence/file/FilePageStoreManager.java | 14 +-
.../persistence/freelist/FreeListImpl.java | 11 +-
.../persistence/tree/io/TrackingPageIO.java | 12 +-
.../wal/AbstractWalRecordsIterator.java | 287 ++++
.../persistence/wal/ByteBufferExpander.java | 64 +
.../cache/persistence/wal/FileInput.java | 36 +-
.../cache/persistence/wal/FileWALPointer.java | 4 +-
.../wal/FileWriteAheadLogManager.java | 594 ++++----
.../cache/persistence/wal/RecordSerializer.java | 5 +
.../persistence/wal/SegmentArchiveResult.java | 61 +
.../persistence/wal/SegmentEofException.java | 3 +-
.../wal/reader/IgniteWalIteratorFactory.java | 102 ++
.../wal/reader/StandaloneGridKernalContext.java | 499 +++++++
...ndaloneIgniteCacheDatabaseSharedManager.java | 30 +
.../reader/StandaloneWalRecordsIterator.java | 258 ++++
.../wal/serializer/RecordV1Serializer.java | 45 +-
.../query/GridCacheDistributedQueryManager.java | 4 +-
.../store/GridCacheStoreManagerAdapter.java | 2 +-
.../cache/transactions/IgniteTxAdapter.java | 28 +-
.../cache/transactions/IgniteTxHandler.java | 2 +-
.../transactions/IgniteTxLocalAdapter.java | 12 +-
.../cache/version/GridCacheVersionManager.java | 6 -
.../cacheobject/IgniteCacheObjectProcessor.java | 5 -
.../IgniteCacheObjectProcessorImpl.java | 5 -
.../cluster/ChangeGlobalStateFinishMessage.java | 86 ++
.../cluster/ChangeGlobalStateMessage.java | 140 ++
.../processors/cluster/ClusterProcessor.java | 3 +-
.../cluster/DiscoveryDataClusterState.java | 157 +++
.../cluster/GridClusterStateProcessor.java | 1129 ++++++---------
.../cluster/IgniteChangeGlobalStateSupport.java | 3 +-
.../datastreamer/DataStreamProcessor.java | 3 +-
.../datastreamer/DataStreamerImpl.java | 14 +-
.../datastructures/DataStructuresProcessor.java | 6 +-
.../datastructures/GridCacheAtomicLongImpl.java | 2 +-
.../GridCacheAtomicReferenceImpl.java | 2 +-
.../GridCacheAtomicSequenceImpl.java | 2 +-
.../GridCacheAtomicStampedImpl.java | 2 +-
.../GridCacheCountDownLatchImpl.java | 2 +-
.../datastructures/GridCacheLockImpl.java | 4 +-
.../datastructures/GridCacheQueueAdapter.java | 1 -
.../datastructures/GridCacheSemaphoreImpl.java | 2 +-
.../datastructures/GridCacheSetImpl.java | 1 -
.../internal/processors/igfs/IgfsImpl.java | 2 -
.../internal/processors/igfs/IgfsProcessor.java | 2 +-
.../GridMarshallerMappingProcessor.java | 16 +-
.../utils/PlatformConfigurationUtils.java | 8 +-
.../processors/query/GridQueryProcessor.java | 8 +-
.../processors/rest/GridRestProcessor.java | 2 +-
.../cluster/GridChangeStateCommandHandler.java | 2 +-
.../service/GridServiceProcessor.java | 33 +-
.../processors/service/GridServiceProxy.java | 9 +-
.../processors/task/GridTaskProcessor.java | 2 +-
.../visor/cache/VisorCacheConfiguration.java | 11 +-
.../visor/node/VisorBasicConfiguration.java | 2 +-
.../node/VisorMemoryPolicyConfiguration.java | 2 +-
.../visor/node/VisorNodeDataCollectorJob.java | 32 +-
.../node/VisorNodeDataCollectorJobResult.java | 73 +-
.../visor/node/VisorNodeDataCollectorTask.java | 14 +-
.../node/VisorNodeDataCollectorTaskResult.java | 28 +-
.../visor/node/VisorPersistenceMetrics.java | 214 +++
.../visor/service/VisorServiceTask.java | 10 +-
.../ignite/spi/discovery/tcp/ClientImpl.java | 12 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 11 +-
.../org.apache.ignite.plugin.PluginProvider | 3 +-
.../internal/TestRecordingCommunicationSpi.java | 10 +
...GridManagerLocalMessageListenerSelfTest.java | 4 +-
...unicationBalanceMultipleConnectionsTest.java | 5 +
.../cache/GridCacheAbstractMetricsSelfTest.java | 24 -
.../processors/cache/GridCacheTestEntryEx.java | 10 +-
.../cache/IgniteActiveClusterTest.java | 182 ---
.../cache/IgniteCacheAbstractTest.java | 17 +
.../processors/cache/IgniteCacheGroupsTest.java | 60 +
.../IgniteClusterActivateDeactivateTest.java | 1284 ++++++++++++++++++
...erActivateDeactivateTestWithPersistence.java | 197 +++
.../IgniteDaemonNodeMarshallerCacheTest.java | 10 -
...iteMarshallerCacheClassNameConflictTest.java | 11 +-
.../IgniteMarshallerCacheFSRestoreTest.java | 217 +++
.../IgniteSemaphoreAbstractSelfTest.java | 17 +-
...titionEvictionDuringReadThroughSelfTest.java | 160 +++
...acheStoreSessionWriteBehindAbstractTest.java | 62 +-
...TxStoreSessionWriteBehindCoalescingTest.java | 88 ++
...IgnitePersistentStoreDataStructuresTest.java | 2 +
.../wal/IgniteWalHistoryReservationsTest.java | 2 +-
.../db/wal/IgniteWalRecoveryTest.java | 100 +-
.../db/wal/reader/IgniteWalReaderTest.java | 385 ++++++
.../db/wal/reader/MockWalIteratorFactory.java | 114 ++
.../pagemem/NoOpPageStoreManager.java | 12 +-
.../persistence/pagemem/NoOpWALManager.java | 23 +-
.../AbstractNodeJoinTemplate.java | 149 +-
.../IgniteChangeGlobalStateAbstractTest.java | 65 +-
.../IgniteChangeGlobalStateCacheTest.java | 2 +-
...IgniteChangeGlobalStateDataStreamerTest.java | 5 +-
...gniteChangeGlobalStateDataStructureTest.java | 6 +-
.../IgniteChangeGlobalStateFailOverTest.java | 26 +-
.../IgniteChangeGlobalStateTest.java | 158 +--
.../IgniteStandByClusterTest.java | 181 ++-
.../join/JoinActiveNodeToActiveCluster.java | 62 +-
...ctiveNodeToActiveClusterWithPersistence.java | 17 +
.../IgniteStandByClientReconnectTest.java | 13 +-
...eStandByClientReconnectToNewClusterTest.java | 13 +-
...ClientWriteBehindStoreNonCoalescingTest.java | 30 +-
.../datastreamer/DataStreamerImplSelfTest.java | 123 +-
.../GridServiceProcessorProxySelfTest.java | 65 +
...cpCommunicationSpiMultithreadedSelfTest.java | 2 +-
.../testframework/junits/GridAbstractTest.java | 4 +-
.../junits/common/GridCommonAbstractTest.java | 3 +
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +
.../testsuites/IgniteCacheTestSuite4.java | 2 +
.../testsuites/IgniteCacheTestSuite5.java | 3 +
.../ignite/testsuites/IgnitePdsTestSuite2.java | 9 +-
.../testsuites/IgniteStandByClusterSuite.java | 5 +-
.../processors/hadoop/HadoopProcessor.java | 4 +-
...ileSystemShmemExternalDualAsyncSelfTest.java | 5 +
.../processors/query/h2/opt/GridH2Table.java | 49 +-
.../cache/IgniteCacheAbstractQuerySelfTest.java | 3 +-
.../DynamicIndexAbstractConcurrentSelfTest.java | 81 +-
.../cache/index/H2DynamicTableSelfTest.java | 53 +
.../Cache/CacheAbstractTest.cs | 26 +-
.../Cache/CacheConfigurationTest.cs | 21 +
.../Cache/PersistentStoreTest.cs | 75 +-
.../Cache/Store/CacheStoreTest.cs | 21 +-
.../Apache.Ignite.Core.Tests/EventsTest.cs | 19 +-
.../Cache/Configuration/CacheConfiguration.cs | 75 +-
.../Apache.Ignite.Core/Common/JavaException.cs | 15 +-
.../Apache.Ignite.Core/IgniteConfiguration.cs | 7 +-
.../Impl/Events/RemoteListenEventFilter.cs | 3 +
.../Apache.Ignite.Core/Impl/ExceptionUtils.cs | 5 +-
.../spark/JavaEmbeddedIgniteRDDSelfTest.java | 5 +
.../frontend/app/data/pom-dependencies.json | 5 +-
.../frontend/app/filters/duration.filter.js | 2 +-
.../configuration/generator/Maven.service.js | 21 +-
.../states/configuration/caches/affinity.pug | 18 +-
.../states/configuration/caches/general.pug | 50 +-
.../yardstick/IgniteBenchmarkArguments.java | 46 +
.../cache/IgniteStreamerBenchmark.java | 234 ++++
216 files changed, 9165 insertions(+), 3050 deletions(-)
----------------------------------------------------------------------
[14/50] [abbrv] ignite git commit: IGNITE-5605 .NET: Inject resources
into remote event filters
Posted by vo...@apache.org.
IGNITE-5605 .NET: Inject resources into remote event filters
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f9f13cf0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f9f13cf0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f9f13cf0
Branch: refs/heads/master
Commit: f9f13cf083b481f004531710ec3835afdf5b7cef
Parents: b67b8c4
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Jul 5 12:59:43 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Jul 5 12:59:43 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests/EventsTest.cs | 19 ++++++++++++++-----
.../Impl/Events/RemoteListenEventFilter.cs | 3 +++
2 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9f13cf0/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
index 7578475..c05511c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
@@ -17,6 +17,8 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedParameter.Global
+// ReSharper disable UnusedAutoPropertyAccessor.Local
+// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable 618
namespace Apache.Ignite.Core.Tests
{
@@ -33,6 +35,7 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.Impl.Events;
+ using Apache.Ignite.Core.Resource;
using Apache.Ignite.Core.Tests.Compute;
using NUnit.Framework;
@@ -360,14 +363,14 @@ namespace Apache.Ignite.Core.Tests
if (i > 3)
{
// Filter
- waitTask = getWaitTask(new EventFilter<IEvent>(e => e.Type == EventType.TaskReduced), new int[0]);
+ waitTask = getWaitTask(new LocalEventFilter<IEvent>(e => e.Type == EventType.TaskReduced), new int[0]);
Assert.IsTrue(waitTask.Wait(timeout));
Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
Assert.AreEqual(EventType.TaskReduced, waitTask.Result.Type);
// Filter & types
- waitTask = getWaitTask(new EventFilter<IEvent>(e => e.Type == EventType.TaskReduced),
+ waitTask = getWaitTask(new LocalEventFilter<IEvent>(e => e.Type == EventType.TaskReduced),
new[] {EventType.TaskReduced});
Assert.IsTrue(waitTask.Wait(timeout));
@@ -868,7 +871,7 @@ namespace Apache.Ignite.Core.Tests
/// <returns>New instance of event listener.</returns>
public static IEventListener<IEvent> GetListener()
{
- return new EventFilter<IEvent>(Listen);
+ return new LocalEventFilter<IEvent>(Listen);
}
/// <summary>
@@ -917,7 +920,7 @@ namespace Apache.Ignite.Core.Tests
/// Test event filter.
/// </summary>
[Serializable]
- public class EventFilter<T> : IEventFilter<T>, IEventListener<T> where T : IEvent
+ public class LocalEventFilter<T> : IEventFilter<T>, IEventListener<T> where T : IEvent
{
/** */
private readonly Func<T, bool> _invoke;
@@ -926,7 +929,7 @@ namespace Apache.Ignite.Core.Tests
/// Initializes a new instance of the <see cref="RemoteListenEventFilter"/> class.
/// </summary>
/// <param name="invoke">The invoke delegate.</param>
- public EventFilter(Func<T, bool> invoke)
+ public LocalEventFilter(Func<T, bool> invoke)
{
_invoke = invoke;
}
@@ -960,6 +963,10 @@ namespace Apache.Ignite.Core.Tests
/** */
private readonly int _type;
+ /** */
+ [InstanceResource]
+ public IIgnite Ignite { get; set; }
+
public RemoteEventFilter(int type)
{
_type = type;
@@ -968,6 +975,8 @@ namespace Apache.Ignite.Core.Tests
/** <inheritdoc /> */
public bool Invoke(IEvent evt)
{
+ Assert.IsNotNull(Ignite);
+
return evt.Type == _type;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f9f13cf0/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs
index 31bfff1..2e0b66c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Impl.Events
using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Impl.Binary.IO;
using Apache.Ignite.Core.Impl.Common;
+ using Apache.Ignite.Core.Impl.Resource;
/// <summary>
/// Event filter/listener holder for RemoteListen.
@@ -75,6 +76,8 @@ namespace Apache.Ignite.Core.Impl.Events
var pred = reader.ReadObject<object>();
+ ResourceProcessor.Inject(pred, grid);
+
var func = DelegateTypeDescriptor.GetEventFilter(pred.GetType());
return new RemoteListenEventFilter(grid, evt => func(pred, evt));
[05/50] [abbrv] ignite git commit: IGNITE-5426:
JdbcThinConnection.readOnly state propagation. This closes #2200.
Posted by vo...@apache.org.
IGNITE-5426: JdbcThinConnection.readOnly state propagation. This closes #2200.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/44fad244
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/44fad244
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/44fad244
Branch: refs/heads/master
Commit: 44fad244aa40f552159af153fefdf25d47c7375e
Parents: 54572c3
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Jul 5 11:18:48 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Jul 5 11:18:48 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/jdbc/thin/JdbcThinConnection.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/44fad244/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
index 14c34ee..89ef2fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
@@ -76,6 +76,9 @@ public class JdbcThinConnection implements Connection {
/** Auto commit flag. */
private boolean autoCommit;
+ /** Read-only flag. */
+ private boolean readOnly;
+
/** Current transaction holdability. */
private int holdability;
@@ -277,13 +280,15 @@ public class JdbcThinConnection implements Connection {
/** {@inheritDoc} */
@Override public void setReadOnly(boolean readOnly) throws SQLException {
ensureNotClosed();
+
+ this.readOnly = readOnly;
}
/** {@inheritDoc} */
@Override public boolean isReadOnly() throws SQLException {
ensureNotClosed();
- return true;
+ return readOnly;
}
/** {@inheritDoc} */
[10/50] [abbrv] ignite git commit: Reworked cluster
activation/deactivation.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterState.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterState.java
deleted file mode 100644
index 1e1ef71..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterState.java
+++ /dev/null
@@ -1,38 +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;
-
-/**
- *
- */
-public enum ClusterState {
- /**
- * Cache is inactive. No operations are allowed, no partition assignments or rebalancing is performed.
- */
- INACTIVE,
-
- /**
- * Cache is active and operations. There are no lost partitions.
- */
- ACTIVE,
-
- /**
- * Cache is inactive. But process of it activation in progress.
- */
- TRANSITION
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index 6d5eaf3..2fd8780 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -83,15 +83,15 @@ public class DynamicCacheChangeRequest implements Serializable {
/** */
private UUID rcvdFrom;
- /** Cache state. Set to non-null when global state is changed. */
- private ClusterState state;
-
/** Reset lost partitions flag. */
private boolean resetLostPartitions;
/** Dynamic schema. */
private QuerySchema schema;
+ /** */
+ private transient boolean locallyConfigured;
+
/**
* @param reqId Unique request ID.
* @param cacheName Cache stop name.
@@ -100,7 +100,6 @@ public class DynamicCacheChangeRequest implements Serializable {
public DynamicCacheChangeRequest(UUID reqId, String cacheName, UUID initiatingNodeId) {
assert reqId != null;
assert cacheName != null;
- assert initiatingNodeId != null;
this.reqId = reqId;
this.cacheName = cacheName;
@@ -108,21 +107,6 @@ public class DynamicCacheChangeRequest implements Serializable {
}
/**
- * @param reqId Unique request ID.
- * @param state New cluster state.
- * @param initiatingNodeId Initiating node ID.
- */
- public DynamicCacheChangeRequest(UUID reqId, ClusterState state, UUID initiatingNodeId) {
- assert reqId != null;
- assert state != null;
- assert initiatingNodeId != null;
-
- this.reqId = reqId;
- this.state = state;
- this.initiatingNodeId = initiatingNodeId;
- }
-
- /**
* @param ctx Context.
* @param cacheName Cache name.
* @return Request to reset lost partitions.
@@ -183,20 +167,6 @@ public class DynamicCacheChangeRequest implements Serializable {
}
/**
- * @return State.
- */
- public ClusterState state() {
- return state;
- }
-
- /**
- * @return {@code True} if global caches state is changes.
- */
- public boolean globalStateChange() {
- return state != null;
- }
-
- /**
* @param template {@code True} if this is request for adding template configuration.
*/
public void template(boolean template) {
@@ -253,7 +223,7 @@ public class DynamicCacheChangeRequest implements Serializable {
}
/**
- *
+ * @return Destroy flag.
*/
public boolean destroy(){
return destroy;
@@ -420,6 +390,20 @@ public class DynamicCacheChangeRequest implements Serializable {
this.schema = schema != null ? schema.copy() : null;
}
+ /**
+ * @return Locally configured flag.
+ */
+ public boolean locallyConfigured() {
+ return locallyConfigured;
+ }
+
+ /**
+ * @param locallyConfigured Locally configured flag.
+ */
+ public void locallyConfigured(boolean locallyConfigured) {
+ this.locallyConfigured = locallyConfigured;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return "DynamicCacheChangeRequest [cacheName=" + cacheName() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
index 9caf9aa..e9ece5a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
@@ -50,7 +50,7 @@ public class ExchangeActions {
private Map<String, ActionData> cachesToResetLostParts;
/** */
- private ClusterState newState;
+ private StateChangeRequest stateChangeReq;
/**
* @param grpId Group ID.
@@ -89,7 +89,7 @@ public class ExchangeActions {
/**
* @return New caches start requests.
*/
- Collection<ActionData> cacheStartRequests() {
+ public Collection<ActionData> cacheStartRequests() {
return cachesToStart != null ? cachesToStart.values() : Collections.<ActionData>emptyList();
}
@@ -184,19 +184,31 @@ public class ExchangeActions {
}
/**
- * @param state New cluster state.
+ * @param stateChange Cluster state change request.
*/
- void newClusterState(ClusterState state) {
- assert state != null;
+ public void stateChangeRequest(StateChangeRequest stateChange) {
+ this.stateChangeReq = stateChange;
+ }
+
+ /**
+ * @return {@code True} if has deactivate request.
+ */
+ public boolean deactivate() {
+ return stateChangeReq != null && !stateChangeReq.activate();
+ }
- newState = state;
+ /**
+ * @return {@code True} if has activate request.
+ */
+ public boolean activate() {
+ return stateChangeReq != null && stateChangeReq.activate();
}
/**
- * @return New cluster state if state change was requested.
+ * @return Cluster state change request.
*/
- @Nullable public ClusterState newClusterState() {
- return newState;
+ @Nullable public StateChangeRequest stateChangeRequest() {
+ return stateChangeReq;
}
/**
@@ -328,13 +340,14 @@ public class ExchangeActions {
F.isEmpty(cachesToStop) &&
F.isEmpty(cacheGrpsToStart) &&
F.isEmpty(cacheGrpsToStop) &&
- F.isEmpty(cachesToResetLostParts);
+ F.isEmpty(cachesToResetLostParts) &&
+ stateChangeReq == null;
}
/**
*
*/
- static class ActionData {
+ public static class ActionData {
/** */
private final DynamicCacheChangeRequest req;
@@ -429,6 +442,6 @@ public class ExchangeActions {
", startGrps=" + startGrps +
", stopGrps=" + stopGrps +
", resetParts=" + (cachesToResetLostParts != null ? cachesToResetLostParts.keySet() : null) +
- ", newState=" + newState + ']';
+ ", stateChangeRequest=" + stateChangeReq + ']';
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java
index a967305..a9692f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java
@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.UUID;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.events.CacheEvent;
-import org.apache.ignite.events.CacheRebalancingEvent;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.util.typedef.F;
@@ -32,7 +31,6 @@ import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ;
-import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_PART_UNLOADED;
import static org.apache.ignite.events.EventType.EVT_CACHE_STARTED;
import static org.apache.ignite.events.EventType.EVT_CACHE_STOPPED;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
index 8ba10a2..7735f74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.processors.cache;
import java.util.Collection;
-import java.util.Set;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.eviction.EvictionFilter;
import org.apache.ignite.cache.eviction.EvictionPolicy;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 2de3808..f9d1114 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -1405,30 +1405,33 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
}
/**
+ * @param cctx Context.
* @param topic Topic.
* @param c Handler.
*/
- public void addOrderedCacheHandler(Object topic, IgniteBiInClosure<UUID, ? extends GridCacheIdMessage> c) {
- addOrderedHandler(false, topic, c);
+ public void addOrderedCacheHandler(GridCacheSharedContext cctx, Object topic, IgniteBiInClosure<UUID, ? extends GridCacheIdMessage> c) {
+ addOrderedHandler(cctx, false, topic, c);
}
/**
+ * @param cctx Context.
* @param topic Topic.
* @param c Handler.
*/
- public void addOrderedCacheGroupHandler(Object topic, IgniteBiInClosure<UUID, ? extends GridCacheGroupIdMessage> c) {
- addOrderedHandler(true, topic, c);
+ public void addOrderedCacheGroupHandler(GridCacheSharedContext cctx, Object topic, IgniteBiInClosure<UUID, ? extends GridCacheGroupIdMessage> c) {
+ addOrderedHandler(cctx, true, topic, c);
}
/**
* Adds ordered message handler.
*
+ * @param cctx Context.
* @param cacheGrp {@code True} if cache group message, {@code false} if cache message.
* @param topic Topic.
* @param c Handler.
*/
@SuppressWarnings({"unchecked"})
- private void addOrderedHandler(boolean cacheGrp, Object topic, IgniteBiInClosure<UUID, ? extends GridCacheMessage> c) {
+ private void addOrderedHandler(GridCacheSharedContext cctx, boolean cacheGrp, Object topic, IgniteBiInClosure<UUID, ? extends GridCacheMessage> c) {
MessageHandlers msgHandlers = cacheGrp ? grpHandlers : cacheHandlers;
IgniteLogger log0 = log;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index 24433de..a6907b9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -274,10 +274,11 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
pendingExplicit = GridConcurrentFactory.newMap();
}
- /** {@inheritDoc} */
- @Override protected void onKernalStart0(boolean reconnect) throws IgniteCheckedException {
- if (!reconnect)
- cctx.gridEvents().addLocalEventListener(discoLsnr, EVT_NODE_FAILED, EVT_NODE_LEFT);
+ /**
+ * Cache futures listener must be registered after communication listener.
+ */
+ public void registerEventListener() {
+ cctx.gridEvents().addLocalEventListener(discoLsnr, EVT_NODE_FAILED, EVT_NODE_LEFT);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 93310e3..22345d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -59,6 +59,7 @@ import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.events.DiscoveryCustomEvent;
import org.apache.ignite.internal.managers.discovery.DiscoCache;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
+import org.apache.ignite.internal.managers.discovery.DiscoveryLocalJoinData;
import org.apache.ignite.internal.managers.eventstorage.DiscoveryEventListener;
import org.apache.ignite.internal.pagemem.snapshot.StartSnapshotOperationAckDiscoveryMessage;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
@@ -81,6 +82,8 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Ign
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage;
import org.apache.ignite.internal.processors.query.schema.SchemaNodeLeaveExchangeWorkerTask;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
import org.apache.ignite.internal.util.GridListSet;
@@ -192,6 +195,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
/** */
private DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss.SSS");
+ /** Events received while cluster state transition was in progress. */
+ private final List<PendingDiscoveryEvent> pendingEvts = new ArrayList<>();
+
/** Discovery listener. */
private final DiscoveryEventListener discoLsnr = new DiscoveryEventListener() {
@Override public void onEvent(DiscoveryEvent evt, DiscoCache cache) {
@@ -199,109 +205,53 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
return;
try {
- ClusterNode loc = cctx.localNode();
-
- assert evt.type() == EVT_NODE_JOINED || evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED ||
- evt.type() == EVT_DISCOVERY_CUSTOM_EVT;
-
- final ClusterNode n = evt.eventNode();
-
- GridDhtPartitionExchangeId exchId = null;
- GridDhtPartitionsExchangeFuture exchFut = null;
-
- if (evt.type() != EVT_DISCOVERY_CUSTOM_EVT) {
- assert !loc.id().equals(n.id());
-
- if (evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED) {
- assert cctx.discovery().node(n.id()) == null;
-
- // Avoid race b/w initial future add and discovery event.
- GridDhtPartitionsExchangeFuture initFut = null;
-
- if (readyTopVer.get().equals(AffinityTopologyVersion.NONE)) {
- initFut = exchangeFuture(initialExchangeId(), null, null, null, null);
-
- initFut.onNodeLeft(n);
- }
-
- for (GridDhtPartitionsExchangeFuture f : exchFuts.values()) {
- if (f != initFut)
- f.onNodeLeft(n);
- }
- }
+ if (evt.type() == EVT_DISCOVERY_CUSTOM_EVT &&
+ (((DiscoveryCustomEvent)evt).customMessage() instanceof ChangeGlobalStateMessage)) {
+ ChangeGlobalStateMessage stateChangeMsg =
+ (ChangeGlobalStateMessage)((DiscoveryCustomEvent)evt).customMessage();
- assert evt.type() != EVT_NODE_JOINED || n.order() > loc.order() :
- "Node joined with smaller-than-local " +
- "order [newOrder=" + n.order() + ", locOrder=" + loc.order() + ']';
+ if (stateChangeMsg.exchangeActions() == null)
+ return;
- exchId = exchangeId(n.id(),
- affinityTopologyVersion(evt),
- evt.type());
+ onDiscoveryEvent(evt, cache);
- exchFut = exchangeFuture(exchId, evt, cache,null, null);
+ return;
}
- else {
- DiscoveryCustomMessage customMsg = ((DiscoveryCustomEvent)evt).customMessage();
+ if (evt.type() == EVT_DISCOVERY_CUSTOM_EVT &&
+ (((DiscoveryCustomEvent)evt).customMessage() instanceof ChangeGlobalStateFinishMessage)) {
+ ChangeGlobalStateFinishMessage stateFinishMsg =
+ (ChangeGlobalStateFinishMessage)((DiscoveryCustomEvent)evt).customMessage();
- if (customMsg instanceof DynamicCacheChangeBatch) {
- DynamicCacheChangeBatch batch = (DynamicCacheChangeBatch)customMsg;
-
- ExchangeActions exchActions = batch.exchangeActions();
-
- if (exchActions != null) {
- exchId = exchangeId(n.id(), affinityTopologyVersion(evt), evt.type());
+ if (stateFinishMsg.clusterActive()) {
+ for (PendingDiscoveryEvent pendingEvt : pendingEvts) {
+ if (log.isDebugEnabled())
+ log.debug("Process pending event: " + pendingEvt.event());
- exchFut = exchangeFuture(exchId, evt, cache, exchActions, null);
+ onDiscoveryEvent(pendingEvt.event(), pendingEvt.discoCache());
}
}
- else if (customMsg instanceof CacheAffinityChangeMessage) {
- CacheAffinityChangeMessage msg = (CacheAffinityChangeMessage)customMsg;
-
- if (msg.exchangeId() == null) {
- if (msg.exchangeNeeded()) {
- exchId = exchangeId(n.id(), affinityTopologyVersion(evt), evt.type());
-
- exchFut = exchangeFuture(exchId, evt, cache, null, msg);
- }
- }
- else if (msg.exchangeId().topologyVersion().topologyVersion() >= cctx.discovery().localJoinEvent().topologyVersion())
- exchangeFuture(msg.exchangeId(), null, null, null, null)
- .onAffinityChangeMessage(evt.eventNode(), msg);
+ else {
+ for (PendingDiscoveryEvent pendingEvt : pendingEvts)
+ processEventInactive(pendingEvt.event(), pendingEvt.discoCache());
}
- else if (customMsg instanceof StartSnapshotOperationAckDiscoveryMessage
- && ((StartSnapshotOperationAckDiscoveryMessage)customMsg).needExchange()) {
- exchId = exchangeId(n.id(), affinityTopologyVersion(evt), evt.type());
- exchFut = exchangeFuture(exchId, evt, null, null, null);
- }
- else {
- // Process event as custom discovery task if needed.
- CachePartitionExchangeWorkerTask task =
- cctx.cache().exchangeTaskForCustomDiscoveryMessage(customMsg);
+ pendingEvts.clear();
- if (task != null)
- exchWorker.addCustomTask(task);
- }
+ return;
}
- if (exchId != null) {
+ if (cache.state().transition()) {
if (log.isDebugEnabled())
- log.debug("Discovery event (will start exchange): " + exchId);
-
- // Event callback - without this callback future will never complete.
- exchFut.onEvent(exchId, evt, cache);
+ log.debug("Add pending event: " + evt);
- // Start exchange process.
- addFuture(exchFut);
- }
- else {
- if (log.isDebugEnabled())
- log.debug("Do not start exchange for discovery event: " + evt);
+ pendingEvts.add(new PendingDiscoveryEvent(evt, cache));
}
+ else if (cache.state().active())
+ onDiscoveryEvent(evt, cache);
+ else
+ processEventInactive(evt, cache);
- // Notify indexing engine about node leave so that we can re-map coordinator accordingly.
- if (evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED)
- exchWorker.addCustomTask(new SchemaNodeLeaveExchangeWorkerTask(evt.eventNode()));
+ notifyNodeFail(evt);
}
finally {
leaveBusy();
@@ -309,6 +259,29 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
};
+ /**
+ * @param evt Event.
+ */
+ private void notifyNodeFail(DiscoveryEvent evt) {
+ if (evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED) {
+ final ClusterNode n = evt.eventNode();
+
+ assert cctx.discovery().node(n.id()) == null;
+
+ for (GridDhtPartitionsExchangeFuture f : exchFuts.values())
+ f.onNodeLeft(n);
+ }
+ }
+
+ /**
+ * @param evt Event.
+ * @param cache Discovery data cache.
+ */
+ private void processEventInactive(DiscoveryEvent evt, DiscoCache cache) {
+ if (log.isDebugEnabled())
+ log.debug("Ignore event, cluster is inactive: " + evt);
+ }
+
/** {@inheritDoc} */
@Override protected void start0() throws IgniteCheckedException {
super.start0();
@@ -338,12 +311,158 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
processSinglePartitionRequest(node, msg);
}
});
+
+ if (!cctx.kernalContext().clientNode()) {
+ for (int cnt = 0; cnt < cctx.gridConfig().getRebalanceThreadPoolSize(); cnt++) {
+ final int idx = cnt;
+
+ cctx.io().addOrderedCacheGroupHandler(cctx, rebalanceTopic(cnt), new CI2<UUID, GridCacheGroupIdMessage>() {
+ @Override public void apply(final UUID id, final GridCacheGroupIdMessage m) {
+ if (!enterBusy())
+ return;
+
+ try {
+ CacheGroupContext grp = cctx.cache().cacheGroup(m.groupId());
+
+ if (grp != null) {
+ if (m instanceof GridDhtPartitionSupplyMessage) {
+ grp.preloader().handleSupplyMessage(idx, id, (GridDhtPartitionSupplyMessage) m);
+
+ return;
+ }
+ else if (m instanceof GridDhtPartitionDemandMessage) {
+ grp.preloader().handleDemandMessage(idx, id, (GridDhtPartitionDemandMessage) m);
+
+ return;
+ }
+ }
+
+ U.error(log, "Unsupported message type: " + m.getClass().getName());
+ }
+ finally {
+ leaveBusy();
+ }
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Callback for local join event (needed since regular event for local join is not generated).
+ *
+ * @param evt Event.
+ * @param cache Cache.
+ */
+ public void onLocalJoin(DiscoveryEvent evt, DiscoCache cache) {
+ discoLsnr.onEvent(evt, cache);
+ }
+
+ /**
+ * @param evt Event.
+ * @param cache Discovery data cache.
+ */
+ private void onDiscoveryEvent(DiscoveryEvent evt, DiscoCache cache) {
+ ClusterNode loc = cctx.localNode();
+
+ assert evt.type() == EVT_NODE_JOINED || evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED ||
+ evt.type() == EVT_DISCOVERY_CUSTOM_EVT;
+
+ final ClusterNode n = evt.eventNode();
+
+ GridDhtPartitionExchangeId exchId = null;
+ GridDhtPartitionsExchangeFuture exchFut = null;
+
+ if (evt.type() != EVT_DISCOVERY_CUSTOM_EVT) {
+ assert evt.type() != EVT_NODE_JOINED || n.isLocal() || n.order() > loc.order() :
+ "Node joined with smaller-than-local " +
+ "order [newOrder=" + n.order() + ", locOrder=" + loc.order() + ']';
+
+ exchId = exchangeId(n.id(), affinityTopologyVersion(evt), evt.type());
+
+ exchFut = exchangeFuture(exchId, evt, cache,null, null);
+ }
+ else {
+ DiscoveryCustomMessage customMsg = ((DiscoveryCustomEvent)evt).customMessage();
+
+ if (customMsg instanceof ChangeGlobalStateMessage) {
+ ChangeGlobalStateMessage stateChangeMsg = (ChangeGlobalStateMessage)customMsg;
+
+ ExchangeActions exchActions = stateChangeMsg.exchangeActions();
+
+ if (exchActions != null) {
+ exchId = exchangeId(n.id(), affinityTopologyVersion(evt), evt.type());
+
+ exchFut = exchangeFuture(exchId, evt, cache, exchActions, null);
+ }
+ }
+ else if (customMsg instanceof DynamicCacheChangeBatch) {
+ DynamicCacheChangeBatch batch = (DynamicCacheChangeBatch)customMsg;
+
+ ExchangeActions exchActions = batch.exchangeActions();
+
+ if (exchActions != null) {
+ exchId = exchangeId(n.id(), affinityTopologyVersion(evt), evt.type());
+
+ exchFut = exchangeFuture(exchId, evt, cache, exchActions, null);
+ }
+ }
+ else if (customMsg instanceof CacheAffinityChangeMessage) {
+ CacheAffinityChangeMessage msg = (CacheAffinityChangeMessage)customMsg;
+
+ if (msg.exchangeId() == null) {
+ if (msg.exchangeNeeded()) {
+ exchId = exchangeId(n.id(), affinityTopologyVersion(evt), evt.type());
+
+ exchFut = exchangeFuture(exchId, evt, cache, null, msg);
+ }
+ }
+ else if (msg.exchangeId().topologyVersion().topologyVersion() >= cctx.discovery().localJoinEvent().topologyVersion())
+ exchangeFuture(msg.exchangeId(), null, null, null, null)
+ .onAffinityChangeMessage(evt.eventNode(), msg);
+ }
+ else if (customMsg instanceof StartSnapshotOperationAckDiscoveryMessage
+ && ((StartSnapshotOperationAckDiscoveryMessage)customMsg).needExchange()) {
+ exchId = exchangeId(n.id(), affinityTopologyVersion(evt), evt.type());
+
+ exchFut = exchangeFuture(exchId, evt, null, null, null);
+ }
+ else {
+ // Process event as custom discovery task if needed.
+ CachePartitionExchangeWorkerTask task =
+ cctx.cache().exchangeTaskForCustomDiscoveryMessage(customMsg);
+
+ if (task != null)
+ exchWorker.addCustomTask(task);
+ }
+ }
+
+ if (exchId != null) {
+ if (log.isDebugEnabled())
+ log.debug("Discovery event (will start exchange): " + exchId);
+
+ // Event callback - without this callback future will never complete.
+ exchFut.onEvent(exchId, evt, cache);
+
+ // Start exchange process.
+ addFuture(exchFut);
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Do not start exchange for discovery event: " + evt);
+ }
+
+ notifyNodeFail(evt);
+
+ // Notify indexing engine about node leave so that we can re-map coordinator accordingly.
+ if (evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED)
+ exchWorker.addCustomTask(new SchemaNodeLeaveExchangeWorkerTask(evt.eventNode()));
}
/**
* @param task Task to run in exchange worker thread.
*/
- public void addCustomTask(CachePartitionExchangeWorkerTask task) {
+ void addCustomTask(CachePartitionExchangeWorkerTask task) {
assert task != null;
exchWorker.addCustomTask(task);
@@ -371,9 +490,14 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
return exchangeId(cctx.localNode().id(), startTopVer, EVT_NODE_JOINED);
}
- /** {@inheritDoc} */
- @Override protected void onKernalStart0(boolean reconnect) throws IgniteCheckedException {
- super.onKernalStart0(reconnect);
+ /**
+ * @param active Cluster state.
+ * @param reconnect Reconnect flag.
+ * @throws IgniteCheckedException If failed.
+ */
+ public void onKernalStart(boolean active, boolean reconnect) throws IgniteCheckedException {
+ for (ClusterNode n : cctx.discovery().remoteNodes())
+ cctx.versions().onReceived(n.id(), n.metrics().getLastDataVersion());
ClusterNode loc = cctx.localNode();
@@ -381,79 +505,49 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
assert startTime > 0;
- // Generate dummy discovery event for local node joining.
- T2<DiscoveryEvent, DiscoCache> locJoin = cctx.discovery().localJoin();
-
- DiscoveryEvent discoEvt = locJoin.get1();
- DiscoCache discoCache = locJoin.get2();
-
- GridDhtPartitionExchangeId exchId = initialExchangeId();
+ DiscoveryLocalJoinData locJoin = cctx.discovery().localJoin();
- GridDhtPartitionsExchangeFuture fut = exchangeFuture(exchId, discoEvt, discoCache, null, null);
+ GridDhtPartitionsExchangeFuture fut = null;
if (reconnect)
reconnectExchangeFut = new GridFutureAdapter<>();
- exchWorker.addFirstExchangeFuture(fut);
-
- if (!cctx.kernalContext().clientNode()) {
- for (int cnt = 0; cnt < cctx.gridConfig().getRebalanceThreadPoolSize(); cnt++) {
- final int idx = cnt;
-
- cctx.io().addOrderedCacheGroupHandler(rebalanceTopic(cnt), new CI2<UUID, GridCacheGroupIdMessage>() {
- @Override public void apply(final UUID id, final GridCacheGroupIdMessage m) {
- if (!enterBusy())
- return;
-
- try {
- CacheGroupContext grp = cctx.cache().cacheGroup(m.groupId());
-
- if (grp != null) {
- if (m instanceof GridDhtPartitionSupplyMessage) {
- grp.preloader().handleSupplyMessage(idx, id, (GridDhtPartitionSupplyMessage) m);
-
- return;
- }
- else if (m instanceof GridDhtPartitionDemandMessage) {
- grp.preloader().handleDemandMessage(idx, id, (GridDhtPartitionDemandMessage) m);
+ if (active) {
+ DiscoveryEvent discoEvt = locJoin.event();
+ DiscoCache discoCache = locJoin.discoCache();
- return;
- }
- }
+ GridDhtPartitionExchangeId exchId = initialExchangeId();
- U.error(log, "Unsupported message type: " + m.getClass().getName());
- }
- finally {
- leaveBusy();
- }
- }
- });
- }
+ fut = exchangeFuture(exchId, discoEvt, discoCache, null, null);
}
+ else if (reconnect)
+ reconnectExchangeFut.onDone();
new IgniteThread(cctx.igniteInstanceName(), "exchange-worker", exchWorker).start();
if (reconnect) {
- fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
- @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> fut) {
- try {
- fut.get();
+ if (fut != null) {
+ fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
+ @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> fut) {
+ try {
+ fut.get();
- for (CacheGroupContext grp : cctx.cache().cacheGroups())
- grp.preloader().onInitialExchangeComplete(null);
+ for (CacheGroupContext grp : cctx.cache().cacheGroups())
+ grp.preloader().onInitialExchangeComplete(null);
- reconnectExchangeFut.onDone();
- }
- catch (IgniteCheckedException e) {
- for (CacheGroupContext grp : cctx.cache().cacheGroups())
- grp.preloader().onInitialExchangeComplete(e);
+ reconnectExchangeFut.onDone();
+ }
+ catch (IgniteCheckedException e) {
+ for (CacheGroupContext grp : cctx.cache().cacheGroups())
+ grp.preloader().onInitialExchangeComplete(e);
- reconnectExchangeFut.onDone(e);
+ reconnectExchangeFut.onDone(e);
+ }
}
- }
- });
+ });
+ }
}
- else {
+ else if (fut != null) {
if (log.isDebugEnabled())
log.debug("Beginning to wait on local exchange future: " + fut);
@@ -489,10 +583,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
}
- AffinityTopologyVersion nodeStartVer = new AffinityTopologyVersion(discoEvt.topologyVersion(), 0);
-
for (CacheGroupContext grp : cctx.cache().cacheGroups()) {
- if (nodeStartVer.equals(grp.localStartVersion()))
+ if (locJoin.joinTopologyVersion().equals(grp.localStartVersion()))
grp.preloader().onInitialExchangeComplete(null);
}
@@ -1669,28 +1761,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
/**
- * @param deque Deque to poll from.
- * @param time Time to wait.
- * @param w Worker.
- * @return Polled item.
- * @throws InterruptedException If interrupted.
- */
- @Nullable private <T> T poll(BlockingQueue<T> deque, long time, GridWorker w) throws InterruptedException {
- assert w != null;
-
- // There is currently a case where {@code interrupted}
- // flag on a thread gets flipped during stop which causes the pool to hang. This check
- // will always make sure that interrupted flag gets reset before going into wait conditions.
- // The true fix should actually make sure that interrupted flag does not get reset or that
- // interrupted exception gets propagated. Until we find a real fix, this method should
- // always work to make sure that there is no hanging during stop.
- if (w.isCancelled())
- Thread.currentThread().interrupt();
-
- return deque.poll(time, MILLISECONDS);
- }
-
- /**
* Exchange future thread. All exchanges happen only by one thread and next
* exchange will not start until previous one completes.
*/
@@ -1710,15 +1780,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
/**
- * Add first exchange future.
- *
- * @param exchFut Exchange future.
- */
- void addFirstExchangeFuture(GridDhtPartitionsExchangeFuture exchFut) {
- futQ.addFirst(exchFut);
- }
-
- /**
* @param exchFut Exchange future.
*/
void addExchangeFuture(GridDhtPartitionsExchangeFuture exchFut) {
@@ -1946,7 +2007,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
}
- if (!exchFut.skipPreload() && cctx.kernalContext().state().active()) {
+ if (!exchFut.skipPreload() ) {
assignsMap = new HashMap<>();
for (CacheGroupContext grp : cctx.cache().cacheGroups()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/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 0f859eb..624dec0 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
@@ -107,6 +107,9 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTransactio
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionManager;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage;
+import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
import org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor;
import org.apache.ignite.internal.processors.plugin.CachePluginManager;
import org.apache.ignite.internal.processors.query.QuerySchema;
@@ -692,36 +695,27 @@ public class GridCacheProcessor extends GridProcessorAdapter {
for (GridCacheSharedManager mgr : sharedCtx.managers())
mgr.start(sharedCtx);
- if (ctx.config().isDaemon()) {
- ctx.state().cacheProcessorStarted(new CacheJoinNodeDiscoveryData(
- IgniteUuid.randomUuid(),
- Collections.<String, CacheInfo>emptyMap(),
- Collections.<String, CacheInfo>emptyMap(),
- false
- ));
-
- return;
- }
-
- Map<String, CacheInfo> caches = new HashMap<>();
+ if (!ctx.isDaemon()) {
+ Map<String, CacheInfo> caches = new HashMap<>();
- Map<String, CacheInfo> templates = new HashMap<>();
+ Map<String, CacheInfo> templates = new HashMap<>();
- addCacheOnJoinFromConfig(caches, templates);
+ addCacheOnJoinFromConfig(caches, templates);
- CacheJoinNodeDiscoveryData discoData = new CacheJoinNodeDiscoveryData(
- IgniteUuid.randomUuid(),
- caches,
- templates,
- startAllCachesOnClientStart()
- );
+ CacheJoinNodeDiscoveryData discoData = new CacheJoinNodeDiscoveryData(
+ IgniteUuid.randomUuid(),
+ caches,
+ templates,
+ startAllCachesOnClientStart()
+ );
- cachesInfo.onStart(discoData);
+ cachesInfo.onStart(discoData);
- if (log.isDebugEnabled())
- log.debug("Started cache processor.");
+ if (log.isDebugEnabled())
+ log.debug("Started cache processor.");
+ }
- ctx.state().cacheProcessorStarted(discoData);
+ ctx.state().cacheProcessorStarted();
}
/**
@@ -830,51 +824,38 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
- @Override public void onKernalStart() throws IgniteCheckedException {
- boolean active = ctx.state().active();
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
+ if (ctx.isDaemon())
+ return;
try {
- boolean checkConsistency =
- !ctx.config().isDaemon() && !getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
+ boolean checkConsistency = !getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
if (checkConsistency)
checkConsistency();
- if (active && cachesInfo.onJoinCacheException() != null)
- throw new IgniteCheckedException(cachesInfo.onJoinCacheException());
-
cachesInfo.onKernalStart(checkConsistency);
- if (active && !ctx.clientNode() && !ctx.isDaemon())
- sharedCtx.database().lock();
-
- // Must start database before start first cache.
- sharedCtx.database().onKernalStart(false);
-
ctx.query().onCacheKernalStart();
- // In shared context, we start exchange manager and wait until processed local join
- // event, all caches which we get on join will be start.
- for (GridCacheSharedManager<?, ?> mgr : sharedCtx.managers()) {
- if (sharedCtx.database() != mgr)
- mgr.onKernalStart(false);
- }
+ sharedCtx.mvcc().registerEventListener();
+
+ sharedCtx.exchange().onKernalStart(active, false);
}
finally {
cacheStartedLatch.countDown();
}
+ if (!ctx.clientNode())
+ addRemovedItemsCleanupTask(Long.getLong(IGNITE_CACHE_REMOVED_ENTRIES_TTL, 10_000));
+
// Escape if cluster inactive.
if (!active)
return;
- if (!ctx.config().isDaemon())
- ctx.cacheObjects().onUtilityCacheStarted();
-
ctx.service().onUtilityCacheStarted();
- final AffinityTopologyVersion startTopVer =
- new AffinityTopologyVersion(ctx.discovery().localJoinEvent().topologyVersion(), 0);
+ final AffinityTopologyVersion startTopVer = ctx.discovery().localJoin().joinTopologyVersion();
final List<IgniteInternalFuture> syncFuts = new ArrayList<>(caches.size());
@@ -894,15 +875,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
});
- // Avoid iterator creation.
- //noinspection ForLoopReplaceableByForEach
for (int i = 0, size = syncFuts.size(); i < size; i++)
syncFuts.get(i).get();
-
- assert ctx.config().isDaemon() || caches.containsKey(CU.UTILITY_CACHE_NAME) : "Utility cache should be started";
-
- if (!ctx.clientNode() && !ctx.isDaemon())
- addRemovedItemsCleanupTask(Long.getLong(IGNITE_CACHE_REMOVED_ENTRIES_TTL, 10_000));
}
/**
@@ -969,8 +943,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
for (CacheGroupContext grp : cacheGrps.values())
stopCacheGroup(grp.groupId());
-
- cachesInfo.clearCaches();
}
/**
@@ -1097,7 +1069,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
@Override public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted) throws IgniteCheckedException {
List<GridCacheAdapter> reconnected = new ArrayList<>(caches.size());
- ClusterCachesReconnectResult reconnectRes = cachesInfo.onReconnected();
+ DiscoveryDataClusterState state = ctx.state().clusterState();
+
+ boolean active = state.active() && !state.transition();
+
+ ClusterCachesReconnectResult reconnectRes = cachesInfo.onReconnected(active, state.transition());
final List<GridCacheAdapter> stoppedCaches = new ArrayList<>();
@@ -1135,7 +1111,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
grp.onReconnected();
}
- sharedCtx.onReconnected();
+ sharedCtx.onReconnected(active);
for (GridCacheAdapter cache : reconnected)
cache.context().gate().reconnected(false);
@@ -1750,17 +1726,26 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
+ * @return Caches to be started when this node starts.
+ */
+ public List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> cachesToStartOnLocalJoin() {
+ return cachesInfo.cachesToStartOnLocalJoin();
+ }
+
+ /**
+ * @param caches Caches to start.
* @param exchTopVer Current exchange version.
* @throws IgniteCheckedException If failed.
*/
- public void startCachesOnLocalJoin(AffinityTopologyVersion exchTopVer) throws IgniteCheckedException {
- List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> caches = cachesInfo.cachesToStartOnLocalJoin();
-
+ public void startCachesOnLocalJoin(List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> caches,
+ AffinityTopologyVersion exchTopVer)
+ throws IgniteCheckedException {
if (!F.isEmpty(caches)) {
for (T2<DynamicCacheDescriptor, NearCacheConfiguration> t : caches) {
DynamicCacheDescriptor desc = t.get1();
prepareCacheStart(
+ desc.cacheConfiguration(),
desc,
t.get2(),
exchTopVer
@@ -1787,6 +1772,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (CU.affinityNode(ctx.discovery().localNode(), filter)) {
prepareCacheStart(
+ desc.cacheConfiguration(),
desc,
null,
exchTopVer
@@ -1799,17 +1785,18 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
+ * @param startCfg Cache configuration to use.
* @param desc Cache descriptor.
* @param reqNearCfg Near configuration if specified for client cache start request.
* @param exchTopVer Current exchange version.
* @throws IgniteCheckedException If failed.
*/
- public void prepareCacheStart(
+ void prepareCacheStart(
+ CacheConfiguration startCfg,
DynamicCacheDescriptor desc,
@Nullable NearCacheConfiguration reqNearCfg,
AffinityTopologyVersion exchTopVer
) throws IgniteCheckedException {
- CacheConfiguration startCfg = desc.cacheConfiguration();
assert !caches.containsKey(startCfg.getName()) : startCfg.getName();
CacheConfiguration ccfg = new CacheConfiguration(startCfg);
@@ -2003,7 +1990,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
sharedCtx.removeCacheContext(ctx);
- onKernalStop(cache, destroy);
+ onKernalStop(cache, true);
stopCache(cache, true, destroy);
@@ -2017,9 +2004,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @param startTopVer Cache start version.
* @param err Cache start error if any.
*/
- void initCacheProxies(
- AffinityTopologyVersion startTopVer, @Nullable
- Throwable err) {
+ void initCacheProxies(AffinityTopologyVersion startTopVer, @Nullable Throwable err) {
for (GridCacheAdapter<?, ?> cache : caches.values()) {
GridCacheContext<?, ?> cacheCtx = cache.context();
@@ -2122,7 +2107,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (exchActions == null)
return;
- if (exchActions.systemCachesStarting() && exchActions.newClusterState() == null)
+ if (exchActions.systemCachesStarting() && exchActions.stateChangeRequest() == null)
ctx.dataStructures().restoreStructuresState(ctx);
if (err == null) {
@@ -2143,9 +2128,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
try {
prepareCacheStop(action.request().cacheName(), action.request().destroy());
-
- if (exchActions.newClusterState() == null)
- ctx.state().onCacheStop(action.request());
}
finally {
sharedCtx.database().checkpointReadUnlock();
@@ -2166,6 +2148,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (!sharedCtx.kernalContext().clientNode())
sharedCtx.database().onCacheGroupsStopped(stoppedGroups);
+
+ if (exchActions.deactivate())
+ sharedCtx.deactivate();
}
}
@@ -2204,10 +2189,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
* @param req Request to complete future for.
+ * @param success Future result.
* @param err Error if any.
*/
void completeCacheStartFuture(DynamicCacheChangeRequest req, boolean success, @Nullable Throwable err) {
- if (req.initiatingNodeId().equals(ctx.localNodeId())) {
+ if (ctx.localNodeId().equals(req.initiatingNodeId())) {
DynamicCacheStartFuture fut = (DynamicCacheStartFuture)pendingFuts.get(req.requestId());
if (fut != null)
@@ -2304,30 +2290,35 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public void collectGridNodeData(DiscoveryDataBag dataBag) {
- if (ctx.state().active())
- cachesInfo.collectGridNodeData(dataBag);
- else
- ctx.state().collectGridNodeData0(dataBag);
+ cachesInfo.collectGridNodeData(dataBag);
}
/** {@inheritDoc} */
@Override public void onJoiningNodeDataReceived(JoiningNodeDiscoveryData data) {
- if (ctx.state().active())
- cachesInfo.onJoiningNodeDataReceived(data);
-
- ctx.state().onJoiningNodeDataReceived0(data);
+ cachesInfo.onJoiningNodeDataReceived(data);
}
/** {@inheritDoc} */
@Override public void onGridDataReceived(GridDiscoveryData data) {
- if (ctx.state().active()) {
- if (!cachesInfo.disconnectedState())
- cachesInfo.addJoinInfo();
+ cachesInfo.onGridDataReceived(data);
+ }
- cachesInfo.onGridDataReceived(data);
- }
+ /**
+ * @param msg Message.
+ */
+ public void onStateChangeFinish(ChangeGlobalStateFinishMessage msg) {
+ cachesInfo.onStateChangeFinish(msg);
+ }
- ctx.state().onGridDataReceived0(data);
+ /**
+ * @param msg Message.
+ * @param topVer Current topology version.
+ * @throws IgniteCheckedException If configuration validation failed.
+ * @return Exchange actions.
+ */
+ public ExchangeActions onStateChangeRequest(ChangeGlobalStateMessage msg, AffinityTopologyVersion topVer)
+ throws IgniteCheckedException {
+ return cachesInfo.onStateChangeRequest(msg, topVer);
}
/**
@@ -2929,13 +2920,19 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
* @param type Event type.
+ * @param customMsg Custom message instance.
* @param node Event node.
* @param topVer Topology version.
+ * @param state Cluster state.
*/
- public void onDiscoveryEvent(int type, ClusterNode node, AffinityTopologyVersion topVer) {
+ public void onDiscoveryEvent(int type,
+ @Nullable DiscoveryCustomMessage customMsg,
+ ClusterNode node,
+ AffinityTopologyVersion topVer,
+ DiscoveryDataClusterState state) {
cachesInfo.onDiscoveryEvent(type, node, topVer);
- sharedCtx.affinity().onDiscoveryEvent(type, node, topVer);
+ sharedCtx.affinity().onDiscoveryEvent(type, customMsg, node, topVer, state);
}
/**
@@ -3214,7 +3211,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
proxy = new IgniteCacheProxy(cacheAdapter.context(), cacheAdapter, null, false);
}
- assert proxy != null;
+ assert proxy != null : name;
return proxy.internalProxy();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
index 75d03d7..9adca8d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -45,7 +46,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopolo
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheSnapshotManager;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
import org.apache.ignite.internal.processors.cache.jta.CacheJtaManagerAdapter;
import org.apache.ignite.internal.processors.cache.store.CacheStoreManager;
@@ -54,6 +54,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
import org.apache.ignite.internal.processors.cache.transactions.TransactionMetricsAdapter;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionManager;
+import org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.GridIntList;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
@@ -156,6 +157,9 @@ public class GridCacheSharedContext<K, V> {
/** Concurrent DHT atomic updates counters. */
private AtomicIntegerArray dhtAtomicUpdCnt;
+ /** */
+ private final List<IgniteChangeGlobalStateSupport> stateAwareMgrs;
+
/**
* @param kernalCtx Context.
* @param txMgr Transaction manager.
@@ -207,6 +211,49 @@ public class GridCacheSharedContext<K, V> {
txFinishMsgLog = kernalCtx.log(CU.TX_MSG_FINISH_LOG_CATEGORY);
txLockMsgLog = kernalCtx.log(CU.TX_MSG_LOCK_LOG_CATEGORY);
txRecoveryMsgLog = kernalCtx.log(CU.TX_MSG_RECOVERY_LOG_CATEGORY);
+
+ stateAwareMgrs = new ArrayList<>();
+
+ if (pageStoreMgr != null)
+ stateAwareMgrs.add(pageStoreMgr);
+
+ if (walMgr != null)
+ stateAwareMgrs.add(walMgr);
+
+ stateAwareMgrs.add(dbMgr);
+
+ stateAwareMgrs.add(snpMgr);
+ }
+
+ /**
+ * @throws IgniteCheckedException If failed.
+ */
+ public void activate() throws IgniteCheckedException {
+ if (!kernalCtx.clientNode())
+ dbMgr.lock();
+
+ boolean success = false;
+
+ try {
+ for (IgniteChangeGlobalStateSupport mgr : stateAwareMgrs)
+ mgr.onActivate(kernalCtx);
+
+ success = true;
+ }
+ finally {
+ if (!success) {
+ if (!kernalCtx.clientNode())
+ dbMgr.unLock();
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public void deactivate() {
+ for (int i = stateAwareMgrs.size() - 1; i >= 0; i--)
+ stateAwareMgrs.get(i).onDeActivate(kernalCtx);
}
/**
@@ -272,12 +319,15 @@ public class GridCacheSharedContext<K, V> {
if (restartOnDisconnect(mgr))
mgr.stop(true);
}
+
+ deactivate();
}
/**
+ * @param active Active flag.
* @throws IgniteCheckedException If failed.
*/
- void onReconnected() throws IgniteCheckedException {
+ void onReconnected(boolean active) throws IgniteCheckedException {
List<GridCacheSharedManager<K, V>> mgrs = new LinkedList<>();
setManagers(mgrs, txMgr,
@@ -303,8 +353,10 @@ public class GridCacheSharedContext<K, V> {
kernalCtx.query().onCacheReconnect();
- for (GridCacheSharedManager<?, ?> mgr : mgrs)
- mgr.onKernalStart(true);
+ if (!active)
+ affinity().removeAllCacheInfo();
+
+ exchMgr.onKernalStart(active, true);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManager.java
index e0e4090..bc1bbb9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManager.java
@@ -40,12 +40,6 @@ public interface GridCacheSharedManager<K, V> {
public void stop(boolean cancel);
/**
- * @param reconnect {@code True} if manager restarted after client reconnect.
- * @throws IgniteCheckedException If failed.
- */
- public void onKernalStart(boolean reconnect) throws IgniteCheckedException;
-
- /**
* @param cancel Cancel flag.
*/
public void onKernalStop(boolean cancel);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManagerAdapter.java
index f6f79e4..90ae670 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManagerAdapter.java
@@ -112,14 +112,6 @@ public class GridCacheSharedManagerAdapter<K, V> implements GridCacheSharedManag
}
/** {@inheritDoc} */
- @Override public final void onKernalStart(boolean reconnect) throws IgniteCheckedException {
- onKernalStart0(reconnect);
-
- if (!reconnect && log != null && log.isDebugEnabled())
- log.debug(kernalStartInfo());
- }
-
- /** {@inheritDoc} */
@Override public final void onKernalStop(boolean cancel) {
if (!starting.get())
// Ignoring attempt to stop manager that has never been started.
@@ -132,14 +124,6 @@ public class GridCacheSharedManagerAdapter<K, V> implements GridCacheSharedManag
}
/**
- * @param reconnect {@code True} if manager restarted after client reconnect.
- * @throws IgniteCheckedException If failed.
- */
- protected void onKernalStart0(boolean reconnect) throws IgniteCheckedException {
- // No-op.
- }
-
- /**
* @param cancel Cancel flag.
*/
protected void onKernalStop0(boolean cancel) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/PendingDiscoveryEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/PendingDiscoveryEvent.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/PendingDiscoveryEvent.java
new file mode 100644
index 0000000..b4274f7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/PendingDiscoveryEvent.java
@@ -0,0 +1,61 @@
+/*
+ * 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.events.DiscoveryEvent;
+import org.apache.ignite.internal.managers.discovery.DiscoCache;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ *
+ */
+public class PendingDiscoveryEvent {
+ /** */
+ private final DiscoveryEvent evt;
+
+ /** */
+ private final DiscoCache cache;
+
+ /**
+ * @param evt Event.
+ * @param cache Discovery data cache.
+ */
+ public PendingDiscoveryEvent(DiscoveryEvent evt, DiscoCache cache) {
+ this.evt = evt;
+ this.cache = cache;
+ }
+
+ /**
+ * @return Event.
+ */
+ public DiscoveryEvent event() {
+ return evt;
+ }
+
+ /**
+ * @return Discovery data cache.
+ */
+ public DiscoCache discoCache() {
+ return cache;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(PendingDiscoveryEvent.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StateChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StateChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StateChangeRequest.java
new file mode 100644
index 0000000..2d35e81
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StateChangeRequest.java
@@ -0,0 +1,77 @@
+/*
+ * 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 java.util.UUID;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ *
+ */
+public class StateChangeRequest {
+ /** */
+ private final ChangeGlobalStateMessage msg;
+
+ /** */
+ private final AffinityTopologyVersion topVer;
+
+ /**
+ * @param msg Message.
+ * @param topVer State change topology versoin.
+ */
+ public StateChangeRequest(ChangeGlobalStateMessage msg,
+ AffinityTopologyVersion topVer) {
+ this.msg = msg;
+ this.topVer = topVer;
+ }
+
+ /**
+ * @return State change exchange version.
+ */
+ public AffinityTopologyVersion topologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @return State change request ID.
+ */
+ public UUID requestId() {
+ return msg.requestId();
+ }
+
+ /**
+ * @return New state.
+ */
+ public boolean activate() {
+ return msg.activate();
+ }
+
+ /**
+ * @return Node initiated state change process.
+ */
+ public UUID initiatorNodeId() {
+ return msg.initiatorNodeId();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(StateChangeRequest.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index c2c71ea..0065e41 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -258,8 +258,8 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
}
/** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
- super.onKernalStart();
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
+ super.onKernalStart(active);
discoveryStarted = true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
index 1c97de2..d6b45b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
@@ -29,7 +29,6 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.processors.cache.GridCacheCompoundIdentityFuture;
-import org.apache.ignite.internal.processors.cache.GridCacheFuture;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.util.GridLeanMap;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 38d0108..960b91a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -50,7 +50,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.processors.cache.GridCacheEntryInfo;
import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
-import org.apache.ignite.internal.processors.cache.GridCacheMapEntryFactory;
import org.apache.ignite.internal.processors.cache.GridCachePreloader;
import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
index 123d26b..0ea48e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
@@ -27,7 +27,6 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
index 6392d0a..439bb9d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
@@ -19,13 +19,11 @@ package org.apache.ignite.internal.processors.cache.distributed.dht;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.NodeStoppingException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index c205c3b..57ce323 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -41,7 +41,6 @@ import org.apache.ignite.internal.managers.discovery.DiscoCache;
import org.apache.ignite.internal.processors.affinity.AffinityAssignment;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
-import org.apache.ignite.internal.processors.cache.ClusterState;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap;
@@ -424,11 +423,8 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
throws IgniteCheckedException {
DiscoveryEvent discoEvt = exchFut.discoveryEvent();
- ClusterState newState = exchFut.newClusterState();
-
- treatAllPartAsLoc = (newState != null && newState == ClusterState.ACTIVE)
- || (ctx.kernalContext().state().active()
- && discoEvt.type() == EventType.EVT_NODE_JOINED
+ treatAllPartAsLoc = exchFut.activateCluster()
+ || (discoEvt.type() == EventType.EVT_NODE_JOINED
&& discoEvt.eventNode().isLocal()
&& !ctx.kernalContext().clientNode()
);
@@ -611,7 +607,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
if (locPart != null) {
GridDhtPartitionState state = locPart.state();
- if (state == MOVING && ctx.kernalContext().state().active()) {
+ if (state == MOVING) {
locPart.rent(false);
updateSeq = updateLocal(p, locPart.state(), updateSeq);
@@ -1773,9 +1769,6 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
* @return Checks if any of the local partitions need to be evicted.
*/
private boolean checkEvictions(long updateSeq, List<List<ClusterNode>> aff) {
- if (!ctx.kernalContext().state().active())
- return false;
-
boolean changed = false;
UUID locId = ctx.localNodeId();
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTopologyFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTopologyFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTopologyFutureAdapter.java
index e70f383..d04870a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTopologyFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTopologyFutureAdapter.java
@@ -80,7 +80,7 @@ public abstract class GridDhtTopologyFutureAdapter extends GridFutureAdapter<Aff
if (err != null)
return err;
- if (!cctx.shared().kernalContext().state().active())
+ if (!cctx.shared().kernalContext().state().publicApiActiveState())
return new CacheInvalidStateException(
"Failed to perform cache operation (cluster is not activated): " + cctx.name());
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index cfecb1c..d66afca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -18,16 +18,13 @@
package org.apache.ignite.internal.processors.cache.distributed.dht;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
-import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.IgniteDiagnosticAware;
-import org.apache.ignite.internal.IgniteDiagnosticMessage;
import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
index 1bd8ec5..6fe96a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
@@ -46,7 +46,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheReturn;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
index 763b43b..fe216a0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
@@ -23,7 +23,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index 774f0ce..e7e95b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -161,6 +161,8 @@ public class GridDhtPartitionDemander {
lastExchangeFut = null;
lastTimeoutObj.set(null);
+
+ syncFut.onDone();
}
/**
[37/50] [abbrv] ignite git commit: IGNITE-5552: ServiceProcessor
recalculates all service assignments even if there is a pending topology
change. This closes #2182.
Posted by vo...@apache.org.
IGNITE-5552: ServiceProcessor recalculates all service assignments even if there is a pending topology change. This closes #2182.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1cf402f3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1cf402f3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1cf402f3
Branch: refs/heads/master
Commit: 1cf402f379516b01ef7317a50c820bf0dec25d81
Parents: c396b0b
Author: Andrey V. Mashenkov <an...@gmail.com>
Authored: Wed Jun 21 19:30:27 2017 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Thu Jul 6 14:26:31 2017 +0300
----------------------------------------------------------------------
.../processors/service/GridServiceProcessor.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1cf402f3/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 87db72a..d67f2d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -1530,6 +1530,9 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
* Topology listener.
*/
private class TopologyListener implements DiscoveryEventListener {
+ /** */
+ private volatile AffinityTopologyVersion currTopVer = null;
+
/** {@inheritDoc} */
@Override public void onEvent(DiscoveryEvent evt, final DiscoCache discoCache) {
GridSpinBusyLock busyLock = GridServiceProcessor.this.busyLock;
@@ -1562,6 +1565,8 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
else
topVer = new AffinityTopologyVersion((evt).topologyVersion(), 0);
+ currTopVer = topVer;
+
depExe.execute(new DepRunnable() {
@Override public void run0() {
// In case the cache instance isn't tracked by DiscoveryManager anymore.
@@ -1582,6 +1587,19 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
boolean firstTime = true;
while (it.hasNext()) {
+ // If topology changed again, let next event handle it.
+ AffinityTopologyVersion currTopVer0 = currTopVer;
+
+ if (currTopVer0 != topVer) {
+ if (log.isInfoEnabled())
+ log.info("Service processor detected a topology change during " +
+ "assignments calculation (will abort current iteration and " +
+ "re-calculate on the newer version): " +
+ "[topVer=" + topVer + ", newTopVer=" + currTopVer + ']');
+
+ return;
+ }
+
Cache.Entry<Object, Object> e = it.next();
if (firstTime) {
[43/50] [abbrv] ignite git commit: Merge remote-tracking branch
'community/ignite-2.1.2' into ignite-2.1.2
Posted by vo...@apache.org.
Merge remote-tracking branch 'community/ignite-2.1.2' into ignite-2.1.2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7f16e6fc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7f16e6fc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7f16e6fc
Branch: refs/heads/master
Commit: 7f16e6fce3e69c39cdede955efde50336ef2e7f4
Parents: 2f1270e 1130a87
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jul 6 14:53:42 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jul 6 14:53:42 2017 +0300
----------------------------------------------------------------------
.../processors/cache/ClusterCachesInfo.java | 4 +
.../processors/cache/GridCacheAdapter.java | 62 ++++---
.../processors/cache/GridCacheAttributes.java | 7 +
.../processors/cache/GridCacheEntryEx.java | 3 +-
.../processors/cache/GridCacheMapEntry.java | 2 +-
.../store/GridCacheStoreManagerAdapter.java | 1 +
.../service/GridServiceProcessor.java | 18 +++
.../processors/service/GridServiceProxy.java | 9 +-
.../cache/IgniteCacheAbstractTest.java | 17 ++
...titionEvictionDuringReadThroughSelfTest.java | 160 +++++++++++++++++++
...acheStoreSessionWriteBehindAbstractTest.java | 62 ++++---
...TxStoreSessionWriteBehindCoalescingTest.java | 88 ++++++++++
...ClientWriteBehindStoreNonCoalescingTest.java | 30 ++--
.../GridServiceProcessorProxySelfTest.java | 65 ++++++++
.../testsuites/IgniteCacheTestSuite4.java | 2 +
.../testsuites/IgniteCacheTestSuite5.java | 3 +
.../Cache/PersistentStoreTest.cs | 74 +++++++++
17 files changed, 550 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f16e6fc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7f16e6fc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
[44/50] [abbrv] ignite git commit: 2.1 Added remote node pending
messages in diagnostic info
Posted by vo...@apache.org.
2.1 Added remote node pending messages in diagnostic info
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9c6a65e2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9c6a65e2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9c6a65e2
Branch: refs/heads/master
Commit: 9c6a65e2723ea8bdb33dde89190a1b12799faf3a
Parents: 7f16e6f
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jul 6 15:10:24 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jul 6 15:10:24 2017 +0300
----------------------------------------------------------------------
.../internal/IgniteDiagnosticMessage.java | 8 +++++++
.../IgniteDiagnosticPrepareContext.java | 3 +++
.../processors/cache/GridCacheIoManager.java | 25 +++++++++++++-------
.../GridCachePartitionExchangeManager.java | 7 +++++-
4 files changed, 33 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c6a65e2/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
index 6e6bac0..bd4ec3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
@@ -460,6 +460,14 @@ public class IgniteDiagnosticMessage implements Message {
}
/**
+ * @param sb String builder.
+ * @param ctx Context.
+ */
+ static void dumpPendingCacheMessages(StringBuilder sb, GridKernalContext ctx) {
+ ctx.cache().context().io().dumpPendingMessages(sb);
+ }
+
+ /**
* @param ctx Context.
* @param nodeId Target node ID.
* @return Communication information future.
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c6a65e2/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
index b55199a..416ef29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
@@ -41,6 +41,7 @@ import static org.apache.ignite.internal.IgniteDiagnosticMessage.TxInfoClosure;
import static org.apache.ignite.internal.IgniteDiagnosticMessage.dumpCommunicationInfo;
import static org.apache.ignite.internal.IgniteDiagnosticMessage.dumpExchangeInfo;
import static org.apache.ignite.internal.IgniteDiagnosticMessage.dumpNodeBasicInfo;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.dumpPendingCacheMessages;
/**
* Groups diagnostic closures by node/closure type.
@@ -193,6 +194,8 @@ public class IgniteDiagnosticPrepareContext {
sb.append(U.nl());
+ dumpPendingCacheMessages(sb, ctx);
+
sb.append(commInfo.get(10_000));
moreInfo(sb, ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c6a65e2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 1d2be13..9f1873e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -91,6 +91,7 @@ import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE;
+import static org.apache.ignite.internal.util.IgniteUtils.nl;
/**
* Cache communication manager.
@@ -131,19 +132,25 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
private final List<GridCacheMessage> pendingMsgs = new ArrayList<>(MAX_STORED_PENDING_MESSAGES);
/**
- *
+ * @param sb String builder.
*/
- public void dumpPendingMessages() {
+ public void dumpPendingMessages(StringBuilder sb) {
synchronized (pendingMsgs) {
if (pendingMsgs.isEmpty())
return;
- diagnosticLog.info("Pending cache messages waiting for exchange [" +
- "readyVer=" + cctx.exchange().readyAffinityVersion() +
- ", discoVer=" + cctx.discovery().topologyVersion() + ']');
+ sb.append("Pending cache messages waiting for exchange [readyVer=").
+ append(cctx.exchange().readyAffinityVersion()).
+ append(", discoVer=").
+ append(cctx.discovery().topologyVersion()).append(']');
+
+ sb.append(nl());
- for (GridCacheMessage msg : pendingMsgs)
- diagnosticLog.info("Message [waitVer=" + msg.topologyVersion() + ", msg=" + msg + ']');
+ for (GridCacheMessage msg : pendingMsgs) {
+ sb.append("Message [waitVer=").append(msg.topologyVersion()).append(", msg=").append(msg).append(']');
+
+ sb.append(nl());
+ }
}
}
@@ -341,12 +348,12 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
append(", desc=").append(descriptorForMessage(cacheMsg)).
append(']');
- msg0.append(U.nl()).append("Registered listeners:");
+ msg0.append(nl()).append("Registered listeners:");
Map<Integer, IgniteBiInClosure[]> idxClsHandlers0 = msgHandlers.idxClsHandlers;
for (Map.Entry<Integer, IgniteBiInClosure[]> e : idxClsHandlers0.entrySet())
- msg0.append(U.nl()).append(e.getKey()).append("=").append(Arrays.toString(e.getValue()));
+ msg0.append(nl()).append(e.getKey()).append("=").append(Arrays.toString(e.getValue()));
if (cctx.kernalContext().isStopping()) {
if (log.isDebugEnabled())
http://git-wip-us.apache.org/repos/asf/ignite/blob/9c6a65e2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index b3cbd17..8506cde 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -1537,7 +1537,12 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
cctx.affinity().dumpDebugInfo();
- cctx.io().dumpPendingMessages();
+ StringBuilder pendingMsgs = new StringBuilder();
+
+ cctx.io().dumpPendingMessages(pendingMsgs);
+
+ if (pendingMsgs.length() > 0)
+ diagnosticLog.info(pendingMsgs.toString());
if (IgniteSystemProperties.getBoolean(IGNITE_IO_DUMP_ON_TIMEOUT, false))
cctx.gridIO().dumpStats();
[16/50] [abbrv] ignite git commit: IGNITE-5663: ODBC: Closing cursor
do not reset prepared statement anymore
Posted by vo...@apache.org.
IGNITE-5663: ODBC: Closing cursor do not reset prepared statement anymore
(cherry picked from commit 64c156e)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/301f310b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/301f310b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/301f310b
Branch: refs/heads/master
Commit: 301f310b6348b3f6fbe54b16d065569755e71bce
Parents: aa21a9b
Author: Igor Sapego <is...@gridgain.com>
Authored: Tue Jul 4 19:42:33 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Wed Jul 5 14:21:40 2017 +0300
----------------------------------------------------------------------
.../cpp/odbc-test/src/queries_test.cpp | 61 ++++++++++++++++++++
modules/platforms/cpp/odbc/src/odbc.cpp | 2 +-
modules/platforms/cpp/odbc/src/statement.cpp | 3 -
3 files changed, 62 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/301f310b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index 41bc1fc..263993c 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -1934,5 +1934,66 @@ BOOST_AUTO_TEST_CASE(TestParamsNum)
CheckParamsNum("INSERT INTO TestType(_key, strField) VALUES(?, ?)", 2);
}
+BOOST_AUTO_TEST_CASE(TestExecuteAfterCursorClose)
+{
+ TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), MakeDateGmt(1987, 6, 5),
+ MakeTimeGmt(12, 48, 12), MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+
+ cache1.Put(1, in);
+
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache");
+
+ int64_t key = 0;
+ char strField[1024] = { 0 };
+ SQLLEN strFieldLen = 0;
+
+ // Binding columns.
+ SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &key, 0, 0);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Binding columns.
+ ret = SQLBindCol(stmt, 2, SQL_C_CHAR, &strField, sizeof(strField), &strFieldLen);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Just selecting everything to make sure everything is OK
+ SQLCHAR selectReq[] = "SELECT _key, strField FROM TestType";
+
+ ret = SQLPrepare(stmt, selectReq, sizeof(selectReq));
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLExecute(stmt);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLFreeStmt(stmt, SQL_CLOSE);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLExecute(stmt);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLFetch(stmt);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ BOOST_CHECK_EQUAL(key, 1);
+
+ BOOST_CHECK_EQUAL(std::string(strField, strFieldLen), "5");
+
+ ret = SQLFetch(stmt);
+
+ BOOST_CHECK_EQUAL(ret, SQL_NO_DATA);
+}
BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/301f310b/modules/platforms/cpp/odbc/src/odbc.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/odbc.cpp b/modules/platforms/cpp/odbc/src/odbc.cpp
index a738598..b450903 100644
--- a/modules/platforms/cpp/odbc/src/odbc.cpp
+++ b/modules/platforms/cpp/odbc/src/odbc.cpp
@@ -212,7 +212,7 @@ namespace ignite
{
using odbc::Statement;
- LOG_MSG("SQLFreeStmt called");
+ LOG_MSG("SQLFreeStmt called [option=" << option << ']');
Statement *statement = reinterpret_cast<Statement*>(stmt);
http://git-wip-us.apache.org/repos/asf/ignite/blob/301f310b/modules/platforms/cpp/odbc/src/statement.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/statement.cpp b/modules/platforms/cpp/odbc/src/statement.cpp
index 697f5b4..adc7d6b 100644
--- a/modules/platforms/cpp/odbc/src/statement.cpp
+++ b/modules/platforms/cpp/odbc/src/statement.cpp
@@ -745,9 +745,6 @@ namespace ignite
SqlResult::Type result = currentQuery->Close();
- if (result == SqlResult::AI_SUCCESS)
- currentQuery.reset();
-
return result;
}
[47/50] [abbrv] ignite git commit: IGNITE-5710 Change H2 version in
depend to Ignite version.
Posted by vo...@apache.org.
IGNITE-5710 Change H2 version in depend to Ignite version.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/516e73a4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/516e73a4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/516e73a4
Branch: refs/heads/master
Commit: 516e73a4baf21c86f46bee03a00e336db3ffe567
Parents: 64d6c98
Author: vsisko <vs...@gridgain.com>
Authored: Fri Jul 7 15:19:08 2017 +0700
Committer: vsisko <vs...@gridgain.com>
Committed: Fri Jul 7 15:19:08 2017 +0700
----------------------------------------------------------------------
.../frontend/app/data/pom-dependencies.json | 5 ++++-
.../configuration/generator/Maven.service.js | 21 +++++++++++++-------
2 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/516e73a4/modules/web-console/frontend/app/data/pom-dependencies.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/data/pom-dependencies.json b/modules/web-console/frontend/app/data/pom-dependencies.json
index 3e0543b..945e3f5 100644
--- a/modules/web-console/frontend/app/data/pom-dependencies.json
+++ b/modules/web-console/frontend/app/data/pom-dependencies.json
@@ -14,7 +14,10 @@
"Generic": {"groupId": "com.mchange", "artifactId": "c3p0", "version": "0.9.5.2"},
"MySQL": {"groupId": "mysql", "artifactId": "mysql-connector-java", "version": "5.1.40"},
"PostgreSQL": {"groupId": "org.postgresql", "artifactId": "postgresql", "version": "9.4.1212.jre7"},
- "H2": {"groupId": "com.h2database", "artifactId": "h2", "version": "1.4.191"},
+ "H2": {"groupId": "com.h2database", "artifactId": "h2", "version": [
+ {"range": ["1.0.0", "2.0.0"], "version": "1.4.191"},
+ {"range": "2.0.0", "version": "1.4.195"}
+ ]},
"Oracle": {"groupId": "com.oracle.jdbc", "artifactId": "ojdbc7", "version": "12.1.0.2", "jar": "ojdbc7.jar"},
"DB2": {"groupId": "ibm", "artifactId": "jdbc", "version": "4.21.29", "jar": "db2jcc4.jar"},
"SQLServer": {"groupId": "microsoft", "artifactId": "jdbc", "version": "4.2", "jar": "sqljdbc41.jar"}
http://git-wip-us.apache.org/repos/asf/ignite/blob/516e73a4/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js b/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
index da098fc..700da4a 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/Maven.service.js
@@ -16,6 +16,9 @@
*/
import StringBuilder from './StringBuilder';
+import VersionService from 'app/modules/configuration/Version.service';
+
+const versionService = new VersionService();
// Java built-in class names.
import POM_DEPENDENCIES from 'app/data/pom-dependencies.json';
@@ -39,13 +42,17 @@ export default class IgniteMavenGenerator {
deps.add({groupId, artifactId, version, jar});
}
- pickDependency(deps, key, dfltVer) {
+ pickDependency(deps, key, dfltVer, igniteVer) {
+ const extractVersion = (version) => {
+ return _.isArray(version) ? _.find(version, (v) => versionService.since(igniteVer, v.range)).version : version;
+ };
+
if (!_.has(POM_DEPENDENCIES, key))
return;
const {groupId, artifactId, version, jar} = POM_DEPENDENCIES[key];
- this.addDependency(deps, groupId || 'org.apache.ignite', artifactId, version || dfltVer, jar);
+ this.addDependency(deps, groupId || 'org.apache.ignite', artifactId, extractVersion(version) || dfltVer, jar);
}
addResource(sb, dir, exclude) {
@@ -139,9 +146,9 @@ export default class IgniteMavenGenerator {
* @param deps Already added dependencies.
* @param storeFactory Store factory to add dependency.
*/
- storeFactoryDependency(deps, storeFactory) {
+ storeFactoryDependency(deps, storeFactory, igniteVer) {
if (storeFactory.dialect && (!storeFactory.connectVia || storeFactory.connectVia === 'DataSource'))
- this.pickDependency(deps, storeFactory.dialect);
+ this.pickDependency(deps, storeFactory.dialect, null, igniteVer);
}
collectDependencies(cluster, targetVer) {
@@ -167,7 +174,7 @@ export default class IgniteMavenGenerator {
_.forEach(caches, (cache) => {
if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind)
- this.storeFactoryDependency(storeDeps, cache.cacheStoreFactory[cache.cacheStoreFactory.kind]);
+ this.storeFactoryDependency(storeDeps, cache.cacheStoreFactory[cache.cacheStoreFactory.kind], igniteVer);
if (_.get(cache, 'nodeFilter.kind') === 'Exclude')
this.addDependency(deps, 'org.apache.ignite', 'ignite-extdata-p2p', igniteVer);
@@ -177,14 +184,14 @@ export default class IgniteMavenGenerator {
const store = cluster.discovery.Jdbc;
if (store.dataSourceBean && store.dialect)
- this.storeFactoryDependency(storeDeps, cluster.discovery.Jdbc);
+ this.storeFactoryDependency(storeDeps, cluster.discovery.Jdbc, igniteVer);
}
_.forEach(cluster.checkpointSpi, (spi) => {
if (spi.kind === 'S3')
this.pickDependency(deps, spi.kind, igniteVer);
else if (spi.kind === 'JDBC')
- this.storeFactoryDependency(storeDeps, spi.JDBC);
+ this.storeFactoryDependency(storeDeps, spi.JDBC, igniteVer);
});
if (_.get(cluster, 'hadoopConfiguration.mapReducePlanner.kind') === 'Weighted' ||
[06/50] [abbrv] ignite git commit: Reworked cluster
activation/deactivation.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
index d0b2d56..92d1f21 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.typedef.internal.U;
import static java.lang.Thread.sleep;
import static org.apache.ignite.testframework.GridTestUtils.runAsync;
@@ -54,7 +55,7 @@ public class IgniteChangeGlobalStateFailOverTest extends IgniteChangeGlobalState
}
/**
- *
+ * @throws Exception If failed.
*/
public void testActivateDeActivateOnFixTopology() throws Exception {
final Ignite igB1 = backUp(0);
@@ -140,7 +141,7 @@ public class IgniteChangeGlobalStateFailOverTest extends IgniteChangeGlobalState
}
/**
- *
+ * @throws Exception If failed.
*/
public void testActivateDeActivateOnJoiningNode() throws Exception {
fail("https://issues.apache.org/jira/browse/IGNITE-5520");
@@ -168,9 +169,9 @@ public class IgniteChangeGlobalStateFailOverTest extends IgniteChangeGlobalState
final IgniteInternalFuture<Void> af = runAsync(new Callable<Void>() {
@Override public Void call() throws Exception {
while (!stop.get()) {
- Ignite ig = randomBackUp(false);
-
if (canAct.get()) {
+ Ignite ig = randomBackUp(false);
+
long start = System.currentTimeMillis();
ig.active(true);
@@ -184,6 +185,8 @@ public class IgniteChangeGlobalStateFailOverTest extends IgniteChangeGlobalState
canAct.set(false);
}
+ else
+ U.sleep(100);
}
return null;
@@ -193,9 +196,9 @@ public class IgniteChangeGlobalStateFailOverTest extends IgniteChangeGlobalState
final IgniteInternalFuture<Void> df = runAsync(new Callable<Void>() {
@Override public Void call() throws Exception {
while (!stop.get()) {
- Ignite ig = randomBackUp(false);
-
if (!canAct.get()) {
+ Ignite ig = randomBackUp(false);
+
long start = System.currentTimeMillis();
ig.active(false);
@@ -209,7 +212,8 @@ public class IgniteChangeGlobalStateFailOverTest extends IgniteChangeGlobalState
canAct.set(true);
}
-
+ else
+ U.sleep(100);
}
return null;
}
@@ -243,16 +247,16 @@ public class IgniteChangeGlobalStateFailOverTest extends IgniteChangeGlobalState
jf2.get();
}
finally {
- log.info("total started nodes: " + (seqIdx.get() - backUpNodes()));
+ log.info("Total started nodes: " + (seqIdx.get() - backUpNodes()));
- log.info("total activate/deactivate:" + cntA.get() + "/" + cntD.get() + " aTime/dTime: "
+ log.info("Total activate/deactivate:" + cntA.get() + "/" + cntD.get() + " aTime/dTime: "
+ (timeA.get() / cntA.get() + "/" + (timeD.get() / cntD.get()))
);
}
}
/**
- *
+ * @throws Exception If failed.
*/
public void testActivateDeActivateOnFixTopologyWithPutValues() throws Exception {
final Ignite igB1 = backUp(0);
@@ -348,7 +352,7 @@ public class IgniteChangeGlobalStateFailOverTest extends IgniteChangeGlobalState
df.get();
}
finally {
- log.info("total activate/deactivate:" + cntA.get() + "/" + cntD.get() + " aTime/dTime:"
+ log.info("Total activate/deactivate:" + cntA.get() + "/" + cntD.get() + " aTime/dTime:"
+ (timeA.get() / cntA.get() + "/" + (timeD.get() / cntD.get()) + " nodes: " + backUpNodes()));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
index 9151c24..80bf1fb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
@@ -128,74 +128,65 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
stopAllPrimary();
- final AtomicInteger exCnt = new AtomicInteger();
-
final CyclicBarrier barrier = new CyclicBarrier(backUpNodes() + backUpClientNodes());
IgniteInternalFuture<Void> f1 = runAsync(new Callable<Void>() {
@Override public Void call() throws Exception {
- try {
- barrier.await();
- ig1B.active(true);
- }catch (Exception e){
- exCnt.incrementAndGet();
- }
+ barrier.await();
+
+ ig1B.active(true);
+
return null;
}
});
- IgniteInternalFuture<Void> f2 = runAsync(new Runnable() {
- @Override public void run() {
- try {
- barrier.await();
- ig2B.active(true);
- }catch (Exception e){
- exCnt.incrementAndGet();
- }
+ IgniteInternalFuture<?> f2 = runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ ig2B.active(true);
+
+ return null;
}
});
- IgniteInternalFuture<Void> f3 = runAsync(new Runnable() {
- @Override public void run() {
- try {
- barrier.await();
- ig3B.active(true);
- }catch (Exception e){
- exCnt.incrementAndGet();
- }
+ IgniteInternalFuture<?> f3 = runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ ig3B.active(true);
+
+ return null;
}
});
- IgniteInternalFuture<Void> f4 = runAsync(new Runnable() {
- @Override public void run() {
- try {
- barrier.await();
- ig1C.active(true);
- }catch (Exception e){
- exCnt.incrementAndGet();
- }
+ IgniteInternalFuture<?> f4 = runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ ig1C.active(true);
+
+ return null;
}
});
- IgniteInternalFuture<Void> f5 = runAsync(new Runnable() {
- @Override public void run() {
- try {
- barrier.await();
- ig2C.active(true);
- }catch (Exception e){
- exCnt.incrementAndGet();
- }
+ IgniteInternalFuture<?> f5 = runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ ig2C.active(true);
+
+ return null;
}
});
- IgniteInternalFuture<Void> f6 = runAsync(new Runnable() {
- @Override public void run() {
- try {
- barrier.await();
- ig3C.active(true);
- }catch (Exception e){
- exCnt.incrementAndGet();
- }
+ IgniteInternalFuture<?> f6 = runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ ig3C.active(true);
+
+ return null;
}
});
@@ -207,8 +198,6 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
f5.get();
f6.get();
- assertTrue(exCnt.get() > 0);
-
assertTrue(ig1B.active());
assertTrue(ig2B.active());
assertTrue(ig3B.active());
@@ -232,40 +221,35 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
stopAllPrimary();
- final AtomicInteger exCnt = new AtomicInteger();
-
final CyclicBarrier barrier = new CyclicBarrier(3);
- IgniteInternalFuture<Void> act1 = runAsync(new Runnable() {
- @Override public void run() {
- try {
- barrier.await();
- ig1B.active(true);
- }catch (Exception e){
- exCnt.incrementAndGet();
- }
+ IgniteInternalFuture<?> act1 = runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ ig1B.active(true);
+
+ return null;
}
});
- IgniteInternalFuture<Void> act2 = runAsync(new Runnable() {
- @Override public void run() {
- try {
- barrier.await();
- ig2B.active(true);
- }catch (Exception e){
- exCnt.incrementAndGet();
- }
+ IgniteInternalFuture<?> act2 = runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ ig2B.active(true);
+
+ return null;
}
});
- IgniteInternalFuture<Void> act3 = runAsync(new Runnable() {
- @Override public void run() {
- try {
- barrier.await();
- ig3B.active(true);
- }catch (Exception e){
- exCnt.incrementAndGet();
- }
+ IgniteInternalFuture<?> act3 = runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ barrier.await();
+
+ ig3B.active(true);
+
+ return null;
}
});
@@ -273,15 +257,13 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
act2.get();
act3.get();
- assertEquals(2, exCnt.get());
-
assertTrue(ig1B.active());
assertTrue(ig2B.active());
assertTrue(ig3B.active());
}
/**
- *
+ * @throws Exception If failed.
*/
public void testActiveAndInActiveAtTheSameTimeCluster() throws Exception {
Ignite ig1P = primary(0);
@@ -318,7 +300,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
}
/**
- *
+ * @throws Exception If failed.
*/
public void testActivateOnAlreadyActivatedCluster() throws Exception {
Ignite ig1P = primary(0);
@@ -375,7 +357,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
}
/**
- *
+ * @throws Exception If failed.
*/
public void testTryUseCacheInActiveCluster() throws Exception {
Ignite ig1B = backUp(0);
@@ -410,13 +392,14 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
IgniteCache cache = ig.cache("cache");
+
return null;
}
}, IgniteException.class, "Can not perform the operation because the cluster is inactive.");
}
/**
- *
+ * @throws Exception If failed.
*/
public void testTryUseServiceInActiveCluster() throws Exception {
Ignite ig1B = backUp(0);
@@ -445,7 +428,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
}
/**
- *
+ * @param ig Node to check.
*/
private void checkExceptionTryUseService(final Ignite ig) {
assertThrows(log, new Callable<Void>() {
@@ -458,7 +441,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
}
/**
- *
+ * @throws Exception If failed.
*/
public void testTryUseDataStructureInActiveCluster() throws Exception {
Ignite ig1B = backUp(0);
@@ -487,19 +470,20 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
}
/**
- *
+ * @param ig Node.
*/
private void checkExceptionTryUseDataStructure(final Ignite ig){
assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
IgniteAtomicSequence seq = ig.atomicSequence("seq", 0, true);
+
return null;
}
}, IgniteException.class, "Can not perform the operation because the cluster is inactive.");
}
/**
- *
+ * @throws Exception If failed.
*/
public void testFailGetLock() throws Exception {
Ignite ig1P = primary(0);
@@ -556,7 +540,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
}
/**
- *
+ * @throws Exception If failed.
*/
public void testActivateAfterFailGetLock() throws Exception {
Ignite ig1P = primary(0);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
index c3bdcda..2678e51 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
@@ -60,7 +60,7 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
/**
* @throws Exception if fail.
*/
- public void testNotStartDynamicCachesOnClientAfterActivation() throws Exception {
+ public void testStartDynamicCachesAfterActivation() throws Exception {
final String cacheName0 = "cache0";
final String cacheName = "cache";
@@ -114,13 +114,10 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
Map<String, GridCacheAdapter<?, ?>> caches = U.field(ig3.context().cache(), "caches");
// Only system cache and cache0
- assertTrue(caches.size() == 2);
+ assertEquals("Unexpected caches: " + caches.keySet(), 3, caches.size());
assertTrue(caches.containsKey(CU.UTILITY_CACHE_NAME));
assertTrue(caches.containsKey(cacheName0));
-
- assertNull(caches.get(cacheName));
-
- assertNotNull(caches.get(cacheName0));
+ assertTrue(caches.containsKey(cacheName));
assertNotNull(ig3.cache(cacheName));
}
@@ -156,12 +153,6 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
assertTrue(!ig2.active());
assertTrue(!ig3.active());
- for (IgniteEx ig : Arrays.asList(ig1, ig2, ig3)) {
- Map<String, DynamicCacheDescriptor> desc = U.field(U.field(ig.context().cache(), "cachesInfo"), "registeredCaches");
-
- assertEquals(0, desc.size());
- }
-
ig3.active(true);
assertTrue(ig1.active());
@@ -286,7 +277,7 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
private final String name;
/**
- * @param name
+ * @param name Node name.
*/
private NodeFilterIgnoreByName(String name) {
this.name = name;
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/JoinActiveNodeToActiveCluster.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/JoinActiveNodeToActiveCluster.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/JoinActiveNodeToActiveCluster.java
index 9c5f017..8e90e78 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/JoinActiveNodeToActiveCluster.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/JoinActiveNodeToActiveCluster.java
@@ -29,9 +29,7 @@ import org.junit.Assert;
*
*/
public class JoinActiveNodeToActiveCluster extends AbstractNodeJoinTemplate {
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public JoinNodeTestPlanBuilder withOutConfigurationTemplate() throws Exception {
JoinNodeTestPlanBuilder b = builder();
@@ -56,9 +54,7 @@ public class JoinActiveNodeToActiveCluster extends AbstractNodeJoinTemplate {
return b;
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public JoinNodeTestPlanBuilder staticCacheConfigurationOnJoinTemplate() throws Exception {
JoinNodeTestPlanBuilder b = builder();
@@ -85,9 +81,7 @@ public class JoinActiveNodeToActiveCluster extends AbstractNodeJoinTemplate {
return b;
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public JoinNodeTestPlanBuilder staticCacheConfigurationInClusterTemplate() throws Exception {
JoinNodeTestPlanBuilder b = builder();
@@ -115,9 +109,7 @@ public class JoinActiveNodeToActiveCluster extends AbstractNodeJoinTemplate {
return b;
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public JoinNodeTestPlanBuilder staticCacheConfigurationSameOnBothTemplate() throws Exception {
JoinNodeTestPlanBuilder b = builder();
@@ -146,9 +138,7 @@ public class JoinActiveNodeToActiveCluster extends AbstractNodeJoinTemplate {
return b;
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public JoinNodeTestPlanBuilder staticCacheConfigurationDifferentOnBothTemplate() throws Exception {
JoinNodeTestPlanBuilder b = builder();
@@ -207,62 +197,46 @@ public class JoinActiveNodeToActiveCluster extends AbstractNodeJoinTemplate {
withOutConfigurationTemplate().execute();
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public void testStaticCacheConfigurationOnJoin() throws Exception {
staticCacheConfigurationOnJoinTemplate().execute();
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public void testStaticCacheConfigurationInCluster() throws Exception {
staticCacheConfigurationInClusterTemplate().execute();
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public void testStaticCacheConfigurationSameOnBoth() throws Exception {
staticCacheConfigurationSameOnBothTemplate().execute();
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public void testStaticCacheConfigurationDifferentOnBoth() throws Exception {
staticCacheConfigurationDifferentOnBothTemplate().execute();
}
// Client node join.
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public void testJoinClientWithOutConfiguration() throws Exception {
joinClientWithOutConfigurationTemplate().execute();
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public void testJoinClientStaticCacheConfigurationOnJoin() throws Exception {
joinClientStaticCacheConfigurationOnJoinTemplate().execute();
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public void testJoinClientStaticCacheConfigurationInCluster() throws Exception {
fail("https://issues.apache.org/jira/browse/IGNITE-5518");
joinClientStaticCacheConfigurationInClusterTemplate().execute();
}
- /**
- *
- */
+ /** {@inheritDoc} */
@Override public void testJoinClientStaticCacheConfigurationSameOnBoth() throws Exception {
joinClientStaticCacheConfigurationSameOnBothTemplate().execute();
}
@@ -276,14 +250,17 @@ public class JoinActiveNodeToActiveCluster extends AbstractNodeJoinTemplate {
joinClientStaticCacheConfigurationDifferentOnBothTemplate().execute();
}
+ /** {@inheritDoc} */
@Override public JoinNodeTestPlanBuilder joinClientWithOutConfigurationTemplate() throws Exception {
return withOutConfigurationTemplate().nodeConfiguration(setClient);
}
+ /** {@inheritDoc} */
@Override public JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationOnJoinTemplate() throws Exception {
return staticCacheConfigurationOnJoinTemplate().nodeConfiguration(setClient);
}
+ /** {@inheritDoc} */
@Override public JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationInClusterTemplate() throws Exception {
return staticCacheConfigurationInClusterTemplate()
.nodeConfiguration(setClient)
@@ -360,8 +337,10 @@ public class JoinActiveNodeToActiveCluster extends AbstractNodeJoinTemplate {
});
}
- @Override
- public JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationDifferentOnBothTemplate() throws Exception {
+ /** {@inheritDoc} */
+ @Override public JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationDifferentOnBothTemplate()
+ throws Exception
+ {
return staticCacheConfigurationDifferentOnBothTemplate()
.nodeConfiguration(setClient)
.afterActivate(new Runnable() {
@@ -436,6 +415,7 @@ public class JoinActiveNodeToActiveCluster extends AbstractNodeJoinTemplate {
});
}
+ /** {@inheritDoc} */
@Override public JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationSameOnBothTemplate() throws Exception {
return staticCacheConfigurationSameOnBothTemplate().nodeConfiguration(setClient);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/persistence/JoinActiveNodeToActiveClusterWithPersistence.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/persistence/JoinActiveNodeToActiveClusterWithPersistence.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/persistence/JoinActiveNodeToActiveClusterWithPersistence.java
index 60388fa..1ccfb7d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/persistence/JoinActiveNodeToActiveClusterWithPersistence.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/persistence/JoinActiveNodeToActiveClusterWithPersistence.java
@@ -30,6 +30,10 @@ public class JoinActiveNodeToActiveClusterWithPersistence extends JoinActiveNode
return persistentCfg(super.cfg(name));
}
+ /**
+ * @param b Builder.
+ * @return Builder.
+ */
private AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder persistent(AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder b) {
b.afterClusterStarted(
b.checkCacheEmpty()
@@ -44,6 +48,7 @@ public class JoinActiveNodeToActiveClusterWithPersistence extends JoinActiveNode
return b;
}
+ /** {@inheritDoc} */
@Override public AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder withOutConfigurationTemplate() throws Exception {
AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder b = persistent(super.withOutConfigurationTemplate());
@@ -52,6 +57,7 @@ public class JoinActiveNodeToActiveClusterWithPersistence extends JoinActiveNode
return b;
}
+ /** {@inheritDoc} */
@Override public AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder joinClientWithOutConfigurationTemplate() throws Exception {
AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder b = persistent(super.joinClientWithOutConfigurationTemplate());
@@ -60,46 +66,57 @@ public class JoinActiveNodeToActiveClusterWithPersistence extends JoinActiveNode
return b;
}
+ /** {@inheritDoc} */
@Override public void testJoinWithOutConfiguration() throws Exception {
withOutConfigurationTemplate().execute();
}
+ /** {@inheritDoc} */
@Override public void testJoinClientWithOutConfiguration() throws Exception {
joinClientWithOutConfigurationTemplate().execute();
}
+ /** {@inheritDoc} */
@Override public void testJoinClientStaticCacheConfigurationDifferentOnBoth() throws Exception {
staticCacheConfigurationDifferentOnBothTemplate().execute();
}
+ /** {@inheritDoc} */
@Override public void testJoinClientStaticCacheConfigurationInCluster() throws Exception {
staticCacheConfigurationInClusterTemplate().execute();
}
+ /** {@inheritDoc} */
@Override public AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder staticCacheConfigurationOnJoinTemplate() throws Exception {
return persistent(super.staticCacheConfigurationOnJoinTemplate());
}
+ /** {@inheritDoc} */
@Override public AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder staticCacheConfigurationInClusterTemplate() throws Exception {
return persistent(super.staticCacheConfigurationInClusterTemplate());
}
+ /** {@inheritDoc} */
@Override public AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder staticCacheConfigurationSameOnBothTemplate() throws Exception {
return persistent(super.staticCacheConfigurationSameOnBothTemplate());
}
+ /** {@inheritDoc} */
@Override public AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder staticCacheConfigurationDifferentOnBothTemplate() throws Exception {
return persistent(super.staticCacheConfigurationDifferentOnBothTemplate());
}
+ /** {@inheritDoc} */
@Override public AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationOnJoinTemplate() throws Exception {
return persistent(super.joinClientStaticCacheConfigurationOnJoinTemplate());
}
+ /** {@inheritDoc} */
@Override public AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationInClusterTemplate() throws Exception {
return persistent(super.joinClientStaticCacheConfigurationInClusterTemplate());
}
+ /** {@inheritDoc} */
@Override public AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationDifferentOnBothTemplate() throws Exception {
return persistent(super.joinClientStaticCacheConfigurationDifferentOnBothTemplate());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteStandByClientReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteStandByClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteStandByClientReconnectTest.java
index 02f7d00..548dba2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteStandByClientReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteStandByClientReconnectTest.java
@@ -24,7 +24,9 @@ import org.apache.ignite.internal.IgniteEx;
*
*/
public class IgniteStandByClientReconnectTest extends IgniteAbstractStandByClientReconnectTest {
-
+ /**
+ * @throws Exception If failed.
+ */
public void testActiveClientReconnectToActiveCluster() throws Exception {
CountDownLatch activateLatch = new CountDownLatch(1);
@@ -103,6 +105,9 @@ public class IgniteStandByClientReconnectTest extends IgniteAbstractStandByClien
checkAllCaches();
}
+ /**
+ * @throws Exception If failed.
+ */
public void testActiveClientReconnectToInActiveCluster() throws Exception {
CountDownLatch activateLatch = new CountDownLatch(1);
@@ -180,6 +185,9 @@ public class IgniteStandByClientReconnectTest extends IgniteAbstractStandByClien
checkAllCaches();
}
+ /**
+ * @throws Exception If failed.
+ */
public void testInActiveClientReconnectToActiveCluster() throws Exception {
CountDownLatch activateLatch = new CountDownLatch(1);
@@ -234,6 +242,9 @@ public class IgniteStandByClientReconnectTest extends IgniteAbstractStandByClien
checkAllCaches();
}
+ /**
+ * @throws Exception If failed.
+ */
public void testInActiveClientReconnectToInActiveCluster() throws Exception {
startNodes(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteStandByClientReconnectToNewClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteStandByClientReconnectToNewClusterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteStandByClientReconnectToNewClusterTest.java
index 2bcc177..2da32e3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteStandByClientReconnectToNewClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/reconnect/IgniteStandByClientReconnectToNewClusterTest.java
@@ -27,7 +27,9 @@ import org.apache.ignite.internal.IgniteEx;
*
*/
public class IgniteStandByClientReconnectToNewClusterTest extends IgniteAbstractStandByClientReconnectTest {
-
+ /**
+ * @throws Exception If failed.
+ */
public void testActiveClientReconnectToActiveCluster() throws Exception {
CountDownLatch activateLatch = new CountDownLatch(1);
@@ -104,6 +106,9 @@ public class IgniteStandByClientReconnectToNewClusterTest extends IgniteAbstract
checkAllCaches();
}
+ /**
+ * @throws Exception If failed.
+ */
public void testActiveClientReconnectToInActiveCluster() throws Exception {
startNodes(null);
@@ -181,6 +186,9 @@ public class IgniteStandByClientReconnectToNewClusterTest extends IgniteAbstract
checkAllCaches();
}
+ /**
+ * @throws Exception If failed.
+ */
public void testInActiveClientReconnectToActiveCluster() throws Exception {
CountDownLatch activateLatch = new CountDownLatch(1);
@@ -236,6 +244,9 @@ public class IgniteStandByClientReconnectToNewClusterTest extends IgniteAbstract
checkDescriptors(client, exp2);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testInActiveClientReconnectToInActiveCluster() throws Exception {
startNodes(null);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java
index 90af25e..bc07028 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java
@@ -479,7 +479,7 @@ public class GridTcpCommunicationSpiMultithreadedSelfTest extends GridSpiAbstrac
timeoutProcessor.start();
- timeoutProcessor.onKernalStart();
+ timeoutProcessor.onKernalStart(true);
for (int i = 0; i < getSpiCount(); i++) {
CommunicationSpi<Message> spi = newCommunicationSpi();
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index a9a870e..d6d241c 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -2099,13 +2099,13 @@ public abstract class GridAbstractTest extends TestCase {
for (Ignite g : G.allGrids()) {
final GridKernalContext ctx = ((IgniteKernal)g).context();
- if (ctx.isStopping())
+ if (ctx.isStopping() || !g.active())
continue;
AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
AffinityTopologyVersion exchVer = ctx.cache().context().exchange().readyAffinityVersion();
- if (! topVer.equals(exchVer)) {
+ if (!topVer.equals(exchVer)) {
info("Topology version mismatch [node=" + g.name() +
", exchVer=" + exchVer +
", topVer=" + topVer + ']');
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 3f87c76..dc7e89d 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -596,6 +596,9 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
else
startTime = g0.context().discovery().gridStartTime();
+ if (g.cluster().localNode().isDaemon())
+ continue;
+
IgniteInternalFuture<?> exchFut =
g0.context().cache().context().exchange().affinityReadyFuture(waitTopVer);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStandByClusterSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStandByClusterSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStandByClusterSuite.java
index 6fa158d..f016e39 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStandByClusterSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStandByClusterSuite.java
@@ -18,6 +18,7 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.IgniteClusterActivateDeactivateTest;
import org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteChangeGlobalStateCacheTest;
import org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteChangeGlobalStateDataStreamerTest;
import org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteChangeGlobalStateDataStructureTest;
@@ -41,11 +42,13 @@ import org.apache.ignite.internal.processors.cache.persistence.standbycluster.re
*/
public class IgniteStandByClusterSuite extends TestSuite {
/**
- *
+ * @return Test suite.
*/
public static TestSuite suite() {
TestSuite suite = new TestSuite("Ignite Activate/DeActivate Cluster Test Suit");
+ suite.addTestSuite(IgniteClusterActivateDeactivateTest.class);
+
suite.addTestSuite(IgniteStandByClusterTest.class);
suite.addTestSuite(IgniteStandByClientReconnectTest.class);
suite.addTestSuite(IgniteStandByClientReconnectToNewClusterTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/1337901f/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
index 329d67f..231fc22 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
@@ -95,8 +95,8 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
}
/** {@inheritDoc} */
- @Override public void onKernalStart() throws IgniteCheckedException {
- super.onKernalStart();
+ @Override public void onKernalStart(boolean active) throws IgniteCheckedException {
+ super.onKernalStart(active);
if (hctx == null)
return;
[32/50] [abbrv] ignite git commit: IGNITE-5702: Set
CacheWriteSynchronizationMode.FULL_SYNC for predefined CREATE TABLE
templates. This closes #2246.
Posted by vo...@apache.org.
IGNITE-5702: Set CacheWriteSynchronizationMode.FULL_SYNC for predefined CREATE TABLE templates. This closes #2246.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6e371ec6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6e371ec6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6e371ec6
Branch: refs/heads/master
Commit: 6e371ec6a7621e8c764762251f343b1b113c0754
Parents: c84328d
Author: Alexander Paschenko <al...@gmail.com>
Authored: Thu Jul 6 12:40:16 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jul 6 12:40:16 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/query/GridQueryProcessor.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6e371ec6/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 ce6c9fe..d44be2c 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
@@ -43,6 +43,7 @@ import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheKeyConfiguration;
import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.cache.query.FieldsQueryCursor;
@@ -58,7 +59,6 @@ import org.apache.ignite.internal.NodeStoppingException;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
@@ -1320,6 +1320,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
ccfg = new CacheConfiguration<>().setCacheMode(CacheMode.REPLICATED);
else
throw new SchemaOperationException(SchemaOperationException.CODE_CACHE_NOT_FOUND, templateName);
+
+ ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
}
if (!F.isEmpty(ccfg.getQueryEntities()))
[40/50] [abbrv] ignite git commit: IGNITE-5424: GridServiceProxy does
not unwraps exception message from InvocationTargetException. This closes
#2168.
Posted by vo...@apache.org.
IGNITE-5424: GridServiceProxy does not unwraps exception message from InvocationTargetException. This closes #2168.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1130a87a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1130a87a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1130a87a
Branch: refs/heads/master
Commit: 1130a87a3157ce3a786994835fb927668c10d558
Parents: 4a169dc
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Jun 30 14:38:54 2017 +0300
Committer: Andrey V. Mashenkov <an...@gmail.com>
Committed: Thu Jul 6 14:37:59 2017 +0300
----------------------------------------------------------------------
.../processors/service/GridServiceProxy.java | 9 ++-
.../GridServiceProcessorProxySelfTest.java | 65 ++++++++++++++++++++
2 files changed, 73 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1130a87a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
index d16a4c4..3a40b90 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
@@ -23,6 +23,7 @@ import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
@@ -413,7 +414,13 @@ public class GridServiceProxy<T> implements Serializable {
if (mtd == null)
throw new GridServiceMethodNotFoundException(svcName, mtdName, argTypes);
- return mtd.invoke(svcCtx.service(), args);
+ try {
+ return mtd.invoke(svcCtx.service(), args);
+ }
+ catch (InvocationTargetException e) {
+ // Get error message.
+ throw new IgniteCheckedException(e.getCause().getMessage(), e);
+ }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/1130a87a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorProxySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorProxySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorProxySelfTest.java
index 9fd2d2c..d1c5294 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorProxySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorProxySelfTest.java
@@ -18,9 +18,11 @@
package org.apache.ignite.internal.processors.service;
import java.util.Map;
+import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.util.typedef.PA;
import org.apache.ignite.internal.util.typedef.X;
@@ -67,6 +69,31 @@ public class GridServiceProcessorProxySelfTest extends GridServiceProcessorAbstr
}
/**
+ * Unwraps error message from InvocationTargetException.
+ *
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("ThrowableNotThrown")
+ public void testException() throws Exception {
+ String name = "errorService";
+
+ Ignite ignite = grid(0);
+
+ ignite.services(ignite.cluster().forRemotes()).deployNodeSingleton(name, new ErrorServiceImpl());
+
+ final ErrorService svc = ignite.services().serviceProxy(name, ErrorService.class, false);
+
+ GridTestUtils.assertThrows(log, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ svc.go();
+
+ return null;
+ }
+ }, IgniteException.class, "Test exception");
+
+ }
+
+ /**
* @throws Exception If failed.
*/
public void testClusterSingletonProxy() throws Exception {
@@ -371,6 +398,7 @@ public class GridServiceProcessorProxySelfTest extends GridServiceProcessorAbstr
map.clear();
}
+ /** {@inheritDoc} */
@Override public int size() {
return map.size();
}
@@ -390,4 +418,41 @@ public class GridServiceProcessorProxySelfTest extends GridServiceProcessorAbstr
X.println("Executing cache service: " + ctx.name());
}
}
+
+ /**
+ *
+ */
+ protected interface ErrorService extends Service {
+ /**
+ *
+ */
+ void go() throws Exception;
+ }
+
+ /**
+ *
+ */
+ protected class ErrorServiceImpl implements ErrorService {
+ /** {@inheritDoc} */
+ @Override public void cancel(ServiceContext ctx) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void init(ServiceContext ctx) throws Exception {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void execute(ServiceContext ctx) throws Exception {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void go() throws Exception {
+ throw new Exception("Test exception");
+ }
+ }
+
+
}
[18/50] [abbrv] ignite git commit: Merge remote-tracking branch
'community/ignite-2.1.2' into ignite-2.1.2
Posted by vo...@apache.org.
Merge remote-tracking branch 'community/ignite-2.1.2' into ignite-2.1.2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0f9a895a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0f9a895a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0f9a895a
Branch: refs/heads/master
Commit: 0f9a895a04cd4a4f6be8e006fc2afd6f720b2215
Parents: 58a937e 301f310
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 5 14:25:16 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 5 14:25:16 2017 +0300
----------------------------------------------------------------------
.../cpp/odbc-test/src/queries_test.cpp | 61 ++++++++++++++++++++
modules/platforms/cpp/odbc/src/odbc.cpp | 2 +-
modules/platforms/cpp/odbc/src/statement.cpp | 3 -
3 files changed, 62 insertions(+), 4 deletions(-)
----------------------------------------------------------------------