You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/10/02 12:58:15 UTC
[01/46] ignite git commit: ignite-973 Fixed atomic cache 'remove' to
always provide old value for indexing
Repository: ignite
Updated Branches:
refs/heads/ignite-1093-2 a8b323d74 -> 5de124cd9
ignite-973 Fixed atomic cache 'remove' to always provide old value for indexing
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/621eb0f7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/621eb0f7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/621eb0f7
Branch: refs/heads/ignite-1093-2
Commit: 621eb0f75bbe1a0a623229dded38a3549309eead
Parents: 8b94494
Author: sboikov <se...@inria.fr>
Authored: Mon Sep 21 21:37:52 2015 +0300
Committer: sboikov <se...@inria.fr>
Committed: Mon Sep 21 21:37:52 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheMapEntry.java | 37 +++++++++++++-------
.../processors/cache/GridCacheProcessor.java | 2 +-
.../processors/cache/GridCacheSwapManager.java | 24 ++++++-------
.../datastreamer/DataStreamerImpl.java | 2 --
4 files changed, 37 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/621eb0f7/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 f2bb646..961c792 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
@@ -1588,6 +1588,9 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
boolean hasValPtr = hasOffHeapPointer();
+ if (old == null)
+ old = saveValueForIndexUnlocked();
+
// Update index inside synchronization since it can be updated
// in load methods without actually holding entry lock.
clearIndex(old);
@@ -2163,6 +2166,9 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
// Must persist inside synchronization in non-tx mode.
cctx.store().remove(null, keyValue(false));
+ if (oldVal == null)
+ oldVal = saveValueForIndexUnlocked();
+
// Update index inside synchronization since it can be updated
// in load methods without actually holding entry lock.
clearIndex(oldVal);
@@ -3342,7 +3348,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
try {
synchronized (this) {
- CacheObject expiredVal = saveValueForIndexUnlocked();
+ CacheObject expiredVal = saveOldValueUnlocked(false);
boolean hasOldBytes = hasOffHeapPointer();
@@ -3523,12 +3529,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
try {
GridCacheQueryManager qryMgr = cctx.queries();
- if (qryMgr != null && qryMgr.enabled()) {
- qryMgr.store(key,
- val,
- ver,
- expireTime);
- }
+ if (qryMgr.enabled())
+ qryMgr.store(key, val, ver, expireTime);
}
catch (IgniteCheckedException e) {
throw new GridCacheIndexUpdateException(e);
@@ -3547,8 +3549,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
try {
GridCacheQueryManager<?, ?> qryMgr = cctx.queries();
- if (qryMgr != null)
- qryMgr.remove(key(), prevVal == null ? null : prevVal);
+ if (qryMgr.enabled())
+ qryMgr.remove(key(), prevVal);
}
catch (IgniteCheckedException e) {
throw new GridCacheIndexUpdateException(e);
@@ -3562,10 +3564,19 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
* @return Previous value or {@code null}.
* @throws IgniteCheckedException If failed to retrieve previous value.
*/
- protected CacheObject saveValueForIndexUnlocked() throws IgniteCheckedException {
+ protected final CacheObject saveValueForIndexUnlocked() throws IgniteCheckedException {
+ return saveOldValueUnlocked(true);
+ }
+
+ /**
+ * @param qryOnly If {@code true} reads old value only if query indexing is enabled.
+ * @return Previous value or {@code null}.
+ * @throws IgniteCheckedException If failed to retrieve previous value.
+ */
+ private CacheObject saveOldValueUnlocked(boolean qryOnly) throws IgniteCheckedException {
assert Thread.holdsLock(this);
- if (cctx.queries() == null)
+ if (qryOnly && !cctx.queries().enabled())
return null;
CacheObject val = rawGetOrUnmarshalUnlocked(false);
@@ -3681,7 +3692,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
if (obsoleteVersionExtras() != null)
return true;
- CacheObject prev = saveValueForIndexUnlocked();
+ CacheObject prev = saveOldValueUnlocked(false);
if (!hasReaders() && markObsolete0(obsoleteVer, false)) {
if (swap) {
@@ -3791,7 +3802,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
GridCacheQueryManager qryMgr = cctx.queries();
- if (qryMgr != null)
+ if (qryMgr.enabled())
qryMgr.onUnswap(key, prevVal);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/621eb0f7/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 c92de7d..7c16136 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
@@ -2759,7 +2759,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (spaceName.equals(CU.swapSpaceName(cctx))) {
GridCacheQueryManager qryMgr = cctx.queries();
- if (qryMgr != null) {
+ if (qryMgr.enabled()) {
try {
KeyCacheObject key = cctx.toCacheKeyObject(keyBytes);
http://git-wip-us.apache.org/repos/asf/ignite/blob/621eb0f7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index 9b6381e..d9a8b5c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -696,12 +696,12 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
final GridCacheQueryManager qryMgr = cctx.queries();
- if (qryMgr != null && !readSwapBeforeRemove(key, swapKey, ldr))
+ if (qryMgr.enabled() && !readSwapBeforeRemove(key, swapKey, ldr))
return null; // Not found.
swapMgr.remove(spaceName, swapKey, new CI1<byte[]>() {
@Override public void apply(byte[] rmv) {
- if (qryMgr == null && cctx.config().isStatisticsEnabled())
+ if (!qryMgr.enabled() && cctx.config().isStatisticsEnabled())
cctx.cache().metrics0().onSwapRead(rmv != null);
if (rmv != null) {
@@ -843,7 +843,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
GridCacheSwapEntry entry;
- if (qryMgr != null) {
+ if (qryMgr.enabled()) {
entry = readOffheapBeforeRemove(key, keyBytes, part);
if (entry != null) {
@@ -952,7 +952,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
ClassLoader ldr = cctx.deploy().globalLoader();
- if (qryMgr != null) { // Unswap for indexing.
+ if (qryMgr.enabled()) { // Unswap for indexing.
Iterator<SwapKey> iter = unprocessedKeys.iterator();
while (iter.hasNext()) {
@@ -967,7 +967,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
unprocessedKeys,
new IgniteBiInClosure<SwapKey, byte[]>() {
@Override public void apply(SwapKey swapKey, byte[] rmv) {
- if (qryMgr == null && cctx.config().isStatisticsEnabled())
+ if (!qryMgr.enabled() && cctx.config().isStatisticsEnabled())
cctx.cache().metrics0().onSwapRead(rmv != null);
if (rmv != null) {
@@ -1124,7 +1124,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
*/
public GridCacheSwapEntry readOffheapBeforeRemove(KeyCacheObject key, byte[] keyBytes, int part)
throws IgniteCheckedException {
- assert cctx.queries() != null;
+ assert cctx.queries().enabled();
byte[] entryBytes = offheap.get(spaceName, part, key, keyBytes);
@@ -1155,7 +1155,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
*/
private boolean readSwapBeforeRemove(@Nullable KeyCacheObject key, SwapKey swapKey, ClassLoader ldr)
throws IgniteCheckedException {
- assert cctx.queries() != null;
+ assert cctx.queries().enabled();
byte[] entryBytes = swapMgr.read(spaceName, swapKey, ldr);
@@ -1196,7 +1196,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
if (offheapEnabled) {
byte[] keyBytes = key.valueBytes(cctx.cacheObjectContext());
- if ((qryMgr == null || readOffheapBeforeRemove(key, keyBytes, part) != null) &&
+ if ((!qryMgr.enabled() || readOffheapBeforeRemove(key, keyBytes, part) != null) &&
offheap.removex(spaceName, part, key, keyBytes)) {
if (cctx.config().isStatisticsEnabled())
cctx.cache().metrics0().onOffHeapRemove();
@@ -1212,7 +1212,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
ClassLoader ldr = cctx.deploy().globalLoader();
- if (qryMgr != null && !readSwapBeforeRemove(key, swapKey, ldr))
+ if (qryMgr.enabled() && !readSwapBeforeRemove(key, swapKey, ldr))
return; // Not found.
swapMgr.remove(spaceName,
@@ -1279,7 +1279,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
GridCacheQueryManager qryMgr = cctx.queries();
- if (qryMgr != null)
+ if (qryMgr.enabled())
qryMgr.onSwap(key);
}
@@ -1308,7 +1308,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
cctx.events().addEvent(swapEntry.partition(), swapEntry.key(), cctx.nodeId(),
(IgniteUuid)null, null, EVT_CACHE_OBJECT_TO_OFFHEAP, null, false, null, true, null, null, null);
- if (qryMgr != null)
+ if (qryMgr.enabled())
qryMgr.onSwap(swapEntry.key());
}
}
@@ -1330,7 +1330,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
cctx.events().addEvent(batchSwapEntry.partition(), batchSwapEntry.key(), cctx.nodeId(),
(IgniteUuid)null, null, EVT_CACHE_OBJECT_SWAPPED, null, false, null, true, null, null, null);
- if (qryMgr != null)
+ if (qryMgr.enabled())
qryMgr.onSwap(batchSwapEntry.key());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/621eb0f7/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 b5d9a7d..ab2a6e8 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
@@ -1569,8 +1569,6 @@ public class DataStreamerImpl<K, V> implements IgniteDataStreamer<K, V>, Delayed
GridCacheEntryEx entry = internalCache.entryEx(e.getKey(), topVer);
- entry.unswap(false);
-
if (plc != null) {
ttl = CU.toTtl(plc.getExpiryForCreation());
[03/46] ignite git commit: Cleaned documentation. Set ATOMIC mode as
default using specific constant.
Posted by sb...@apache.org.
Cleaned documentation. Set ATOMIC mode as default using specific constant.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/50f75bd6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/50f75bd6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/50f75bd6
Branch: refs/heads/ignite-1093-2
Commit: 50f75bd6111b5b9163391e4c0913ff5b696a2862
Parents: e51fb42
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Sep 22 11:44:22 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Sep 22 11:44:22 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/cache/CacheAtomicityMode.java | 17 +++++------------
.../processors/cache/GridCacheProcessor.java | 2 +-
2 files changed, 6 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/50f75bd6/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java
index 9e0f81e..92b5aa1 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheAtomicityMode.java
@@ -33,11 +33,6 @@ public enum CacheAtomicityMode {
/**
* Specified fully {@code ACID}-compliant transactional cache behavior. See
* {@link Transaction} for more information about transactions.
- * <p>
- * This mode is currently the default cache atomicity mode. However, cache
- * atomicity mode will be changed to {@link #ATOMIC} starting from version {@code 5.2},
- * so it is recommended that desired atomicity mode is explicitly configured
- * instead of relying on default value.
*/
TRANSACTIONAL,
@@ -49,18 +44,16 @@ public enum CacheAtomicityMode {
* In addition to transactions and locking, one of the main differences in {@code ATOMIC} mode
* is that bulk writes, such as {@code putAll(...)}, {@code removeAll(...)}, and {@code transformAll(...)}
* methods, become simple batch operations which can partially fail. In case of partial
- * failure {@link org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException} will be thrown which will contain a list of keys
- * for which the update failed. It is recommended that bulk writes are used whenever multiple keys
- * need to be inserted or updated in cache, as they reduce number of network trips and provide
- * better performance.
+ * failure {@link org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException} will be thrown
+ * which will contain a list of keys for which the update failed. It is recommended that bulk writes are used
+ * whenever multiple keys need to be inserted or updated in cache, as they reduce number of network trips and
+ * provide better performance.
* <p>
* Note that even without locking and transactions, {@code ATOMIC} mode still provides
* full consistency guarantees across all cache nodes.
* <p>
* Also note that all data modifications in {@code ATOMIC} mode are guaranteed to be atomic
* and consistent with writes to the underlying persistent store, if one is configured.
- * <p>
- * This mode is currently implemented for {@link CacheMode#PARTITIONED} caches only.
*/
ATOMIC;
@@ -76,4 +69,4 @@ public enum CacheAtomicityMode {
@Nullable public static CacheAtomicityMode fromOrdinal(int ord) {
return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/50f75bd6/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 7c16136..9c325aa 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
@@ -271,7 +271,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cfg.setRebalanceMode(ASYNC);
if (cfg.getAtomicityMode() == null)
- cfg.setAtomicityMode(ATOMIC);
+ cfg.setAtomicityMode(CacheConfiguration.DFLT_CACHE_ATOMICITY_MODE);
if (cfg.getWriteSynchronizationMode() == null)
cfg.setWriteSynchronizationMode(PRIMARY_SYNC);
[04/46] ignite git commit: Added test.
Posted by sb...@apache.org.
Added test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/33fe30da
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/33fe30da
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/33fe30da
Branch: refs/heads/ignite-1093-2
Commit: 33fe30da620e4f08cee959104805f3527b597700
Parents: e51fb42
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 22 12:55:18 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 22 12:55:18 2015 +0300
----------------------------------------------------------------------
...lientDiscoverySpiFailureTimeoutSelfTest.java | 118 ++++++++++++++++++-
.../tcp/TcpClientDiscoverySpiSelfTest.java | 13 +-
2 files changed, 119 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/33fe30da/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
index 66275b3..14417c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
@@ -21,12 +21,25 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import java.net.SocketTimeoutException;
+import java.util.Collections;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.events.Event;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryPingRequest;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+
/**
* Client-based discovery SPI test with failure detection timeout enabled.
*/
@@ -60,7 +73,7 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
/** {@inheritDoc} */
@Override protected TcpDiscoverySpi getDiscoverySpi() {
- return useTestSpi ? new TestTcpDiscoverySpi() : super.getDiscoverySpi();
+ return useTestSpi ? new TestTcpDiscoverySpi2() : super.getDiscoverySpi();
}
/**
@@ -117,16 +130,16 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
private void checkFailureThresholdWorkability() throws Exception {
useTestSpi = true;
- TestTcpDiscoverySpi firstSpi = null;
- TestTcpDiscoverySpi secondSpi = null;
+ TestTcpDiscoverySpi2 firstSpi = null;
+ TestTcpDiscoverySpi2 secondSpi = null;
try {
startServerNodes(2);
checkNodes(2, 0);
- firstSpi = (TestTcpDiscoverySpi)(G.ignite("server-0").configuration().getDiscoverySpi());
- secondSpi = (TestTcpDiscoverySpi)(G.ignite("server-1").configuration().getDiscoverySpi());
+ firstSpi = (TestTcpDiscoverySpi2)(G.ignite("server-0").configuration().getDiscoverySpi());
+ secondSpi = (TestTcpDiscoverySpi2)(G.ignite("server-1").configuration().getDiscoverySpi());
assert firstSpi.err == null;
@@ -157,9 +170,102 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
}
/**
+ * Test tries to provoke scenario when client sends reconnect message before router failure detected.
+ *
+ * @throws Exception If failed.
+ */
+ public void _testClientReconnectOnCoordinatorRouterFail() throws Exception {
+ startServerNodes(1);
+
+ Ignite srv = G.ignite("server-0");
+
+ final TcpDiscoveryNode srvNode = (TcpDiscoveryNode)srv.cluster().localNode();
+
+ final UUID srvNodeId = srvNode.id();
+
+ clientIpFinder = new TcpDiscoveryVmIpFinder();
+
+ clientIpFinder.setAddresses(
+ Collections.singleton("localhost:" + srvNode.discoveryPort() + ".." + (srvNode.discoveryPort() + 1)));
+
+ failureThreshold = 1000L;
+ netTimeout = 500L;
+
+ startClientNodes(1); // Client should connect to coordinator.
+
+ failureThreshold = 10_000L;
+ netTimeout = 5000L;
+
+ for (int i = 0; i < 2; i++) {
+ Ignite g = startGrid("server-" + srvIdx.getAndIncrement());
+
+ srvNodeIds.add(g.cluster().localNode().id());
+ }
+
+ checkNodes(3, 1);
+
+ final CountDownLatch latch = new CountDownLatch(3);
+
+ String nodes[] = {"server-1", "server-2", "client-0"};
+
+ final AtomicBoolean err = new AtomicBoolean();
+
+ for (String node : nodes) {
+ G.ignite(node).events().localListen(new IgnitePredicate<Event>() {
+ @Override public boolean apply(Event evt) {
+ DiscoveryEvent disoEvt = (DiscoveryEvent)evt;
+
+ if (disoEvt.eventNode().id().equals(srvNodeId)) {
+ info("Expected node failed event: " + ((DiscoveryEvent) evt).eventNode());
+
+ latch.countDown();
+ }
+ else {
+ log.info("Unexpected node failed event: " + evt);
+
+ err.set(true);
+ }
+
+ return true;
+ }
+ }, EVT_NODE_FAILED);
+ }
+
+ Thread.sleep(5000);
+
+ Ignite client = G.ignite("client-0");
+
+ UUID nodeId = client.cluster().localNode().id();
+
+ log.info("Fail coordinator: " + srvNodeId);
+
+ TestTcpDiscoverySpi srvSpi = (TestTcpDiscoverySpi)srv.configuration().getDiscoverySpi();
+
+ srvSpi.pauseAll(false);
+
+ try {
+ Thread.sleep(2000);
+ }
+ finally {
+ srvSpi.simulateNodeFailure();
+ srvSpi.resumeAll();
+ }
+
+ try {
+ assertTrue(latch.await(10_000, TimeUnit.MILLISECONDS));
+
+ assertFalse("Unexpected event, see log for details.", err.get());
+ assertEquals(nodeId, client.cluster().localNode().id());
+ }
+ finally {
+ srvSpi.resumeAll();
+ }
+ }
+
+ /**
*
*/
- private static class TestTcpDiscoverySpi extends TcpDiscoverySpi {
+ private static class TestTcpDiscoverySpi2 extends TcpDiscoverySpi {
/** */
private long readDelay;
http://git-wip-us.apache.org/repos/asf/ignite/blob/33fe30da/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
index c86f06a..9fbf5b1 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
@@ -89,13 +89,13 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
/** */
- private static final AtomicInteger srvIdx = new AtomicInteger();
+ protected static final AtomicInteger srvIdx = new AtomicInteger();
/** */
private static final AtomicInteger clientIdx = new AtomicInteger();
/** */
- private static Collection<UUID> srvNodeIds;
+ protected static Collection<UUID> srvNodeIds;
/** */
private static Collection<UUID> clientNodeIds;
@@ -128,13 +128,13 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
private UUID nodeId;
/** */
- private TcpDiscoveryVmIpFinder clientIpFinder;
+ protected TcpDiscoveryVmIpFinder clientIpFinder;
/** */
private long joinTimeout = TcpDiscoverySpi.DFLT_JOIN_TIMEOUT;
/** */
- private long netTimeout = TcpDiscoverySpi.DFLT_NETWORK_TIMEOUT;
+ protected long netTimeout = TcpDiscoverySpi.DFLT_NETWORK_TIMEOUT;
/** */
private boolean longSockTimeouts;
@@ -466,7 +466,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
@Override public void apply(Socket sock) {
try {
latch.await();
- } catch (InterruptedException e) {
+ }
+ catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
@@ -2056,7 +2057,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
/**
*
*/
- private static class TestTcpDiscoverySpi extends TcpDiscoverySpi {
+ protected static class TestTcpDiscoverySpi extends TcpDiscoverySpi {
/** */
private final Object mux = new Object();
[44/46] ignite git commit: 1093
Posted by sb...@apache.org.
1093
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9abfc606
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9abfc606
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9abfc606
Branch: refs/heads/ignite-1093-2
Commit: 9abfc60694ddb2cc4dc11cd41124c79c09d083dd
Parents: e1651dd
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Sep 28 14:39:52 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Sep 28 14:39:52 2015 +0300
----------------------------------------------------------------------
.../GridDhtPartitionDemandMessage.java | 7 ++
.../dht/preloader/GridDhtPartitionDemander.java | 68 ++++++++++++--------
.../dht/preloader/GridDhtPartitionSupplier.java | 7 +-
3 files changed, 53 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9abfc606/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
index 06ac54b..6c60930 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
@@ -123,6 +123,13 @@ public class GridDhtPartitionDemandMessage extends GridCacheMessage {
}
/**
+ * @param updateSeq Update sequence.
+ */
+ void updateSequence(long updateSeq) {
+ this.updateSeq = updateSeq;
+ }
+
+ /**
* @return Update sequence.
*/
long updateSequence() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/9abfc606/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 345e3bd..5d4db40 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
@@ -64,7 +64,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.CI2;
-import org.apache.ignite.internal.util.typedef.T3;
+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;
@@ -110,6 +110,9 @@ public class GridDhtPartitionDemander {
/** Demand lock. */
private final ReadWriteLock demandLock;
+ /** Rebalancing iteration counter. */
+ private long updateSeq = 0;
+
/**
* @param cctx Cctx.
* @param demandLock Demand lock.
@@ -194,7 +197,10 @@ public class GridDhtPartitionDemander {
* @return {@code True} if topology changed.
*/
private boolean topologyChanged(SyncFuture fut) {
- return !cctx.affinity().affinityTopologyVersion().equals(fut.topologyVersion()) || fut != syncFut;
+ return
+ !cctx.affinity().affinityTopologyVersion().equals(fut.topologyVersion()) || // Topology already changed.
+ fut != syncFut || // Same topology, but dummy exchange forced because of missing partitions.
+ cctx.shared().exchange().hasPendingExchange(); // New topology pending.
}
/**
@@ -256,20 +262,20 @@ public class GridDhtPartitionDemander {
final SyncFuture oldFut = syncFut;
- if (!oldFut.isDummy() && assigns.topologyVersion().compareTo(oldFut.topologyVersion()) < 0) {
- U.log(log, "Skipping obsolete (dummy) exchange. [top=" + assigns.topologyVersion() + "]");
+ if (cctx.shared().exchange().hasPendingExchange()) { // Will rebalance at actual topology.
+ U.log(log, "Skipping obsolete exchange. [top=" + assigns.topologyVersion() + "]");
return;
}
- final SyncFuture fut = new SyncFuture(assigns, cctx, log, oldFut.isDummy());
+ final SyncFuture fut = new SyncFuture(assigns, cctx, log, oldFut.isDummy(), ++updateSeq);
if (!oldFut.isDummy())
oldFut.cancel();
else
- fut.listen(new CI1<IgniteInternalFuture<?>>() {
- @Override public void apply(IgniteInternalFuture<?> future) {
- oldFut.onDone();
+ fut.listen(new CI1<IgniteInternalFuture<Boolean>>() {
+ @Override public void apply(IgniteInternalFuture<Boolean> future) {
+ oldFut.onDone(fut.result());
}
});
@@ -385,13 +391,13 @@ public class GridDhtPartitionDemander {
final CacheConfiguration cfg = cctx.config();
- U.log(log, "Starting rebalancing [cache=" + cctx.name() + ", mode=" + cfg.getRebalanceMode() +
- ", fromNode=" + node.id() + ", partitionsCount=" + d.partitions().size() +
- ", topology=" + d.topologyVersion() + ", updateSeq=" + d.updateSequence() + "]");
-
//Check remote node rebalancing API version.
if (new Integer(1).equals(node.attribute(IgniteNodeAttributes.REBALANCING_VERSION))) {
- fut.appendPartitions(node.id(), d.partitions(), d.updateSequence());
+ U.log(log, "Starting rebalancing [cache=" + cctx.name() + ", mode=" + cfg.getRebalanceMode() +
+ ", fromNode=" + node.id() + ", partitionsCount=" + d.partitions().size() +
+ ", topology=" + d.topologyVersion() + ", updateSeq=" + fut.updateSeq + "]");
+
+ fut.appendPartitions(node.id(), d.partitions());
int lsnrCnt = cctx.gridConfig().getRebalanceThreadPoolSize();
@@ -415,6 +421,7 @@ public class GridDhtPartitionDemander {
GridDhtPartitionDemandMessage initD = new GridDhtPartitionDemandMessage(d, sParts.get(cnt));
initD.topic(GridCachePartitionExchangeManager.rebalanceTopic(cnt));
+ initD.updateSequence(fut.updateSeq);
try {
if (!topologyChanged(fut)) {
@@ -442,9 +449,13 @@ public class GridDhtPartitionDemander {
}
}
else {
+ U.log(log, "Starting rebalancing [cache=" + cctx.name() + ", mode=" + cfg.getRebalanceMode() +
+ ", fromNode=" + node.id() + ", partitionsCount=" + d.partitions().size() +
+ ", topology=" + d.topologyVersion() + ", updateSeq=" + d.updateSequence() + "]");
+
DemandWorker dw = new DemandWorker(dmIdx.incrementAndGet(), fut);
- fut.appendPartitions(node.id(), d.partitions(), d.updateSequence());
+ fut.appendPartitions(node.id(), d.partitions());
dw.run(node, d);
}
@@ -516,7 +527,9 @@ public class GridDhtPartitionDemander {
assert node != null;
- if (!fut.topologyVersion().equals(topVer) || topologyChanged(fut) || !fut.isActual(id, supply.updateSequence()))
+ if (!fut.topologyVersion().equals(topVer) || // Current future based on another topology.
+ topologyChanged(fut) || // Topology already changed (for current future) or new topology pending.
+ !fut.isActual(supply.updateSequence())) // Current future have same topology, but another update sequence.
return;
if (log.isDebugEnabled())
@@ -761,7 +774,7 @@ public class GridDhtPartitionDemander {
private final IgniteLogger log;
/** Remaining. T3: startTime, partitions, updateSequence */
- private final Map<UUID, T3<Long, Collection<Integer>, Long>> remaining = new HashMap<>();
+ private final Map<UUID, T2<Long, Collection<Integer>>> remaining = new HashMap<>();
/** Missed. */
private final Map<UUID, Collection<Integer>> missed = new HashMap<>();
@@ -776,6 +789,9 @@ public class GridDhtPartitionDemander {
/** Topology version. */
private final AffinityTopologyVersion topVer;
+ /** Unique (per demander) sequence id. */
+ private final long updateSeq;
+
/**
* @param assigns Assigns.
* @param cctx Context.
@@ -785,7 +801,8 @@ public class GridDhtPartitionDemander {
SyncFuture(GridDhtPreloaderAssignments assigns,
GridCacheContext<?, ?> cctx,
IgniteLogger log,
- boolean sentStopEvnt) {
+ boolean sentStopEvnt,
+ long updateSeq) {
assert assigns != null;
this.exchFut = assigns.exchangeFuture();
@@ -793,6 +810,7 @@ public class GridDhtPartitionDemander {
this.cctx = cctx;
this.log = log;
this.sendStoppedEvnt = sentStopEvnt;
+ this.updateSeq = updateSeq;
if (assigns != null)
cctx.discovery().topologyFuture(assigns.topologyVersion().topologyVersion() + 1).listen(
@@ -812,6 +830,7 @@ public class GridDhtPartitionDemander {
this.cctx = null;
this.log = null;
this.sendStoppedEvnt = false;
+ this.updateSeq = -1;
}
/**
@@ -822,14 +841,11 @@ public class GridDhtPartitionDemander {
}
/**
- * @param nodeId Node id.
* @param updateSeq Update sequence.
* @return true in case future created for specified updateSeq, false in other case.
*/
- private boolean isActual(UUID nodeId, long updateSeq) {
- T3<Long, Collection<Integer>, Long> t = remaining.get(nodeId);
-
- return t != null ? t.get3().equals(updateSeq) : false;
+ private boolean isActual(long updateSeq) {
+ return this.updateSeq == updateSeq;
}
/**
@@ -843,11 +859,11 @@ public class GridDhtPartitionDemander {
* @param nodeId Node id.
* @param parts Parts.
*/
- private void appendPartitions(UUID nodeId, Collection<Integer> parts, long updateSeq) {
+ private void appendPartitions(UUID nodeId, Collection<Integer> parts) {
lock.lock();
try {
- remaining.put(nodeId, new T3<>(U.currentTimeMillis(), parts, updateSeq));
+ remaining.put(nodeId, new T2<>(U.currentTimeMillis(), parts));
}
finally {
lock.unlock();
@@ -1027,10 +1043,10 @@ public class GridDhtPartitionDemander {
if (!m.isEmpty()) {
U.log(log, ("Reassigning partitions that were missed: " + m));
- cctx.shared().exchange().forceDummyExchange(true, exchFut);
-
onDone(false); //Finished but has missed partitions and forced dummy exchange
+ cctx.shared().exchange().forceDummyExchange(true, exchFut);
+
return;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9abfc606/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
index e23a50b..81e2fa4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
@@ -105,7 +105,7 @@ class GridDhtPartitionSupplier {
SupplyContext sc = entry.getValue();
- if (t.get3() != null && !t.get3().equals(cctx.affinity().affinityTopologyVersion()) && sc != null)
+ if (t.get3() != null && !t.get3().equals(cctx.affinity().affinityTopologyVersion()) && sc != null)
clearContext(scMap, t, sc, log);
}
}
@@ -128,7 +128,7 @@ class GridDhtPartitionSupplier {
}
};
- cctx.events().addListener(lsnr, EVT_NODE_JOINED, EVT_NODE_LEFT, EVT_NODE_FAILED, EVT_CACHE_REBALANCE_STOPPED);
+ cctx.events().addListener(lsnr, EVT_NODE_FAILED, EVT_CACHE_REBALANCE_STOPPED);
startOldListeners();
}
@@ -532,7 +532,8 @@ class GridDhtPartitionSupplier {
if (log.isDebugEnabled())
log.debug("Replying to partition demand [node=" + n.id() + ", demand=" + d + ", supply=" + s + ']');
- if (!cctx.affinity().affinityTopologyVersion().equals(d.topologyVersion()))
+ if (!cctx.affinity().affinityTopologyVersion().equals(d.topologyVersion()) || // Topology already changed.
+ cctx.shared().exchange().hasPendingExchange()) // New topology pending.
return true;
cctx.io().sendOrderedMessage(n, d.topic(), s, cctx.ioPolicy(), d.timeout());
[45/46] ignite git commit: 1093
Posted by sb...@apache.org.
1093
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f0f7c32c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f0f7c32c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f0f7c32c
Branch: refs/heads/ignite-1093-2
Commit: f0f7c32caa1a9566c77d0a66bb533a4a07a2338a
Parents: 9abfc60
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Sep 29 18:20:01 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Sep 29 18:20:01 2015 +0300
----------------------------------------------------------------------
.../dht/preloader/GridDhtPartitionDemander.java | 2 +-
.../dht/preloader/GridDhtPartitionSupplier.java | 196 +++++++++++++------
.../GridCacheRebalancingSyncSelfTest.java | 30 ++-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 17 --
.../spi/discovery/tcp/TestTcpDiscoverySpi.java | 46 +++++
.../testframework/junits/GridAbstractTest.java | 3 +-
6 files changed, 194 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0f7c32c/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 5d4db40..d1d475c 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
@@ -818,7 +818,7 @@ public class GridDhtPartitionDemander {
@Override public void apply(IgniteInternalFuture<Long> future) {
SyncFuture.this.cancel();
}
- });
+ }); // todo: is it necessary?
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0f7c32c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
index 81e2fa4..b5bb25d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
@@ -24,7 +24,6 @@ import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.events.CacheRebalancingEvent;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
@@ -41,15 +40,12 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalP
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.internal.util.typedef.CI2;
-import org.apache.ignite.internal.util.typedef.T4;
+import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
import org.jsr166.ConcurrentHashMap8;
-import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_STOPPED;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
-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.internal.processors.cache.distributed.dht.GridDhtPartitionState.OWNING;
/**
@@ -71,8 +67,8 @@ class GridDhtPartitionSupplier {
/** Preload predicate. */
private IgnitePredicate<GridCacheEntryInfo> preloadPred;
- /** Supply context map. T4: nodeId, idx, topologyVersion, updateSequence. */
- private final ConcurrentHashMap8<T4<UUID, Integer, AffinityTopologyVersion, Long>, SupplyContext> scMap =
+ /** Supply context map. T2: nodeId, idx. */
+ private final ConcurrentHashMap8<T2<UUID, Integer>, SupplyContext> scMap =
new ConcurrentHashMap8<>();
/** Rebalancing listener. */
@@ -100,26 +96,18 @@ class GridDhtPartitionSupplier {
lsnr = new GridLocalEventListener() {
@Override public void onEvent(Event evt) {
if (evt instanceof DiscoveryEvent) {
- for (Map.Entry<T4<UUID, Integer, AffinityTopologyVersion, Long>, SupplyContext> entry : scMap.entrySet()) {
- T4<UUID, Integer, AffinityTopologyVersion, Long> t = entry.getKey();
+ for (Map.Entry<T2<UUID, Integer>, SupplyContext> entry : scMap.entrySet()) {
+ T2<UUID, Integer> t = entry.getKey();
- SupplyContext sc = entry.getValue();
+ if (t.get1().equals(((DiscoveryEvent)evt).eventNode().id())) {
+ SupplyContext sctx = entry.getValue();
- if (t.get3() != null && !t.get3().equals(cctx.affinity().affinityTopologyVersion()) && sc != null)
- clearContext(scMap, t, sc, log);
- }
- }
- else if (evt instanceof CacheRebalancingEvent) {
- CacheRebalancingEvent e = (CacheRebalancingEvent)evt;
+ clearContext(sctx, log);
- if (cctx.name().equals(e.cacheName())) {
- UUID id = e.discoveryNode().id();
+ U.log(log, "Supply context removed for failed node [node=" + t.get1() + "]");
- for (Map.Entry<T4<UUID, Integer, AffinityTopologyVersion, Long>, SupplyContext> entry : scMap.entrySet()) {
- if (id.equals(entry.getKey().get1()))
- clearContext(scMap, entry.getKey(), entry.getValue(), log);
+ scMap.remove(t, sctx);
}
-
}
}
else {
@@ -128,7 +116,7 @@ class GridDhtPartitionSupplier {
}
};
- cctx.events().addListener(lsnr, EVT_NODE_FAILED, EVT_CACHE_REBALANCE_STOPPED);
+ cctx.events().addListener(lsnr, EVT_NODE_FAILED);
startOldListeners();
}
@@ -145,32 +133,38 @@ class GridDhtPartitionSupplier {
/**
* Clear context.
*
- * @param map Context map.
- * @param t id.
* @param sc Supply context.
* @param log Logger.
* @return true in case context was removed.
*/
- private static boolean clearContext(
- final ConcurrentHashMap8<T4<UUID, Integer, AffinityTopologyVersion, Long>, SupplyContext> map,
- final T4<UUID, Integer, AffinityTopologyVersion, Long> t,
+ private static void clearContext(
final SupplyContext sc,
final IgniteLogger log) {
- final Iterator it = sc.entryIt;
+ if (sc != null) {
+ final Iterator it = sc.entryIt;
- if (it != null && it instanceof GridCloseableIterator && !((GridCloseableIterator)it).isClosed()) {
- try {
- synchronized (it) {
- if (!((GridCloseableIterator)it).isClosed())
- ((GridCloseableIterator)it).close();
+ if (it != null && it instanceof GridCloseableIterator && !((GridCloseableIterator)it).isClosed()) {
+ try {
+ synchronized (it) {
+ if (!((GridCloseableIterator)it).isClosed())
+ ((GridCloseableIterator)it).close();
+ }
+ }
+ catch (IgniteCheckedException e) {
+ log.error("Iterator close failed.", e);
}
}
- catch (IgniteCheckedException e) {
- log.error("Iterator close failed.", e);
+
+ final GridDhtLocalPartition loc = sc.loc;
+
+ if (loc != null && loc.reservations() > 0) {
+ synchronized (loc) {
+ if (loc.reservations() > 0)
+ loc.release();
+ }
+
}
}
-
- return map.remove(t, sc);
}
/**
@@ -199,10 +193,16 @@ class GridDhtPartitionSupplier {
ClusterNode node = cctx.discovery().node(id);
- T4<UUID, Integer, AffinityTopologyVersion, Long> scId = new T4<>(id, idx, d.topologyVersion(), d.updateSequence());
+ T2<UUID, Integer> scId = new T2<>(id, idx);
try {
- SupplyContext sctx = scMap.get(scId);
+ SupplyContext sctx = scMap.remove(scId);
+
+ if (sctx != null && (!d.topologyVersion().equals(sctx.topVer) || d.updateSequence() != sctx.updateSeq)) {
+ clearContext(sctx, log);
+
+ sctx = null;
+ }
if (sctx == null && d.partitions() == null)
return;
@@ -230,18 +230,27 @@ class GridDhtPartitionSupplier {
newReq = false;
- GridDhtLocalPartition loc = top.localPartition(part, d.topologyVersion(), false);
+ GridDhtLocalPartition loc;
- if (loc == null || loc.state() != OWNING || !loc.reserve()) {
- // Reply with partition of "-1" to let sender know that
- // this node is no longer an owner.
- s.missed(part);
+ if (sctx != null && sctx.loc != null) {
+ loc = sctx.loc;
- if (log.isDebugEnabled())
- log.debug("Requested partition is not owned by local node [part=" + part +
- ", demander=" + id + ']');
+ assert loc.reservations() > 0;
+ }
+ else {
+ loc = top.localPartition(part, d.topologyVersion(), false);
- continue;
+ if (loc == null || loc.state() != OWNING || !loc.reserve()) {
+ // Reply with partition of "-1" to let sender know that
+ // this node is no longer an owner.
+ s.missed(part);
+
+ if (log.isDebugEnabled())
+ log.debug("Requested partition is not owned by local node [part=" + part +
+ ", demander=" + id + ']');
+
+ continue;
+ }
}
GridCacheEntryInfoCollectSwapListener swapLsnr = null;
@@ -279,9 +288,18 @@ class GridDhtPartitionSupplier {
if (s.messageSize() >= cctx.config().getRebalanceBatchSize()) {
if (++bCnt >= maxBatchesCnt) {
- saveSupplyContext(scId, phase, partIt, part, entIt, swapLsnr);
+ saveSupplyContext(scId,
+ phase,
+ partIt,
+ part,
+ entIt,
+ swapLsnr,
+ loc,
+ d.topologyVersion(),
+ d.updateSequence());
swapLsnr = null;
+ loc = null;
reply(node, d, s);
@@ -323,7 +341,10 @@ class GridDhtPartitionSupplier {
partIt,
null,
swapLsnr,
- part);
+ part,
+ loc,
+ d.topologyVersion(),
+ d.updateSequence());
}
}
@@ -354,9 +375,18 @@ class GridDhtPartitionSupplier {
if (s.messageSize() >= cctx.config().getRebalanceBatchSize()) {
if (++bCnt >= maxBatchesCnt) {
- saveSupplyContext(scId, phase, partIt, part, iter, swapLsnr);
+ saveSupplyContext(scId,
+ phase,
+ partIt,
+ part,
+ iter,
+ swapLsnr,
+ loc,
+ d.topologyVersion(),
+ d.updateSequence());
swapLsnr = null;
+ loc = null;
reply(node, d, s);
@@ -437,7 +467,10 @@ class GridDhtPartitionSupplier {
partIt,
null,
null,
- part);
+ part,
+ loc,
+ d.topologyVersion(),
+ d.updateSequence());
}
}
@@ -465,9 +498,17 @@ class GridDhtPartitionSupplier {
if (s.messageSize() >= cctx.config().getRebalanceBatchSize()) {
if (++bCnt >= maxBatchesCnt) {
- saveSupplyContext(scId, phase, partIt, part, lsnrIt, swapLsnr);
-
- swapLsnr = null;
+ saveSupplyContext(scId,
+ phase,
+ partIt,
+ part,
+ lsnrIt,
+ swapLsnr,
+ loc,
+ d.topologyVersion(),
+ d.updateSequence());
+
+ loc = null;
reply(node, d, s);
@@ -500,7 +541,8 @@ class GridDhtPartitionSupplier {
sctx = null;
}
finally {
- loc.release();
+ if (loc != null)
+ loc.release();
if (swapLsnr != null) {
cctx.swap().removeOffHeapListener(part, swapLsnr);
@@ -561,12 +603,24 @@ class GridDhtPartitionSupplier {
* @param swapLsnr Swap listener.
*/
private void saveSupplyContext(
- T4 t,
+ T2<UUID, Integer> t,
int phase,
Iterator<Integer> partIt,
int part,
- Iterator<?> entryIt, GridCacheEntryInfoCollectSwapListener swapLsnr) {
- scMap.put(t, new SupplyContext(phase, partIt, entryIt, swapLsnr, part));
+ Iterator<?> entryIt, GridCacheEntryInfoCollectSwapListener swapLsnr,
+ GridDhtLocalPartition loc,
+ AffinityTopologyVersion topVer,
+ long updateSeq) {
+ SupplyContext old = scMap.putIfAbsent(t, new SupplyContext(phase,
+ partIt,
+ entryIt,
+ swapLsnr,
+ part,
+ loc,
+ topVer,
+ updateSeq));
+
+ assert old == null;
}
/**
@@ -588,6 +642,15 @@ class GridDhtPartitionSupplier {
/** Partition. */
private final int part;
+ /** Local partition. */
+ GridDhtLocalPartition loc;
+
+ /** Topology version. */
+ AffinityTopologyVersion topVer;
+
+ /** Update seq. */
+ long updateSeq;
+
/**
* @param phase Phase.
* @param partIt Partition iterator.
@@ -595,13 +658,22 @@ class GridDhtPartitionSupplier {
* @param swapLsnr Swap listener.
* @param part Partition.
*/
- public SupplyContext(int phase, Iterator<Integer> partIt, Iterator<?> entryIt,
- GridCacheEntryInfoCollectSwapListener swapLsnr, int part) {
+ public SupplyContext(int phase,
+ Iterator<Integer> partIt,
+ Iterator<?> entryIt,
+ GridCacheEntryInfoCollectSwapListener swapLsnr,
+ int part,
+ GridDhtLocalPartition loc,
+ AffinityTopologyVersion topVer,
+ long updateSeq) {
this.phase = phase;
this.partIt = partIt;
this.entryIt = entryIt;
this.swapLsnr = swapLsnr;
this.part = part;
+ this.loc = loc;
+ this.topVer = topVer;
+ this.updateSeq = updateSeq;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0f7c32c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
index be8e24b..bb40f31 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -59,18 +60,10 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
protected static String CACHE_NAME_DHT_REPLICATED_2 = "cacheR2";
/** */
- private volatile boolean concurrentStartFinished = false;
+ private volatile boolean concurrentStartFinished;
/** */
- private volatile boolean concurrentStartFinished2 = false;
-
- private volatile FailableTcpDiscoverySpi spi;
-
- public static class FailableTcpDiscoverySpi extends TcpDiscoverySpi {
- public void fail() {
- simulateNodeFailure();
- }
- }
+ private volatile boolean concurrentStartFinished2;
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
@@ -78,11 +71,6 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
iCfg.setRebalanceThreadPoolSize(4);
- iCfg.setDiscoverySpi(new FailableTcpDiscoverySpi());
-
- if (getTestGridName(20).equals(gridName))
- spi = (FailableTcpDiscoverySpi)iCfg.getDiscoverySpi();
-
((TcpDiscoverySpi)iCfg.getDiscoverySpi()).setIpFinder(ipFinder);
((TcpDiscoverySpi)iCfg.getDiscoverySpi()).setForceServerMode(true);
@@ -96,7 +84,8 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
cachePCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
cachePCfg.setBackups(1);
cachePCfg.setRebalanceBatchSize(1);
- cachePCfg.setRebalanceBatchesCount(1);
+ //cachePCfg.setRebalanceBatchesCount(1);
+ cachePCfg.setRebalanceBatchesCount(Integer.MAX_VALUE);
CacheConfiguration<Integer, Integer> cachePCfg2 = new CacheConfiguration<>();
@@ -285,6 +274,9 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
long start = System.currentTimeMillis();
+ concurrentStartFinished = false;
+ concurrentStartFinished2 = false;
+
Thread t1 = new Thread() {
@Override public void run() {
try {
@@ -409,11 +401,11 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
waitForRebalancing(1, 2);
- startGrid(20);
+ startGrid(2);
- waitForRebalancing(20, 3);
+ waitForRebalancing(2, 3);
- spi.fail();
+ ((TestTcpDiscoverySpi)grid(2).configuration().getDiscoverySpi()).simulateNodeFailure();
waitForRebalancing(0, 4);
waitForRebalancing(1, 4);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0f7c32c/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 0280e9c..51d8a2d 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -511,23 +511,6 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
}
/**
- *
- */
- private static class TestTcpDiscoverySpi extends TcpDiscoverySpi {
- /** */
- private boolean ignorePingResponse;
-
- /** {@inheritDoc} */
- protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, long timeout) throws IOException,
- IgniteCheckedException {
- if (msg instanceof TcpDiscoveryPingResponse && ignorePingResponse)
- return;
- else
- super.writeToSocket(sock, msg, timeout);
- }
- }
-
- /**
* @throws Exception If any error occurs.
*/
public void testNodeAdded() throws Exception {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0f7c32c/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestTcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestTcpDiscoverySpi.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestTcpDiscoverySpi.java
new file mode 100644
index 0000000..dbc54bc
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TestTcpDiscoverySpi.java
@@ -0,0 +1,46 @@
+/*
+ * 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.spi.discovery.tcp;
+
+import java.io.IOException;
+import java.net.Socket;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryPingResponse;
+
+/**
+ *
+ */
+public class TestTcpDiscoverySpi extends TcpDiscoverySpi {
+ /** */
+ public boolean ignorePingResponse;
+
+ /** {@inheritDoc} */
+ protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, long timeout) throws IOException,
+ IgniteCheckedException {
+ if (msg instanceof TcpDiscoveryPingResponse && ignorePingResponse)
+ return;
+ else
+ super.writeToSocket(sock, msg, timeout);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void simulateNodeFailure() {
+ super.simulateNodeFailure();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0f7c32c/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 f54fe06..546549b 100644
--- 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
@@ -76,6 +76,7 @@ import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointSpi;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
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.multicast.TcpDiscoveryMulticastIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -1227,7 +1228,7 @@ public abstract class GridAbstractTest extends TestCase {
cfg.setCommunicationSpi(commSpi);
- TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+ TcpDiscoverySpi discoSpi = new TestTcpDiscoverySpi();
if (isDebug()) {
discoSpi.setMaxMissedHeartbeats(Integer.MAX_VALUE);
[12/46] ignite git commit: ignite-1524 Fixed processing of
ClientReconnectMessage
Posted by sb...@apache.org.
ignite-1524 Fixed processing of ClientReconnectMessage
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/04f4f54a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/04f4f54a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/04f4f54a
Branch: refs/heads/ignite-1093-2
Commit: 04f4f54a7ff1d43fa3baf4fa07865a8163796a82
Parents: 1942d75
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 23 09:31:59 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 23 09:31:59 2015 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 97 +++++++++++---------
...lientDiscoverySpiFailureTimeoutSelfTest.java | 33 +++++--
2 files changed, 81 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/04f4f54a/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 4ce46e8..8a205d2 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
@@ -2958,70 +2958,81 @@ class ServerImpl extends TcpDiscoveryImpl {
* @param msg Client reconnect message.
*/
private void processClientReconnectMessage(TcpDiscoveryClientReconnectMessage msg) {
+ UUID nodeId = msg.creatorNodeId();
+
UUID locNodeId = getLocalNodeId();
boolean isLocNodeRouter = locNodeId.equals(msg.routerNodeId());
if (!msg.verified()) {
- assert isLocNodeRouter;
-
- msg.verify(locNodeId);
+ TcpDiscoveryNode node = ring.node(nodeId);
- if (ring.hasRemoteNodes()) {
- sendMessageAcrossRing(msg);
+ assert node == null || node.isClient();
- return;
+ if (node != null) {
+ node.clientRouterNodeId(msg.routerNodeId());
+ node.aliveCheck(spi.maxMissedClientHbs);
}
- }
-
- UUID nodeId = msg.creatorNodeId();
- TcpDiscoveryNode node = ring.node(nodeId);
+ if (isLocalNodeCoordinator()) {
+ msg.verify(locNodeId);
- assert node == null || node.isClient();
+ if (node != null) {
+ Collection<TcpDiscoveryAbstractMessage> pending = msgHist.messages(msg.lastMessageId(), node);
- if (node != null) {
- assert node.isClient();
+ if (pending != null) {
+ msg.pendingMessages(pending);
+ msg.success(true);
- node.clientRouterNodeId(msg.routerNodeId());
- node.aliveCheck(spi.maxMissedClientHbs);
+ if (log.isDebugEnabled())
+ log.debug("Accept client reconnect, restored pending messages " +
+ "[locNodeId=" + locNodeId + ", clientNodeId=" + nodeId + ']');
+ }
+ else {
+ if (log.isDebugEnabled())
+ log.debug("Failing reconnecting client node because failed to restore pending " +
+ "messages [locNodeId=" + locNodeId + ", clientNodeId=" + nodeId + ']');
- if (isLocalNodeCoordinator()) {
- Collection<TcpDiscoveryAbstractMessage> pending = msgHist.messages(msg.lastMessageId(), node);
+ processNodeFailedMessage(new TcpDiscoveryNodeFailedMessage(locNodeId,
+ node.id(), node.internalOrder()));
+ }
+ }
+ else if (log.isDebugEnabled())
+ log.debug("Reconnecting client node is already failed [nodeId=" + nodeId + ']');
- if (pending != null) {
- msg.pendingMessages(pending);
- msg.success(true);
+ if (isLocNodeRouter) {
+ ClientMessageWorker wrk = clientMsgWorkers.get(nodeId);
- if (log.isDebugEnabled())
- log.debug("Accept client reconnect, restored pending messages " +
- "[locNodeId=" + locNodeId + ", clientNodeId=" + nodeId + ']');
+ if (wrk != null)
+ wrk.addMessage(msg);
+ else if (log.isDebugEnabled())
+ log.debug("Failed to reconnect client node (disconnected during the process) [locNodeId=" +
+ locNodeId + ", clientNodeId=" + nodeId + ']');
}
else {
- if (log.isDebugEnabled())
- log.debug("Failing reconnecting client node because failed to restore pending " +
- "messages [locNodeId=" + locNodeId + ", clientNodeId=" + nodeId + ']');
-
- processNodeFailedMessage(new TcpDiscoveryNodeFailedMessage(locNodeId,
- node.id(), node.internalOrder()));
+ if (ring.hasRemoteNodes())
+ sendMessageAcrossRing(msg);
}
}
- }
- else if (log.isDebugEnabled())
- log.debug("Reconnecting client node is already failed [nodeId=" + nodeId + ']');
-
- if (isLocNodeRouter) {
- ClientMessageWorker wrk = clientMsgWorkers.get(nodeId);
-
- if (wrk != null)
- wrk.addMessage(msg);
- else if (log.isDebugEnabled())
- log.debug("Failed to reconnect client node (disconnected during the process) [locNodeId=" +
- locNodeId + ", clientNodeId=" + nodeId + ']');
+ else {
+ if (ring.hasRemoteNodes())
+ sendMessageAcrossRing(msg);
+ }
}
else {
- if (ring.hasRemoteNodes())
- sendMessageAcrossRing(msg);
+ if (isLocNodeRouter) {
+ ClientMessageWorker wrk = clientMsgWorkers.get(nodeId);
+
+ if (wrk != null)
+ wrk.addMessage(msg);
+ else if (log.isDebugEnabled())
+ log.debug("Failed to reconnect client node (disconnected during the process) [locNodeId=" +
+ locNodeId + ", clientNodeId=" + nodeId + ']');
+ }
+ else {
+ if (ring.hasRemoteNodes() && !locNodeId.equals(msg.verifierNodeId()))
+ sendMessageAcrossRing(msg);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/04f4f54a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
index 14417c1..344efc0 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
@@ -21,7 +21,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import java.net.SocketTimeoutException;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -170,11 +172,26 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
}
/**
+ * @throws Exception If failed.
+ */
+ public void testClientReconnectOnCoordinatorRouterFail1() throws Exception {
+ clientReconnectOnCoordinatorRouterFail(1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testClientReconnectOnCoordinatorRouterFail2() throws Exception {
+ clientReconnectOnCoordinatorRouterFail(2);
+ }
+
+ /**
* Test tries to provoke scenario when client sends reconnect message before router failure detected.
*
+ * @param srvNodes Number of additional server nodes.
* @throws Exception If failed.
*/
- public void _testClientReconnectOnCoordinatorRouterFail() throws Exception {
+ public void clientReconnectOnCoordinatorRouterFail(int srvNodes) throws Exception {
startServerNodes(1);
Ignite srv = G.ignite("server-0");
@@ -189,24 +206,28 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
Collections.singleton("localhost:" + srvNode.discoveryPort() + ".." + (srvNode.discoveryPort() + 1)));
failureThreshold = 1000L;
- netTimeout = 500L;
+ netTimeout = 1000L;
startClientNodes(1); // Client should connect to coordinator.
failureThreshold = 10_000L;
netTimeout = 5000L;
- for (int i = 0; i < 2; i++) {
+ List<String> nodes = new ArrayList<>();
+
+ for (int i = 0; i < srvNodes; i++) {
Ignite g = startGrid("server-" + srvIdx.getAndIncrement());
+ nodes.add(g.name());
+
srvNodeIds.add(g.cluster().localNode().id());
}
- checkNodes(3, 1);
+ checkNodes(1 + srvNodes, 1);
- final CountDownLatch latch = new CountDownLatch(3);
+ nodes.add("client-0");
- String nodes[] = {"server-1", "server-2", "client-0"};
+ final CountDownLatch latch = new CountDownLatch(nodes.size());
final AtomicBoolean err = new AtomicBoolean();
[21/46] ignite git commit: Fixed test.
Posted by sb...@apache.org.
Fixed test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f6ba3c3b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f6ba3c3b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f6ba3c3b
Branch: refs/heads/ignite-1093-2
Commit: f6ba3c3b4575c60f94ae4742b5d2d7bd2183f938
Parents: 4b0c029
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 24 12:56:19 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 24 12:56:19 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheVariableTopologySelfTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ba3c3b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
index 7078843..80103c3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache;
import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.CacheException;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -146,7 +147,7 @@ public class GridCacheVariableTopologySelfTest extends GridCommonAbstractTest {
catch (TransactionRollbackException | ClusterTopologyException e) {
info("Caught exception: " + e);
}
- catch (IgniteException e) {
+ catch (CacheException | IgniteException e) {
if (X.hasCause(e, ClusterTopologyCheckedException.class))
info("Caught cache exception: " + e);
else
[16/46] ignite git commit: Merging IGNITE-1171 - fixed problems with
custom events in discovery
Posted by sb...@apache.org.
Merging IGNITE-1171 - fixed problems with custom events in discovery
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6f3ef6a8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6f3ef6a8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6f3ef6a8
Branch: refs/heads/ignite-1093-2
Commit: 6f3ef6a84ee1c3e77d32ca9930835d1720918e20
Parents: 517d0f5
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Sep 23 16:36:15 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Sep 23 16:36:15 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/IgniteAtomicLong.java | 2 +-
.../cache/DynamicCacheDescriptor.java | 10 +-
.../GridCachePartitionExchangeManager.java | 6 +
.../processors/cache/GridCacheProcessor.java | 18 +-
.../continuous/CacheContinuousQueryManager.java | 10 +-
.../communication/tcp/TcpCommunicationSpi.java | 7 +-
.../discovery/DiscoverySpiCustomMessage.java | 12 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 301 ++++++++++++++----
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 6 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 94 ++----
.../messages/TcpDiscoveryDiscardMessage.java | 15 +-
.../TcpDiscoveryNodeAddFinishedMessage.java | 2 +-
.../messages/TcpDiscoveryNodeAddedMessage.java | 19 +-
.../distributed/CacheAffEarlySelfTest.java | 245 ---------------
.../distributed/CacheAffinityEarlyTest.java | 168 ++++++++++
...GridCacheValueConsistencyAtomicSelfTest.java | 2 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 53 ++--
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 315 ++++++++++++++++++-
.../testsuites/IgniteCacheTestSuite4.java | 2 +
20 files changed, 864 insertions(+), 425 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java
index 83e2525..bac1a68 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java
@@ -160,4 +160,4 @@ public interface IgniteAtomicLong extends Closeable {
* @throws IgniteException If operation failed.
*/
@Override public void close();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
index f3c3be9..3cfc34e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
@@ -39,9 +39,6 @@ public class DynamicCacheDescriptor {
@GridToStringExclude
private CacheConfiguration cacheCfg;
- /** Cancelled flag. */
- private boolean cancelled;
-
/** Locally configured flag. */
private boolean locCfg;
@@ -156,6 +153,13 @@ public class DynamicCacheDescriptor {
}
/**
+ * @return Started flag.
+ */
+ public boolean started() {
+ return started;
+ }
+
+ /**
* @return Cache configuration.
*/
public CacheConfiguration cacheConfiguration() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/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 34c571c..eb76233 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
@@ -1435,6 +1435,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
private static final long serialVersionUID = 0L;
/** */
+ @GridToStringInclude
private AffinityTopologyVersion topVer;
/**
@@ -1455,5 +1456,10 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
return done;
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(AffinityReadyFuture.class, this, super.toString());
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/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 e92ea57..74124bf 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
@@ -1522,10 +1522,15 @@ public class GridCacheProcessor extends GridProcessorAdapter {
* @return Collection of started cache names.
*/
public Collection<String> cacheNames() {
- return F.viewReadOnly(registeredCaches.keySet(),
- new IgniteClosure<String, String>() {
- @Override public String apply(String s) {
- return unmaskNull(s);
+ return F.viewReadOnly(registeredCaches.values(),
+ new IgniteClosure<DynamicCacheDescriptor, String>() {
+ @Override public String apply(DynamicCacheDescriptor desc) {
+ return desc.cacheConfiguration().getName();
+ }
+ },
+ new IgnitePredicate<DynamicCacheDescriptor>() {
+ @Override public boolean apply(DynamicCacheDescriptor desc) {
+ return desc.started();
}
});
}
@@ -1568,6 +1573,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
req.deploymentId(),
topVer
);
+
+ DynamicCacheDescriptor desc = registeredCaches.get(maskNull(req.cacheName()));
+
+ if (desc != null)
+ desc.onStart();
}
// Start statically configured caches received from remote nodes during exchange.
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index da02b97..c719f1e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -448,8 +448,12 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
taskNameHash,
skipPrimaryCheck);
- UUID id = cctx.kernalContext().continuous().startRoutine(hnd, bufSize, timeInterval,
- autoUnsubscribe, grp.predicate()).get();
+ UUID id = cctx.kernalContext().continuous().startRoutine(
+ hnd,
+ bufSize,
+ timeInterval,
+ autoUnsubscribe,
+ grp.predicate()).get();
if (notifyExisting) {
final Iterator<GridCacheEntryEx> it = cctx.cache().allEntries().iterator();
@@ -811,4 +815,4 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 2594213..c93d5af 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -2126,8 +2126,9 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
if (failureDetectionTimeoutEnabled() && (e instanceof HandshakeTimeoutException ||
timeoutHelper.checkFailureTimeoutReached(e))) {
- log.debug("Handshake timed out (failure threshold reached) [failureDetectionTimeout=" +
- failureDetectionTimeout() + ", err=" + e.getMessage() + ", client=" + client + ']');
+ if (log.isDebugEnabled())
+ log.debug("Handshake timed out (failure threshold reached) [failureDetectionTimeout=" +
+ failureDetectionTimeout() + ", err=" + e.getMessage() + ", client=" + client + ']');
throw e;
}
@@ -2700,7 +2701,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
*
* FOR TEST PURPOSES ONLY!!!
*/
- void simulateNodeFailure() {
+ public void simulateNodeFailure() {
if (nioSrvr != null)
nioSrvr.stop();
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiCustomMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiCustomMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiCustomMessage.java
index 373c121..a0f9b75 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiCustomMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiCustomMessage.java
@@ -5,9 +5,9 @@
* 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.
@@ -18,13 +18,15 @@
package org.apache.ignite.spi.discovery;
import java.io.Serializable;
+
+import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
+import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
import org.jetbrains.annotations.Nullable;
/**
* Message to send across ring.
*
- * @see org.apache.ignite.internal.managers.discovery.GridDiscoveryManager#sendCustomEvent(
- * org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage)
+ * @see GridDiscoveryManager#sendCustomEvent(DiscoveryCustomMessage)
*/
public interface DiscoverySpiCustomMessage extends Serializable {
/**
@@ -36,4 +38,4 @@ public interface DiscoverySpiCustomMessage extends Serializable {
* @return {@code true} if message can be modified during listener notification. Changes will be send to next nodes.
*/
public boolean isMutable();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/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 8a205d2..d8ee953 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
@@ -37,10 +37,13 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.NoSuchElementException;
import java.util.Queue;
+import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.UUID;
@@ -64,6 +67,7 @@ import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.events.DiscoveryCustomEvent;
import org.apache.ignite.internal.processors.security.SecurityContext;
+import org.apache.ignite.internal.util.GridBoundedLinkedHashSet;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -145,7 +149,7 @@ import static org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryStatusChe
/**
*
*/
-@SuppressWarnings("NonPrivateFieldAccessedInSynchronizedContext")
+@SuppressWarnings("All")
class ServerImpl extends TcpDiscoveryImpl {
/** */
private final ThreadPoolExecutor utilityPool = new ThreadPoolExecutor(0, 1, 2000, TimeUnit.MILLISECONDS,
@@ -1368,8 +1372,13 @@ class ServerImpl extends TcpDiscoveryImpl {
* @param msgs Messages to include.
* @param discardMsgId Discarded message ID.
*/
- private void prepareNodeAddedMessage(TcpDiscoveryAbstractMessage msg, UUID destNodeId,
- @Nullable Collection<TcpDiscoveryAbstractMessage> msgs, @Nullable IgniteUuid discardMsgId) {
+ private void prepareNodeAddedMessage(
+ TcpDiscoveryAbstractMessage msg,
+ UUID destNodeId,
+ @Nullable Collection<TcpDiscoveryAbstractMessage> msgs,
+ @Nullable IgniteUuid discardMsgId,
+ @Nullable IgniteUuid discardCustomMsgId
+ ) {
assert destNodeId != null;
if (msg instanceof TcpDiscoveryNodeAddedMessage) {
@@ -1393,7 +1402,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
nodeAddedMsg.topology(topToSnd);
- nodeAddedMsg.messages(msgs, discardMsgId);
+ nodeAddedMsg.messages(msgs, discardMsgId, discardCustomMsgId);
Map<Long, Collection<ClusterNode>> hist;
@@ -1416,7 +1425,7 @@ class ServerImpl extends TcpDiscoveryImpl {
nodeAddedMsg.topology(null);
nodeAddedMsg.topologyHistory(null);
- nodeAddedMsg.messages(null, null);
+ nodeAddedMsg.messages(null, null, null);
}
}
@@ -1825,7 +1834,7 @@ class ServerImpl extends TcpDiscoveryImpl {
*/
private TcpDiscoveryAbstractMessage prepare(TcpDiscoveryAbstractMessage msg, UUID destNodeId) {
if (msg instanceof TcpDiscoveryNodeAddedMessage)
- prepareNodeAddedMessage(msg, destNodeId, null, null);
+ prepareNodeAddedMessage(msg, destNodeId, null, null, null);
return msg;
}
@@ -1834,16 +1843,22 @@ class ServerImpl extends TcpDiscoveryImpl {
/**
* Pending messages container.
*/
- private static class PendingMessages {
+ private static class PendingMessages implements Iterable<TcpDiscoveryAbstractMessage> {
/** */
private static final int MAX = 1024;
/** Pending messages. */
private final Queue<TcpDiscoveryAbstractMessage> msgs = new ArrayDeque<>(MAX * 2);
+ /** Processed custom message IDs. */
+ private Set<IgniteUuid> procCustomMsgs = new GridBoundedLinkedHashSet<IgniteUuid>(MAX * 2);
+
/** Discarded message ID. */
private IgniteUuid discardId;
+ /** Discarded message ID. */
+ private IgniteUuid customDiscardId;
+
/**
* Adds pending message and shrinks queue if it exceeds limit
* (messages that were not discarded yet are never removed).
@@ -1869,31 +1884,118 @@ class ServerImpl extends TcpDiscoveryImpl {
* @param msgs Message.
* @param discardId Discarded message ID.
*/
- void reset(@Nullable Collection<TcpDiscoveryAbstractMessage> msgs, @Nullable IgniteUuid discardId) {
+ void reset(
+ @Nullable Collection<TcpDiscoveryAbstractMessage> msgs,
+ @Nullable IgniteUuid discardId,
+ @Nullable IgniteUuid customDiscardId
+ ) {
this.msgs.clear();
if (msgs != null)
this.msgs.addAll(msgs);
this.discardId = discardId;
+ this.customDiscardId = customDiscardId;
}
/**
- * Clears pending messages.
+ * Discards message with provided ID and all before it.
+ *
+ * @param id Discarded message ID.
*/
- void clear() {
- msgs.clear();
+ void discard(IgniteUuid id, boolean custom) {
+ if (custom)
+ customDiscardId = id;
+ else
+ discardId = id;
+ }
- discardId = null;
+ /**
+ * Gets iterator for non-discarded messages.
+ *
+ * @return Non-discarded messages iterator.
+ */
+ public Iterator<TcpDiscoveryAbstractMessage> iterator() {
+ return new SkipIterator();
}
/**
- * Discards message with provided ID and all before it.
*
- * @param id Discarded message ID.
*/
- void discard(IgniteUuid id) {
- discardId = id;
+ private class SkipIterator implements Iterator<TcpDiscoveryAbstractMessage> {
+ /** Skip non-custom messages flag. */
+ private boolean skipMsg = discardId != null;
+
+ /** Skip custom messages flag. */
+ private boolean skipCustomMsg;
+
+ /** Internal iterator. */
+ private Iterator<TcpDiscoveryAbstractMessage> msgIt = msgs.iterator();
+
+ /** Next message. */
+ private TcpDiscoveryAbstractMessage next;
+
+ {
+ advance();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean hasNext() {
+ return next != null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public TcpDiscoveryAbstractMessage next() {
+ if (next == null)
+ throw new NoSuchElementException();
+
+ TcpDiscoveryAbstractMessage next0 = next;
+
+ advance();
+
+ return next0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Advances iterator to the next available item.
+ */
+ private void advance() {
+ next = null;
+
+ while (msgIt.hasNext()) {
+ TcpDiscoveryAbstractMessage msg0 = msgIt.next();
+
+ if (msg0 instanceof TcpDiscoveryCustomEventMessage) {
+ if (skipCustomMsg) {
+ assert customDiscardId != null;
+
+ if (F.eq(customDiscardId, msg0.id()))
+ skipCustomMsg = false;
+
+ continue;
+ }
+ }
+ else {
+ if (skipMsg) {
+ assert discardId != null;
+
+ if (F.eq(discardId, msg0.id()))
+ skipMsg = false;
+
+ continue;
+ }
+ }
+
+ next = msg0;
+
+ break;
+ }
+ }
}
}
@@ -1941,6 +2043,12 @@ class ServerImpl extends TcpDiscoveryImpl {
/** Connection check threshold. */
private long connCheckThreshold;
+ /** Pending custom messages that should not be sent between NodeAdded and NodeAddFinished messages. */
+ private Queue<TcpDiscoveryCustomEventMessage> pendingCustomMsgs = new ArrayDeque<>();
+
+ /** Collection to track joining nodes. */
+ private Set<UUID> joiningNodes = new HashSet<>();
+
/**
*/
protected RingMessageWorker() {
@@ -2046,6 +2154,8 @@ class ServerImpl extends TcpDiscoveryImpl {
sendHeartbeatMessage();
checkHeartbeatsReceiving();
+
+ checkPendingCustomMessages();
}
/**
@@ -2323,20 +2433,11 @@ class ServerImpl extends TcpDiscoveryImpl {
debugLog("Pending messages will be sent [failure=" + failure +
", forceSndPending=" + forceSndPending + ']');
- boolean skip = pendingMsgs.discardId != null;
-
- for (TcpDiscoveryAbstractMessage pendingMsg : pendingMsgs.msgs) {
- if (skip) {
- if (pendingMsg.id().equals(pendingMsgs.discardId))
- skip = false;
-
- continue;
- }
-
+ for (TcpDiscoveryAbstractMessage pendingMsg : pendingMsgs) {
long tstamp = U.currentTimeMillis();
prepareNodeAddedMessage(pendingMsg, next.id(), pendingMsgs.msgs,
- pendingMsgs.discardId);
+ pendingMsgs.discardId, pendingMsgs.customDiscardId);
if (timeoutHelper == null)
timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
@@ -2354,13 +2455,13 @@ class ServerImpl extends TcpDiscoveryImpl {
int res = spi.readReceipt(sock, timeoutHelper.nextTimeoutChunk(ackTimeout0));
if (log.isDebugEnabled())
- log.debug("Pending message has been sent to next node [msg=" + msg.id() +
- ", pendingMsgId=" + pendingMsg + ", next=" + next.id() +
+ log.debug("Pending message has been sent to next node [msgId=" + msg.id() +
+ ", pendingMsgId=" + pendingMsg.id() + ", next=" + next.id() +
", res=" + res + ']');
if (debugMode)
- debugLog("Pending message has been sent to next node [msg=" + msg.id() +
- ", pendingMsgId=" + pendingMsg + ", next=" + next.id() +
+ debugLog("Pending message has been sent to next node [msgId=" + msg.id() +
+ ", pendingMsgId=" + pendingMsg.id() + ", next=" + next.id() +
", res=" + res + ']');
// Resetting timeout control object to create a new one for the next bunch of
@@ -2377,7 +2478,8 @@ class ServerImpl extends TcpDiscoveryImpl {
msg = new TcpDiscoveryStatusCheckMessage(locNode, null);
}
else
- prepareNodeAddedMessage(msg, next.id(), pendingMsgs.msgs, pendingMsgs.discardId);
+ prepareNodeAddedMessage(msg, next.id(), pendingMsgs.msgs, pendingMsgs.discardId,
+ pendingMsgs.customDiscardId);
try {
long tstamp = U.currentTimeMillis();
@@ -2478,21 +2580,6 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
- if (msg instanceof TcpDiscoveryStatusCheckMessage) {
- TcpDiscoveryStatusCheckMessage msg0 = (TcpDiscoveryStatusCheckMessage)msg;
-
- if (next.id().equals(msg0.failedNodeId())) {
- next = null;
-
- if (log.isDebugEnabled())
- log.debug("Discarding status check since next node has indeed failed [next=" + next +
- ", msg=" + msg + ']');
-
- // Discard status check message by exiting loop and handle failure.
- break;
- }
- }
-
next = null;
searchNext = true;
@@ -2524,6 +2611,29 @@ class ServerImpl extends TcpDiscoveryImpl {
for (TcpDiscoveryNode n : failedNodes)
msgWorker.addMessage(new TcpDiscoveryNodeFailedMessage(locNodeId, n.id(), n.internalOrder()));
+ if (!sent) {
+ if (log.isDebugEnabled())
+ log.debug("Pending messages will be resent to local node");
+
+ if (debugMode)
+ log.debug("Pending messages will be resent to local node");
+
+ for (TcpDiscoveryAbstractMessage pendingMsg : pendingMsgs) {
+ prepareNodeAddedMessage(pendingMsg, locNodeId, pendingMsgs.msgs, pendingMsgs.discardId,
+ pendingMsgs.customDiscardId);
+
+ msgWorker.addMessage(pendingMsg);
+
+ if (log.isDebugEnabled())
+ log.debug("Pending message has been sent to local node [msg=" + msg.id() +
+ ", pendingMsgId=" + pendingMsg + ", next=" + next.id() + ']');
+
+ if (debugMode)
+ debugLog("Pending message has been sent to local node [msg=" + msg.id() +
+ ", pendingMsgId=" + pendingMsg + ", next=" + next.id() + ']');
+ }
+ }
+
LT.warn(log, null, "Local node has detected failed nodes and started cluster-wide procedure. " +
"To speed up failure detection please see 'Failure Detection' section under javadoc" +
" for 'TcpDiscoverySpi'");
@@ -3077,7 +3187,7 @@ class ServerImpl extends TcpDiscoveryImpl {
processNodeAddFinishedMessage(addFinishMsg);
- addMessage(new TcpDiscoveryDiscardMessage(locNodeId, msg.id()));
+ addMessage(new TcpDiscoveryDiscardMessage(locNodeId, msg.id(), false));
return;
}
@@ -3118,6 +3228,8 @@ class ServerImpl extends TcpDiscoveryImpl {
return;
}
+ joiningNodes.add(node.id());
+
if (!isLocalNodeCoordinator() && spi.nodeAuth != null && spi.nodeAuth.isGlobalNodeAuthentication()) {
boolean authFailed = true;
@@ -3222,6 +3334,8 @@ class ServerImpl extends TcpDiscoveryImpl {
n.visible(true);
}
+ joiningNodes.clear();
+
locNode.setAttributes(node.attributes());
locNode.visible(true);
@@ -3237,10 +3351,11 @@ class ServerImpl extends TcpDiscoveryImpl {
topHist.clear();
topHist.putAll(msg.topologyHistory());
- pendingMsgs.discard(msg.discardedMessageId());
+ pendingMsgs.reset(msg.messages(), msg.discardedMessageId(),
+ msg.discardedCustomMessageId());
// Clear data to minimize message size.
- msg.messages(null, null);
+ msg.messages(null, null, null);
msg.topology(null);
msg.topologyHistory(null);
msg.clearDiscoveryData();
@@ -3307,7 +3422,7 @@ class ServerImpl extends TcpDiscoveryImpl {
if (msg.verified()) {
spi.stats.onRingMessageReceived(msg);
- addMessage(new TcpDiscoveryDiscardMessage(locNodeId, msg.id()));
+ addMessage(new TcpDiscoveryDiscardMessage(locNodeId, msg.id(), false));
return;
}
@@ -3342,7 +3457,11 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
- if (msg.verified() && !locNodeId.equals(nodeId) && spiStateCopy() == CONNECTED && fireEvt) {
+ joiningNodes.remove(nodeId);
+
+ TcpDiscoverySpiState state = spiStateCopy();
+
+ if (msg.verified() && !locNodeId.equals(nodeId) && state != CONNECTING && fireEvt) {
spi.stats.onNodeJoined();
// Make sure that node with greater order will never get EVT_NODE_JOINED
@@ -3357,7 +3476,7 @@ class ServerImpl extends TcpDiscoveryImpl {
boolean b = ring.topologyVersion(topVer);
assert b : "Topology version has not been updated: [ring=" + ring + ", msg=" + msg +
- ", lastMsg=" + lastMsg + ", spiState=" + spiStateCopy() + ']';
+ ", lastMsg=" + lastMsg + ", spiState=" + state + ']';
if (log.isDebugEnabled())
log.debug("Topology version has been updated: [ring=" + ring + ", msg=" + msg + ']');
@@ -3365,7 +3484,8 @@ class ServerImpl extends TcpDiscoveryImpl {
lastMsg = msg;
}
- notifyDiscovery(EVT_NODE_JOINED, topVer, node);
+ if (state == CONNECTED)
+ notifyDiscovery(EVT_NODE_JOINED, topVer, node);
try {
if (spi.ipFinder.isShared() && locNodeCoord)
@@ -3381,7 +3501,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
- if (msg.verified() && locNodeId.equals(nodeId) && spiStateCopy() == CONNECTING) {
+ if (msg.verified() && locNodeId.equals(nodeId) && state == CONNECTING) {
assert node != null;
assert topVer > 0 : "Invalid topology version: " + msg;
@@ -3402,6 +3522,8 @@ class ServerImpl extends TcpDiscoveryImpl {
if (ring.hasRemoteNodes())
sendMessageAcrossRing(msg);
+
+ checkPendingCustomMessages();
}
/**
@@ -3481,7 +3603,7 @@ class ServerImpl extends TcpDiscoveryImpl {
if (msg.verified()) {
spi.stats.onRingMessageReceived(msg);
- addMessage(new TcpDiscoveryDiscardMessage(locNodeId, msg.id()));
+ addMessage(new TcpDiscoveryDiscardMessage(locNodeId, msg.id(), false));
return;
}
@@ -3553,6 +3675,8 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
+ joiningNodes.remove(leftNode.id());
+
spi.stats.onNodeLeft();
notifyDiscovery(EVT_NODE_LEFT, topVer, leftNode);
@@ -3580,6 +3704,8 @@ class ServerImpl extends TcpDiscoveryImpl {
U.closeQuiet(sock);
}
+
+ checkPendingCustomMessages();
}
/**
@@ -3650,7 +3776,7 @@ class ServerImpl extends TcpDiscoveryImpl {
if (msg.verified()) {
spi.stats.onRingMessageReceived(msg);
- addMessage(new TcpDiscoveryDiscardMessage(locNodeId, msg.id()));
+ addMessage(new TcpDiscoveryDiscardMessage(locNodeId, msg.id(), false));
return;
}
@@ -3707,6 +3833,8 @@ class ServerImpl extends TcpDiscoveryImpl {
", msg=" + msg.warning() + ']');
}
+ joiningNodes.remove(node.id());
+
notifyDiscovery(EVT_NODE_FAILED, topVer, node);
spi.stats.onNodeFailed();
@@ -3720,6 +3848,8 @@ class ServerImpl extends TcpDiscoveryImpl {
U.closeQuiet(sock);
}
+
+ checkPendingCustomMessages();
}
/**
@@ -4046,7 +4176,7 @@ class ServerImpl extends TcpDiscoveryImpl {
}
if (msg.verified())
- pendingMsgs.discard(msgId);
+ pendingMsgs.discard(msgId, msg.customMessageDiscard());
if (ring.hasRemoteNodes())
sendMessageAcrossRing(msg);
@@ -4098,18 +4228,23 @@ class ServerImpl extends TcpDiscoveryImpl {
*/
private void processCustomMessage(TcpDiscoveryCustomEventMessage msg) {
if (isLocalNodeCoordinator()) {
- boolean sndNext;
+ if (!joiningNodes.isEmpty()) {
+ pendingCustomMsgs.add(msg);
- if (!msg.verified()) {
+ return;
+ }
+
+ boolean sndNext = !msg.verified();
+
+ if (sndNext) {
msg.verify(getLocalNodeId());
msg.topologyVersion(ring.topologyVersion());
- notifyDiscoveryListener(msg);
-
- sndNext = true;
+ if (pendingMsgs.procCustomMsgs.add(msg.id()))
+ notifyDiscoveryListener(msg);
+ else
+ sndNext = false;
}
- else
- sndNext = false;
if (sndNext && ring.hasRemoteNodes())
sendMessageAcrossRing(msg);
@@ -4139,12 +4274,30 @@ class ServerImpl extends TcpDiscoveryImpl {
}
}
- addMessage(new TcpDiscoveryDiscardMessage(getLocalNodeId(), msg.id()));
+ addMessage(new TcpDiscoveryDiscardMessage(getLocalNodeId(), msg.id(), true));
}
}
else {
- if (msg.verified())
+ TcpDiscoverySpiState state0;
+
+ synchronized (mux) {
+ state0 = spiState;
+ }
+
+ if (msg.verified() && msg.topologyVersion() != ring.topologyVersion()) {
+ if (log.isDebugEnabled())
+ log.debug("Discarding custom event message [msg=" + msg + ", ring=" + ring + ']');
+
+ return;
+ }
+
+ if (msg.verified() && state0 == CONNECTED && pendingMsgs.procCustomMsgs.add(msg.id())) {
+ assert joiningNodes.isEmpty() : "Joining nodes: " + joiningNodes + ", msg=" + msg + ", loc=" + locNode.id() +
+ ", topver=" + ring.topologyVersion();
+ assert msg.topologyVersion() == ring.topologyVersion() : "msg: " + msg + ", topver=" + ring.topologyVersion();
+
notifyDiscoveryListener(msg);
+ }
if (ring.hasRemoteNodes())
sendMessageAcrossRing(msg);
@@ -4152,6 +4305,18 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
+ * Checks and flushes custom event messages if no nodes are attempting to join the grid.
+ */
+ private void checkPendingCustomMessages() {
+ if (joiningNodes.isEmpty() && isLocalNodeCoordinator()) {
+ TcpDiscoveryCustomEventMessage msg;
+
+ while ((msg = pendingCustomMsgs.poll()) != null)
+ processCustomMessage(msg);
+ }
+ }
+
+ /**
* @param msg Custom message.
*/
private void notifyDiscoveryListener(TcpDiscoveryCustomEventMessage msg) {
@@ -5081,7 +5246,7 @@ class ServerImpl extends TcpDiscoveryImpl {
log.debug("Redirecting message to client [sock=" + sock + ", locNodeId="
+ getLocalNodeId() + ", rmtNodeId=" + clientNodeId + ", msg=" + msg + ']');
- prepareNodeAddedMessage(msg, clientNodeId, null, null);
+ prepareNodeAddedMessage(msg, clientNodeId, null, null, null);
writeToSocket(sock, msg, spi.failureDetectionTimeoutEnabled() ?
spi.failureDetectionTimeout() : spi.getSocketTimeout());
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
index e5be530..2786d0b 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryImpl.java
@@ -5,9 +5,9 @@
* 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.
@@ -313,4 +313,4 @@ abstract class TcpDiscoveryImpl {
return res;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 80fcc46..6254605 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -2038,4 +2038,4 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
return S.toString(SocketTimeoutObject.class, this);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
index 2b17696..7ca092c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNodesRing.java
@@ -17,7 +17,17 @@
package org.apache.ignite.spi.discovery.tcp.internal;
-import java.util.ArrayList;
+import org.apache.ignite.cluster.ClusterNode;
+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.P1;
+import org.apache.ignite.internal.util.typedef.PN;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.jetbrains.annotations.Nullable;
+
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -29,16 +39,6 @@ import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.ignite.cluster.ClusterNode;
-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.P1;
-import org.apache.ignite.internal.util.typedef.PN;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgnitePredicate;
-import org.jetbrains.annotations.Nullable;
/**
* Convenient way to represent topology for {@link org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi}
@@ -81,6 +81,9 @@ public class TcpDiscoveryNodesRing {
/** */
private long nodeOrder;
+ /** */
+ private long maxInternalOrder;
+
/** Lock. */
@GridToStringExclude
private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
@@ -99,6 +102,8 @@ public class TcpDiscoveryNodesRing {
this.locNode = locNode;
clear();
+
+ maxInternalOrder = locNode.internalOrder();
}
finally {
rwLock.writeLock().unlock();
@@ -204,7 +209,9 @@ public class TcpDiscoveryNodesRing {
if (nodesMap.containsKey(node.id()))
return false;
- assert node.internalOrder() > maxInternalOrder() : "Adding node to the middle of the ring " +
+ long maxInternalOrder0 = maxInternalOrder();
+
+ assert node.internalOrder() > maxInternalOrder0 : "Adding node to the middle of the ring " +
"[ring=" + this + ", node=" + node + ']';
nodesMap.put(node.id(), node);
@@ -216,6 +223,8 @@ public class TcpDiscoveryNodesRing {
nodes.add(node);
nodeOrder = node.internalOrder();
+
+ maxInternalOrder = node.internalOrder();
}
finally {
rwLock.writeLock().unlock();
@@ -231,9 +240,13 @@ public class TcpDiscoveryNodesRing {
rwLock.readLock().lock();
try {
- TcpDiscoveryNode last = nodes.last();
+ if (maxInternalOrder == 0) {
+ TcpDiscoveryNode last = nodes.last();
+
+ return last != null ? maxInternalOrder = last.internalOrder() : -1;
+ }
- return last != null ? last.internalOrder() : -1;
+ return maxInternalOrder;
}
finally {
rwLock.readLock().unlock();
@@ -336,47 +349,6 @@ public class TcpDiscoveryNodesRing {
}
/**
- * Removes nodes from the topology.
- *
- * @param nodeIds IDs of the nodes to remove.
- * @return Collection of removed nodes.
- */
- public Collection<TcpDiscoveryNode> removeNodes(Collection<UUID> nodeIds) {
- assert !F.isEmpty(nodeIds);
-
- rwLock.writeLock().lock();
-
- try {
- boolean firstRmv = true;
-
- Collection<TcpDiscoveryNode> res = null;
-
- for (UUID id : nodeIds) {
- TcpDiscoveryNode rmv = nodesMap.remove(id);
-
- if (rmv != null) {
- if (firstRmv) {
- nodes = new TreeSet<>(nodes);
-
- res = new ArrayList<>(nodeIds.size());
-
- firstRmv = false;
- }
-
- nodes.remove(rmv);
-
- res.add(rmv);
- }
- }
-
- return res == null ? Collections.<TcpDiscoveryNode>emptyList() : res;
- }
- finally {
- rwLock.writeLock().unlock();
- }
- }
-
- /**
* Removes all remote nodes, leaves only local node.
* <p>
* This should be called when SPI should be disconnected from topology and
@@ -397,6 +369,7 @@ public class TcpDiscoveryNodesRing {
nodesMap.put(locNode.id(), locNode);
nodeOrder = 0;
+ maxInternalOrder = 0;
topVer = 0;
}
@@ -622,13 +595,8 @@ public class TcpDiscoveryNodesRing {
rwLock.writeLock().lock();
try {
- if (nodeOrder == 0) {
- TcpDiscoveryNode last = nodes.last();
-
- assert last != null;
-
- nodeOrder = last.internalOrder();
- }
+ if (nodeOrder == 0)
+ nodeOrder = maxInternalOrder();
return ++nodeOrder;
}
@@ -681,4 +649,4 @@ public class TcpDiscoveryNodesRing {
rwLock.readLock().unlock();
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
index 1e1fa6b..145f19e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryDiscardMessage.java
@@ -32,16 +32,20 @@ public class TcpDiscoveryDiscardMessage extends TcpDiscoveryAbstractMessage {
/** ID of the message to discard (this and all preceding). */
private final IgniteUuid msgId;
+ /** True if this is discard ID for custom event message. */
+ private final boolean customMsgDiscard;
+
/**
* Constructor.
*
* @param creatorNodeId Creator node ID.
* @param msgId Message ID.
*/
- public TcpDiscoveryDiscardMessage(UUID creatorNodeId, IgniteUuid msgId) {
+ public TcpDiscoveryDiscardMessage(UUID creatorNodeId, IgniteUuid msgId, boolean customMsgDiscard) {
super(creatorNodeId);
this.msgId = msgId;
+ this.customMsgDiscard = customMsgDiscard;
}
/**
@@ -53,6 +57,15 @@ public class TcpDiscoveryDiscardMessage extends TcpDiscoveryAbstractMessage {
return msgId;
}
+ /**
+ * Flag indicating whether the ID to discard is for a custom message or not.
+ *
+ * @return Custom message flag.
+ */
+ public boolean customMessageDiscard() {
+ return customMsgDiscard;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(TcpDiscoveryDiscardMessage.class, this, "super", super.toString());
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
index c6a469f..1b99a56 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddFinishedMessage.java
@@ -101,4 +101,4 @@ public class TcpDiscoveryNodeAddFinishedMessage extends TcpDiscoveryAbstractMess
@Override public String toString() {
return S.toString(TcpDiscoveryNodeAddFinishedMessage.class, this, "super", super.toString());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
index 01c6789..5a7146d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryNodeAddedMessage.java
@@ -48,6 +48,9 @@ public class TcpDiscoveryNodeAddedMessage extends TcpDiscoveryAbstractMessage {
/** Discarded message ID. */
private IgniteUuid discardMsgId;
+ /** Discarded message ID. */
+ private IgniteUuid discardCustomMsgId;
+
/** Current topology. Initialized by coordinator. */
@GridToStringInclude
private Collection<TcpDiscoveryNode> top;
@@ -117,14 +120,28 @@ public class TcpDiscoveryNodeAddedMessage extends TcpDiscoveryAbstractMessage {
}
/**
+ * Gets discarded custom message ID.
+ *
+ * @return Discarded message ID.
+ */
+ @Nullable public IgniteUuid discardedCustomMessageId() {
+ return discardCustomMsgId;
+ }
+
+ /**
* Sets pending messages to send to new node.
*
* @param msgs Pending messages to send to new node.
* @param discardMsgId Discarded message ID.
*/
- public void messages(@Nullable Collection<TcpDiscoveryAbstractMessage> msgs, @Nullable IgniteUuid discardMsgId) {
+ public void messages(
+ @Nullable Collection<TcpDiscoveryAbstractMessage> msgs,
+ @Nullable IgniteUuid discardMsgId,
+ @Nullable IgniteUuid discardCustomMsgId
+ ) {
this.msgs = msgs;
this.discardMsgId = discardMsgId;
+ this.discardCustomMsgId = discardCustomMsgId;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffEarlySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffEarlySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffEarlySelfTest.java
deleted file mode 100644
index 7f0ca11..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffEarlySelfTest.java
+++ /dev/null
@@ -1,245 +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.distributed;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Random;
-import java.util.UUID;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.IgniteKernal;
-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.IgniteFutureTimeoutException;
-import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- *
- */
-public class CacheAffEarlySelfTest extends GridCommonAbstractTest {
- /** Grid count. */
- private static int GRID_CNT = 8;
-
- /** Operation timeout. */
- private static long OP_TIMEOUT = 5000;
-
- /** Always dump threads or only once per operation. */
- private static boolean ALWAYS_DUMP_THREADS = false;
-
- /** Stopped. */
- private volatile boolean stopped;
-
- /** Iteration. */
- private int iters = 10;
-
- /** Concurrent. */
- private boolean concurrent = true;
-
- /** Futs. */
- private Collection<IgniteInternalFuture<?>> futs = new ArrayList<>(GRID_CNT);
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder(true);
- finder.setAddresses(Collections.singletonList("127.0.0.1:47500..47510"));
-
- TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
- discoSpi.setIpFinder(finder);
-
- cfg.setDiscoverySpi(discoSpi);
-
- OptimizedMarshaller marsh = new OptimizedMarshaller();
- marsh.setRequireSerializable(false);
-
- cfg.setMarshaller(marsh);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected long getTestTimeout() {
- return 6 * 60 * 1000L;
- }
-
- /**
- *
- */
- public void testStartNodes() throws Exception {
- for (int i = 0; i < iters; i++) {
- try {
- System.out.println("*** Iteration " + (i + 1) + '/' + iters);
-
- IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
- @Override public void run() {
- try {
- doTest();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }, 1);
-
- fut.get(30000);
- }
- catch (IgniteFutureTimeoutCheckedException e) {
- // No-op.
- }
- finally {
- stopAllGrids(true);
- }
- }
- }
-
- /**
- *
- */
- public void doTest() throws Exception {
- for (int i = 0; i < GRID_CNT; i++) {
- final int idx = i;
-
- final Ignite grid = concurrent ? null : startGrid(idx);
-
- IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
- @Override public void run() {
- Random rnd = new Random();
-
- try {
- final Ignite ignite = grid == null ? startGrid(idx) : grid;
-
- final IgniteCache<UUID, UUID> cache = getCache(ignite).withAsync();
-
- CacheAffEarlySelfTest.this.execute(cache, new IgniteInClosure<IgniteCache<UUID,UUID>>() {
- @Override public void apply(IgniteCache<UUID, UUID> entries) {
- cache.put(ignite.cluster().localNode().id(), UUID.randomUUID());
- }
- });
-
- while (!stopped) {
- int val = Math.abs(rnd.nextInt(100));
- if (val >= 0 && val < 40)
- execute(cache, new IgniteInClosure<IgniteCache<UUID, UUID>>() {
- @Override public void apply(IgniteCache<UUID, UUID> entries) {
- cache.containsKey(ignite.cluster().localNode().id());
- }
- });
- else if (val >= 40 && val < 80)
- execute(cache, new IgniteInClosure<IgniteCache<UUID, UUID>>() {
- @Override public void apply(IgniteCache<UUID, UUID> entries) {
- cache.get(ignite.cluster().localNode().id());
- }
- });
- else
- execute(cache, new IgniteInClosure<IgniteCache<UUID, UUID>>() {
- @Override public void apply(IgniteCache<UUID, UUID> entries) {
- cache.put(ignite.cluster().localNode().id(), UUID.randomUUID());
- }
- });
-
- Thread.sleep(50);
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }, 1);
-
- futs.add(fut);
- }
-
- Thread.sleep(10000);
-
- stopped = true;
-
- for (IgniteInternalFuture<?> fut : futs)
- fut.get();
- }
-
- /**
- * @param cache Cache.
- * @param c Closure.
- */
- private void execute(IgniteCache<UUID, UUID> cache, IgniteInClosure<IgniteCache<UUID, UUID>> c) {
- c.apply(cache);
-
- IgniteFuture<Object> fut = cache.future();
-
- boolean success = false;
-
- int iter = 0;
-
- while (!success) {
- try {
- fut.get(OP_TIMEOUT);
-
- success = true;
- }
- catch (IgniteFutureTimeoutException e) {
- debug(iter == 0 || ALWAYS_DUMP_THREADS);
- }
-
- iter++;
- }
- }
-
- /**
- *
- */
- private void debug(boolean dumpThreads) {
- log.info("DUMPING DEBUG INFO:");
-
- for (Ignite ignite : G.allGrids())
- ((IgniteKernal)ignite).dumpDebugInfo();
-
- if (dumpThreads) {
- U.dumpThreads(null);
-
- U.dumpThreads(log);
- }
- }
-
- /**
- * @param grid Grid.
- */
- private IgniteCache<UUID, UUID> getCache(Ignite grid) {
- CacheConfiguration<UUID, UUID> ccfg = defaultCacheConfiguration();
-
- ccfg.setCacheMode(CacheMode.PARTITIONED);
- ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
- ccfg.setBackups(1);
- ccfg.setNearConfiguration(null);
-
- return grid.getOrCreateCache(ccfg);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java
new file mode 100644
index 0000000..6b67139
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java
@@ -0,0 +1,168 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
+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;
+
+/**
+ *
+ */
+public class CacheAffinityEarlyTest extends GridCommonAbstractTest {
+ /** Grid count. */
+ private static int GRID_CNT = 8;
+
+ /** Stopped. */
+ private volatile boolean stopped;
+
+ /** Iteration. */
+ private static final int iters = 10;
+
+ /** Concurrent. */
+ private static final boolean concurrent = true;
+
+ /** Futs. */
+ private Collection<IgniteInternalFuture<?>> futs = new ArrayList<>(GRID_CNT);
+
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+ discoSpi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ OptimizedMarshaller marsh = new OptimizedMarshaller();
+ marsh.setRequireSerializable(false);
+
+ cfg.setMarshaller(marsh);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long getTestTimeout() {
+ return 6 * 60 * 1000L;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartNodes() throws Exception {
+ for (int i = 0; i < iters; i++) {
+ try {
+ log.info("Iteration: " + (i + 1) + '/' + iters);
+
+ doTest();
+ }
+ finally {
+ stopAllGrids(true);
+ }
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void doTest() throws Exception {
+ final AtomicBoolean failed = new AtomicBoolean();
+
+ for (int i = 0; i < GRID_CNT; i++) {
+ final int idx = i;
+
+ final Ignite grid = concurrent ? null : startGrid(idx);
+
+ IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+ @Override public void run() {
+ Random rnd = new Random();
+
+ try {
+ Ignite ignite = grid == null ? startGrid(idx) : grid;
+
+ IgniteCache<Object, Object> cache = getCache(ignite);
+
+ cache.put(ignite.cluster().localNode().id(), UUID.randomUUID());
+
+ while (!stopped) {
+ int val = Math.abs(rnd.nextInt(100));
+
+ if (val >= 0 && val < 40)
+ cache.containsKey(ignite.cluster().localNode().id());
+ else if (val >= 40 && val < 80)
+ cache.get(ignite.cluster().localNode().id());
+ else
+ cache.put(ignite.cluster().localNode().id(), UUID.randomUUID());
+
+ Thread.sleep(50);
+ }
+ }
+ catch (Exception e) {
+ log.error("Unexpected error: " + e, e);
+
+ failed.set(true);
+ }
+ }
+ }, 1);
+
+ futs.add(fut);
+ }
+
+ Thread.sleep(10_000);
+
+ stopped = true;
+
+ for (IgniteInternalFuture<?> fut : futs)
+ fut.get();
+
+ assertFalse(failed.get());
+ }
+
+ /**
+ * @param grid Grid.
+ * @return Cache.
+ */
+ private IgniteCache getCache(Ignite grid) {
+ CacheConfiguration ccfg = defaultCacheConfiguration();
+
+ ccfg.setCacheMode(CacheMode.PARTITIONED);
+ ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ ccfg.setBackups(1);
+ ccfg.setNearConfiguration(null);
+
+ return grid.getOrCreateCache(ccfg);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
index 7451911..18c8d8e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheValueConsistencyAtomicSelfTest.java
@@ -35,4 +35,4 @@ public class GridCacheValueConsistencyAtomicSelfTest extends GridCacheValueConsi
@Override protected int iterationCount() {
return 100_000;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index 16fa662..1ccbe1f 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -102,7 +102,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected long getTestTimeout() {
- return 3 * 60 * 1000;
+ return 5 * 60 * 1000;
}
/**
@@ -249,35 +249,48 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
* @throws Exception If any error occurs.
*/
public void testMultipleStartOnCoordinatorStop() throws Exception{
- clientFlagGlobal = false;
+ for (int k = 0; k < 3; k++) {
+ log.info("Iteration: " + k);
- startGrids(GRID_CNT);
+ clientFlagGlobal = false;
- final CyclicBarrier barrier = new CyclicBarrier(GRID_CNT + 4);
+ final int START_NODES = 5;
+ final int JOIN_NODES = 10;
- final AtomicInteger startIdx = new AtomicInteger(GRID_CNT);
+ startGrids(START_NODES);
- IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
- @Override public Object call() throws Exception {
- barrier.await();
+ final CyclicBarrier barrier = new CyclicBarrier(JOIN_NODES + 1);
- Ignite ignite = startGrid(startIdx.getAndIncrement());
+ final AtomicInteger startIdx = new AtomicInteger(START_NODES);
- assertFalse(ignite.configuration().isClientMode());
+ IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ int idx = startIdx.getAndIncrement();
- log.info("Started node: " + ignite.name());
+ Thread.currentThread().setName("start-thread-" + idx);
- return null;
- }
- }, GRID_CNT + 3, "start-thread");
+ barrier.await();
- barrier.await();
+ Ignite ignite = startGrid(idx);
- U.sleep(ThreadLocalRandom.current().nextInt(10, 100));
+ assertFalse(ignite.configuration().isClientMode());
- for (int i = 0; i < GRID_CNT; i++)
- stopGrid(i);
+ log.info("Started node: " + ignite.name());
+
+ return null;
+ }
+ }, JOIN_NODES, "start-thread");
- fut.get();
+ barrier.await();
+
+ U.sleep(ThreadLocalRandom.current().nextInt(10, 100));
+
+ for (int i = 0; i < START_NODES; i++)
+ stopGrid(i);
+
+ fut.get();
+
+ stopAllGrids();
+ }
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index 981f649..0280e9c 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -35,8 +35,10 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
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.IgniteException;
+import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
@@ -45,6 +47,7 @@ import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.port.GridPortRecord;
+import org.apache.ignite.internal.util.io.GridByteArrayOutputStream;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.X;
@@ -52,11 +55,14 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.DiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddedMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage;
import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryPingResponse;
@@ -87,6 +93,9 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
/** */
private UUID nodeId;
+ /** */
+ private TcpDiscoverySpi nodeSpi;
+
/**
* @throws Exception If fails.
*/
@@ -99,8 +108,11 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- TcpDiscoverySpi spi = gridName.contains("testPingInterruptedOnNodeFailedFailingNode") ?
- new TestTcpDiscoverySpi() : new TcpDiscoverySpi();
+ TcpDiscoverySpi spi = nodeSpi;
+
+ if (spi == null)
+ spi = gridName.contains("testPingInterruptedOnNodeFailedFailingNode") ?
+ new TestTcpDiscoverySpi() : new TcpDiscoverySpi();
discoMap.put(gridName, spi);
@@ -1164,6 +1176,305 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed
+ */
+ public void testCustomEventRace1_1() throws Exception {
+ try {
+ customEventRace1(true, false);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed
+ */
+ public void testCustomEventRace1_2() throws Exception {
+ try {
+ customEventRace1(false, false);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed
+ */
+ public void testCustomEventRace1_3() throws Exception {
+ try {
+ customEventRace1(true, true);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @param cacheStartFrom1 If {code true} starts cache from node1.
+ * @param stopCrd If {@code true} stops coordinator.
+ * @throws Exception If failed
+ */
+ private void customEventRace1(final boolean cacheStartFrom1, boolean stopCrd) throws Exception {
+ TestCustomEventRaceSpi spi0 = new TestCustomEventRaceSpi();
+
+ nodeSpi = spi0;
+
+ final Ignite ignite0 = startGrid(0);
+
+ nodeSpi = new TestCustomEventRaceSpi();
+
+ final Ignite ignite1 = startGrid(1);
+
+ CountDownLatch latch1 = new CountDownLatch(1);
+ CountDownLatch latch2 = new CountDownLatch(1);
+
+ spi0.nodeAdded1 = latch1;
+ spi0.nodeAdded2 = latch2;
+ spi0.debug = true;
+
+ IgniteInternalFuture<?> fut1 = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ log.info("Start 2");
+
+ nodeSpi = new TestCustomEventRaceSpi();
+
+ Ignite ignite2 = startGrid(2);
+
+ return null;
+ }
+ });
+
+ latch1.await();
+
+ final String CACHE_NAME = "cache";
+
+ IgniteInternalFuture<?> fut2 = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName(CACHE_NAME);
+
+ Ignite ignite = cacheStartFrom1 ? ignite1 : ignite0;
+
+ ignite.createCache(ccfg);
+
+ return null;
+ }
+ });
+
+ if (stopCrd) {
+ spi0.stop = true;
+
+ latch2.countDown();
+
+ ignite0.close();
+ }
+ else {
+ U.sleep(500);
+
+ latch2.countDown();
+ }
+
+ fut1.get();
+ fut2.get();
+
+ IgniteCache<Object, Object> cache = grid(2).cache(CACHE_NAME);
+
+ assertNotNull(cache);
+
+ cache.put(1, 1);
+
+ assertEquals(1, cache.get(1));
+
+ nodeSpi = new TestCustomEventRaceSpi();
+
+ Ignite ignite = startGrid(3);
+
+ cache = ignite.cache(CACHE_NAME);
+
+ cache.put(2, 2);
+
+ assertEquals(1, cache.get(1));
+ assertEquals(2, cache.get(2));
+ }
+
+ /**
+ * @throws Exception If failed
+ */
+ public void testCustomEventCoordinatorFailure1() throws Exception {
+ try {
+ customEventCoordinatorFailure(true);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed
+ */
+ public void testCustomEventCoordinatorFailure2() throws Exception {
+ try {
+ customEventCoordinatorFailure(false);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @param twoNodes If {@code true} starts two nodes, otherwise three.
+ * @throws Exception If failed
+ */
+ private void customEventCoordinatorFailure(boolean twoNodes) throws Exception {
+ TestCustomEventCoordinatorFailureSpi spi0 = new TestCustomEventCoordinatorFailureSpi();
+
+ nodeSpi = spi0;
+
+ Ignite ignite0 = startGrid(0);
+
+ nodeSpi = new TestCustomEventCoordinatorFailureSpi();
+
+ Ignite ignite1 = startGrid(1);
+
+ nodeSpi = new TestCustomEventCoordinatorFailureSpi();
+
+ Ignite ignite2 = twoNodes ? null : startGrid(2);
+
+ final Ignite createCacheNode = ignite2 != null ? ignite2 : ignite1;
+
+ CountDownLatch latch = new CountDownLatch(1);
+
+ spi0.latch = latch;
+
+ final String CACHE_NAME = "test-cache";
+
+ IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ log.info("Create test cache");
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName(CACHE_NAME);
+
+ createCacheNode.createCache(ccfg);
+
+ return null;
+ }
+ }, "create-cache-thread");
+
+ ((TcpCommunicationSpi)ignite0.configuration().getCommunicationSpi()).simulateNodeFailure();
+
+ latch.await();
+
+ ignite0.close();
+
+ fut.get();
+
+ IgniteCache<Object, Object> cache = grid(1).cache(CACHE_NAME);
+
+ assertNotNull(cache);
+
+ cache.put(1, 1);
+
+ assertEquals(1, cache.get(1));
+
+ log.info("Try start one more node.");
+
+ nodeSpi = new TestCustomEventCoordinatorFailureSpi();
+
+ Ignite ignite = startGrid(twoNodes ? 2 : 3);
+
+ cache = ignite.cache(CACHE_NAME);
+
+ assertNotNull(cache);
+
+ cache.put(2, 2);
+
+ assertEquals(1, cache.get(1));
+ assertEquals(2, cache.get(2));
+ }
+
+ /**
+ *
+ */
+ private static class TestCustomEventCoordinatorFailureSpi extends TcpDiscoverySpi {
+ /** */
+ private volatile CountDownLatch latch;
+
+ /** */
+ private boolean stop;
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg,
+ GridByteArrayOutputStream bout, long timeout) throws IOException, IgniteCheckedException {
+ if (msg instanceof TcpDiscoveryCustomEventMessage && latch != null) {
+ log.info("Stop node on custom event: " + msg);
+
+ latch.countDown();
+
+ stop = true;
+ }
+
+ if (stop)
+ return;
+
+ super.writeToSocket(sock, msg, bout, timeout);
+ }
+ }
+
+ /**
+ *
+ */
+ private static class TestCustomEventRaceSpi extends TcpDiscoverySpi {
+ /** */
+ private volatile CountDownLatch nodeAdded1;
+
+ /** */
+ private volatile CountDownLatch nodeAdded2;
+
+ /** */
+ private volatile boolean stop;
+
+ /** */
+ private boolean debug;
+
+ /** {@inheritDoc} */
+ @Override protected void writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg,
+ GridByteArrayOutputStream bout, long timeout) throws IOException, IgniteCheckedException {
+ if (msg instanceof TcpDiscoveryNodeAddedMessage) {
+ if (nodeAdded1 != null) {
+ nodeAdded1.countDown();
+
+ if (debug)
+ log.info("--- Wait node added: " + msg);
+
+ U.await(nodeAdded2);
+
+ nodeAdded1 = null;
+ nodeAdded2 = null;
+ }
+
+ if (stop)
+ return;
+
+ if (debug)
+ log.info("--- Send node added: " + msg);
+ }
+
+ if (debug && msg instanceof TcpDiscoveryNodeAddFinishedMessage)
+ log.info("--- Send node finished: " + msg);
+
+ if (debug && msg instanceof TcpDiscoveryCustomEventMessage)
+ log.info("--- Send custom event: " + msg);
+
+ super.writeToSocket(sock, msg, bout, timeout);
+ }
+ }
+
+ /**
* Starts new grid with given index. Method optimize is not invoked.
*
* @param idx Index of the grid to start.
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f3ef6a8/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 88977fb..289da3d 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
@@ -74,6 +74,7 @@ import org.apache.ignite.internal.processors.cache.IgniteInternalCacheTypesTest;
import org.apache.ignite.internal.processors.cache.IgniteStartCacheInTransactionAtomicSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteStartCacheInTransactionSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteSystemCacheOnClientTest;
+import org.apache.ignite.internal.processors.cache.distributed.CacheAffinityEarlyTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheNoValueClassOnServerNodeTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheLockFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheMultiTxLockSelfTest;
@@ -195,6 +196,7 @@ public class IgniteCacheTestSuite4 extends TestSuite {
suite.addTestSuite(IgniteCacheConfigurationDefaultTemplateTest.class);
suite.addTestSuite(IgniteDynamicClientCacheStartSelfTest.class);
suite.addTestSuite(IgniteDynamicCacheStartNoExchangeTimeoutTest.class);
+ suite.addTestSuite(CacheAffinityEarlyTest.class);
suite.addTestSuite(GridCacheTxLoadFromStoreOnLockSelfTest.class);
[18/46] ignite git commit: IGNITE-1536 - Removed duplicated
continuous query notifications in REPLICATED cache
Posted by sb...@apache.org.
IGNITE-1536 - Removed duplicated continuous query notifications in REPLICATED cache
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7db44f11
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7db44f11
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7db44f11
Branch: refs/heads/ignite-1093-2
Commit: 7db44f11f7925b5a29a0a3e017baa93b52fb2982
Parents: 70a8a92
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Wed Sep 23 18:53:06 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Wed Sep 23 18:53:06 2015 -0700
----------------------------------------------------------------------
.../processors/cache/IgniteCacheProxy.java | 4 +-
.../continuous/CacheContinuousQueryManager.java | 58 +++------
.../continuous/GridContinuousProcessor.java | 3 +-
...ontinuousQueryReplicatedOneNodeSelfTest.java | 120 +++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite.java | 4 +-
5 files changed, 144 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7db44f11/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index cc6c19a..ae96f23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -556,7 +556,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
qry.getPageSize(),
qry.getTimeInterval(),
qry.isAutoUnsubscribe(),
- loc ? ctx.grid().cluster().forLocal() : null);
+ loc);
final QueryCursor<Cache.Entry<K, V>> cur =
qry.getInitialQuery() != null ? query(qry.getInitialQuery()) : null;
@@ -1896,4 +1896,4 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
@Override public String toString() {
return S.toString(IgniteCacheProxy.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7db44f11/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index c719f1e..6a151a5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -43,10 +43,9 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.query.ContinuousQuery;
-import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.cluster.ClusterTopologyException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
@@ -55,6 +54,7 @@ import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.plugin.security.SecurityPermission;
import org.apache.ignite.resources.LoggerResource;
import org.jsr166.ConcurrentHashMap8;
@@ -271,7 +271,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
* @param bufSize Buffer size.
* @param timeInterval Time interval.
* @param autoUnsubscribe Auto unsubscribe flag.
- * @param grp Cluster group.
+ * @param loc Local flag.
* @return Continuous routine ID.
* @throws IgniteCheckedException In case of error.
*/
@@ -280,7 +280,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
int bufSize,
long timeInterval,
boolean autoUnsubscribe,
- ClusterGroup grp) throws IgniteCheckedException
+ boolean loc) throws IgniteCheckedException
{
return executeQuery0(
locLsnr,
@@ -293,7 +293,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
true,
false,
true,
- grp);
+ loc);
}
/**
@@ -321,7 +321,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
true,
false,
true,
- loc ? cctx.grid().cluster().forLocal() : null);
+ loc);
}
/**
@@ -383,7 +383,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
* @param oldValRequired Old value required flag.
* @param sync Synchronous flag.
* @param ignoreExpired Ignore expired event flag.
- * @param grp Cluster group.
+ * @param loc Local flag.
* @return Continuous routine ID.
* @throws IgniteCheckedException In case of error.
*/
@@ -397,44 +397,15 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
boolean oldValRequired,
boolean sync,
boolean ignoreExpired,
- ClusterGroup grp) throws IgniteCheckedException
+ boolean loc) throws IgniteCheckedException
{
cctx.checkSecurity(SecurityPermission.CACHE_READ);
- if (grp == null)
- grp = cctx.kernalContext().grid().cluster();
-
- Collection<ClusterNode> nodes = grp.nodes();
-
- if (nodes.isEmpty())
- throw new ClusterTopologyException("Failed to execute continuous query (empty cluster group is " +
- "provided).");
-
- boolean skipPrimaryCheck = false;
-
- switch (cctx.config().getCacheMode()) {
- case LOCAL:
- if (!nodes.contains(cctx.localNode()))
- throw new ClusterTopologyException("Continuous query for LOCAL cache can be executed " +
- "only locally (provided projection contains remote nodes only).");
- else if (nodes.size() > 1)
- U.warn(log, "Continuous query for LOCAL cache will be executed locally (provided projection is " +
- "ignored).");
-
- grp = grp.forNode(cctx.localNode());
-
- break;
-
- case REPLICATED:
- if (nodes.size() == 1 && F.first(nodes).equals(cctx.localNode()))
- skipPrimaryCheck = cctx.affinityNode();
-
- break;
- }
-
int taskNameHash = !internal && cctx.kernalContext().security().enabled() ?
cctx.kernalContext().job().currentTaskNameHash() : 0;
+ boolean skipPrimaryCheck = loc && cctx.config().getCacheMode() == CacheMode.REPLICATED && cctx.affinityNode();
+
GridContinuousHandler hnd = new CacheContinuousQueryHandler(
cctx.name(),
TOPIC_CACHE.topic(topicPrefix, cctx.localNodeId(), seq.getAndIncrement()),
@@ -448,12 +419,17 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
taskNameHash,
skipPrimaryCheck);
+ IgnitePredicate<ClusterNode> pred = null;
+
+ if (loc || cctx.config().getCacheMode() == CacheMode.LOCAL)
+ pred = F.nodeForNodeId(cctx.localNodeId());
+
UUID id = cctx.kernalContext().continuous().startRoutine(
hnd,
bufSize,
timeInterval,
autoUnsubscribe,
- grp.predicate()).get();
+ pred).get();
if (notifyExisting) {
final Iterator<GridCacheEntryEx> it = cctx.cache().allEntries().iterator();
@@ -635,7 +611,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
cfg.isOldValueRequired(),
cfg.isSynchronous(),
false,
- null);
+ false);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/7db44f11/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index 18c1f36..e29bdd4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -795,7 +795,8 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
try {
IgnitePredicate<ClusterNode> prjPred = data.projectionPredicate();
- ctx.resource().injectGeneric(prjPred);
+ if (prjPred != null)
+ ctx.resource().injectGeneric(prjPred);
if (prjPred == null || prjPred.apply(ctx.discovery().node(ctx.localNodeId()))) {
registered = registerHandler(node.id(), routineId, hnd, data.bufferSize(), data.interval(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/7db44f11/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedOneNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedOneNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedOneNodeSelfTest.java
new file mode 100644
index 0000000..8152b2a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedOneNodeSelfTest.java
@@ -0,0 +1,120 @@
+/*
+ * 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.query.continuous;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.event.CacheEntryEvent;
+import javax.cache.event.CacheEntryListenerException;
+import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+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;
+
+/**
+ * Test for replicated cache with one node.
+ */
+public class GridCacheContinuousQueryReplicatedOneNodeSelfTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration cacheCfg = defaultCacheConfiguration();
+
+ cacheCfg.setCacheMode(CacheMode.REPLICATED);
+ cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
+ cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+
+ cfg.setCacheConfiguration(cacheCfg);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(disco);
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testLocal() throws Exception {
+ doTest(true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDistributed() throws Exception {
+ doTest(false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void doTest(boolean loc) throws Exception {
+ try {
+ IgniteCache<String, Integer> cache = startGrid(0).cache(null);
+
+ ContinuousQuery<String, Integer> qry = new ContinuousQuery<>();
+
+ final AtomicInteger cnt = new AtomicInteger();
+ final CountDownLatch latch = new CountDownLatch(10);
+
+ qry.setLocalListener(new CacheEntryUpdatedListener<String, Integer>() {
+ @Override
+ public void onUpdated(Iterable<CacheEntryEvent<? extends String, ? extends Integer>> evts)
+ throws CacheEntryListenerException {
+ for (CacheEntryEvent<? extends String, ? extends Integer> evt : evts) {
+ cnt.incrementAndGet();
+ latch.countDown();
+ }
+ }
+ });
+
+ cache.query(qry.setLocal(loc));
+
+ startGrid(1);
+
+ awaitPartitionMapExchange();
+
+ for (int i = 0; i < 10; i++)
+ cache.put("key" + i, i);
+
+ assert latch.await(5000, TimeUnit.MILLISECONDS);
+
+ assertEquals(10, cnt.get());
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7db44f11/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 41670d1..fe54b63 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -73,6 +73,7 @@ import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheCon
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryPartitionedP2PDisabledSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryPartitionedSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryReplicatedAtomicSelfTest;
+import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryReplicatedOneNodeSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryReplicatedP2PDisabledSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryReplicatedSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.IgniteCacheContinuousQueryClientTest;
@@ -158,6 +159,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
suite.addTestSuite(GridCacheContinuousQueryAtomicNearEnabledSelfTest.class);
suite.addTestSuite(GridCacheContinuousQueryAtomicP2PDisabledSelfTest.class);
suite.addTestSuite(IgniteCacheContinuousQueryClientTest.class);
+ suite.addTestSuite(GridCacheContinuousQueryReplicatedOneNodeSelfTest.class);
// Reduce fields queries.
suite.addTestSuite(GridCacheReduceFieldsQueryLocalSelfTest.class);
@@ -187,4 +189,4 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
return suite;
}
-}
\ No newline at end of file
+}
[46/46] ignite git commit: 1093
Posted by sb...@apache.org.
1093
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5de124cd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5de124cd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5de124cd
Branch: refs/heads/ignite-1093-2
Commit: 5de124cd9a270446c301b6782a0530c48758f035
Parents: f0f7c32
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Oct 1 18:43:46 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Oct 1 18:43:46 2015 +0300
----------------------------------------------------------------------
.../dht/preloader/GridDhtPartitionDemander.java | 24 +++++----
.../dht/preloader/GridDhtPartitionSupplier.java | 56 ++++++++++++--------
2 files changed, 47 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5de124cd/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 d1d475c..56a9c9b 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
@@ -199,8 +199,8 @@ public class GridDhtPartitionDemander {
private boolean topologyChanged(SyncFuture fut) {
return
!cctx.affinity().affinityTopologyVersion().equals(fut.topologyVersion()) || // Topology already changed.
- fut != syncFut || // Same topology, but dummy exchange forced because of missing partitions.
- cctx.shared().exchange().hasPendingExchange(); // New topology pending.
+ fut != syncFut || // Same topology, but dummy exchange forced because of missing partitions.
+ cctx.shared().exchange().hasPendingExchange(); // New topology pending.
}
/**
@@ -262,12 +262,6 @@ public class GridDhtPartitionDemander {
final SyncFuture oldFut = syncFut;
- if (cctx.shared().exchange().hasPendingExchange()) { // Will rebalance at actual topology.
- U.log(log, "Skipping obsolete exchange. [top=" + assigns.topologyVersion() + "]");
-
- return;
- }
-
final SyncFuture fut = new SyncFuture(assigns, cctx, log, oldFut.isDummy(), ++updateSeq);
if (!oldFut.isDummy())
@@ -281,6 +275,14 @@ public class GridDhtPartitionDemander {
syncFut = fut;
+ if (cctx.shared().exchange().hasPendingExchange()) { // Will rebalance at actual topology.
+ U.log(log, "Skipping obsolete exchange. [top=" + assigns.topologyVersion() + "]");
+
+ fut.cancel();
+
+ return;
+ }
+
if (assigns.isEmpty()) {
fut.doneIfEmpty();
@@ -397,7 +399,9 @@ public class GridDhtPartitionDemander {
", fromNode=" + node.id() + ", partitionsCount=" + d.partitions().size() +
", topology=" + d.topologyVersion() + ", updateSeq=" + fut.updateSeq + "]");
- fut.appendPartitions(node.id(), d.partitions());
+ Collection<Integer> parts = new HashSet<>(d.partitions());
+
+ fut.appendPartitions(node.id(), parts);
int lsnrCnt = cctx.gridConfig().getRebalanceThreadPoolSize();
@@ -406,7 +410,7 @@ public class GridDhtPartitionDemander {
for (int cnt = 0; cnt < lsnrCnt; cnt++)
sParts.add(new HashSet<Integer>());
- Iterator<Integer> it = d.partitions().iterator();
+ Iterator<Integer> it = parts.iterator();
int cnt = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/5de124cd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
index b5bb25d..98946f4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
@@ -46,6 +46,7 @@ import org.apache.ignite.lang.IgnitePredicate;
import org.jsr166.ConcurrentHashMap8;
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.processors.cache.distributed.dht.GridDhtPartitionState.OWNING;
/**
@@ -104,7 +105,7 @@ class GridDhtPartitionSupplier {
clearContext(sctx, log);
- U.log(log, "Supply context removed for failed node [node=" + t.get1() + "]");
+ U.log(log, "Supply context removed for node failed or left [node=" + t.get1() + "]");
scMap.remove(t, sctx);
}
@@ -116,7 +117,7 @@ class GridDhtPartitionSupplier {
}
};
- cctx.events().addListener(lsnr, EVT_NODE_FAILED);
+ cctx.events().addListener(lsnr, EVT_NODE_LEFT, EVT_NODE_FAILED);
startOldListeners();
}
@@ -301,12 +302,12 @@ class GridDhtPartitionSupplier {
swapLsnr = null;
loc = null;
- reply(node, d, s);
+ reply(node, d, s, scId);
return;
}
else {
- if (!reply(node, d, s))
+ if (!reply(node, d, s, scId))
return;
s = new GridDhtPartitionSupplyMessageV2(d.updateSequence(),
@@ -388,12 +389,12 @@ class GridDhtPartitionSupplier {
swapLsnr = null;
loc = null;
- reply(node, d, s);
+ reply(node, d, s, scId);
return;
}
else {
- if (!reply(node, d, s))
+ if (!reply(node, d, s, scId))
return;
s = new GridDhtPartitionSupplyMessageV2(d.updateSequence(),
@@ -510,12 +511,12 @@ class GridDhtPartitionSupplier {
loc = null;
- reply(node, d, s);
+ reply(node, d, s, scId);
return;
}
else {
- if (!reply(node, d, s))
+ if (!reply(node, d, s, scId))
return;
s = new GridDhtPartitionSupplyMessageV2(d.updateSequence(),
@@ -553,7 +554,7 @@ class GridDhtPartitionSupplier {
scMap.remove(scId);
- reply(node, d, s);
+ reply(node, d, s, scId);
}
catch (IgniteCheckedException e) {
U.error(log, "Failed to send partition supply message to node: " + id, e);
@@ -567,7 +568,10 @@ class GridDhtPartitionSupplier {
* @return {@code True} if message was sent, {@code false} if recipient left grid.
* @throws IgniteCheckedException If failed.
*/
- private boolean reply(ClusterNode n, GridDhtPartitionDemandMessage d, GridDhtPartitionSupplyMessageV2 s)
+ private boolean reply(ClusterNode n,
+ GridDhtPartitionDemandMessage d,
+ GridDhtPartitionSupplyMessageV2 s,
+ T2<UUID, Integer> scId)
throws IgniteCheckedException {
try {
@@ -575,8 +579,11 @@ class GridDhtPartitionSupplier {
log.debug("Replying to partition demand [node=" + n.id() + ", demand=" + d + ", supply=" + s + ']');
if (!cctx.affinity().affinityTopologyVersion().equals(d.topologyVersion()) || // Topology already changed.
- cctx.shared().exchange().hasPendingExchange()) // New topology pending.
- return true;
+ cctx.shared().exchange().hasPendingExchange()) { // New topology pending.
+ clearContext(scMap.remove(scId), log);
+
+ return false;
+ }
cctx.io().sendOrderedMessage(n, d.topic(), s, cctx.ioPolicy(), d.timeout());
@@ -590,6 +597,8 @@ class GridDhtPartitionSupplier {
if (log.isDebugEnabled())
log.debug("Failed to send partition supply message because node left grid: " + n.id());
+ clearContext(scMap.remove(scId), log);
+
return false;
}
}
@@ -611,14 +620,15 @@ class GridDhtPartitionSupplier {
GridDhtLocalPartition loc,
AffinityTopologyVersion topVer,
long updateSeq) {
- SupplyContext old = scMap.putIfAbsent(t, new SupplyContext(phase,
- partIt,
- entryIt,
- swapLsnr,
- part,
- loc,
- topVer,
- updateSeq));
+ SupplyContext old = scMap.putIfAbsent(t,
+ new SupplyContext(phase,
+ partIt,
+ entryIt,
+ swapLsnr,
+ part,
+ loc,
+ topVer,
+ updateSeq));
assert old == null;
}
@@ -643,13 +653,13 @@ class GridDhtPartitionSupplier {
private final int part;
/** Local partition. */
- GridDhtLocalPartition loc;
+ private final GridDhtLocalPartition loc;
/** Topology version. */
- AffinityTopologyVersion topVer;
+ private final AffinityTopologyVersion topVer;
/** Update seq. */
- long updateSeq;
+ private final long updateSeq;
/**
* @param phase Phase.
[13/46] ignite git commit: 1093
Posted by sb...@apache.org.
1093
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b7e91796
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b7e91796
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b7e91796
Branch: refs/heads/ignite-1093-2
Commit: b7e9179604833dad2b358917413d092989f2bd55
Parents: a8b323d
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Sep 23 13:00:42 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Sep 23 13:00:42 2015 +0300
----------------------------------------------------------------------
.../dht/preloader/GridDhtPartitionDemander.java | 42 ++++++++++++-----
.../dht/preloader/GridDhtPartitionSupplier.java | 49 +++++++++++---------
2 files changed, 57 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7e91796/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 bbb6a21..345e3bd 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
@@ -64,11 +64,11 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.CI2;
+import org.apache.ignite.internal.util.typedef.T3;
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;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.thread.IgniteThread;
@@ -391,7 +391,7 @@ public class GridDhtPartitionDemander {
//Check remote node rebalancing API version.
if (new Integer(1).equals(node.attribute(IgniteNodeAttributes.REBALANCING_VERSION))) {
- fut.appendPartitions(node.id(), d.partitions());
+ fut.appendPartitions(node.id(), d.partitions(), d.updateSequence());
int lsnrCnt = cctx.gridConfig().getRebalanceThreadPoolSize();
@@ -418,10 +418,13 @@ public class GridDhtPartitionDemander {
try {
if (!topologyChanged(fut)) {
- cctx.io().sendOrderedMessage(node, GridCachePartitionExchangeManager.rebalanceTopic(cnt), initD, cctx.ioPolicy(), d.timeout());
+ cctx.io().sendOrderedMessage(node,
+ GridCachePartitionExchangeManager.rebalanceTopic(cnt), initD, cctx.ioPolicy(), d.timeout());
if (log.isDebugEnabled())
- log.debug("Requested rebalancing [from node=" + node.id() + ", listener index=" + cnt + ", partitions count=" + sParts.get(cnt).size() + " (" + partitionsList(sParts.get(cnt)) + ")]");
+ log.debug("Requested rebalancing [from node=" + node.id() + ", listener index=" +
+ cnt + ", partitions count=" + sParts.get(cnt).size() +
+ " (" + partitionsList(sParts.get(cnt)) + ")]");
}
else {
@@ -441,7 +444,7 @@ public class GridDhtPartitionDemander {
else {
DemandWorker dw = new DemandWorker(dmIdx.incrementAndGet(), fut);
- fut.appendPartitions(node.id(), d.partitions());
+ fut.appendPartitions(node.id(), d.partitions(), d.updateSequence());
dw.run(node, d);
}
@@ -513,7 +516,7 @@ public class GridDhtPartitionDemander {
assert node != null;
- if (!fut.topologyVersion().equals(topVer) || topologyChanged(fut))
+ if (!fut.topologyVersion().equals(topVer) || topologyChanged(fut) || !fut.isActual(id, supply.updateSequence()))
return;
if (log.isDebugEnabled())
@@ -744,7 +747,7 @@ public class GridDhtPartitionDemander {
/**
*
*/
- public static class SyncFuture extends GridFutureAdapter<Object> {
+ public static class SyncFuture extends GridFutureAdapter<Boolean> {
/** */
private static final long serialVersionUID = 1L;
@@ -757,8 +760,8 @@ public class GridDhtPartitionDemander {
/** */
private final IgniteLogger log;
- /** Remaining. */
- private final Map<UUID, IgniteBiTuple<Long, Collection<Integer>>> remaining = new HashMap<>();
+ /** Remaining. T3: startTime, partitions, updateSequence */
+ private final Map<UUID, T3<Long, Collection<Integer>, Long>> remaining = new HashMap<>();
/** Missed. */
private final Map<UUID, Collection<Integer>> missed = new HashMap<>();
@@ -819,6 +822,17 @@ public class GridDhtPartitionDemander {
}
/**
+ * @param nodeId Node id.
+ * @param updateSeq Update sequence.
+ * @return true in case future created for specified updateSeq, false in other case.
+ */
+ private boolean isActual(UUID nodeId, long updateSeq) {
+ T3<Long, Collection<Integer>, Long> t = remaining.get(nodeId);
+
+ return t != null ? t.get3().equals(updateSeq) : false;
+ }
+
+ /**
* @return Is dummy (created at demander creation).
*/
private boolean isDummy() {
@@ -829,11 +843,11 @@ public class GridDhtPartitionDemander {
* @param nodeId Node id.
* @param parts Parts.
*/
- private void appendPartitions(UUID nodeId, Collection<Integer> parts) {
+ private void appendPartitions(UUID nodeId, Collection<Integer> parts, long updateSeq) {
lock.lock();
try {
- remaining.put(nodeId, new IgniteBiTuple<>(U.currentTimeMillis(), parts));
+ remaining.put(nodeId, new T3<>(U.currentTimeMillis(), parts, updateSeq));
}
finally {
lock.unlock();
@@ -1014,12 +1028,16 @@ public class GridDhtPartitionDemander {
U.log(log, ("Reassigning partitions that were missed: " + m));
cctx.shared().exchange().forceDummyExchange(true, exchFut);
+
+ onDone(false); //Finished but has missed partitions and forced dummy exchange
+
+ return;
}
cctx.shared().exchange().scheduleResendPartitions();
}
- onDone();
+ onDone(true);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7e91796/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
index d33dc5a..a4bd134 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
@@ -131,7 +131,12 @@ class GridDhtPartitionSupplier {
private static void clearContexts(
ConcurrentHashMap8<T4, SupplyContext> map, IgniteLogger log, GridCacheContext<?, ?> cctx) {
for (Map.Entry<T4, SupplyContext> entry : map.entrySet()) {
- clearContext(map, entry.getKey(), entry.getValue(), log, cctx);
+ T4 t = entry.getKey();
+
+ SupplyContext sc = entry.getValue();
+
+ if (t.get3() != null && !t.get3().equals(cctx.affinity().affinityTopologyVersion()) && sc != null)
+ clearContext(map, t, sc, log);
}
}
@@ -139,34 +144,31 @@ class GridDhtPartitionSupplier {
* Clear context.
*
* @param map Context map.
+ * @param t id.
+ * @param sc Supply context.
* @param log Logger.
+ * @return true in case context was removed.
*/
private static boolean clearContext(
- ConcurrentHashMap8<T4, SupplyContext> map,
- T4 t,
- SupplyContext sc,
- IgniteLogger log,
- GridCacheContext<?, ?> cctx) {
-
- if (!t.get3().equals(cctx.affinity().affinityTopologyVersion()) && sc != null) {
- Iterator it = sc.entryIt;
-
- if (it != null && it instanceof GridCloseableIterator && !((GridCloseableIterator)it).isClosed()) {
- try {
- synchronized (map) {
- if (!((GridCloseableIterator)it).isClosed())
- ((GridCloseableIterator)it).close();
- }
- }
- catch (IgniteCheckedException e) {
- log.error("Iterator close failed.", e);
+ final ConcurrentHashMap8<T4, SupplyContext> map,
+ final T4 t,
+ final SupplyContext sc,
+ final IgniteLogger log) {
+ final Iterator it = sc.entryIt;
+
+ if (it != null && it instanceof GridCloseableIterator && !((GridCloseableIterator)it).isClosed()) {
+ try {
+ synchronized (it) {
+ if (!((GridCloseableIterator)it).isClosed())
+ ((GridCloseableIterator)it).close();
}
}
-
- return map.remove(t, sc);
+ catch (IgniteCheckedException e) {
+ log.error("Iterator close failed.", e);
+ }
}
- return false;
+ return map.remove(t, sc);
}
/**
@@ -528,6 +530,9 @@ class GridDhtPartitionSupplier {
if (log.isDebugEnabled())
log.debug("Replying to partition demand [node=" + n.id() + ", demand=" + d + ", supply=" + s + ']');
+ if (!cctx.affinity().affinityTopologyVersion().equals(d.topologyVersion()))
+ return true;
+
cctx.io().sendOrderedMessage(n, d.topic(), s, cctx.ioPolicy(), d.timeout());
// Throttle preloading.
[23/46] ignite git commit: schema-import examples fix (cherry picked
from commit 169066b)
Posted by sb...@apache.org.
schema-import examples fix
(cherry picked from commit 169066b)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/30f5b9ef
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/30f5b9ef
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/30f5b9ef
Branch: refs/heads/ignite-1093-2
Commit: 30f5b9ef82fe9216fd89827977c601b8eb17db50
Parents: 1021d4e
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Sep 24 14:33:26 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Sep 24 15:16:17 2015 +0300
----------------------------------------------------------------------
examples/schema-import/pom.xml | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/30f5b9ef/examples/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom.xml b/examples/schema-import/pom.xml
index d302606..fdbd631 100644
--- a/examples/schema-import/pom.xml
+++ b/examples/schema-import/pom.xml
@@ -26,13 +26,19 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-parent</artifactId>
+ <version>1</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
- <groupId>org.apache.ignite</groupId>
<artifactId>ignite-schema-import-demo</artifactId>
- <version>${project.version}</version>
+ <version>1.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
[17/46] ignite git commit: Exposed IgniteKernal.dumpDebugInfo() to MX
bean
Posted by sb...@apache.org.
Exposed IgniteKernal.dumpDebugInfo() to MX bean
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/70a8a92d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/70a8a92d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/70a8a92d
Branch: refs/heads/ignite-1093-2
Commit: 70a8a92da3cf39b0ed1cf18effd8fae1478cb2bd
Parents: 6f3ef6a
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Wed Sep 23 17:23:31 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Wed Sep 23 17:23:31 2015 -0700
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/IgniteKernal.java | 4 +---
.../src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java | 8 +++++++-
2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/70a8a92d/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 82db059..60725e4 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
@@ -3153,9 +3153,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
return ctx.isDaemon() && U.hasAnnotation(comp.getClass(), SkipDaemon.class);
}
- /**
- *
- */
+ /** {@inheritDoc} */
public void dumpDebugInfo() {
U.warn(log, "Dumping debug info for node [id=" + ctx.localNodeId() +
", name=" + ctx.gridName() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/70a8a92d/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
index 4755bf2..c30e0e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
@@ -366,4 +366,10 @@ public interface IgniteMXBean {
*/
@MXBeanDescription("Prints last suppressed errors.")
public void printLastErrors();
-}
\ No newline at end of file
+
+ /**
+ * Dumps debug information for the current node.
+ */
+ @MXBeanDescription("Dumps debug information for the current node.")
+ public void dumpDebugInfo();
+}
[27/46] ignite git commit: ignite-1540 Handle error in
GridDhtAtomicUpdateFuture.onDone
Posted by sb...@apache.org.
ignite-1540 Handle error in GridDhtAtomicUpdateFuture.onDone
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1056a31f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1056a31f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1056a31f
Branch: refs/heads/ignite-1093-2
Commit: 1056a31fc72ea25c8790e37f2621f3d6e1908c89
Parents: ece3400
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 24 15:52:17 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 24 15:52:17 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1056a31f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 0cbad48..35b8e27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -311,6 +311,11 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
if (super.onDone(res, err)) {
cctx.mvcc().removeAtomicFuture(version());
+ if (err != null) {
+ for (KeyCacheObject key : keys)
+ updateRes.addFailedKey(key, err);
+ }
+
if (updateReq.writeSynchronizationMode() == FULL_SYNC)
completionCb.apply(updateReq, updateRes);
[34/46] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a42750ae
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a42750ae
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a42750ae
Branch: refs/heads/ignite-1093-2
Commit: a42750ae0465cb79c39d9e8875c11cafd91fd8a3
Parents: d7b36d8 27cf501
Author: sboikov <sb...@gridgain.com>
Authored: Fri Sep 25 14:08:41 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Sep 25 14:08:41 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/GridUpdateNotifierSelfTest.java | 1 +
...ridCachePartitionedQueueFailoverDataConsistencySelfTest.java | 5 -----
.../expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java | 5 ++++-
3 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
[43/46] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-1093-2
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-1093-2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e1651dd0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e1651dd0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e1651dd0
Branch: refs/heads/ignite-1093-2
Commit: e1651dd034855650109e7504e32960c533950a8b
Parents: eeb313c c001d47
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Sep 28 14:13:55 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Sep 28 14:13:55 2015 +0300
----------------------------------------------------------------------
bin/igniterouter.bat | 2 +-
bin/igniterouter.sh | 2 +-
examples/schema-import/pom.xml | 10 +-
.../org/apache/ignite/IgniteAtomicLong.java | 2 +-
.../org/apache/ignite/IgniteFileSystem.java | 2 +-
.../apache/ignite/cache/CacheAtomicityMode.java | 17 +-
.../configuration/CacheConfiguration.java | 17 +-
.../apache/ignite/internal/IgniteKernal.java | 4 +-
.../cache/DynamicCacheDescriptor.java | 10 +-
.../processors/cache/GridCacheAdapter.java | 8 +-
.../processors/cache/GridCacheMapEntry.java | 51 +--
.../GridCachePartitionExchangeManager.java | 6 +
.../processors/cache/GridCacheProcessor.java | 28 +-
.../cache/GridCacheSwapEntryImpl.java | 31 +-
.../processors/cache/GridCacheSwapManager.java | 80 ++--
.../processors/cache/IgniteCacheProxy.java | 4 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 6 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 5 +
.../near/GridNearTxFinishFuture.java | 4 +-
.../cache/distributed/near/GridNearTxLocal.java | 19 +-
.../continuous/CacheContinuousQueryManager.java | 66 ++-
.../transactions/IgniteTxLocalAdapter.java | 35 +-
.../continuous/GridContinuousProcessor.java | 3 +-
.../datastreamer/DataStreamerImpl.java | 2 -
.../internal/processors/igfs/IgfsImpl.java | 87 +---
.../processors/igfs/IgfsMetaManager.java | 193 ++++++++-
.../org/apache/ignite/mxbean/IgniteMXBean.java | 8 +-
.../communication/tcp/TcpCommunicationSpi.java | 7 +-
.../discovery/DiscoverySpiCustomMessage.java | 12 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 398 +++++++++++++------
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 6 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 94 ++---
.../messages/TcpDiscoveryDiscardMessage.java | 15 +-
.../TcpDiscoveryNodeAddFinishedMessage.java | 2 +-
.../messages/TcpDiscoveryNodeAddedMessage.java | 19 +-
.../internal/GridUpdateNotifierSelfTest.java | 1 +
.../GridCacheAbstractRemoveFailureTest.java | 6 +-
.../GridCacheVariableTopologySelfTest.java | 3 +-
.../IgniteCacheEntryListenerAbstractTest.java | 65 ++-
.../cache/IgniteDynamicCacheFilterTest.java | 150 +++++++
.../IgniteTxExceptionAbstractSelfTest.java | 3 +
...nedQueueFailoverDataConsistencySelfTest.java | 5 -
.../distributed/CacheAffEarlySelfTest.java | 245 ------------
.../distributed/CacheAffinityEarlyTest.java | 168 ++++++++
.../IgniteTxPreloadAbstractTest.java | 43 +-
.../GridCacheColocatedTxExceptionSelfTest.java | 5 -
.../IgniteCachePutRetryAbstractSelfTest.java | 33 ++
...GridCacheValueConsistencyAtomicSelfTest.java | 2 +-
.../near/GridCacheNearTxExceptionSelfTest.java | 5 -
.../near/NearCacheMultithreadedUpdateTest.java | 217 ++++++++++
.../GridCacheReplicatedInvalidateSelfTest.java | 249 ------------
.../GridCacheReplicatedTxExceptionSelfTest.java | 5 -
.../replicated/GridReplicatedTxPreloadTest.java | 2 -
...eCacheExpiryPolicyWithStoreAbstractTest.java | 5 +-
.../GridCacheLocalTxExceptionSelfTest.java | 5 -
...ontinuousQueryReplicatedOneNodeSelfTest.java | 120 ++++++
.../processors/igfs/IgfsAbstractSelfTest.java | 201 +++++++---
.../igfs/IgfsClientCacheSelfTest.java | 15 +-
.../igfs/IgfsMetaManagerSelfTest.java | 106 ++---
...lientDiscoverySpiFailureTimeoutSelfTest.java | 139 ++++++-
.../tcp/TcpClientDiscoverySpiSelfTest.java | 13 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 53 ++-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 315 ++++++++++++++-
.../multijvm/IgniteCacheProcessProxy.java | 3 +-
.../IgniteCacheFailoverTestSuite.java | 4 -
.../IgniteCacheFailoverTestSuite3.java | 23 +-
.../testsuites/IgniteCacheTestSuite3.java | 2 -
.../testsuites/IgniteCacheTestSuite4.java | 12 +
.../testsuites/IgniteHadoopTestSuite.java | 19 +-
.../processors/query/h2/IgniteH2Indexing.java | 19 +-
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 54 ++-
.../query/h2/opt/GridH2KeyValueRowOffheap.java | 11 +-
.../query/h2/opt/GridH2RowDescriptor.java | 5 +
.../processors/query/h2/opt/GridH2Table.java | 10 +-
.../cache/CacheIndexStreamerTest.java | 37 +-
.../processors/cache/GridCacheSwapSelfTest.java | 4 +-
.../IgniteCacheQuerySelfTestSuite.java | 4 +-
.../IgniteCacheWithIndexingTestSuite.java | 2 +
pom.xml | 27 +-
79 files changed, 2456 insertions(+), 1214 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1651dd0/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1651dd0/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1651dd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1651dd0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1651dd0/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
[14/46] ignite git commit: IGNITE-586: Fixed IGFS rename problem
causing corrupted file system structure.
Posted by sb...@apache.org.
IGNITE-586: Fixed IGFS rename problem causing corrupted file system structure.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b3bcf4ae
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b3bcf4ae
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b3bcf4ae
Branch: refs/heads/ignite-1093-2
Commit: b3bcf4aeecf9aa1bd6d19e94c8da7b09741f5410
Parents: 0a41ae5
Author: iveselovskiy <iv...@gridgain.com>
Authored: Wed Sep 23 13:45:01 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 23 13:45:01 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/IgniteFileSystem.java | 2 +-
.../configuration/CacheConfiguration.java | 2 +-
.../internal/processors/igfs/IgfsImpl.java | 87 ++------
.../processors/igfs/IgfsMetaManager.java | 193 ++++++++++++++++--
.../processors/igfs/IgfsAbstractSelfTest.java | 201 ++++++++++++++-----
.../igfs/IgfsClientCacheSelfTest.java | 15 +-
.../igfs/IgfsMetaManagerSelfTest.java | 106 +++++-----
.../testsuites/IgniteHadoopTestSuite.java | 19 +-
8 files changed, 409 insertions(+), 216 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3bcf4ae/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
index b02d0f1..a187a90 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
@@ -451,7 +451,7 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
* @return File information for specified path or {@code null} if such path does not exist.
* @throws IgniteException In case of error.
*/
- public IgfsFile info(IgfsPath path) throws IgniteException;
+ @Nullable public IgfsFile info(IgfsPath path) throws IgniteException;
/**
* Gets used space in bytes.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3bcf4ae/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 44a3fa9..6ac2b64 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -436,7 +436,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @return {@code this} for chaining.
*/
public CacheConfiguration<K, V> setName(String name) {
- A.ensure(name == null || !name.isEmpty(), "Name cannot be null or empty.");
+ A.ensure(name == null || !name.isEmpty(), "Name cannot be empty.");
this.name = name;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3bcf4ae/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 695db38..0dd0307 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
@@ -472,8 +472,7 @@ public final class IgfsImpl implements IgfsEx {
@SuppressWarnings("ConstantConditions")
@Override public IgfsStatus globalSpace() {
return safeOp(new Callable<IgfsStatus>() {
- @Override
- public IgfsStatus call() throws Exception {
+ @Override public IgfsStatus call() throws Exception {
IgniteBiTuple<Long, Long> space = igfsCtx.kernalContext().grid().compute().execute(
new IgfsGlobalSpaceTask(name()), null);
@@ -560,7 +559,7 @@ public final class IgfsImpl implements IgfsEx {
}
/** {@inheritDoc} */
- @Override public IgfsFile info(final IgfsPath path) {
+ @Override @Nullable public IgfsFile info(final IgfsPath path) {
A.notNull(path, "path");
return safeOp(new Callable<IgfsFile>() {
@@ -692,64 +691,12 @@ public final class IgfsImpl implements IgfsEx {
return null;
}
- IgfsPath destParent = dest.parent();
+ IgfsFileInfo info = meta.move(src, dest);
- // Resolve source file info.
- FileDescriptor srcDesc = getFileDescriptor(src);
+ int evtTyp = info.isFile() ? EVT_IGFS_FILE_RENAMED : EVT_IGFS_DIR_RENAMED;
- // File not found.
- if (srcDesc == null || srcDesc.parentId == null) {
- if (mode == PRIMARY)
- checkConflictWithPrimary(src);
-
- throw new IgfsPathNotFoundException("Failed to rename (source path not found): " + src);
- }
-
- String srcFileName = src.name();
-
- // Resolve destination file info.
- FileDescriptor destDesc = getFileDescriptor(dest);
-
- String destFileName;
-
- boolean newDest = destDesc == null;
-
- if (newDest) {
- assert destParent != null;
-
- // Use parent directory for destination parent and destination path name as destination name.
- destDesc = getFileDescriptor(destParent);
-
- // Destination directory doesn't exist.
- if (destDesc == null)
- throw new IgfsPathNotFoundException("Failed to rename (destination directory does not " +
- "exist): " + dest);
-
- destFileName = dest.name();
- }
- else
- // Use destination directory for destination parent and source path name as destination name.
- destFileName = srcFileName;
-
- // Can move only into directory, but not into file.
- if (destDesc.isFile)
- throw new IgfsParentNotDirectoryException("Failed to rename (destination is not a directory): "
- + dest);
-
- meta.move(srcDesc.fileId, srcFileName, srcDesc.parentId, destFileName, destDesc.fileId);
-
- if (srcDesc.isFile) { // Renamed a file.
- if (evts.isRecordable(EVT_IGFS_FILE_RENAMED))
- evts.record(new IgfsEvent(
- src,
- newDest ? dest : new IgfsPath(dest, destFileName),
- localNode(),
- EVT_IGFS_FILE_RENAMED));
- }
- else { // Renamed a directory.
- if (evts.isRecordable(EVT_IGFS_DIR_RENAMED))
- evts.record(new IgfsEvent(src, dest, localNode(), EVT_IGFS_DIR_RENAMED));
- }
+ if (evts.isRecordable(evtTyp))
+ evts.record(new IgfsEvent(src, info.path(), localNode(), evtTyp));
return null;
}
@@ -967,8 +914,7 @@ public final class IgfsImpl implements IgfsEx {
}
return F.viewReadOnly(files, new C1<String, IgfsPath>() {
- @Override
- public IgfsPath apply(String e) {
+ @Override public IgfsPath apply(String e) {
return new IgfsPath(path, e);
}
});
@@ -981,8 +927,7 @@ public final class IgfsImpl implements IgfsEx {
A.notNull(path, "path");
return safeOp(new Callable<Collection<IgfsFile>>() {
- @Override
- public Collection<IgfsFile> call() throws Exception {
+ @Override public Collection<IgfsFile> call() throws Exception {
if (log.isDebugEnabled())
log.debug("List directory details: " + path);
@@ -1058,8 +1003,7 @@ public final class IgfsImpl implements IgfsEx {
A.ensure(seqReadsBeforePrefetch >= 0, "seqReadsBeforePrefetch >= 0");
return safeOp(new Callable<IgfsInputStreamAdapter>() {
- @Override
- public IgfsInputStreamAdapter call() throws Exception {
+ @Override public IgfsInputStreamAdapter call() throws Exception {
if (log.isDebugEnabled())
log.debug("Open file for reading [path=" + path + ", bufSize=" + bufSize + ']');
@@ -1146,8 +1090,7 @@ public final class IgfsImpl implements IgfsEx {
A.ensure(bufSize >= 0, "bufSize >= 0");
return safeOp(new Callable<IgfsOutputStream>() {
- @Override
- public IgfsOutputStream call() throws Exception {
+ @Override public IgfsOutputStream call() throws Exception {
if (log.isDebugEnabled())
log.debug("Open file for writing [path=" + path + ", bufSize=" + bufSize + ", overwrite=" +
overwrite + ", props=" + props + ']');
@@ -1250,8 +1193,7 @@ public final class IgfsImpl implements IgfsEx {
A.ensure(bufSize >= 0, "bufSize >= 0");
return safeOp(new Callable<IgfsOutputStream>() {
- @Override
- public IgfsOutputStream call() throws Exception {
+ @Override public IgfsOutputStream call() throws Exception {
if (log.isDebugEnabled())
log.debug("Open file for appending [path=" + path + ", bufSize=" + bufSize + ", create=" + create +
", props=" + props + ']');
@@ -1373,8 +1315,7 @@ public final class IgfsImpl implements IgfsEx {
A.ensure(len >= 0, "len >= 0");
return safeOp(new Callable<Collection<IgfsBlockLocation>>() {
- @Override
- public Collection<IgfsBlockLocation> call() throws Exception {
+ @Override public Collection<IgfsBlockLocation> call() throws Exception {
if (log.isDebugEnabled())
log.debug("Get affinity for file block [path=" + path + ", start=" + start + ", len=" + len + ']');
@@ -1407,8 +1348,7 @@ public final class IgfsImpl implements IgfsEx {
/** {@inheritDoc} */
@Override public IgfsMetrics metrics() {
return safeOp(new Callable<IgfsMetrics>() {
- @Override
- public IgfsMetrics call() throws Exception {
+ @Override public IgfsMetrics call() throws Exception {
IgfsPathSummary sum = new IgfsPathSummary();
summary0(ROOT_ID, sum);
@@ -1587,6 +1527,7 @@ public final class IgfsImpl implements IgfsEx {
*/
@Nullable private FileDescriptor getFileDescriptor(IgfsPath path) throws IgniteCheckedException {
List<IgniteUuid> ids = meta.fileIds(path);
+
IgfsFileInfo fileInfo = meta.info(ids.get(ids.size() - 1));
if (fileInfo == null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3bcf4ae/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
index 5611f33..d283b64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
@@ -26,13 +26,16 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.TreeMap;
+import java.util.TreeSet;
import java.util.concurrent.CountDownLatch;
import javax.cache.processor.EntryProcessor;
import javax.cache.processor.MutableEntry;
@@ -584,23 +587,29 @@ public class IgfsMetaManager extends IgfsManager {
assert validTxState(true);
assert fileIds != null && fileIds.length > 0;
- // Always sort file IDs participating in transaction to escape cache transaction deadlocks.
Arrays.sort(fileIds);
- // Wrap array as collection (1) to escape superfluous check in projection and (2) to check assertions.
- Collection<IgniteUuid> keys = Arrays.asList(fileIds);
+ return lockIds(Arrays.asList(fileIds));
+ }
+ /**
+ * Lock file IDs.
+ * @param fileIds File IDs (sorted).
+ * @return Map with lock info.
+ * @throws IgniteCheckedException If failed.
+ */
+ private Map<IgniteUuid, IgfsFileInfo> lockIds(Collection<IgniteUuid> fileIds) throws IgniteCheckedException {
if (log.isDebugEnabled())
- log.debug("Locking file ids: " + keys);
+ log.debug("Locking file ids: " + fileIds);
// Lock files and get their infos.
- Map<IgniteUuid, IgfsFileInfo> map = id2InfoPrj.getAll(keys);
+ Map<IgniteUuid, IgfsFileInfo> map = id2InfoPrj.getAll(fileIds);
if (log.isDebugEnabled())
- log.debug("Locked file ids: " + keys);
+ log.debug("Locked file ids: " + fileIds);
// Force root ID always exist in cache.
- if (keys.contains(ROOT_ID) && !map.containsKey(ROOT_ID)) {
+ if (fileIds.contains(ROOT_ID) && !map.containsKey(ROOT_ID)) {
IgfsFileInfo info = new IgfsFileInfo();
id2InfoPrj.putIfAbsent(ROOT_ID, info);
@@ -807,27 +816,131 @@ public class IgfsMetaManager extends IgfsManager {
}
/**
- * Move or rename file.
+ * Move routine.
*
- * @param fileId File ID to move or rename.
- * @param srcFileName Original file name in the parent's listing.
- * @param srcParentId Parent directory ID.
- * @param destFileName New file name in the parent's listing after moving.
- * @param destParentId New parent directory ID.
- * @throws IgniteCheckedException If failed.
+ * @param srcPath Source path.
+ * @param dstPath Destinatoin path.
+ * @return File info of renamed entry.
+ * @throws IgniteCheckedException In case of exception.
*/
- public void move(IgniteUuid fileId, String srcFileName, IgniteUuid srcParentId, String destFileName,
- IgniteUuid destParentId) throws IgniteCheckedException {
+ public IgfsFileInfo move(IgfsPath srcPath, IgfsPath dstPath) throws IgniteCheckedException {
if (busyLock.enterBusy()) {
try {
assert validTxState(false);
+ // 1. First get source and destination path IDs.
+ List<IgniteUuid> srcPathIds = fileIds(srcPath);
+ List<IgniteUuid> dstPathIds = fileIds(dstPath);
+
+ final Set<IgniteUuid> allIds = new TreeSet<>(new Comparator<IgniteUuid>() {
+ @Override
+ public int compare(IgniteUuid u1, IgniteUuid u2) {
+ if (u1 == u2)
+ return 0;
+
+ if (u1 == null)
+ return -1;
+
+ return u1.compareTo(u2);
+ }
+ });
+
+ allIds.addAll(srcPathIds);
+
+ final IgniteUuid dstLeafId = dstPathIds.get(dstPathIds.size() - 1);
+
+ if (dstLeafId == null) {
+ // Delete null entry for the unexisting destination element:
+ dstPathIds.remove(dstPathIds.size() - 1);
+ }
+
+ allIds.addAll(dstPathIds);
+
+ if (allIds.remove(null)) {
+ throw new IgfsPathNotFoundException("Failed to perform move because some path component was " +
+ "not found. [src=" + srcPath + ", dst=" + dstPath + ']');
+ }
+
+ // 2. Start transaction.
IgniteInternalTx tx = metaCache.txStartEx(PESSIMISTIC, REPEATABLE_READ);
try {
- moveNonTx(fileId, srcFileName, srcParentId, destFileName, destParentId);
+ // 3. Obtain the locks.
+ final Map<IgniteUuid, IgfsFileInfo> allInfos = lockIds(allIds);
+
+ // 4. Verify integrity of source directory.
+ if (!verifyPathIntegrity(srcPath, srcPathIds, allInfos)) {
+ throw new IgfsPathNotFoundException("Failed to perform move because source directory " +
+ "structure changed concurrently [src=" + srcPath + ", dst=" + dstPath + ']');
+ }
+
+ // 5. Verify integrity of destination directory.
+ final IgfsPath dstDirPath = dstLeafId != null ? dstPath : dstPath.parent();
+
+ if (!verifyPathIntegrity(dstDirPath, dstPathIds, allInfos)) {
+ throw new IgfsPathNotFoundException("Failed to perform move because destination directory " +
+ "structure changed concurrently [src=" + srcPath + ", dst=" + dstPath + ']');
+ }
+
+ // 6. Calculate source and destination targets which will be changed.
+ IgniteUuid srcTargetId = srcPathIds.get(srcPathIds.size() - 2);
+ IgfsFileInfo srcTargetInfo = allInfos.get(srcTargetId);
+ String srcName = srcPath.name();
+
+ IgniteUuid dstTargetId;
+ IgfsFileInfo dstTargetInfo;
+ String dstName;
+
+ if (dstLeafId != null) {
+ // Destination leaf exists. Check if it is an empty directory.
+ IgfsFileInfo dstLeafInfo = allInfos.get(dstLeafId);
+
+ assert dstLeafInfo != null;
+
+ if (dstLeafInfo.isDirectory()) {
+ // Destination is a directory.
+ dstTargetId = dstLeafId;
+ dstTargetInfo = dstLeafInfo;
+ dstName = srcPath.name();
+ }
+ else {
+ // Error, destination is existing file.
+ throw new IgfsPathAlreadyExistsException("Failed to perform move " +
+ "because destination points to " +
+ "existing file [src=" + srcPath + ", dst=" + dstPath + ']');
+ }
+ }
+ else {
+ // Destination leaf doesn't exist, so we operate on parent.
+ dstTargetId = dstPathIds.get(dstPathIds.size() - 1);
+ dstTargetInfo = allInfos.get(dstTargetId);
+ dstName = dstPath.name();
+ }
+
+ assert dstTargetInfo != null;
+ assert dstTargetInfo.isDirectory();
+
+ // 7. Last check: does destination target already have listing entry with the same name?
+ if (dstTargetInfo.listing().containsKey(dstName)) {
+ throw new IgfsPathAlreadyExistsException("Failed to perform move because destination already " +
+ "contains entry with the same name existing file [src=" + srcPath +
+ ", dst=" + dstPath + ']');
+ }
+
+ // 8. Actual move: remove from source parent and add to destination target.
+ IgfsListingEntry entry = srcTargetInfo.listing().get(srcName);
+
+ id2InfoPrj.invoke(srcTargetId, new UpdateListing(srcName, entry, true));
+ id2InfoPrj.invoke(dstTargetId, new UpdateListing(dstName, entry, false));
tx.commit();
+
+ IgfsPath realNewPath = new IgfsPath(dstDirPath, dstName);
+
+ IgfsFileInfo moved = allInfos.get(srcPathIds.get(srcPathIds.size() - 1));
+
+ // Set the new path to the info to simplify event creation:
+ return IgfsFileInfo.builder(moved).path(realNewPath).build();
}
finally {
tx.close();
@@ -838,9 +951,49 @@ public class IgfsMetaManager extends IgfsManager {
}
}
else
- throw new IllegalStateException("Failed to move file system entry because Grid is stopping [fileId=" +
- fileId + ", srcFileName=" + srcFileName + ", srcParentId=" + srcParentId + ", destFileName=" +
- destFileName + ", destParentId=" + destParentId + ']');
+ throw new IllegalStateException("Failed to perform move because Grid is stopping [srcPath=" +
+ srcPath + ", dstPath=" + dstPath + ']');
+ }
+
+ /**
+ * Verify path integrity.
+ *
+ * @param path Path to verify.
+ * @param expIds Expected IDs for this path. Might contain additional elements, e.g. because they were created
+ * on a child path.
+ * @param infos Locked infos.
+ * @return
+ */
+ private static boolean verifyPathIntegrity(IgfsPath path, List<IgniteUuid> expIds,
+ Map<IgniteUuid, IgfsFileInfo> infos) {
+ List<String> pathParts = path.components();
+
+ assert pathParts.size() < expIds.size();
+
+ for (int i = 0; i < pathParts.size(); i++) {
+ IgniteUuid parentId = expIds.get(i);
+
+ // If parent ID is null, it doesn't exist.
+ if (parentId != null) {
+ IgfsFileInfo parentInfo = infos.get(parentId);
+
+ // If parent info is null, it doesn't exist.
+ if (parentInfo != null) {
+ IgfsListingEntry childEntry = parentInfo.listing().get(pathParts.get(i));
+
+ // If expected child exists.
+ if (childEntry != null) {
+ // If child ID matches expected ID.
+ if (F.eq(childEntry.fileId(), expIds.get(i + 1)))
+ continue;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ return true;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3bcf4ae/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index 0a1e626..cfa99ff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -43,6 +43,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.FileSystemConfiguration;
@@ -59,13 +60,17 @@ import org.apache.ignite.igfs.IgfsOutputStream;
import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.igfs.IgfsPathNotFoundException;
import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteUuid;
@@ -101,6 +106,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
/** Concurrent operations count. */
protected static final int OPS_CNT = 16;
+ /** Seed. */
+ protected static final long SEED = System.currentTimeMillis();
+
/** Amount of blocks to prefetch. */
protected static final int PREFETCH_BLOCKS = 1;
@@ -203,11 +211,11 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
/**
* Data chunk.
*
- * @param length Length.
+ * @param len Length.
* @return Data chunk.
*/
- static byte[] createChunk(int length) {
- byte[] chunk = new byte[length];
+ static byte[] createChunk(int len) {
+ byte[] chunk = new byte[len];
for (int i = 0; i < chunk.length; i++)
chunk[i] = (byte)i;
@@ -224,6 +232,12 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
igfs = (IgfsImpl) ignite.fileSystem("igfs");
}
+ /**
+ * Creates secondary file system stack.
+ *
+ * @return The secondary file system.
+ * @throws Exception On error.
+ */
protected IgfsSecondaryFileSystem createSecondaryFileSystemStack() throws Exception {
Ignite igniteSecondary = startGridWithIgfs("ignite-secondary", "igfs-secondary", PRIMARY, null,
SECONDARY_REST_CFG);
@@ -845,17 +859,16 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
/**
* Ensure that formatting is not propagated to the secondary file system.
*
- * TODO: IGNITE-586.
- *
* @throws Exception If failed.
*/
@SuppressWarnings("ConstantConditions")
public void testFormat() throws Exception {
- // Test works too long and fails.
- fail("https://issues.apache.org/jira/browse/IGNITE-586");
+ final GridCacheAdapter<IgfsBlockKey, byte[]> dataCache = getDataCache(igfs);
- IgniteKernal grid = (IgniteKernal)G.ignite("grid");
- GridCacheAdapter cache = grid.internalCache("dataCache");
+ assert dataCache != null;
+
+ int size0 = dataCache.size(new CachePeekMode[] {CachePeekMode.ALL});
+ assert size0 == 0 : "Initial data cache size = " + size0;
if (dual)
create(igfsSecondary, paths(DIR, SUBDIR, DIR_NEW, SUBDIR_NEW), paths(FILE, FILE_NEW));
@@ -873,23 +886,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
assert igfs.info(FILE).length() == 10 * 1024 * 1024;
- int size = cache.size();
- int primarySize = cache.primarySize();
- int primaryKeySetSize = cache.primaryKeySet().size();
-
- int primaryPartSize = 0;
-
- for (int p : cache.affinity().primaryPartitions(grid.localNode())) {
- Set set = cache.entrySet(p);
-
- if (set != null)
- primaryPartSize += set.size();
- }
-
- assert size > 0;
- assert primarySize > 0;
- assert primarySize == primaryKeySetSize;
- assert primarySize == primaryPartSize;
+ assert dataCache.size(new CachePeekMode[] {CachePeekMode.ALL}) > 0;
igfs.format();
@@ -903,27 +900,26 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
// Ensure entries deletion in the primary file system.
checkNotExist(igfs, DIR, SUBDIR, FILE);
- int sizeNew = cache.size();
- int primarySizeNew = cache.primarySize();
- int primaryKeySetSizeNew = cache.primaryKeySet().size();
-
- int primaryPartSizeNew = 0;
-
- for (int p : cache.affinity().primaryPartitions(grid.localNode())) {
- Set set = cache.entrySet(p);
-
- if (set != null) {
- for (Object entry : set)
- System.out.println(entry);
-
- primaryPartSizeNew += set.size();
+ if (!GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ try {
+ return dataCache.size(new CachePeekMode[] {CachePeekMode.ALL}) == 0;
+ } catch (IgniteCheckedException ice) {
+ throw new IgniteException(ice);
+ }
+ }
+ }, 10_000)) {
+ Set<GridCacheEntryEx> set = dataCache.allEntries();
+
+ for (GridCacheEntryEx e: set) {
+ X.println("deleted = " + e.deleted());
+ X.println("detached = " + e.detached());
+ X.println("info = " + e.info());
+ X.println("k = " + e.key() + ", v = " + e.valueBytes());
}
- }
- assert sizeNew == 0;
- assert primarySizeNew == 0;
- assert primaryKeySetSizeNew == 0;
- assert primaryPartSizeNew == 0;
+ assert false;
+ }
}
/**
@@ -1885,14 +1881,18 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
public void testDeadlocksRename() throws Exception {
for (int i = 0; i < REPEAT_CNT; i++) {
try {
+ info(">>>>>> Start deadlock test.");
+
checkDeadlocks(5, 2, 2, 2, OPS_CNT, 0, 0, 0, 0);
+
+ info(">>>>>> End deadlock test.");
}
finally {
- info(">>>>>> Start deadlock test");
+ info(">>>>>> Start cleanup.");
clear(igfs, igfsSecondary);
- info(">>>>>> End deadlock test");
+ info(">>>>>> End cleanup.");
}
}
}
@@ -1903,6 +1903,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
* @throws Exception If failed.
*/
public void testDeadlocksDelete() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1515");
+
for (int i = 0; i < REPEAT_CNT; i++) {
try {
checkDeadlocks(5, 2, 2, 2, 0, OPS_CNT, 0, 0, 0);
@@ -1967,6 +1969,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
* @throws Exception If failed.
*/
public void testDeadlocks() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-1515");
+
for (int i = 0; i < REPEAT_CNT; i++) {
try {
checkDeadlocks(5, 2, 2, 2, OPS_CNT, OPS_CNT, OPS_CNT, OPS_CNT, OPS_CNT);
@@ -2038,7 +2042,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
}
// Now as we have all paths defined, plan operations on them.
- final Random rand = new Random(U.currentTimeMillis());
+ final Random rand = new Random(SEED);
int totalOpCnt = renCnt + delCnt + updateCnt + mkdirsCnt + createCnt;
@@ -2194,7 +2198,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
threads.add(new Thread(r));
}
- // Create folder structure.
+ // Create file/directory structure.
for (int i = 0; i < lvlCnt; i++) {
int lvl = i + 1;
@@ -2252,6 +2256,14 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
}
}
+ /**
+ * Creates specified files/directories
+ *
+ * @param uni The file system to operate on.
+ * @param dirs The directories to create.
+ * @param files The files to create.
+ * @throws Exception On error.
+ */
@SuppressWarnings("EmptyTryBlock")
public void create(UniversalFileSystemAdapter uni, @Nullable IgfsPath[] dirs, @Nullable IgfsPath[] files) throws Exception {
if (dirs != null) {
@@ -2646,6 +2658,34 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
}
/**
+ * Gets the data cache instance for this IGFS instance.
+ *
+ * @param igfs The IGFS unstance.
+ * @return The data cache.
+ */
+ protected static GridCacheAdapter<IgfsBlockKey, byte[]> getDataCache(IgniteFileSystem igfs) {
+ String dataCacheName = igfs.configuration().getDataCacheName();
+
+ IgniteEx igniteEx = ((IgfsEx)igfs).context().kernalContext().grid();
+
+ return ((IgniteKernal)igniteEx).internalCache(dataCacheName);
+ }
+
+ /**
+ * Gets meta cache.
+ *
+ * @param igfs The IGFS instance.
+ * @return The data cache.
+ */
+ protected static GridCacheAdapter<IgniteUuid, IgfsFileInfo> getMetaCache(IgniteFileSystem igfs) {
+ String dataCacheName = igfs.configuration().getMetaCacheName();
+
+ IgniteEx igniteEx = ((IgfsEx)igfs).context().kernalContext().grid();
+
+ return ((IgniteKernal)igniteEx).internalCache(dataCacheName);
+ }
+
+ /**
* Clear particular IGFS.
*
* @param igfs IGFS.
@@ -2674,6 +2714,69 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
// Clear igfs.
igfs.format();
+
+ final IgniteFileSystem igfs0 = igfs;
+
+ if (!GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ return isEmpty(igfs0);
+ }
+ }, 10_000L)) {
+ dumpCache("MetaCache" , getMetaCache(igfs));
+
+ dumpCache("DataCache" , getDataCache(igfs));
+
+ assert false;
+ }
+ }
+
+ /**
+ * Dumps given cache for diagnostic purposes.
+ *
+ * @param cacheName Name.
+ * @param cache The cache.
+ */
+ private static void dumpCache(String cacheName, GridCacheAdapter<?,?> cache) {
+ X.println("=============================== " + cacheName + " cache dump: ");
+
+ Set<GridCacheEntryEx> set = cache.entries();
+
+ for (GridCacheEntryEx e: set)
+ X.println("Lost " + cacheName + " entry = " + e);
+ }
+
+ /**
+ * Answers if the given IGFS is empty.
+ *
+ * @param igfs IGFS to operate on.
+ * @return True if IGFS is empty.
+ */
+ private static boolean isEmpty(IgniteFileSystem igfs) {
+ GridCacheAdapter dataCache = getDataCache(igfs);
+
+ assert dataCache != null;
+
+ int size1 = dataCache.size();
+
+ if (size1 > 0) {
+ X.println("Data cache size = " + size1);
+
+ return false;
+ }
+
+ GridCacheAdapter metaCache = getMetaCache(igfs);
+
+ assert metaCache != null;
+
+ int size2 = metaCache.size();
+
+ if (size2 > 2) {
+ X.println("Meta cache size = " + size2);
+
+ return false;
+ }
+
+ return true;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3bcf4ae/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsClientCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsClientCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsClientCacheSelfTest.java
index f2394fc..8e8eac1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsClientCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsClientCacheSelfTest.java
@@ -47,9 +47,6 @@ public class IgfsClientCacheSelfTest extends IgfsAbstractSelfTest {
/** Data cache name. */
private static final String DATA_CACHE_NAME = null;
- /** Regular cache name. */
- private static final String CACHE_NAME = "cache";
-
/**
* Constructor.
*/
@@ -61,9 +58,9 @@ public class IgfsClientCacheSelfTest extends IgfsAbstractSelfTest {
@Override protected void beforeTestsStarted() throws Exception {
igfsSecondaryFileSystem = createSecondaryFileSystemStack();
- Ignite ignite1 = G.start(getConfiguration(getTestGridName(1)));
+ Ignite ignitePrimary = G.start(getConfiguration(getTestGridName(1)));
- igfs = (IgfsImpl) ignite1.fileSystem("igfs");
+ igfs = (IgfsImpl) ignitePrimary.fileSystem("igfs");
}
/**{@inheritDoc} */
@@ -86,8 +83,10 @@ public class IgfsClientCacheSelfTest extends IgfsAbstractSelfTest {
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
- cfg.setCacheConfiguration(cacheConfiguration(META_CACHE_NAME), cacheConfiguration(DATA_CACHE_NAME),
- cacheConfiguration(CACHE_NAME));
+ cfg.setCacheConfiguration(
+ cacheConfiguration(META_CACHE_NAME),
+ cacheConfiguration(DATA_CACHE_NAME)
+ );
TcpDiscoverySpi disco = new TcpDiscoverySpi();
@@ -117,7 +116,7 @@ public class IgfsClientCacheSelfTest extends IgfsAbstractSelfTest {
* @return Cache configuration.
*/
protected CacheConfiguration cacheConfiguration(String cacheName) {
- CacheConfiguration cacheCfg = defaultCacheConfiguration();
+ CacheConfiguration<?,?> cacheCfg = defaultCacheConfiguration();
cacheCfg.setName(cacheName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3bcf4ae/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
index 75423f1..206c9fe 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
@@ -152,8 +152,6 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
assertEquals(F.asMap("dir", new IgfsListingEntry(dir), "file", new IgfsListingEntry(file)),
mgr.directoryListing(ROOT_ID));
- //IgfsFileInfo tmp = mgr.info(dir.id());
-
assertEquals(dir, mgr.info(dir.id()));
assertEquals(file, mgr.info(file.id()));
@@ -215,6 +213,9 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
IgfsFileInfo a = new IgfsFileInfo(true, null);
IgfsFileInfo b = new IgfsFileInfo(true, null);
+ IgfsFileInfo k = new IgfsFileInfo(true, null);
+ IgfsFileInfo z = new IgfsFileInfo(true, null);
+
IgfsFileInfo f1 = new IgfsFileInfo(400, null, false, null);
IgfsFileInfo f2 = new IgfsFileInfo(new IgfsFileInfo(400, null, false, null), 0);
IgfsFileInfo f3 = new IgfsFileInfo(new IgfsFileInfo(400, null, false, null), 200000L);
@@ -223,6 +224,8 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
assertNull(mgr.putIfAbsent(ROOT_ID, "a", a));
assertNull(mgr.putIfAbsent(ROOT_ID, "f1", f1));
assertNull(mgr.putIfAbsent(a.id(), "b", b));
+ assertNull(mgr.putIfAbsent(a.id(), "k", z));
+ assertNull(mgr.putIfAbsent(b.id(), "k", k));
assertNull(mgr.putIfAbsent(a.id(), "f2", f2));
assertNull(mgr.putIfAbsent(b.id(), "f3", f3));
@@ -232,15 +235,15 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
assertEquals(F.asMap("a", new IgfsListingEntry(a), "f1", new IgfsListingEntry(f1)),
mgr.directoryListing(ROOT_ID));
- assertEquals(F.asMap("b", new IgfsListingEntry(b), "f2", new IgfsListingEntry(f2)),
+ assertEquals(F.asMap("b", new IgfsListingEntry(b), "f2", new IgfsListingEntry(f2), "k", new IgfsListingEntry(z)),
mgr.directoryListing(a.id()));
- assertEquals(F.asMap("f3", new IgfsListingEntry(f3)), mgr.directoryListing(b.id()));
+ assertEquals(F.asMap("f3", new IgfsListingEntry(f3),
+ "k", new IgfsListingEntry(k)), mgr.directoryListing(b.id()));
// Validate empty files listings.
- for (IgfsFileInfo info : Arrays.asList(f1, f2, f3)) {
+ for (IgfsFileInfo info : Arrays.asList(f1, f2, f3))
assertEmpty(mgr.directoryListing(info.id()));
- }
// Validate 'file info' operations.
for (IgfsFileInfo info : Arrays.asList(rootInfo, a, b, f1, f2, f3)) {
@@ -279,51 +282,44 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
assertEquals(Arrays.asList(ROOT_ID, a.id(), b.id(), null), mgr.fileIds(new IgfsPath("/a/b/f6")));
assertEquals(Arrays.asList(ROOT_ID, null, null, null, null), mgr.fileIds(new IgfsPath("/f7/a/b/f6")));
- // Validate 'rename' operation.
- final IgniteUuid rndId = IgniteUuid.randomUuid();
-
// One of participated files does not exist in cache.
- expectsRenameFail(ROOT_ID, "b", rndId, "b2", rndId, "Failed to lock source directory (not found?)");
- expectsRenameFail(b.id(), "b", rndId, "b2", rndId, "Failed to lock source directory (not found?)");
- expectsRenameFail(ROOT_ID, "b", ROOT_ID, "b2", rndId, "Failed to lock destination directory (not found?)");
- expectsRenameFail(b.id(), "b", ROOT_ID, "b2", rndId, "Failed to lock destination directory (not found?)");
- expectsRenameFail(rndId, "b", ROOT_ID, "b2", ROOT_ID, "Failed to lock target file (not found?)");
- expectsRenameFail(rndId, "b", b.id(), "b2", b.id(), "Failed to lock target file (not found?)");
-
- // Target file ID differ from the file ID resolved from the source directory for source file name.
- expectsRenameFail(b.id(), "a", ROOT_ID, "q", ROOT_ID, "Failed to remove file name from the source directory");
- expectsRenameFail(f1.id(), "a", ROOT_ID, "q", ROOT_ID, "Failed to remove file name from the source directory");
- expectsRenameFail(f2.id(), "a", ROOT_ID, "q", ROOT_ID, "Failed to remove file name from the source directory");
- expectsRenameFail(f3.id(), "a", ROOT_ID, "q", ROOT_ID, "Failed to remove file name from the source directory");
-
- // Invalid source file name (not found).
- expectsRenameFail(a.id(), "u1", ROOT_ID, "q", ROOT_ID, "Failed to remove file name from the source");
- expectsRenameFail(a.id(), "u2", ROOT_ID, "q", ROOT_ID, "Failed to remove file name from the source");
- expectsRenameFail(a.id(), "u3", ROOT_ID, "q", ROOT_ID, "Failed to remove file name from the source");
-
- // Invalid destination file - already exists.
- expectsRenameFail(a.id(), "a", ROOT_ID, "f1", ROOT_ID, "Failed to add file name into the destination");
- expectsRenameFail(f2.id(), "f2", a.id(), "f1", ROOT_ID, "Failed to add file name into the destination");
- expectsRenameFail(f3.id(), "f3", b.id(), "f1", ROOT_ID, "Failed to add file name into the destination");
- expectsRenameFail(b.id(), "b", a.id(), "f2", a.id(), "Failed to add file name into the destination");
+ expectsRenameFail("/b8", "/b2", "Failed to perform move because some path component was not found.");
+
+ expectsRenameFail("/a", "/b/b8", "Failed to perform move because some path component was not found.");
+
+ expectsRenameFail("/a/f2", "/a/b/f3", "Failed to perform move because destination points to existing file");
+
+ expectsRenameFail("/a/k", "/a/b/", "Failed to perform move because destination already " +
+ "contains entry with the same name existing file");
+
+ mgr.delete(a.id(), "k", k.id());
+ mgr.delete(b.id(), "k", z.id());
System.out.println("/: " + mgr.directoryListing(ROOT_ID));
System.out.println("a: " + mgr.directoryListing(a.id()));
System.out.println("b: " + mgr.directoryListing(b.id()));
System.out.println("f3: " + mgr.directoryListing(f3.id()));
- mgr.move(a.id(), "a", ROOT_ID, "a2", ROOT_ID);
- mgr.move(b.id(), "b", a.id(), "b2", a.id());
+ //mgr.move(a.id(), "a", ROOT_ID, "a2", ROOT_ID);
+ mgr.move(path("/a"), path("/a2"));
+ //mgr.move(b.id(), "b", a.id(), "b2", a.id());
+ mgr.move(path("/a2/b"), path("/a2/b2"));
assertNotNull(mgr.info(b.id()));
- mgr.move(f3.id(), "f3", b.id(), "f3-2", a.id());
+ //mgr.move(f3.id(), "f3", b.id(), "f3-2", a.id());
+ mgr.move(path("/a2/b2/f3"), path("/a2/b2/f3-2"));
assertNotNull(mgr.info(b.id()));
- mgr.move(f3.id(), "f3-2", a.id(), "f3", b.id());
- mgr.move(b.id(), "b2", a.id(), "b", a.id());
- mgr.move(a.id(), "a2", ROOT_ID, "a", ROOT_ID);
+ //mgr.move(f3.id(), "f3-2", a.id(), "f3", b.id());
+ mgr.move(path("/a2/b2/f3-2"), path("/a2/b2/f3"));
+
+ //mgr.move(b.id(), "b2", a.id(), "b", a.id());
+ mgr.move(path("/a2/b2"), path("/a2/b"));
+
+ //mgr.move(a.id(), "a2", ROOT_ID, "a", ROOT_ID);
+ mgr.move(path("/a2"), path("/a"));
// Validate 'remove' operation.
for (int i = 0; i < 100; i++) {
@@ -345,7 +341,9 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
assertEquals(F.asMap("a", new IgfsListingEntry(a), "f1", new IgfsListingEntry(f1)),
mgr.directoryListing(ROOT_ID));
- assertEquals(F.asMap("b", new IgfsListingEntry(b), "f2", new IgfsListingEntry(f2)),
+ assertEquals(
+ F.asMap("b", new IgfsListingEntry(b),
+ "f2", new IgfsListingEntry(f2)),
mgr.directoryListing(a.id()));
assertEmpty(mgr.directoryListing(b.id()));
@@ -393,6 +391,16 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
}
/**
+ * Utility method to make IgfsPath.
+ *
+ * @param p The String path.
+ * @return The IgfsPath object.
+ */
+ private static IgfsPath path(String p) {
+ return new IgfsPath(p);
+ }
+
+ /**
* Validate passed map is empty.
*
* @param map Map to validate it is empty.
@@ -411,8 +419,7 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
private void expectsUpdatePropertiesFail(@Nullable final IgniteUuid fileId, @Nullable final Map<String, String> props,
Class<? extends Throwable> cls, @Nullable String msg) {
assertThrows(log, new Callable() {
- @Override
- public Object call() throws Exception {
+ @Override public Object call() throws Exception {
return mgr.updateProperties(null, fileId, "file", props);
}
}, cls, msg);
@@ -440,25 +447,18 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
/**
* Test expected failures for 'move file' operation.
*
- * @param fileId File ID to rename.
- * @param srcFileName Original file name in the parent's listing.
- * @param srcParentId Source parent directory ID.
- * @param destFileName New file name in the parent's listing after renaming.
- * @param destParentId Destination parent directory ID.
* @param msg Failure message if expected exception was not thrown.
*/
- private void expectsRenameFail(final IgniteUuid fileId, final String srcFileName, final IgniteUuid srcParentId,
- final String destFileName, final IgniteUuid destParentId, @Nullable String msg) {
+ private void expectsRenameFail(final String src, final String dst, @Nullable String msg) {
Throwable err = assertThrowsInherited(log, new Callable() {
- @Override
- public Object call() throws Exception {
- mgr.move(fileId, srcFileName, srcParentId, destFileName, destParentId);
+ @Override public Object call() throws Exception {
+ mgr.move(new IgfsPath(src), new IgfsPath(dst));
return null;
}
- }, IgniteCheckedException.class, msg);
+ }, IgfsException.class, msg);
- assertTrue("Unexpected cause: " + err.getCause(), err.getCause() instanceof IgfsException);
+ assertTrue("Unexpected cause: " + err, err instanceof IgfsException);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/b3bcf4ae/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
index 23f85d2..0216f4b 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/testsuites/IgniteHadoopTestSuite.java
@@ -61,7 +61,6 @@ import org.apache.ignite.internal.processors.hadoop.HadoopJobTrackerSelfTest;
import org.apache.ignite.internal.processors.hadoop.HadoopMapReduceEmbeddedSelfTest;
import org.apache.ignite.internal.processors.hadoop.HadoopMapReduceTest;
import org.apache.ignite.internal.processors.hadoop.HadoopSerializationWrapperSelfTest;
-import org.apache.ignite.internal.processors.hadoop.HadoopSortingExternalTest;
import org.apache.ignite.internal.processors.hadoop.HadoopSortingTest;
import org.apache.ignite.internal.processors.hadoop.HadoopSplitWrapperSelfTest;
import org.apache.ignite.internal.processors.hadoop.HadoopTaskExecutionSelfTest;
@@ -73,8 +72,6 @@ import org.apache.ignite.internal.processors.hadoop.shuffle.collections.HadoopCo
import org.apache.ignite.internal.processors.hadoop.shuffle.collections.HadoopHashMapSelfTest;
import org.apache.ignite.internal.processors.hadoop.shuffle.collections.HadoopSkipListSelfTest;
import org.apache.ignite.internal.processors.hadoop.shuffle.streams.HadoopDataStreamSelfTest;
-import org.apache.ignite.internal.processors.hadoop.taskexecutor.external.HadoopExternalTaskExecutionSelfTest;
-import org.apache.ignite.internal.processors.hadoop.taskexecutor.external.communication.HadoopExternalCommunicationSelfTest;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -97,6 +94,14 @@ public class IgniteHadoopTestSuite extends TestSuite {
TestSuite suite = new TestSuite("Ignite Hadoop MR Test Suite");
+ suite.addTest(new TestSuite(ldr.loadClass(HadoopIgfs20FileSystemLoopbackPrimarySelfTest.class.getName())));
+
+ suite.addTest(new TestSuite(ldr.loadClass(HadoopIgfsDualSyncSelfTest.class.getName())));
+ suite.addTest(new TestSuite(ldr.loadClass(HadoopIgfsDualAsyncSelfTest.class.getName())));
+
+ suite.addTest(new TestSuite(ldr.loadClass(Hadoop1OverIgfsDualSyncTest.class.getName())));
+ suite.addTest(new TestSuite(ldr.loadClass(Hadoop1OverIgfsDualAsyncTest.class.getName())));
+
suite.addTest(new TestSuite(ldr.loadClass(IgniteHadoopFileSystemLoopbackExternalPrimarySelfTest.class.getName())));
suite.addTest(new TestSuite(ldr.loadClass(IgniteHadoopFileSystemLoopbackExternalSecondarySelfTest.class.getName())));
suite.addTest(new TestSuite(ldr.loadClass(IgniteHadoopFileSystemLoopbackExternalDualSyncSelfTest.class.getName())));
@@ -115,11 +120,6 @@ public class IgniteHadoopTestSuite extends TestSuite {
suite.addTest(new TestSuite(ldr.loadClass(IgniteHadoopFileSystemHandshakeSelfTest.class.getName())));
- suite.addTest(new TestSuite(ldr.loadClass(HadoopIgfs20FileSystemLoopbackPrimarySelfTest.class.getName())));
-
- suite.addTest(new TestSuite(ldr.loadClass(HadoopIgfsDualSyncSelfTest.class.getName())));
- suite.addTest(new TestSuite(ldr.loadClass(HadoopIgfsDualAsyncSelfTest.class.getName())));
-
suite.addTest(IgfsEventsTestSuite.suiteNoarchOnly());
suite.addTest(new TestSuite(ldr.loadClass(HadoopFileSystemsTest.class.getName())));
@@ -163,9 +163,6 @@ public class IgniteHadoopTestSuite extends TestSuite {
suite.addTest(new TestSuite(ldr.loadClass(HadoopCommandLineTest.class.getName())));
suite.addTest(new TestSuite(ldr.loadClass(HadoopSecondaryFileSystemConfigurationTest.class.getName())));
-
- suite.addTest(new TestSuite(ldr.loadClass(Hadoop1OverIgfsDualSyncTest.class.getName())));
- suite.addTest(new TestSuite(ldr.loadClass(Hadoop1OverIgfsDualAsyncTest.class.getName())));
return suite;
}
[29/46] ignite git commit: Changed
IgniteCacheProcessProxy.localEntries to avoid issues with Cache.Entry
serialization.
Posted by sb...@apache.org.
Changed IgniteCacheProcessProxy.localEntries to avoid issues with Cache.Entry serialization.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bf7591b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bf7591b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bf7591b5
Branch: refs/heads/ignite-1093-2
Commit: bf7591b5eb6323011a03c424362ab68f994cffc9
Parents: 31c4405
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 24 16:33:05 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 24 16:33:05 2015 +0300
----------------------------------------------------------------------
.../testframework/junits/multijvm/IgniteCacheProcessProxy.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bf7591b5/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
index dfbb0ae..ac8c5af 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
@@ -43,6 +43,7 @@ import org.apache.ignite.cache.query.Query;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.QueryMetrics;
import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
import org.apache.ignite.internal.util.future.IgniteFinishedFutureImpl;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteCallable;
@@ -209,7 +210,7 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
Collection<Entry> res = new ArrayList<>();
for (Entry e : cache().localEntries(peekModes))
- res.add(e);
+ res.add(new CacheEntryImpl(e.getKey(), e.getValue()));
return res;
}
[30/46] ignite git commit: Enabled test for atomic cache.
Posted by sb...@apache.org.
Enabled test for atomic cache.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/03a8fe58
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/03a8fe58
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/03a8fe58
Branch: refs/heads/ignite-1093-2
Commit: 03a8fe587e46404461bff6f118ccbb8539f3f39a
Parents: bf7591b
Author: sboikov <sb...@gridgain.com>
Authored: Fri Sep 25 13:12:11 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Sep 25 13:12:11 2015 +0300
----------------------------------------------------------------------
.../expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/03a8fe58/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
index 99af872..78c59ac 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
@@ -25,6 +25,7 @@ import javax.cache.integration.CompletionListenerFuture;
import javax.cache.processor.EntryProcessor;
import javax.cache.processor.MutableEntry;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.configuration.CacheConfiguration;
@@ -141,7 +142,8 @@ public abstract class IgniteCacheExpiryPolicyWithStoreAbstractTest extends Ignit
* @throws Exception If failed.
*/
public void testReadThrough() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-821");
+ if (atomicityMode() == CacheAtomicityMode.TRANSACTIONAL)
+ fail("https://issues.apache.org/jira/browse/IGNITE-821");
IgniteCache<Integer, Integer> cache = jcache(0);
@@ -185,6 +187,7 @@ public abstract class IgniteCacheExpiryPolicyWithStoreAbstractTest extends Ignit
/**
* @param key Key.
* @param ttl TTL.
+ * @param primaryOnly If {@code true} expect entries only on primary node.
* @throws Exception If failed.
*/
private void checkTtl(Object key, final long ttl, boolean primaryOnly) throws Exception {
[22/46] ignite git commit: Fixed imports.
Posted by sb...@apache.org.
Fixed imports.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ece34004
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ece34004
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ece34004
Branch: refs/heads/ignite-1093-2
Commit: ece3400438709b2bac2ad9d206028b4bdb897073
Parents: f6ba3c3
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 24 13:09:15 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 24 13:09:15 2015 +0300
----------------------------------------------------------------------
.../IgniteCacheFailoverTestSuite.java | 4 ----
.../IgniteCacheFailoverTestSuite3.java | 23 +++-----------------
2 files changed, 3 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ece34004/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
index abc8765..c9e507d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
@@ -33,18 +33,14 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtR
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheTxNodeFailureSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridNearCacheTxNodeFailureSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteAtomicLongChangingTopologySelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryTransactionalSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicClientInvalidPartitionHandlingSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicClientRemoveFailureTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicInvalidPartitionHandlingSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicPrimaryWriteOrderRemoveFailureTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicRemoveFailureTest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearRemoveFailureTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearRemoveFailureTest;
-import org.apache.ignite.spi.communication.tcp.IgniteCacheSslStartStopSelfTest;
import org.apache.ignite.testframework.GridTestUtils;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ece34004/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
index 318db9e..0bde89a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite3.java
@@ -18,18 +18,10 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
-import org.apache.ignite.internal.processors.cache.GridCacheIncrementTransformTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheTopologySafeGetSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.*;
-import org.apache.ignite.internal.processors.cache.distributed.dht.*;
-import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearRemoveFailureTest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicPrimaryWriteOrderNearRemoveFailureTest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearRemoveFailureTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryAtomicSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryTransactionalSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.IgniteCachePutRetryAtomicPrimaryWriteOrderSelfTest;
import org.apache.ignite.spi.communication.tcp.IgniteCacheSslStartStopSelfTest;
-import org.apache.ignite.testframework.GridTestUtils;
-
-import java.util.Set;
/**
* Test suite.
@@ -40,15 +32,6 @@ public class IgniteCacheFailoverTestSuite3 extends TestSuite {
* @throws Exception Thrown in case of the failure.
*/
public static TestSuite suite() throws Exception {
- return suite(null);
- }
-
- /**
- * @param ignoredTests Tests don't include in the execution.
- * @return Test suite.
- * @throws Exception Thrown in case of the failure.
- */
- public static TestSuite suite(Set<Class> ignoredTests) throws Exception {
TestSuite suite = new TestSuite("Cache Failover Test Suite3");
suite.addTestSuite(IgniteCachePutRetryAtomicSelfTest.class);
[06/46] ignite git commit: ignite-973 - fix
Posted by sb...@apache.org.
ignite-973 - fix
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f0be45e3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f0be45e3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f0be45e3
Branch: refs/heads/ignite-1093-2
Commit: f0be45e309f9a594334209a251c069f9ba3db120
Parents: e51fb42
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Sep 22 13:36:40 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Sep 22 13:36:40 2015 +0300
----------------------------------------------------------------------
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 3 +++
.../internal/processors/query/h2/opt/GridH2Table.java | 10 +++++++++-
.../internal/processors/cache/CacheIndexStreamerTest.java | 4 ++--
3 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0be45e3/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
index 07c49a5..4a16284 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
@@ -119,6 +119,9 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
* @throws IgniteCheckedException If failed.
*/
public synchronized void onUnswap(Object val, boolean beforeRmv) throws IgniteCheckedException {
+ if (peekValue(VAL_COL) != null)
+ return;
+
setValue(VAL_COL, desc.wrap(val, desc.valueType()));
notifyAll();
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0be45e3/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 66241b4..bf318b2 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
@@ -55,6 +55,8 @@ import org.h2.value.Value;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
+import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.VAL_COL;
+
/**
* H2 Table implementation.
*/
@@ -372,6 +374,12 @@ public class GridH2Table extends TableBase {
if (!del) {
GridH2Row old = pk.put(row); // Put to PK.
+ if (old instanceof GridH2AbstractKeyValueRow) { // Unswap value on replace.
+ GridH2AbstractKeyValueRow kvOld = (GridH2AbstractKeyValueRow)old;
+
+ kvOld.onUnswap(kvOld.getValue(VAL_COL), true);
+ }
+
int len = idxs.size();
int i = 1;
@@ -399,7 +407,7 @@ public class GridH2Table extends TableBase {
GridH2Row old = pk.remove(row);
if (old instanceof GridH2AbstractKeyValueRow) { // Unswap value.
- Value v = row.getValue(GridH2AbstractKeyValueRow.VAL_COL);
+ Value v = row.getValue(VAL_COL);
if (v != null)
((GridH2AbstractKeyValueRow)old).onUnswap(v.getObject(), true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0be45e3/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
index 25c3b81..23f4e91 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
@@ -31,7 +31,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
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.spi.swapspace.file.FileSwapSpaceSpi;
+import org.apache.ignite.spi.swapspace.inmemory.GridTestSwapSpaceSpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -52,7 +52,7 @@ public class CacheIndexStreamerTest extends GridCommonAbstractTest {
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
- cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+ cfg.setSwapSpaceSpi(new GridTestSwapSpaceSpi());
return cfg;
}
[10/46] ignite git commit: Added test.
Posted by sb...@apache.org.
Added test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1942d758
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1942d758
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1942d758
Branch: refs/heads/ignite-1093-2
Commit: 1942d75856ab6d317b743de71b53a29abf81316a
Parents: ca2bce0
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 22 17:36:18 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 22 17:36:18 2015 +0300
----------------------------------------------------------------------
.../IgniteCachePutRetryAbstractSelfTest.java | 33 ++++++++++++++++++++
1 file changed, 33 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1942d758/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
index 943caeb..76f12c4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
@@ -168,6 +168,13 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
/**
* @throws Exception If failed.
*/
+ public void testGetAndPut() throws Exception {
+ checkRetry(Test.GET_AND_PUT, TestMemoryMode.HEAP, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testPutStoreEnabled() throws Exception {
checkRetry(Test.PUT, TestMemoryMode.HEAP, true);
}
@@ -275,6 +282,29 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
break;
}
+ case GET_AND_PUT: {
+ for (int i = 0; i < keysCnt; i++)
+ cache.put(i, 0);
+
+ while (System.currentTimeMillis() < stopTime) {
+ Integer expOld = iter;
+
+ Integer val = ++iter;
+
+ for (int i = 0; i < keysCnt; i++) {
+ Integer old = cache.getAndPut(i, val);
+
+ assertTrue("Unexpected old value [old=" + old + ", exp=" + expOld + ']',
+ expOld.equals(old) || val.equals(old));
+ }
+
+ for (int i = 0; i < keysCnt; i++)
+ assertEquals(val, cache.get(i));
+ }
+
+ break;
+ }
+
case PUT_ALL: {
while (System.currentTimeMillis() < stopTime) {
Integer val = ++iter;
@@ -495,6 +525,9 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
PUT,
/** */
+ GET_AND_PUT,
+
+ /** */
PUT_ALL,
/** */
[26/46] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3c5758ba
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3c5758ba
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3c5758ba
Branch: refs/heads/ignite-1093-2
Commit: 3c5758bab14b30b1dad7eb39d1c388e5f6956e0f
Parents: dd7d4fa ece3400
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Sep 24 15:17:46 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Sep 24 15:17:46 2015 +0300
----------------------------------------------------------------------
.../socket/WordsSocketStreamerServer.java | 5 +-
.../org/apache/ignite/IgniteAtomicLong.java | 2 +-
.../org/apache/ignite/IgniteFileSystem.java | 2 +-
.../apache/ignite/cache/CacheAtomicityMode.java | 17 +-
.../configuration/CacheConfiguration.java | 17 +-
.../apache/ignite/internal/IgniteKernal.java | 4 +-
.../cache/DynamicCacheDescriptor.java | 10 +-
.../processors/cache/GridCacheAdapter.java | 8 +-
.../processors/cache/GridCacheMapEntry.java | 51 +-
.../GridCachePartitionExchangeManager.java | 6 +
.../processors/cache/GridCacheProcessor.java | 28 +-
.../cache/GridCacheSwapEntryImpl.java | 31 +-
.../processors/cache/GridCacheSwapManager.java | 80 ++-
.../processors/cache/IgniteCacheProxy.java | 4 +-
.../continuous/CacheContinuousQueryManager.java | 66 +-
.../continuous/GridContinuousProcessor.java | 3 +-
.../datastreamer/DataStreamerImpl.java | 2 -
.../internal/processors/igfs/IgfsImpl.java | 87 +--
.../processors/igfs/IgfsMetaManager.java | 193 +++++-
.../org/apache/ignite/mxbean/IgniteMXBean.java | 8 +-
.../communication/tcp/TcpCommunicationSpi.java | 7 +-
.../discovery/DiscoverySpiCustomMessage.java | 12 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 410 +++++++++----
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 6 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 94 +--
.../messages/TcpDiscoveryDiscardMessage.java | 15 +-
.../TcpDiscoveryNodeAddFinishedMessage.java | 2 +-
.../messages/TcpDiscoveryNodeAddedMessage.java | 19 +-
.../org/apache/ignite/stream/StreamAdapter.java | 104 +++-
.../stream/StreamMultipleTupleExtractor.java | 38 ++
.../stream/StreamSingleTupleExtractor.java | 40 ++
.../ignite/stream/StreamTupleExtractor.java | 20 +-
.../ignite/stream/socket/SocketStreamer.java | 3 +-
.../GridCacheAbstractRemoveFailureTest.java | 6 +-
.../GridCacheVariableTopologySelfTest.java | 3 +-
.../IgniteCacheEntryListenerAbstractTest.java | 65 +-
.../distributed/CacheAffEarlySelfTest.java | 245 --------
.../distributed/CacheAffinityEarlyTest.java | 168 +++++
.../IgniteCachePutRetryAbstractSelfTest.java | 33 +
...GridCacheValueConsistencyAtomicSelfTest.java | 2 +-
.../near/NearCacheMultithreadedUpdateTest.java | 217 +++++++
...ontinuousQueryReplicatedOneNodeSelfTest.java | 120 ++++
.../processors/igfs/IgfsAbstractSelfTest.java | 201 ++++--
.../igfs/IgfsClientCacheSelfTest.java | 15 +-
.../igfs/IgfsMetaManagerSelfTest.java | 106 ++--
...lientDiscoverySpiFailureTimeoutSelfTest.java | 139 ++++-
.../tcp/TcpClientDiscoverySpiSelfTest.java | 13 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 53 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 315 +++++++++-
.../stream/socket/SocketStreamerSelfTest.java | 112 +++-
.../IgniteCacheFailoverTestSuite.java | 4 -
.../IgniteCacheFailoverTestSuite3.java | 23 +-
.../testsuites/IgniteCacheTestSuite4.java | 2 +
.../testsuites/IgniteHadoopTestSuite.java | 19 +-
.../processors/query/h2/IgniteH2Indexing.java | 19 +-
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 54 +-
.../query/h2/opt/GridH2KeyValueRowOffheap.java | 11 +-
.../query/h2/opt/GridH2RowDescriptor.java | 5 +
.../processors/query/h2/opt/GridH2Table.java | 10 +-
.../cache/CacheIndexStreamerTest.java | 37 +-
.../processors/cache/GridCacheSwapSelfTest.java | 4 +-
.../IgniteCacheQuerySelfTestSuite.java | 4 +-
.../IgniteCacheWithIndexingTestSuite.java | 2 +
modules/mqtt/pom.xml | 114 ++++
.../apache/ignite/stream/mqtt/MqttStreamer.java | 611 +++++++++++++++++++
.../stream/mqtt/IgniteMqttStreamerTest.java | 553 +++++++++++++++++
.../mqtt/IgniteMqttStreamerTestSuite.java | 34 ++
.../Apache.Ignite.Core/Impl/IgniteManager.cs | 2 -
modules/yardstick/config/ignite-base-config.xml | 2 +-
pom.xml | 1 +
71 files changed, 3762 insertions(+), 958 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c5758ba/pom.xml
----------------------------------------------------------------------
[37/46] ignite git commit: IGNITE-257 - Fixed and uncommented tests.
Posted by sb...@apache.org.
IGNITE-257 - Fixed and uncommented tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cdc5b49f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cdc5b49f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cdc5b49f
Branch: refs/heads/ignite-1093-2
Commit: cdc5b49f31973d4c973dc465f7c01ce2eb4c8c89
Parents: 343191b
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Sep 25 17:58:51 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Sep 25 17:58:51 2015 -0700
----------------------------------------------------------------------
.../near/GridNearTxFinishFuture.java | 4 +--
.../cache/distributed/near/GridNearTxLocal.java | 19 +++++++++--
.../transactions/IgniteTxLocalAdapter.java | 35 ++++++++++++++------
.../IgniteTxExceptionAbstractSelfTest.java | 3 ++
.../GridCacheColocatedTxExceptionSelfTest.java | 5 ---
.../near/GridCacheNearTxExceptionSelfTest.java | 5 ---
.../GridCacheReplicatedTxExceptionSelfTest.java | 5 ---
.../GridCacheLocalTxExceptionSelfTest.java | 5 ---
8 files changed, 47 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/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 ab6dc3c..85311cc 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
@@ -268,7 +268,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
if (tx.onePhaseCommit()) {
finishOnePhase();
- tx.tmFinish(err == null);
+ tx.tmFinish(commit && err == null);
}
Throwable th = this.err.get();
@@ -333,7 +333,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
* Initializes future.
*/
void finish() {
- if (tx.needCheckBackup()) {
+ if (tx.onNeedCheckBackup()) {
assert tx.onePhaseCommit();
checkBackup();
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index a4e06c3..8975b4a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -114,7 +114,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
private Map<IgniteTxKey, IgniteCacheExpiryPolicy> accessMap;
/** */
- private boolean needCheckBackup;
+ private Boolean needCheckBackup;
/** */
private boolean hasRemoteLocks;
@@ -255,8 +255,23 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
/**
* @return If need to check tx commit on backup.
*/
+ public boolean onNeedCheckBackup() {
+ Boolean check = needCheckBackup;
+
+ if (check != null && check) {
+ needCheckBackup = false;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @return If backup check was requested.
+ */
public boolean needCheckBackup() {
- return needCheckBackup;
+ return needCheckBackup != null;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/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 6ca1f72..aa0ffe8 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
@@ -1120,11 +1120,13 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
state(commit ? COMMITTED : ROLLED_BACK);
- boolean needsCompletedVersions = commit && needsCompletedVersions();
+ if (commit) {
+ boolean needsCompletedVersions = needsCompletedVersions();
- assert !needsCompletedVersions || completedBase != null;
- assert !needsCompletedVersions || committedVers != null;
- assert !needsCompletedVersions || rolledbackVers != null;
+ assert !needsCompletedVersions || completedBase != null : "Missing completed base for transaction: " + this;
+ assert !needsCompletedVersions || committedVers != null : "Missing committed versions for transaction: " + this;
+ assert !needsCompletedVersions || rolledbackVers != null : "Missing rolledback versions for transaction: " + this;
+ }
}
}
@@ -2895,11 +2897,17 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
}
return nonInterruptable(commitAsync().chain(new CX1<IgniteInternalFuture<IgniteInternalTx>, GridCacheReturn>() {
- @Override
- public GridCacheReturn applyx(IgniteInternalFuture<IgniteInternalTx> txFut) throws IgniteCheckedException {
- txFut.get();
+ @Override public GridCacheReturn applyx(IgniteInternalFuture<IgniteInternalTx> txFut) throws IgniteCheckedException {
+ try {
+ txFut.get();
+
+ return implicitRes;
+ }
+ catch (IgniteCheckedException | RuntimeException e) {
+ rollbackAsync();
- return implicitRes;
+ throw e;
+ }
}
}));
}
@@ -3118,9 +3126,16 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
return nonInterruptable(commitAsync().chain(new CX1<IgniteInternalFuture<IgniteInternalTx>, GridCacheReturn>() {
@Override public GridCacheReturn applyx(IgniteInternalFuture<IgniteInternalTx> txFut)
throws IgniteCheckedException {
- txFut.get();
+ try {
+ txFut.get();
- return implicitRes;
+ return implicitRes;
+ }
+ catch (IgniteCheckedException | RuntimeException e) {
+ rollbackAsync();
+
+ throw e;
+ }
}
}));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
index 10b47fe..3311608 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
@@ -368,6 +368,9 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
for (Integer key : keys)
checkUnlocked(key);
+
+ for (int i = 0; i < gridCount(); i++)
+ assertEquals(0, ((IgniteKernal)ignite(0)).internalCache(null).context().tm().idMapSize());
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
index 5514ff6..b5d79e1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
@@ -28,11 +28,6 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
*/
public class GridCacheColocatedTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
/** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-257");
- }
-
- /** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
return PARTITIONED;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
index 67bccac..d6e3804 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
@@ -27,11 +27,6 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
*/
public class GridCacheNearTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
/** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-257");
- }
-
- /** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
return PARTITIONED;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
index c2799db..1c96a4d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
@@ -28,11 +28,6 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
*/
public class GridCacheReplicatedTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
/** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-257");
- }
-
- /** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
return REPLICATED;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
index 2fae99b..63a900d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
@@ -27,11 +27,6 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
*/
public class GridCacheLocalTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
/** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-257");
- }
-
- /** {@inheritDoc} */
@Override protected int gridCount() {
return 1;
}
[38/46] ignite git commit: IGNITE-1554 Fix igniterouter scripts.
Posted by sb...@apache.org.
IGNITE-1554 Fix igniterouter scripts.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dc379fe1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dc379fe1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dc379fe1
Branch: refs/heads/ignite-1093-2
Commit: dc379fe14179a819818e31b190a68982f4dd24a7
Parents: cdc5b49
Author: Raul Kripalani <ra...@apache.org>
Authored: Sat Sep 26 11:31:11 2015 +0100
Committer: Raul Kripalani <ra...@apache.org>
Committed: Sat Sep 26 11:34:55 2015 +0100
----------------------------------------------------------------------
bin/igniterouter.bat | 2 +-
bin/igniterouter.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc379fe1/bin/igniterouter.bat
----------------------------------------------------------------------
diff --git a/bin/igniterouter.bat b/bin/igniterouter.bat
index b1f9148..0a9775e 100644
--- a/bin/igniterouter.bat
+++ b/bin/igniterouter.bat
@@ -27,7 +27,7 @@ if "%OS%" == "Windows_NT" setlocal
:: Set router service environment.
::
set "DEFAULT_CONFIG=config\router\default-router.xml"
-set MAIN_CLASS=org.apache.ignite.client.router.impl.GridRouterCommandLineStartup
+set MAIN_CLASS=org.apache.ignite.internal.client.router.impl.GridRouterCommandLineStartup
::
:: Start router service.
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc379fe1/bin/igniterouter.sh
----------------------------------------------------------------------
diff --git a/bin/igniterouter.sh b/bin/igniterouter.sh
index 9ab848e..af27f8b 100755
--- a/bin/igniterouter.sh
+++ b/bin/igniterouter.sh
@@ -45,7 +45,7 @@ setIgniteHome
# Set router service environment.
#
export DEFAULT_CONFIG=config/router/default-router.xml
-export MAIN_CLASS=org.apache.ignite.client.router.impl.GridRouterCommandLineStartup
+export MAIN_CLASS=org.apache.ignite.internal.client.router.impl.GridRouterCommandLineStartup
#
# Start router service.
[11/46] ignite git commit: Merge branch 'ignite-1.4'
Posted by sb...@apache.org.
Merge branch 'ignite-1.4'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0a41ae57
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0a41ae57
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0a41ae57
Branch: refs/heads/ignite-1093-2
Commit: 0a41ae57215e9d2d208d33f7a46653c4be43de9c
Parents: 88acd31 1942d75
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 22 17:53:41 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 22 17:53:41 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/cache/CacheAtomicityMode.java | 17 +--
.../configuration/CacheConfiguration.java | 15 +++
.../processors/cache/GridCacheAdapter.java | 8 +-
.../processors/cache/GridCacheMapEntry.java | 51 ++++----
.../processors/cache/GridCacheProcessor.java | 10 +-
.../cache/GridCacheSwapEntryImpl.java | 31 ++++-
.../processors/cache/GridCacheSwapManager.java | 80 ++++++++-----
.../datastreamer/DataStreamerImpl.java | 2 -
.../IgniteCacheEntryListenerAbstractTest.java | 65 +++++++++-
.../IgniteCachePutRetryAbstractSelfTest.java | 33 ++++++
...lientDiscoverySpiFailureTimeoutSelfTest.java | 118 ++++++++++++++++++-
.../tcp/TcpClientDiscoverySpiSelfTest.java | 13 +-
.../processors/query/h2/IgniteH2Indexing.java | 19 +--
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 54 ++++++---
.../query/h2/opt/GridH2KeyValueRowOffheap.java | 11 +-
.../query/h2/opt/GridH2RowDescriptor.java | 5 +
.../processors/query/h2/opt/GridH2Table.java | 10 +-
.../cache/CacheIndexStreamerTest.java | 37 ++++--
.../processors/cache/GridCacheSwapSelfTest.java | 4 +-
.../IgniteCacheWithIndexingTestSuite.java | 2 +
20 files changed, 448 insertions(+), 137 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a41ae57/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
[28/46] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/31c44054
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/31c44054
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/31c44054
Branch: refs/heads/ignite-1093-2
Commit: 31c44054c25e03e95fb4a3e237bfa6bf273c59dd
Parents: 1056a31 3c5758b
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 24 15:52:40 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 24 15:52:40 2015 +0300
----------------------------------------------------------------------
examples/schema-import/pom.xml | 10 ++++++++--
pom.xml | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[07/46] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.4' into ignite-1.4
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.4' into ignite-1.4
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/39dace45
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/39dace45
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/39dace45
Branch: refs/heads/ignite-1093-2
Commit: 39dace45c81aef7cb913fcf4f98a7d71e34beebd
Parents: f0be45e a104087
Author: S.Vladykin <sv...@gridgain.com>
Authored: Tue Sep 22 13:38:21 2015 +0300
Committer: S.Vladykin <sv...@gridgain.com>
Committed: Tue Sep 22 13:38:21 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/cache/CacheAtomicityMode.java | 17 +--
.../processors/cache/GridCacheProcessor.java | 2 +-
...lientDiscoverySpiFailureTimeoutSelfTest.java | 118 ++++++++++++++++++-
.../tcp/TcpClientDiscoverySpiSelfTest.java | 13 +-
4 files changed, 125 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
[40/46] ignite git commit: Added test.
Posted by sb...@apache.org.
Added test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2575cf33
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2575cf33
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2575cf33
Branch: refs/heads/ignite-1093-2
Commit: 2575cf33a4b8389aa84e9cf0ee68d48c3a48bfa7
Parents: 8fea96e
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 28 13:07:59 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 28 13:07:59 2015 +0300
----------------------------------------------------------------------
.../cache/IgniteDynamicCacheFilterTest.java | 150 +++++++++++++++++++
.../testsuites/IgniteCacheTestSuite4.java | 3 +
2 files changed, 153 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2575cf33/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
new file mode 100644
index 0000000..4d543e0
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
@@ -0,0 +1,150 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.lang.IgnitePredicate;
+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 static org.apache.ignite.cache.CacheMode.REPLICATED;
+import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class IgniteDynamicCacheFilterTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final String ATTR_NAME = "cacheAttr";
+
+ /** */
+ private String attrVal;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setCacheMode(REPLICATED);
+ ccfg.setRebalanceMode(SYNC);
+
+ ccfg.setNodeFilter(new TestNodeFilter("A"));
+
+ if (attrVal != null) {
+ Map<String, Object> attrs = new HashMap<>();
+
+ attrs.put(ATTR_NAME, attrVal);
+
+ cfg.setUserAttributes(attrs);
+ }
+
+ cfg.setCacheConfiguration(ccfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ super.afterTest();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCofiguredCacheFilter() throws Exception {
+ attrVal = "A";
+
+ Ignite ignite0 = startGrid(0);
+
+ IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+
+ assertNotNull(cache0);
+
+ cache0.put(1, 1);
+
+ attrVal = null;
+
+ Ignite ignite1 = startGrid(1);
+
+ IgniteCache<Integer, Integer> cache1 = ignite1.cache(null);
+
+ assertNotNull(cache1);
+
+ attrVal = "B";
+
+ Ignite ignite2 = startGrid(2);
+
+ IgniteCache<Integer, Integer> cache2 = ignite2.cache(null);
+
+ assertNotNull(cache2);
+
+ attrVal = "A";
+
+ Ignite ignite3 = startGrid(3);
+
+ IgniteCache<Integer, Integer> cache3 = ignite3.cache(null);
+
+ assertNotNull(cache3);
+
+ assertNotNull(cache0.localPeek(1));
+ assertNotNull(cache3.localPeek(1));
+
+ assertNull(cache1.localPeek(1));
+ assertNull(cache2.localPeek(1));
+ }
+
+ /**
+ *
+ */
+ private static class TestNodeFilter implements IgnitePredicate<ClusterNode> {
+ /** */
+ private String val;
+
+ /**
+ * @param val Attribute value.
+ */
+ public TestNodeFilter(String val) {
+ assert val != null;
+
+ this.val = val;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean apply(ClusterNode node) {
+ return val.equals(node.attribute(ATTR_NAME));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2575cf33/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 0ebcc81..959ceb1 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
@@ -65,6 +65,7 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheTxPeekModesTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheTxPreloadNoWriteTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheTxReplicatedPeekModesTest;
import org.apache.ignite.internal.processors.cache.IgniteCacheTxStoreValueTest;
+import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheFilterTest;
import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheStartNoExchangeTimeoutTest;
import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheStartSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheWithConfigStartSelfTest;
@@ -268,6 +269,8 @@ public class IgniteCacheTestSuite4 extends TestSuite {
suite.addTestSuite(GridCacheNearTxPreloadSelfTest.class);
suite.addTestSuite(GridReplicatedTxPreloadTest.class);
+ suite.addTestSuite(IgniteDynamicCacheFilterTest.class);
+
return suite;
}
}
\ No newline at end of file
[25/46] ignite git commit: schema-import examples fix (cherry picked
from commit b054fdc)
Posted by sb...@apache.org.
schema-import examples fix
(cherry picked from commit b054fdc)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dd7d4fac
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dd7d4fac
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dd7d4fac
Branch: refs/heads/ignite-1093-2
Commit: dd7d4fac3a5f391b23c196a5d9951de9d3a762fa
Parents: 94f5248
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Sep 24 15:17:15 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Sep 24 15:17:15 2015 +0300
----------------------------------------------------------------------
examples/schema-import/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dd7d4fac/examples/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom.xml b/examples/schema-import/pom.xml
index fce6f47..32ce869 100644
--- a/examples/schema-import/pom.xml
+++ b/examples/schema-import/pom.xml
@@ -38,7 +38,7 @@
</properties>
<artifactId>ignite-schema-import-demo</artifactId>
- <version>1.3.3-p7-SNAPSHOT</version>
+ <version>1.5.0-SNAPSHOT</version>
<dependencies>
<dependency>
[35/46] ignite git commit: fixed sha1 & md5,
again (cherry picked from commit 7752aa9)
Posted by sb...@apache.org.
fixed sha1 & md5, again
(cherry picked from commit 7752aa9)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a6306a54
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a6306a54
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a6306a54
Branch: refs/heads/ignite-1093-2
Commit: a6306a5471a189fd4bbdabb9c1ccd9a8f0c38cb5
Parents: 3c5758b
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Sep 25 16:01:40 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Sep 25 16:21:23 2015 +0300
----------------------------------------------------------------------
pom.xml | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6306a54/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 462d4a0..fad8807 100644
--- a/pom.xml
+++ b/pom.xml
@@ -622,7 +622,15 @@
</fileset>
</copy>
- <!-- appending filename to md5 and sha1 files. to be improved. -->
+ <!-- appending filename to md5 and sha1 files. to be improved!! -->
+ <!-- update versions task will replace " " to " ", so additional echo added. -->
+ <echo file="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.md5" append="true" message=" " />
+ <echo file="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.sha1" append="true" message=" " />
+ <echo file="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.md5" append="true" message=" " />
+ <echo file="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.sha1" append="true" message=" " />
+ <echo file="${basedir}/target/site/${project.artifactId}-${project.version}-src.zip.md5" append="true" message=" " />
+ <echo file="${basedir}/target/site/${project.artifactId}-${project.version}-src.zip.sha1" append="true" message=" " />
+
<echo file="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.md5" append="true" message=" ${project.artifactId}-fabric-${project.version}-bin.zip" />
<echo file="${basedir}/target/site/${project.artifactId}-fabric-${project.version}-bin.zip.sha1" append="true" message=" ${project.artifactId}-fabric-${project.version}-bin.zip" />
<echo file="${basedir}/target/site/${project.artifactId}-hadoop-${project.version}-bin.zip.md5" append="true" message=" ${project.artifactId}-hadoop-${project.version}-bin.zip" />
[32/46] ignite git commit: 1093
Posted by sb...@apache.org.
1093
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eeb313c4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eeb313c4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eeb313c4
Branch: refs/heads/ignite-1093-2
Commit: eeb313c44980ac96e96890d823602716f815e098
Parents: b7e9179
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Sep 25 14:01:41 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Sep 25 14:01:41 2015 +0300
----------------------------------------------------------------------
.../dht/preloader/GridDhtPartitionSupplier.java | 56 ++++++++++----------
.../dht/preloader/GridDhtPreloader.java | 15 ++++--
.../GridCacheRebalancingSyncSelfTest.java | 50 +++++++++--------
3 files changed, 69 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/eeb313c4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
index a4bd134..e23a50b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
@@ -24,6 +24,7 @@ import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.CacheRebalancingEvent;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
@@ -45,6 +46,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
import org.jsr166.ConcurrentHashMap8;
+import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_STOPPED;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
@@ -69,8 +71,9 @@ class GridDhtPartitionSupplier {
/** Preload predicate. */
private IgnitePredicate<GridCacheEntryInfo> preloadPred;
- /** Supply context map. */
- private final ConcurrentHashMap8<T4, SupplyContext> scMap = new ConcurrentHashMap8<>();
+ /** Supply context map. T4: nodeId, idx, topologyVersion, updateSequence. */
+ private final ConcurrentHashMap8<T4<UUID, Integer, AffinityTopologyVersion, Long>, SupplyContext> scMap =
+ new ConcurrentHashMap8<>();
/** Rebalancing listener. */
private GridLocalEventListener lsnr;
@@ -97,7 +100,27 @@ class GridDhtPartitionSupplier {
lsnr = new GridLocalEventListener() {
@Override public void onEvent(Event evt) {
if (evt instanceof DiscoveryEvent) {
- clearContexts(scMap, log, cctx);
+ for (Map.Entry<T4<UUID, Integer, AffinityTopologyVersion, Long>, SupplyContext> entry : scMap.entrySet()) {
+ T4<UUID, Integer, AffinityTopologyVersion, Long> t = entry.getKey();
+
+ SupplyContext sc = entry.getValue();
+
+ if (t.get3() != null && !t.get3().equals(cctx.affinity().affinityTopologyVersion()) && sc != null)
+ clearContext(scMap, t, sc, log);
+ }
+ }
+ else if (evt instanceof CacheRebalancingEvent) {
+ CacheRebalancingEvent e = (CacheRebalancingEvent)evt;
+
+ if (cctx.name().equals(e.cacheName())) {
+ UUID id = e.discoveryNode().id();
+
+ for (Map.Entry<T4<UUID, Integer, AffinityTopologyVersion, Long>, SupplyContext> entry : scMap.entrySet()) {
+ if (id.equals(entry.getKey().get1()))
+ clearContext(scMap, entry.getKey(), entry.getValue(), log);
+ }
+
+ }
}
else {
assert false;
@@ -105,9 +128,7 @@ class GridDhtPartitionSupplier {
}
};
- //todo: rebalance stopped.
-
- cctx.events().addListener(lsnr, EVT_NODE_JOINED, EVT_NODE_LEFT, EVT_NODE_FAILED);
+ cctx.events().addListener(lsnr, EVT_NODE_JOINED, EVT_NODE_LEFT, EVT_NODE_FAILED, EVT_CACHE_REBALANCE_STOPPED);
startOldListeners();
}
@@ -122,25 +143,6 @@ class GridDhtPartitionSupplier {
}
/**
- * Clear contexts.
- *
- * @param map Context map.
- * @param log Logger.
- * @param cctx Context.
- */
- private static void clearContexts(
- ConcurrentHashMap8<T4, SupplyContext> map, IgniteLogger log, GridCacheContext<?, ?> cctx) {
- for (Map.Entry<T4, SupplyContext> entry : map.entrySet()) {
- T4 t = entry.getKey();
-
- SupplyContext sc = entry.getValue();
-
- if (t.get3() != null && !t.get3().equals(cctx.affinity().affinityTopologyVersion()) && sc != null)
- clearContext(map, t, sc, log);
- }
- }
-
- /**
* Clear context.
*
* @param map Context map.
@@ -150,8 +152,8 @@ class GridDhtPartitionSupplier {
* @return true in case context was removed.
*/
private static boolean clearContext(
- final ConcurrentHashMap8<T4, SupplyContext> map,
- final T4 t,
+ final ConcurrentHashMap8<T4<UUID, Integer, AffinityTopologyVersion, Long>, SupplyContext> map,
+ final T4<UUID, Integer, AffinityTopologyVersion, Long> t,
final SupplyContext sc,
final IgniteLogger log) {
final Iterator it = sc.entryIt;
http://git-wip-us.apache.org/repos/asf/ignite/blob/eeb313c4/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 30b5505..ec9b8e7 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
@@ -27,7 +27,6 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
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.IgniteInternalFuture;
@@ -60,13 +59,13 @@ import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
+import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST;
import static org.apache.ignite.events.EventType.EVT_CACHE_REBALANCE_PART_UNLOADED;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
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_CACHE_REBALANCE_PART_DATA_LOST;
-import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.MOVING;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.AFFINITY_POOL;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.MOVING;
import static org.apache.ignite.internal.util.GridConcurrentFactory.newMap;
/**
@@ -376,6 +375,7 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
/** {@inheritDoc} */
public void handleSupplyMessage(int idx, UUID id, final GridDhtPartitionSupplyMessageV2 s) {
demandLock.readLock().lock();
+
try {
demander.handleSupplyMessage(idx, id, s);
}
@@ -391,7 +391,14 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
/** {@inheritDoc} */
@Override public void addAssignments(GridDhtPreloaderAssignments assignments, boolean forcePreload) throws IgniteCheckedException {
- demander.addAssignments(assignments, forcePreload);
+ demandLock.writeLock().lock();
+
+ try {
+ demander.addAssignments(assignments, forcePreload);
+ }
+ finally {
+ demandLock.writeLock().unlock();
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/eeb313c4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
index 42c1857..be8e24b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
@@ -169,7 +169,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
protected void checkData(Ignite ignite, String name, int from) throws IgniteCheckedException {
for (int i = from; i < from + TEST_SIZE; i++) {
if (i % (TEST_SIZE / 10) == 0)
- log.info("Checked " + i * 100 / (TEST_SIZE) + "% entries (" + TEST_SIZE + ").");
+ log.info("<" + name + "> Checked " + i * 100 / (TEST_SIZE) + "% entries (" + TEST_SIZE + ").");
assert ignite.cache(name).get(i) != null && ignite.cache(name).get(i).equals(i + name.hashCode()) :
i + " value " + (i + name.hashCode()) + " does not match (" + ignite.cache(name).get(i) + ")";
@@ -252,12 +252,27 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
break;
}
- else
- fut.get();
+ else if (!fut.get()) {
+ finished = false;
+
+ log.warning("Rebalancing finished with missed partitions.");
+ }
}
}
}
+ private void test() throws Exception {
+ while (true) {
+ testComplexRebalancing();
+
+ U.sleep(5000);
+ }
+ }
+
+ @Override protected long getTestTimeout() {
+ return Long.MAX_VALUE;
+ }
+
/**
* @throws Exception
*/
@@ -270,7 +285,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
long start = System.currentTimeMillis();
- new Thread() {
+ Thread t1 = new Thread() {
@Override public void run() {
try {
startGrid(1);
@@ -295,9 +310,9 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
e.printStackTrace();
}
}
- }.start();
+ };
- new Thread() {
+ Thread t2 = new Thread() {
@Override public void run() {
try {
startGrid(3);
@@ -309,50 +324,43 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
e.printStackTrace();
}
}
- }.start();// Should cancel current rebalancing.
+ };
- while (!concurrentStartFinished || !concurrentStartFinished2) {
- U.sleep(10);
- }
+ t1.start();
+ t2.start();// Should cancel t1 rebalancing.
- //wait until cache rebalanced in async mode
+ t1.join();
+ t2.join();
waitForRebalancing(1, 5, 1);
waitForRebalancing(2, 5, 1);
waitForRebalancing(3, 5, 1);
waitForRebalancing(4, 5, 1);
- //cache rebalanced in async node
+ checkData(grid(4), 0);
stopGrid(0);
- //wait until cache rebalanced
waitForRebalancing(1, 6);
waitForRebalancing(2, 6);
waitForRebalancing(3, 6);
waitForRebalancing(4, 6);
- //cache rebalanced
-
stopGrid(1);
- //wait until cache rebalanced
waitForRebalancing(2, 7);
waitForRebalancing(3, 7);
waitForRebalancing(4, 7);
- //cache rebalanced
-
stopGrid(2);
- //wait until cache rebalanced
waitForRebalancing(3, 8);
waitForRebalancing(4, 8);
- //cache rebalanced
-
stopGrid(3);
+ waitForRebalancing(4, 9);
+
long spend = (System.currentTimeMillis() - start) / 1000;
checkData(grid(4), 0);
[41/46] ignite git commit: IGNITE-1557
Posted by sb...@apache.org.
IGNITE-1557
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/00e61e52
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/00e61e52
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/00e61e52
Branch: refs/heads/ignite-1093-2
Commit: 00e61e52678aefc2fcad0179fb3e05b46265b102
Parents: 8fea96e
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Sep 28 14:00:23 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Sep 28 14:00:23 2015 +0300
----------------------------------------------------------------------
pom.xml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/00e61e52/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index fad8807..5194a72 100644
--- a/pom.xml
+++ b/pom.xml
@@ -897,6 +897,22 @@
</execution>
</executions>
</plugin>
+
+ <plugin><!-- skipping generates dependencies licenses -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>ignite-dependencies</id>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
[20/46] ignite git commit: Added test.
Posted by sb...@apache.org.
Added test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4b0c029c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4b0c029c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4b0c029c
Branch: refs/heads/ignite-1093-2
Commit: 4b0c029cef4b351f0d389a171c30b7dcf8c1ca22
Parents: b56b15c
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 24 12:19:28 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 24 12:19:28 2015 +0300
----------------------------------------------------------------------
.../near/NearCacheMultithreadedUpdateTest.java | 217 +++++++++++++++++++
1 file changed, 217 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4b0c029c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheMultithreadedUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheMultithreadedUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheMultithreadedUpdateTest.java
new file mode 100644
index 0000000..9d92724
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheMultithreadedUpdateTest.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.distributed.near;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+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.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.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class NearCacheMultithreadedUpdateTest extends GridCommonAbstractTest {
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private boolean client;
+
+ /** */
+ private final int SRV_CNT = 3;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ cfg.setClientMode(client);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(SRV_CNT);
+
+ client = true;
+
+ startGrid(SRV_CNT);
+
+ client = false;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testUpdateMultithreadedTx() throws Exception {
+ updateMultithreaded(TRANSACTIONAL, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testUpdateMultithreadedTxRestart() throws Exception {
+ updateMultithreaded(TRANSACTIONAL, true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testUpdateMultithreadedAtomic() throws Exception {
+ updateMultithreaded(ATOMIC, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testUpdateMultithreadedAtomicRestart() throws Exception {
+ updateMultithreaded(ATOMIC, true);
+ }
+
+ /**
+ * @param atomicityMode Cache atomicity mode.
+ * @param restart If {@code true} restarts one node.
+ * @throws Exception If failed.
+ */
+ private void updateMultithreaded(CacheAtomicityMode atomicityMode, boolean restart) throws Exception {
+ Ignite srv = ignite(0);
+
+ srv.destroyCache(null);
+
+ IgniteCache<Integer, Integer> srvCache = srv.createCache(cacheConfiguration(atomicityMode));
+
+ Ignite client = ignite(SRV_CNT);
+
+ assertTrue(client.configuration().isClientMode());
+
+ final IgniteCache<Integer, Integer> clientCache =
+ client.createNearCache(null, new NearCacheConfiguration<Integer, Integer>());
+
+ final AtomicBoolean stop = new AtomicBoolean();
+
+ IgniteInternalFuture<?> restartFut = null;
+
+ // Primary key for restarted node.
+ final Integer key0 = primaryKey(ignite(SRV_CNT - 1).cache(null));
+
+ if (restart) {
+ restartFut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ while (!stop.get()) {
+ Thread.sleep(300);
+
+ log.info("Stop node.");
+
+ stopGrid(SRV_CNT - 1);
+
+ Thread.sleep(300);
+
+ log.info("Start node.");
+
+ startGrid(SRV_CNT - 1);
+ }
+
+ return null;
+ }
+ }, "restart-thread");
+ }
+
+ try {
+ long stopTime = System.currentTimeMillis() + 30_000;
+
+ int iter = 0;
+
+ while (System.currentTimeMillis() < stopTime) {
+ if (iter % 100 == 0)
+ log.info("Iteration: " + iter);
+
+ final Integer key = iter++;
+
+ final AtomicInteger val = new AtomicInteger();
+
+ GridTestUtils.runMultiThreaded(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ clientCache.put(key0, val.incrementAndGet());
+
+ for (int i = 0; i < 10; i++)
+ clientCache.put(key, val.incrementAndGet());
+
+ return null;
+ }
+ }, 20, "update-thread");
+
+ if (restart) {
+ assertEquals(srvCache.get(key), clientCache.get(key));
+ assertEquals(srvCache.get(key0), clientCache.get(key0));
+ }
+ else {
+ assertEquals(srvCache.get(key), clientCache.localPeek(key));
+ assertEquals(srvCache.get(key0), clientCache.localPeek(key0));
+ }
+ }
+
+ stop.set(true);
+
+ if (restartFut != null)
+ restartFut.get();
+ }
+ finally {
+ stop.set(true);
+ }
+ }
+
+ /**
+ * @param atomicityMode Cache atomicity mode.
+ * @return Cache configuration.
+ */
+ private CacheConfiguration<Integer, Integer> cacheConfiguration(CacheAtomicityMode atomicityMode) {
+ CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+
+ ccfg.setAtomicityMode(atomicityMode);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setBackups(1);
+
+ return ccfg;
+ }
+}
[05/46] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.4' into ignite-1.4
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-1.4' into ignite-1.4
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a1040872
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a1040872
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a1040872
Branch: refs/heads/ignite-1093-2
Commit: a1040872f37cf4fd1dc20584c68307f420d0d3af
Parents: 33fe30d 50f75bd
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 22 12:59:14 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 22 12:59:14 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/cache/CacheAtomicityMode.java | 17 +++++------------
.../processors/cache/GridCacheProcessor.java | 2 +-
2 files changed, 6 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
[42/46] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c001d472
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c001d472
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c001d472
Branch: refs/heads/ignite-1093-2
Commit: c001d47206ec4c63d757925742b7083854bd9c2f
Parents: 00e61e5 2575cf3
Author: Anton Vinogradov <av...@apache.org>
Authored: Mon Sep 28 14:00:45 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Sep 28 14:00:45 2015 +0300
----------------------------------------------------------------------
.../cache/IgniteDynamicCacheFilterTest.java | 150 +++++++++++++++++++
.../testsuites/IgniteCacheTestSuite4.java | 3 +
2 files changed, 153 insertions(+)
----------------------------------------------------------------------
[19/46] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-1.4'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1.4'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b56b15cd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b56b15cd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b56b15cd
Branch: refs/heads/ignite-1093-2
Commit: b56b15cda7fc94b25400b1334b365053f0017f7f
Parents: b3bcf4a 7db44f1
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 24 09:09:46 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 24 09:09:46 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/IgniteAtomicLong.java | 2 +-
.../apache/ignite/internal/IgniteKernal.java | 4 +-
.../cache/DynamicCacheDescriptor.java | 10 +-
.../GridCachePartitionExchangeManager.java | 6 +
.../processors/cache/GridCacheProcessor.java | 18 +-
.../processors/cache/IgniteCacheProxy.java | 4 +-
.../continuous/CacheContinuousQueryManager.java | 66 ++-
.../continuous/GridContinuousProcessor.java | 3 +-
.../org/apache/ignite/mxbean/IgniteMXBean.java | 8 +-
.../communication/tcp/TcpCommunicationSpi.java | 7 +-
.../discovery/DiscoverySpiCustomMessage.java | 12 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 398 +++++++++++++------
.../spi/discovery/tcp/TcpDiscoveryImpl.java | 6 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 2 +-
.../tcp/internal/TcpDiscoveryNodesRing.java | 94 ++---
.../messages/TcpDiscoveryDiscardMessage.java | 15 +-
.../TcpDiscoveryNodeAddFinishedMessage.java | 2 +-
.../messages/TcpDiscoveryNodeAddedMessage.java | 19 +-
.../GridCacheAbstractRemoveFailureTest.java | 6 +-
.../distributed/CacheAffEarlySelfTest.java | 245 ------------
.../distributed/CacheAffinityEarlyTest.java | 168 ++++++++
...GridCacheValueConsistencyAtomicSelfTest.java | 2 +-
...ontinuousQueryReplicatedOneNodeSelfTest.java | 120 ++++++
...lientDiscoverySpiFailureTimeoutSelfTest.java | 33 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 53 ++-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 315 ++++++++++++++-
.../testsuites/IgniteCacheTestSuite4.java | 2 +
.../IgniteCacheQuerySelfTestSuite.java | 4 +-
28 files changed, 1099 insertions(+), 525 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b56b15cd/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java
----------------------------------------------------------------------
[36/46] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/343191bc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/343191bc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/343191bc
Branch: refs/heads/ignite-1093-2
Commit: 343191bce46f9d745c1c0151ba86ac6032e76f16
Parents: a6306a5 a42750a
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Sep 25 16:21:42 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Sep 25 16:21:42 2015 +0300
----------------------------------------------------------------------
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 5 +
.../internal/GridUpdateNotifierSelfTest.java | 1 +
...nedQueueFailoverDataConsistencySelfTest.java | 5 -
.../GridCacheReplicatedInvalidateSelfTest.java | 249 -------------------
...eCacheExpiryPolicyWithStoreAbstractTest.java | 5 +-
.../multijvm/IgniteCacheProcessProxy.java | 3 +-
.../testsuites/IgniteCacheTestSuite3.java | 2 -
7 files changed, 12 insertions(+), 258 deletions(-)
----------------------------------------------------------------------
[09/46] ignite git commit: Check for WeakValue in
GridH2AbstractKeyValueRow.onUnswap
Posted by sb...@apache.org.
Check for WeakValue in GridH2AbstractKeyValueRow.onUnswap
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ca2bce00
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ca2bce00
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ca2bce00
Branch: refs/heads/ignite-1093-2
Commit: ca2bce00516142a1204fb9226c938174047e72d6
Parents: 72c3eef
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 22 15:04:27 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 22 15:04:27 2015 +0300
----------------------------------------------------------------------
.../processors/query/h2/opt/GridH2AbstractKeyValueRow.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca2bce00/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
index c11f541..ca5442a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
@@ -119,7 +119,9 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
* @throws IgniteCheckedException If failed.
*/
public synchronized void onUnswap(Object val, boolean beforeRmv) throws IgniteCheckedException {
- if (peekValue(VAL_COL) != null)
+ Value val0 = peekValue(VAL_COL);
+
+ if (val0 != null && !(val0 instanceof WeakValue))
return;
setValue(VAL_COL, desc.wrap(val, desc.valueType()));
[33/46] ignite git commit: Removed test.
Posted by sb...@apache.org.
Removed test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d7b36d8b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d7b36d8b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d7b36d8b
Branch: refs/heads/ignite-1093-2
Commit: d7b36d8bd804f9d5abadf230b2f24bfc14ce4b74
Parents: bf7591b
Author: sboikov <sb...@gridgain.com>
Authored: Fri Sep 25 14:08:13 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Sep 25 14:08:13 2015 +0300
----------------------------------------------------------------------
.../GridCacheReplicatedInvalidateSelfTest.java | 249 -------------------
.../testsuites/IgniteCacheTestSuite3.java | 2 -
2 files changed, 251 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d7b36d8b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java
deleted file mode 100644
index a0c2fca..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedInvalidateSelfTest.java
+++ /dev/null
@@ -1,249 +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.distributed.replicated;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-import java.util.UUID;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-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.clock.GridClockDeltaSnapshotMessage;
-import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.spi.IgniteSpiException;
-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.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.transactions.Transaction;
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
-
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
-import static org.apache.ignite.cache.CacheRebalanceMode.NONE;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
-import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
-import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
-
-/**
- *
- */
-public class GridCacheReplicatedInvalidateSelfTest extends GridCommonAbstractTest {
- /** Random number generator. */
- private static final Random RAND = new Random();
-
- /** Grid count. */
- private static final int GRID_CNT = 3;
-
- /** */
- private static final Integer KEY = 1;
-
- /** */
- private static final String VAL = "test";
-
- /** */
- private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
- /**
- * Don't start grid by default.
- */
- public GridCacheReplicatedInvalidateSelfTest() {
- super(false);
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration c = super.getConfiguration(gridName);
-
- c.getTransactionConfiguration().setTxSerializableEnabled(true);
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
- disco.setIpFinder(ipFinder);
-
- c.setDiscoverySpi(disco);
-
- c.setCommunicationSpi(new TestCommunicationSpi());
-
- CacheConfiguration cc = defaultCacheConfiguration();
-
- cc.setRebalanceMode(NONE);
- cc.setCacheMode(REPLICATED);
- cc.setWriteSynchronizationMode(FULL_SYNC);
-
- c.setCacheConfiguration(cc);
-
- return c;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Override protected void beforeTestsStarted() throws Exception {
- for (int i = 0; i < GRID_CNT; i++)
- startGrid(i);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /**
- * @throws Exception If failed.
- */
- @Override protected void beforeTest() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-601");
-
- for (int i = 0; i < GRID_CNT; i++)
- ioSpi(i).clearCounts();
- }
-
- /**
- * @param i Index.
- * @return IO SPI.
- */
- private TestCommunicationSpi ioSpi(int i) {
- return (TestCommunicationSpi)grid(i).configuration().getCommunicationSpi();
- }
-
- /**
- * @throws IgniteCheckedException If test failed.
- */
- public void testOptimisticReadCommitted() throws Throwable {
- checkCommit(OPTIMISTIC, READ_COMMITTED);
- }
-
- /**
- * @throws IgniteCheckedException If test failed.
- */
- public void testOptimisticRepeatableRead() throws Throwable {
- checkCommit(OPTIMISTIC, REPEATABLE_READ);
- }
-
- /**
- * @throws IgniteCheckedException If test failed.
- */
- public void testOptimisticSerializable() throws Throwable {
- checkCommit(OPTIMISTIC, SERIALIZABLE);
- }
-
- /**
- * @param concurrency Concurrency.
- * @param isolation Isolation.
- * @throws Throwable If check failed.
- */
- private void checkCommit(TransactionConcurrency concurrency,
- TransactionIsolation isolation) throws Throwable {
- int idx = RAND.nextInt(GRID_CNT);
-
- IgniteCache<Integer, String> cache = jcache(idx);
-
- Transaction tx = grid(idx).transactions().txStart(concurrency, isolation, 0, 0);
-
- try {
- cache.put(KEY, VAL);
-
- tx.commit();
- }
- catch (Throwable e) {
- error("Transaction failed (will rollback): " + tx, e);
-
- tx.rollback();
-
- throw e;
- }
-
- TestCommunicationSpi ioSpi = ioSpi(idx);
-
- int checkIdx = RAND.nextInt(GRID_CNT);
-
- while (checkIdx == idx)
- checkIdx = RAND.nextInt(GRID_CNT);
-
- Ignite checkIgnite = grid(checkIdx);
-
- int msgCnt = ioSpi.getMessagesCount(checkIgnite.cluster().localNode().id());
-
- info("Checked node: " + checkIgnite.cluster().localNode().id());
-
- assertEquals("Invalid message count for grid: " + checkIgnite.cluster().localNode().id(), 2, msgCnt);
- }
-
- /**
- *
- */
- private class TestCommunicationSpi extends TcpCommunicationSpi {
- /** */
- private final Map<UUID, Integer> msgCntMap = new HashMap<>();
-
- /**
- * @param destNodeId Node id to check.
- * @return Number of messages that was sent to node.
- */
- public int getMessagesCount(UUID destNodeId) {
- synchronized (msgCntMap) {
- Integer cnt = msgCntMap.get(destNodeId);
-
- return cnt == null ? 0 : cnt;
- }
- }
-
- /**
- * Clear message counts.
- */
- public void clearCounts() {
- synchronized (msgCntMap) {
- msgCntMap.clear();
- }
- }
-
- /** {@inheritDoc} */
- @Override public void sendMessage(ClusterNode destNode, Message msg,
- IgniteInClosure<IgniteException> ackClosure)
- throws IgniteSpiException {
- Object msg0 = ((GridIoMessage)msg).message();
-
- if (!(msg0 instanceof GridClockDeltaSnapshotMessage)) {
- info("Sending message [locNodeId=" + ignite.cluster().localNode().id() +
- ", destNodeId= " + destNode.id()
- + ", msg=" + msg + ']');
-
- synchronized (msgCntMap) {
- Integer cnt = msgCntMap.get(destNode.id());
-
- msgCntMap.put(destNode.id(), cnt == null ? 1 : cnt + 1);
- }
- }
-
- super.sendMessage(destNode, msg, ackClosure);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d7b36d8b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index 5a2815d..02a7f7f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -54,7 +54,6 @@ import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCa
import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedEventSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedEvictionEventSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedGetAndTransformStoreSelfTest;
-import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedInvalidateSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedLockSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedMultiNodeLockSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedMultiNodeSelfTest;
@@ -104,7 +103,6 @@ public class IgniteCacheTestSuite3 extends TestSuite {
suite.addTestSuite(GridCacheReplicatedEventSelfTest.class);
suite.addTestSuite(GridCacheReplicatedSynchronousCommitTest.class);
- suite.addTestSuite(GridCacheReplicatedInvalidateSelfTest.class);
suite.addTestSuite(GridCacheReplicatedLockSelfTest.class);
suite.addTestSuite(GridCacheReplicatedMultiNodeLockSelfTest.class);
suite.addTestSuite(GridCacheReplicatedMultiNodeSelfTest.class);
[31/46] ignite git commit: Enabled test.
Posted by sb...@apache.org.
Enabled test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/27cf5016
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/27cf5016
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/27cf5016
Branch: refs/heads/ignite-1093-2
Commit: 27cf5016a5c859c877a95d793c622926bafb2f9f
Parents: 03a8fe5
Author: sboikov <sb...@gridgain.com>
Authored: Fri Sep 25 13:33:27 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Sep 25 13:33:27 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/GridUpdateNotifierSelfTest.java | 1 +
...ridCachePartitionedQueueFailoverDataConsistencySelfTest.java | 5 -----
2 files changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/27cf5016/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
index 61c2085..93fd916 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonTest;
*/
@GridCommonTest(group = "Kernal Self")
public class GridUpdateNotifierSelfTest extends GridCommonAbstractTest {
+ /** */
private String updateStatusParams;
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/27cf5016/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueFailoverDataConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueFailoverDataConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueFailoverDataConsistencySelfTest.java
index 0d3634f..bef2b22 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueFailoverDataConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueFailoverDataConsistencySelfTest.java
@@ -30,11 +30,6 @@ import static org.apache.ignite.cache.CacheMemoryMode.ONHEAP_TIERED;
public class GridCachePartitionedQueueFailoverDataConsistencySelfTest extends
GridCacheAbstractQueueFailoverDataConsistencySelfTest {
/** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-264");
- }
-
- /** {@inheritDoc} */
@Override protected CacheMemoryMode collectionMemoryMode() {
return ONHEAP_TIERED;
}
[39/46] ignite git commit: ignite-808 Fixed
GridDhtTxPrepareFuture.onEntriesLocked
Posted by sb...@apache.org.
ignite-808 Fixed GridDhtTxPrepareFuture.onEntriesLocked
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8fea96ea
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8fea96ea
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8fea96ea
Branch: refs/heads/ignite-1093-2
Commit: 8fea96ea1bba43bdc702e6096bb5492bdb745b67
Parents: dc379fe
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 28 11:44:12 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 28 11:44:12 2015 +0300
----------------------------------------------------------------------
.../distributed/dht/GridDhtTxPrepareFuture.java | 6 ++-
.../IgniteTxPreloadAbstractTest.java | 43 ++++++++++++--------
.../replicated/GridReplicatedTxPreloadTest.java | 2 -
.../testsuites/IgniteCacheTestSuite4.java | 7 ++++
4 files changed, 37 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8fea96ea/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 81cc272..761bbb0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -318,7 +318,11 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
private void onEntriesLocked() {
ret = new GridCacheReturn(null, tx.localResult(), null, true);
- for (IgniteTxEntry txEntry : tx.optimisticLockEntries()) {
+ for (IgniteTxEntry writeEntry : writes) {
+ IgniteTxEntry txEntry = tx.entry(writeEntry.txKey());
+
+ assert txEntry != null : writeEntry;
+
GridCacheContext cacheCtx = txEntry.context();
GridCacheEntryEx cached = txEntry.cached();
http://git-wip-us.apache.org/repos/asf/ignite/blob/8fea96ea/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
index 939b4a6..0a7845b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
@@ -24,6 +24,7 @@ import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.EntryProcessorResult;
import javax.cache.processor.MutableEntry;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteTransactions;
@@ -65,6 +66,7 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
+ // No-op.
}
/** {@inheritDoc} */
@@ -78,7 +80,7 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
public void testRemoteTxPreloading() throws Exception {
IgniteCache<String, Integer> cache = jcache(0);
- for (int i = 0; i < 10000; i++)
+ for (int i = 0; i < 10_000; i++)
cache.put(String.valueOf(i), 0);
final AtomicInteger gridIdx = new AtomicInteger(1);
@@ -104,31 +106,36 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
for (int i = 0; i < 10; i++)
keys.add(String.valueOf(i * 1000));
- cache.invokeAll(keys, new EntryProcessor<String, Integer, Void>() {
- @Override public Void process(MutableEntry<String, Integer> e, Object... args) {
- Integer val = e.getValue();
+ Map<String, EntryProcessorResult<Integer>> resMap = cache.invokeAll(keys,
+ new EntryProcessor<String, Integer, Integer>() {
+ @Override public Integer process(MutableEntry<String, Integer> e, Object... args) {
+ Integer val = e.getValue();
- if (val == null) {
- keyNotLoaded = true;
+ if (val == null) {
+ keyNotLoaded = true;
- e.setValue(1);
+ e.setValue(1);
- return null;
- }
+ return null;
+ }
- e.setValue(val + 1);
+ e.setValue(val + 1);
- return null;
+ return val;
+ }
}
- });
+ );
assertFalse(keyNotLoaded);
- fut.get();
+ for (String key : keys) {
+ EntryProcessorResult<Integer> res = resMap.get(key);
- for (int i = 0; i < GRID_CNT; i++)
- // Wait for preloader.
- jcache(i).rebalance().get();
+ assertNotNull(res);
+ assertEquals(0, (Object)res.get());
+ }
+
+ fut.get();
for (int i = 0; i < GRID_CNT; i++) {
for (String key : keys)
@@ -217,10 +224,10 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
CacheConfiguration cfg = super.cacheConfiguration(gridName);
cfg.setRebalanceMode(ASYNC);
-
cfg.setWriteSynchronizationMode(FULL_SYNC);
-
cfg.setCacheStoreFactory(null);
+ cfg.setReadThrough(false);
+ cfg.setWriteThrough(false);
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8fea96ea/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
index e3ce612..4da7734 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridReplicatedTxPreloadTest.java
@@ -24,8 +24,6 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
/**
* Tests cache transaction during preloading.
- *
- * TODO: IGNITE-808.
*/
public class GridReplicatedTxPreloadTest extends IgniteTxPreloadAbstractTest {
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/8fea96ea/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 289da3d..0ebcc81 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
@@ -76,9 +76,12 @@ import org.apache.ignite.internal.processors.cache.IgniteStartCacheInTransaction
import org.apache.ignite.internal.processors.cache.IgniteSystemCacheOnClientTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheAffinityEarlyTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheNoValueClassOnServerNodeTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtTxPreloadSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheLockFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheMultiTxLockSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearTxPreloadSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.IgniteCacheNearReadCommittedTest;
+import org.apache.ignite.internal.processors.cache.distributed.replicated.GridReplicatedTxPreloadTest;
import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLoadAllTest;
import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLoaderWriterTest;
import org.apache.ignite.internal.processors.cache.integration.IgniteCacheAtomicLocalLoadAllTest;
@@ -261,6 +264,10 @@ public class IgniteCacheTestSuite4 extends TestSuite {
suite.addTestSuite(CacheSwapUnswapGetTest.class);
+ suite.addTestSuite(GridCacheDhtTxPreloadSelfTest.class);
+ suite.addTestSuite(GridCacheNearTxPreloadSelfTest.class);
+ suite.addTestSuite(GridReplicatedTxPreloadTest.class);
+
return suite;
}
}
\ No newline at end of file
[02/46] ignite git commit: IGNITE-1522 - Made cache entry listener
configurations transient in cache configuration
Posted by sb...@apache.org.
IGNITE-1522 - Made cache entry listener configurations transient in cache configuration
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e51fb420
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e51fb420
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e51fb420
Branch: refs/heads/ignite-1093-2
Commit: e51fb420d1284465c7cbe55a28c2374ddf67d495
Parents: 621eb0f
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Mon Sep 21 23:29:20 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Mon Sep 21 23:29:20 2015 -0700
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 15 +++++
.../IgniteCacheEntryListenerAbstractTest.java | 65 +++++++++++++++++++-
2 files changed, 79 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e51fb420/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 7d1e14d..44a3fa9 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.ignite.configuration;
import java.io.Serializable;
import java.util.Collection;
+import java.util.HashSet;
import javax.cache.Cache;
import javax.cache.configuration.CompleteConfiguration;
import javax.cache.configuration.Factory;
@@ -1799,6 +1800,20 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
return this;
}
+ /**
+ * Creates a copy of current configuration and removes all cache entry listeners.
+ * They are executed only locally and should never be sent to remote nodes.
+ *
+ * @return Configuration object that will be serialized.
+ */
+ protected Object writeReplace() {
+ CacheConfiguration<K, V> cfg = new CacheConfiguration<>(this);
+
+ cfg.listenerConfigurations = new HashSet<>();
+
+ return cfg;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheConfiguration.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e51fb420/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
index 78a6700..3fdd7fc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
@@ -17,6 +17,10 @@
package org.apache.ignite.internal.processors.cache;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -32,11 +36,13 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.cache.configuration.CacheEntryListenerConfiguration;
import javax.cache.configuration.Factory;
+import javax.cache.configuration.FactoryBuilder;
import javax.cache.configuration.MutableCacheEntryListenerConfiguration;
import javax.cache.event.CacheEntryCreatedListener;
import javax.cache.event.CacheEntryEvent;
import javax.cache.event.CacheEntryExpiredListener;
import javax.cache.event.CacheEntryListener;
+import javax.cache.event.CacheEntryListenerException;
import javax.cache.event.CacheEntryRemovedListener;
import javax.cache.event.CacheEntryUpdatedListener;
import javax.cache.event.EventType;
@@ -358,6 +364,34 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb
}
/**
+ * @throws Exception If failed.
+ */
+ public void testSerialization() throws Exception {
+ if (cacheMode() == LOCAL)
+ return;
+
+ AtomicBoolean serialized = new AtomicBoolean();
+
+ NonSerializableListener lsnr = new NonSerializableListener(serialized);
+
+ jcache(0).registerCacheEntryListener(new MutableCacheEntryListenerConfiguration<>(
+ FactoryBuilder.factoryOf(lsnr),
+ null,
+ true,
+ false
+ ));
+
+ try {
+ startGrid(gridCount());
+ }
+ finally {
+ stopGrid(gridCount());
+ }
+
+ assertFalse(serialized.get());
+ }
+
+ /**
* @param key Key.
* @param val Value.
* @param cache Cache.
@@ -1190,4 +1224,33 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb
}
}
-}
\ No newline at end of file
+ /**
+ */
+ public static class NonSerializableListener implements CacheEntryCreatedListener<Object, Object>, Externalizable {
+ /** */
+ private final AtomicBoolean serialized;
+
+ /**
+ * @param serialized Serialized flag.
+ */
+ public NonSerializableListener(AtomicBoolean serialized) {
+ this.serialized = serialized;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onCreated(Iterable<CacheEntryEvent<? extends Object, ? extends Object>> evts)
+ throws CacheEntryListenerException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ serialized.set(true);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ // No-op.
+ }
+ }
+}
[08/46] ignite git commit: ignite-1516 Optimize
GridH2AbstractKeyValueRow.getValue
Posted by sb...@apache.org.
ignite-1516 Optimize GridH2AbstractKeyValueRow.getValue
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/72c3eef2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/72c3eef2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/72c3eef2
Branch: refs/heads/ignite-1093-2
Commit: 72c3eef2aa31df4a68b46a8877809cc0f49c1368
Parents: 39dace4
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 22 13:51:09 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 22 13:51:09 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 8 +--
.../processors/cache/GridCacheMapEntry.java | 14 ++---
.../processors/cache/GridCacheProcessor.java | 6 +--
.../cache/GridCacheSwapEntryImpl.java | 31 +++++++++--
.../processors/cache/GridCacheSwapManager.java | 56 +++++++++++++-------
.../processors/query/h2/IgniteH2Indexing.java | 19 ++++---
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 49 ++++++++++-------
.../query/h2/opt/GridH2KeyValueRowOffheap.java | 11 +++-
.../query/h2/opt/GridH2RowDescriptor.java | 5 ++
.../cache/CacheIndexStreamerTest.java | 33 +++++++++---
.../processors/cache/GridCacheSwapSelfTest.java | 4 +-
.../IgniteCacheWithIndexingTestSuite.java | 2 +
12 files changed, 158 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/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 1fc94ec..ae987b7 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
@@ -805,9 +805,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (modes.offheap || modes.swap) {
GridCacheSwapManager swapMgr = ctx.isNear() ? ctx.near().dht().context().swap() : ctx.swap();
- GridCacheSwapEntry swapEntry = swapMgr.read(cacheKey, modes.offheap, modes.swap);
-
- cacheVal = swapEntry != null ? swapEntry.value() : null;
+ cacheVal = swapMgr.readValue(cacheKey, modes.offheap, modes.swap);
}
}
else
@@ -856,9 +854,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (offheap || swap) {
GridCacheSwapManager swapMgr = ctx.isNear() ? ctx.near().dht().context().swap() : ctx.swap();
- GridCacheSwapEntry swapEntry = swapMgr.read(key, offheap, swap);
-
- return swapEntry != null ? swapEntry.value() : null;
+ return swapMgr.readValue(key, offheap, swap);
}
return null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/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 961c792..4bf0aa1 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
@@ -512,7 +512,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
}
else
- e = detached() ? cctx.swap().read(this, true, true, true) : cctx.swap().readAndRemove(this);
+ e = detached() ? cctx.swap().read(this, true, true, true, false) : cctx.swap().readAndRemove(this);
if (log.isDebugEnabled())
log.debug("Read swap entry [swapEntry=" + e + ", cacheEntry=" + this + ']');
@@ -2840,7 +2840,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
if (offheap || swap) {
- GridCacheSwapEntry e = cctx.swap().read(this, false, offheap, swap);
+ GridCacheSwapEntry e = cctx.swap().read(this, false, offheap, swap, true);
return e != null ? e.value() : null;
}
@@ -3581,14 +3581,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
CacheObject val = rawGetOrUnmarshalUnlocked(false);
- if (val == null) {
- GridCacheSwapEntry swapEntry = cctx.swap().read(key, true, true);
-
- if (swapEntry == null)
- return null;
-
- return swapEntry.value();
- }
+ if (val == null)
+ val = cctx.swap().readValue(key, true, true);
return val;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/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 9c325aa..e92ea57 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
@@ -2763,14 +2763,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
try {
KeyCacheObject key = cctx.toCacheKeyObject(keyBytes);
- GridCacheSwapEntry swapEntry = GridCacheSwapEntryImpl.unmarshal(valBytes);
+ GridCacheSwapEntry swapEntry = GridCacheSwapEntryImpl.unmarshal(valBytes, true);
CacheObject val = swapEntry.value();
- if (val == null)
- val = cctx.cacheObjects().toCacheObject(cctx.cacheObjectContext(), swapEntry.type(),
- swapEntry.valueBytes());
-
assert val != null;
qryMgr.remove(key, val);
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
index b7c66d3..6b1266f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapEntryImpl.java
@@ -94,8 +94,6 @@ public class GridCacheSwapEntryImpl implements GridCacheSwapEntry {
long expireTime,
@Nullable IgniteUuid keyClsLdrId,
@Nullable IgniteUuid valClsLdrId) {
- assert ver != null;
-
this.valBytes = valBytes;
this.type = type;
this.ver = ver;
@@ -268,9 +266,36 @@ public class GridCacheSwapEntryImpl implements GridCacheSwapEntry {
/**
* @param arr Entry bytes.
+ * @param valOnly If {@code true} unmarshalls only entry value.
* @return Entry.
*/
- public static GridCacheSwapEntryImpl unmarshal(byte[] arr) {
+ public static GridCacheSwapEntryImpl unmarshal(byte[] arr, boolean valOnly) {
+ if (valOnly) {
+ long off = BYTE_ARR_OFF + VERSION_OFFSET; // Skip ttl, expire time.
+
+ boolean verEx = UNSAFE.getByte(arr, off++) != 0;
+
+ off += verEx ? VERSION_EX_SIZE : VERSION_SIZE;
+
+ int arrLen = UNSAFE.getInt(arr, off);
+
+ off += 4;
+
+ byte type = UNSAFE.getByte(arr, off++);
+
+ byte[] valBytes = new byte[arrLen];
+
+ UNSAFE.copyMemory(arr, off, valBytes, BYTE_ARR_OFF, arrLen);
+
+ return new GridCacheSwapEntryImpl(ByteBuffer.wrap(valBytes),
+ type,
+ null,
+ 0L,
+ 0L,
+ null,
+ null);
+ }
+
long off = BYTE_ARR_OFF;
long ttl = UNSAFE.getLong(arr, off);
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index d9a8b5c..2ab7b5b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -569,6 +569,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
* @param entryLocked {@code True} if cache entry is locked.
* @param readOffheap Read offheap flag.
* @param readSwap Read swap flag.
+ * @param valOnly If {@code true} unmarshals only entry value.
* @return Value from swap or {@code null}.
* @throws IgniteCheckedException If failed.
*/
@@ -578,7 +579,8 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
int part,
boolean entryLocked,
boolean readOffheap,
- boolean readSwap)
+ boolean readSwap,
+ boolean valOnly)
throws IgniteCheckedException
{
assert readOffheap || readSwap;
@@ -605,7 +607,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
cctx.cache().metrics0().onOffHeapRead(bytes != null);
if (bytes != null)
- return swapEntry(unmarshalSwapEntry(bytes));
+ return swapEntry(unmarshalSwapEntry(bytes, valOnly));
}
if (!swapEnabled || !readSwap)
@@ -620,7 +622,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
if (bytes == null && lsnr != null)
return lsnr.entry;
- return bytes != null ? swapEntry(unmarshalSwapEntry(bytes)) : null;
+ return bytes != null ? swapEntry(unmarshalSwapEntry(bytes, valOnly)) : null;
}
finally {
if (lsnr != null)
@@ -706,7 +708,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
if (rmv != null) {
try {
- GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(rmv));
+ GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(rmv, false));
if (entry == null)
return;
@@ -756,20 +758,22 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
* @param locked {@code True} if cache entry is locked.
* @param readOffheap Read offheap flag.
* @param readSwap Read swap flag.
+ * @param valOnly If {@code true} unmarshals only entry value.
* @return Read value.
* @throws IgniteCheckedException If read failed.
*/
@Nullable GridCacheSwapEntry read(GridCacheEntryEx entry,
boolean locked,
boolean readOffheap,
- boolean readSwap)
+ boolean readSwap,
+ boolean valOnly)
throws IgniteCheckedException
{
if (!offheapEnabled && !swapEnabled)
return null;
return read(entry.key(), entry.key().valueBytes(cctx.cacheObjectContext()), entry.partition(), locked,
- readOffheap, readSwap);
+ readOffheap, readSwap, valOnly);
}
/**
@@ -805,7 +809,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
* @return Read value.
* @throws IgniteCheckedException If read failed.
*/
- @Nullable public GridCacheSwapEntry read(KeyCacheObject key,
+ @Nullable public CacheObject readValue(KeyCacheObject key,
boolean readOffheap,
boolean readSwap)
throws IgniteCheckedException
@@ -815,7 +819,17 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
int part = cctx.affinity().partition(key);
- return read(key, key.valueBytes(cctx.cacheObjectContext()), part, false, readOffheap, readSwap);
+ GridCacheSwapEntry swapEntry = read(key,
+ key.valueBytes(cctx.cacheObjectContext()),
+ part,
+ false,
+ readOffheap,
+ readSwap,
+ true);
+
+ assert swapEntry == null || swapEntry.value() != null : swapEntry;
+
+ return swapEntry != null ? swapEntry.value() : null;
}
/**
@@ -865,7 +879,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
cctx.cache().metrics0().onOffHeapRemove();
}
- entry = entryBytes == null ? null : swapEntry(unmarshalSwapEntry(entryBytes));
+ entry = entryBytes == null ? null : swapEntry(unmarshalSwapEntry(entryBytes, false));
}
return entry;
@@ -972,7 +986,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
if (rmv != null) {
try {
- GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(rmv));
+ GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(rmv, false));
if (entry == null)
return;
@@ -1078,7 +1092,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
Collection<GridCacheSwapListener> lsnrs = offheapLsnrs.get(part);
if (lsnrs != null) {
- GridCacheSwapEntry e = swapEntry(GridCacheSwapEntryImpl.unmarshal(entry));
+ GridCacheSwapEntry e = swapEntry(GridCacheSwapEntryImpl.unmarshal(entry, false));
for (GridCacheSwapListener lsnr : lsnrs)
lsnr.onEntryUnswapped(part, key, e);
@@ -1132,7 +1146,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
cctx.cache().metrics0().onOffHeapRead(entryBytes != null);
if (entryBytes != null) {
- GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(entryBytes));
+ GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(entryBytes, false));
if (entry != null) {
cctx.queries().onUnswap(key, entry.value());
@@ -1165,7 +1179,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
if (entryBytes == null)
return false;
- GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(entryBytes));
+ GridCacheSwapEntry entry = swapEntry(unmarshalSwapEntry(entryBytes, true));
if (entry == null)
return false;
@@ -2063,7 +2077,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
try {
for (Map.Entry<byte[], byte[]> e : iter) {
try {
- GridCacheSwapEntry swapEntry = unmarshalSwapEntry(e.getValue());
+ GridCacheSwapEntry swapEntry = unmarshalSwapEntry(e.getValue(), false);
IgniteUuid valLdrId = swapEntry.valueClassLoaderId();
@@ -2120,10 +2134,11 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
/**
* @param bytes Bytes to unmarshal.
+ * @param valOnly If {@code true} unmarshalls only value.
* @return Unmarshalled entry.
*/
- private GridCacheSwapEntry unmarshalSwapEntry(byte[] bytes) {
- return GridCacheSwapEntryImpl.unmarshal(bytes);
+ private GridCacheSwapEntry unmarshalSwapEntry(byte[] bytes, boolean valOnly) {
+ return GridCacheSwapEntryImpl.unmarshal(bytes, valOnly);
}
/**
@@ -2169,7 +2184,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
@Override protected Map.Entry<byte[], GridCacheSwapEntry> onNext() throws IgniteCheckedException {
Map.Entry<byte[], byte[]> e = iter.nextX();
- GridCacheSwapEntry unmarshalled = unmarshalSwapEntry(e.getValue());
+ GridCacheSwapEntry unmarshalled = unmarshalSwapEntry(e.getValue(), false);
return F.t(e.getKey(), swapEntry(unmarshalled));
}
@@ -2446,6 +2461,9 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
abstract protected GridCloseableIterator<T1> partitionIterator(int part) throws IgniteCheckedException;
}
+ /**
+ *
+ */
private class GridVersionedMapEntry<K,V> implements Map.Entry<K,V>, GridCacheVersionAware {
/** */
private Map.Entry<byte[], byte[]> entry;
@@ -2474,7 +2492,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
/** {@inheritDoc} */
@Override public V getValue() {
try {
- GridCacheSwapEntry e = unmarshalSwapEntry(entry.getValue());
+ GridCacheSwapEntry e = unmarshalSwapEntry(entry.getValue(), false);
swapEntry(e);
@@ -2487,7 +2505,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
/** {@inheritDoc} */
@Override public GridCacheVersion version() {
- GridCacheSwapEntry e = unmarshalSwapEntry(entry.getValue());
+ GridCacheSwapEntry e = unmarshalSwapEntry(entry.getValue(), false);
return e.version();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 2af1386..8595187 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -71,7 +71,6 @@ import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheSwapEntry;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
@@ -2108,6 +2107,9 @@ public class IgniteH2Indexing implements GridQueryIndexing {
/** */
private final GridUnsafeGuard guard;
+ /** */
+ private final boolean preferSwapVal;
+
/**
* @param type Type descriptor.
* @param schema Schema.
@@ -2136,6 +2138,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
keyType = DataType.getTypeFromClass(type.keyClass());
valType = DataType.getTypeFromClass(type.valueClass());
+
+ preferSwapVal = schema.ccfg.getMemoryMode() == CacheMemoryMode.OFFHEAP_TIERED;
}
/** {@inheritDoc} */
@@ -2263,15 +2267,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (cctx.isNear())
cctx = cctx.near().dht().context();
- GridCacheSwapEntry e = cctx.swap().read(cctx.toCacheKeyObject(key), true, true);
+ CacheObject v = cctx.swap().readValue(cctx.toCacheKeyObject(key), true, true);
- if (e == null)
+ if (v == null)
return null;
- CacheObject v = e.value();
-
- assert v != null : "swap must unmarshall it for us";
-
return v.value(cctx.cacheObjectContext(), false);
}
@@ -2312,5 +2312,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
return new GridH2KeyValueRowOffheap(this, ptr);
}
+
+ /** {@inheritDoc} */
+ @Override public boolean preferSwapValue() {
+ return preferSwapVal;
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
index 4a16284..c11f541 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
@@ -130,20 +130,23 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
/**
* Atomically updates weak value.
*
- * @param upd New value.
- * @return {@code null} If update succeeded, unexpected value otherwise.
+ * @param valObj New value.
+ * @return New value if old value is empty, old value otherwise.
+ * @throws IgniteCheckedException If failed.
*/
- protected synchronized Value updateWeakValue(Value upd) {
+ protected synchronized Value updateWeakValue(Object valObj) throws IgniteCheckedException {
Value res = peekValue(VAL_COL);
if (res != null && !(res instanceof WeakValue))
return res;
+ Value upd = desc.wrap(valObj, desc.valueType());
+
setValue(VAL_COL, new WeakValue(upd));
notifyAll();
- return null;
+ return upd;
}
/**
@@ -188,21 +191,23 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
Value v;
if (col == VAL_COL) {
- v = syncValue(0);
+ v = peekValue(VAL_COL);
long start = 0;
int attempt = 0;
while ((v = WeakValue.unwrap(v)) == null) {
- v = getOffheapValue(VAL_COL);
+ if (!desc.preferSwapValue()) {
+ v = getOffheapValue(VAL_COL);
- if (v != null) {
- setValue(VAL_COL, v);
+ if (v != null) {
+ setValue(VAL_COL, v);
- if (peekValue(KEY_COL) == null)
- cache();
+ if (peekValue(KEY_COL) == null)
+ cache();
- return v;
+ return v;
+ }
}
Object k = getValue(KEY_COL).getObject();
@@ -213,16 +218,24 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
if (valObj != null) {
// Even if we've found valObj in swap, it is may be some new value,
// while the needed value was already unswapped, so we have to recheck it.
- if ((v = WeakValue.unwrap(syncValue(0))) == null && (v = getOffheapValue(VAL_COL)) == null) {
- Value upd = desc.wrap(valObj, desc.valueType());
-
- v = updateWeakValue(upd);
-
- return v == null ? upd : v;
- }
+ if ((v = getOffheapValue(VAL_COL)) == null)
+ return updateWeakValue(valObj);
}
else {
// If nothing found in swap then we should be already unswapped.
+ if (desc.preferSwapValue()) {
+ v = getOffheapValue(VAL_COL);
+
+ if (v != null) {
+ setValue(VAL_COL, v);
+
+ if (peekValue(KEY_COL) == null)
+ cache();
+
+ return v;
+ }
+ }
+
v = syncValue(attempt);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
index de31fe1..2dd9f25 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
@@ -216,12 +216,19 @@ public class GridH2KeyValueRowOffheap extends GridH2AbstractKeyValueRow {
/** {@inheritDoc} */
@SuppressWarnings("NonSynchronizedMethodOverridesSynchronizedMethod")
- @Override protected synchronized Value updateWeakValue(Value upd) {
+ @Override protected synchronized Value updateWeakValue(Object valObj) throws IgniteCheckedException {
+ Value val = peekValue(VAL_COL);
+
+ if (val != null)
+ return val;
+
+ Value upd = desc.wrap(valObj, desc.valueType());
+
setValue(VAL_COL, upd);
notifyAll();
- return null;
+ return upd;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
index 0edd102..ed3ff7a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
@@ -111,4 +111,9 @@ public interface GridH2RowDescriptor extends GridOffHeapSmartPointerFactory<Grid
* @throws IgniteCheckedException If failed.
*/
public Value wrap(Object o, int type) throws IgniteCheckedException;
+
+ /**
+ * @return {@code True} if should check swap value before offheap.
+ */
+ public boolean preferSwapValue();
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
index 23f4e91..e6bf22b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
@@ -23,7 +23,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -36,6 +36,8 @@ 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.CacheMemoryMode.OFFHEAP_TIERED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
/**
@@ -45,7 +47,6 @@ public class CacheIndexStreamerTest extends GridCommonAbstractTest {
/** */
private final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -60,14 +61,29 @@ public class CacheIndexStreamerTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
- public void testStreamer() throws Exception {
+ public void testStreamerAtomic() throws Exception {
+ checkStreamer(ATOMIC);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStreamerTx() throws Exception {
+ checkStreamer(TRANSACTIONAL);
+ }
+
+ /**
+ * @param atomicityMode Cache atomicity mode.
+ * @throws Exception If failed.
+ */
+ public void checkStreamer(CacheAtomicityMode atomicityMode) throws Exception {
final Ignite ignite = startGrid(0);
- final IgniteCache<Integer, String> cache = ignite.createCache(cacheConfiguration());
+ final IgniteCache<Integer, String> cache = ignite.createCache(cacheConfiguration(atomicityMode));
final AtomicBoolean stop = new AtomicBoolean();
- final int KEYS= 10_000;
+ final int KEYS = 10_000;
try {
IgniteInternalFuture streamerFut = GridTestUtils.runAsync(new Callable() {
@@ -118,14 +134,15 @@ public class CacheIndexStreamerTest extends GridCommonAbstractTest {
}
/**
+ * @param atomicityMode Cache atomicity mode.
* @return Cache configuration.
*/
- private CacheConfiguration cacheConfiguration() {
+ private CacheConfiguration cacheConfiguration(CacheAtomicityMode atomicityMode) {
CacheConfiguration ccfg = new CacheConfiguration();
- ccfg.setAtomicityMode(ATOMIC);
+ ccfg.setAtomicityMode(atomicityMode);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
- ccfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
+ ccfg.setMemoryMode(OFFHEAP_TIERED);
ccfg.setOffHeapMaxMemory(0);
ccfg.setBackups(1);
ccfg.setIndexedTypes(Integer.class, String.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java
index e0e6ff0..cd1fc93 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java
@@ -244,12 +244,12 @@ public class GridCacheSwapSelfTest extends GridCommonAbstractTest {
}
/**
- * TODO: IGNITE-599.
- *
* @throws Exception If failed.
*/
public void testSwapEviction() throws Exception {
try {
+ fail("https://issues.apache.org/jira/browse/IGNITE-599");
+
final CountDownLatch evicted = new CountDownLatch(10);
startGrids(1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/72c3eef2/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
index f30f70e..550c69f 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
@@ -19,6 +19,7 @@ package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
import org.apache.ignite.internal.processors.cache.CacheConfigurationP2PTest;
+import org.apache.ignite.internal.processors.cache.CacheIndexStreamerTest;
import org.apache.ignite.internal.processors.cache.GridCacheOffHeapAndSwapSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheOffHeapSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheOffheapIndexEntryEvictTest;
@@ -63,6 +64,7 @@ public class IgniteCacheWithIndexingTestSuite extends TestSuite {
suite.addTestSuite(GridCacheOffheapIndexGetSelfTest.class);
suite.addTestSuite(GridCacheOffheapIndexEntryEvictTest.class);
+ suite.addTestSuite(CacheIndexStreamerTest.class);
suite.addTestSuite(CacheConfigurationP2PTest.class);
[15/46] ignite git commit: Fixed test.
Posted by sb...@apache.org.
Fixed test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/517d0f58
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/517d0f58
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/517d0f58
Branch: refs/heads/ignite-1093-2
Commit: 517d0f584f67e9291b7f6f2efe3f42b7131f6a25
Parents: 04f4f54
Author: sboikov <sb...@gridgain.com>
Authored: Wed Sep 23 15:43:13 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Sep 23 15:43:13 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAbstractRemoveFailureTest.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/517d0f58/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
index 647746e..a3d9948 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
@@ -365,13 +365,13 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr
U.sleep(random(START_DELAY.get1(), START_DELAY.get2()));
- if (stop.get())
- return;
-
log.info("Restarting node " + idx);
startGrid(idx);
+ if (stop.get())
+ return;
+
U.sleep(1000);
}
[24/46] ignite git commit: schema-import examples fix (cherry picked
from commit b054fdc)
Posted by sb...@apache.org.
schema-import examples fix
(cherry picked from commit b054fdc)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/94f5248b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/94f5248b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/94f5248b
Branch: refs/heads/ignite-1093-2
Commit: 94f5248b0e03f04c53f0c264a880803e20de2d3a
Parents: 30f5b9e
Author: Anton Vinogradov <av...@apache.org>
Authored: Thu Sep 24 14:52:09 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Thu Sep 24 15:16:20 2015 +0300
----------------------------------------------------------------------
examples/schema-import/pom.xml | 2 +-
pom.xml | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/94f5248b/examples/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom.xml b/examples/schema-import/pom.xml
index fdbd631..fce6f47 100644
--- a/examples/schema-import/pom.xml
+++ b/examples/schema-import/pom.xml
@@ -38,7 +38,7 @@
</properties>
<artifactId>ignite-schema-import-demo</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.3.3-p7-SNAPSHOT</version>
<dependencies>
<dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/94f5248b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b47958f..33689a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -466,6 +466,7 @@
<id>examples</id>
<modules>
<module>examples</module>
+ <module>examples/schema-import</module>
</modules>
</profile>