You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/09/25 01:11:37 UTC
[01/50] ignite git commit: Merge branch 'ignite-1.4'
Repository: ignite
Updated Branches:
refs/heads/ignite-257 dce579200 -> 69f6f9b51
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/c311c3c9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c311c3c9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c311c3c9
Branch: refs/heads/ignite-257
Commit: c311c3c9e53398dd510839ea02efc541054461fe
Parents: 6e48c9c cd6a1d5
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 17 10:44:39 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 17 10:44:39 2015 +0300
----------------------------------------------------------------------
.../configuration/NearCacheConfiguration.java | 18 +-
.../distributed/dht/GridDhtLocalPartition.java | 26 +-
.../query/GridCacheDistributedQueryFuture.java | 27 +-
.../cache/query/GridCacheLocalQueryFuture.java | 5 +
.../cache/query/GridCacheQueryAdapter.java | 170 ++++++++-----
.../query/GridCacheQueryFutureAdapter.java | 11 +-
.../cache/query/GridCacheQueryManager.java | 30 ++-
.../distributed/CacheAffEarlySelfTest.java | 245 +++++++++++++++++++
.../GridCacheSwapScanQueryAbstractSelfTest.java | 118 ++++-----
.../processors/igfs/IgfsAbstractSelfTest.java | 5 +-
...CacheScanPartitionQueryFallbackSelfTest.java | 244 +++++-------------
.../ignite/visor/commands/VisorConsole.scala | 31 ++-
.../yardstick/IgniteBenchmarkArguments.java | 24 +-
.../org/apache/ignite/yardstick/IgniteNode.java | 12 +-
14 files changed, 610 insertions(+), 356 deletions(-)
----------------------------------------------------------------------
[36/50] ignite git commit: Merging IGNITE-1171 - fixed problems with
custom events in discovery
Posted by ag...@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-257
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);
[22/50] ignite git commit: ignite-973 Fixed atomic cache 'remove' to
always provide old value for indexing
Posted by ag...@apache.org.
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-257
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());
[18/50] ignite git commit: IGNITE-1370 Refactor StreamTupleExtractor
API for 0..1 and 0..n extraction.
Posted by ag...@apache.org.
IGNITE-1370 Refactor StreamTupleExtractor API for 0..1 and 0..n extraction.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/421a5234
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/421a5234
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/421a5234
Branch: refs/heads/ignite-257
Commit: 421a5234b5a7e56e36952a4c1976b3118310073e
Parents: eae4df1 b80b171
Author: Raul Kripalani <ra...@apache.org>
Authored: Mon Sep 21 16:28:12 2015 +0100
Committer: Raul Kripalani <ra...@apache.org>
Committed: Mon Sep 21 16:28:12 2015 +0100
----------------------------------------------------------------------
.../socket/WordsSocketStreamerServer.java | 5 +-
.../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 +-
.../stream/socket/SocketStreamerSelfTest.java | 112 ++++++++++++++-----
7 files changed, 270 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
[08/50] ignite git commit: Fixed yardstick config.
Posted by ag...@apache.org.
Fixed yardstick config.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4c101dc2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4c101dc2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4c101dc2
Branch: refs/heads/ignite-257
Commit: 4c101dc23be2365c6983381cac9dbe68873040d8
Parents: 3676cbe
Author: sboikov <sb...@gridgain.com>
Authored: Fri Sep 18 14:11:07 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Sep 18 14:11:07 2015 +0300
----------------------------------------------------------------------
modules/yardstick/config/ignite-base-config.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c101dc2/modules/yardstick/config/ignite-base-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-base-config.xml b/modules/yardstick/config/ignite-base-config.xml
index 6e94b3c..c77cc9a 100644
--- a/modules/yardstick/config/ignite-base-config.xml
+++ b/modules/yardstick/config/ignite-base-config.xml
@@ -25,7 +25,7 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="base-ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" abstract="true">
- <property name="peerClassLoadingEnabled" value="true"/>
+ <property name="peerClassLoadingEnabled" value="false"/>
<property name="metricsLogFrequency" value="5000"/>
[47/50] ignite git commit: ignite-1540 Handle error in
GridDhtAtomicUpdateFuture.onDone
Posted by ag...@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-257
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);
[16/50] ignite git commit: Merge branch 'ignite-1.4'
Posted by ag...@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/eae4df1e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eae4df1e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eae4df1e
Branch: refs/heads/ignite-257
Commit: eae4df1e5207cfa124e25dff5079c1405ae01803
Parents: 1021d4e 8b94494
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Sep 21 17:15:38 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 21 17:15:38 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 12 ++++++------
.../dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs | 2 --
modules/yardstick/config/ignite-base-config.xml | 2 +-
3 files changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[12/50] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.4' into ignite-1.4
Posted by ag...@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/7ccd0b31
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7ccd0b31
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7ccd0b31
Branch: refs/heads/ignite-257
Commit: 7ccd0b315192657f5fb2cde565ae4a12e4764b40
Parents: 90cccc9 d08ecf1
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 18 16:56:38 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 18 16:56:38 2015 +0300
----------------------------------------------------------------------
modules/yardstick/config/ignite-base-config.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[27/50] ignite git commit: ignite-973 - fix
Posted by ag...@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-257
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;
}
[43/50] ignite git commit: schema-import examples fix (cherry picked
from commit 169066b)
Posted by ag...@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-257
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>
[32/50] ignite git commit: Merge branch 'ignite-1.4'
Posted by ag...@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-257
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
----------------------------------------------------------------------
[06/50] ignite git commit: minor
Posted by ag...@apache.org.
minor
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d64fc9d1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d64fc9d1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d64fc9d1
Branch: refs/heads/ignite-257
Commit: d64fc9d105c66c08234d7bdf72046128456620a5
Parents: 3676cbe
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Sep 17 18:03:57 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Sep 17 18:03:57 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d64fc9d1/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 d9f6840..0cbad48 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
@@ -418,4 +418,4 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
@Override public String toString() {
return S.toString(GridDhtAtomicUpdateFuture.class, this);
}
-}
\ No newline at end of file
+}
[05/50] ignite git commit: Test for ignite-973.
Posted by ag...@apache.org.
Test for ignite-973.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3676cbe7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3676cbe7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3676cbe7
Branch: refs/heads/ignite-257
Commit: 3676cbe7f5f5f73199487318d6841e50a1f73496
Parents: 585761f
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 17 17:52:24 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 17 17:52:24 2015 +0300
----------------------------------------------------------------------
.../ignite/testframework/GridTestUtils.java | 14 +-
.../cache/CacheIndexStreamerTest.java | 137 +++++++++++++++++++
2 files changed, 150 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3676cbe7/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index edf7c52..be3f0e4 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -633,11 +633,23 @@ public final class GridTestUtils {
*/
@SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor")
public static <T> IgniteInternalFuture<T> runAsync(final Callable<T> task) {
+ return runAsync(task, "async-runner");
+ }
+
+ /**
+ * Runs callable task asyncronously.
+ *
+ * @param task Callable.
+ * @param threadName Thread name.
+ * @return Future with task result.
+ */
+ @SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor")
+ public static <T> IgniteInternalFuture<T> runAsync(final Callable<T> task, String threadName) {
if (!busyLock.enterBusy())
throw new IllegalStateException("Failed to start new threads (test is being stopped).");
try {
- final GridTestSafeThreadFactory thrFactory = new GridTestSafeThreadFactory("async-runner");
+ final GridTestSafeThreadFactory thrFactory = new GridTestSafeThreadFactory(threadName);
final GridFutureAdapter<T> fut = new GridFutureAdapter<T>() {
@Override public boolean cancel() throws IgniteCheckedException {
http://git-wip-us.apache.org/repos/asf/ignite/blob/3676cbe7/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
new file mode 100644
index 0000000..25c3b81
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
+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.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+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);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStreamer() throws Exception {
+ final Ignite ignite = startGrid(0);
+
+ final IgniteCache<Integer, String> cache = ignite.createCache(cacheConfiguration());
+
+ final AtomicBoolean stop = new AtomicBoolean();
+
+ final int KEYS= 10_000;
+
+ try {
+ IgniteInternalFuture streamerFut = GridTestUtils.runAsync(new Callable() {
+ @Override public Void call() throws Exception {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ while (!stop.get()) {
+ try (IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(null)) {
+ for (int i = 0; i < 1; i++)
+ streamer.addData(rnd.nextInt(KEYS), String.valueOf(i));
+ }
+ }
+
+ return null;
+ }
+ }, "streamer-thread");
+
+ IgniteInternalFuture updateFut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ while (!stop.get()) {
+ for (int i = 0; i < 100; i++) {
+ Integer key = rnd.nextInt(KEYS);
+
+ cache.put(key, String.valueOf(key));
+
+ cache.remove(key);
+ }
+ }
+
+ return null;
+ }
+ }, 1, "update-thread");
+
+ U.sleep(30_000);
+
+ stop.set(true);
+
+ streamerFut.get();
+ updateFut.get();
+ }
+ finally {
+ stop.set(true);
+
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @return Cache configuration.
+ */
+ private CacheConfiguration cacheConfiguration() {
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setAtomicityMode(ATOMIC);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
+ ccfg.setOffHeapMaxMemory(0);
+ ccfg.setBackups(1);
+ ccfg.setIndexedTypes(Integer.class, String.class);
+
+ return ccfg;
+ }
+
+
+}
[13/50] ignite git commit: minor (fixed warning messages)
Posted by ag...@apache.org.
minor (fixed warning messages)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/84a23008
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/84a23008
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/84a23008
Branch: refs/heads/ignite-257
Commit: 84a230084e9488a4ddb9b52f86ecd6c623baf745
Parents: d64fc9d
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Sep 18 23:15:59 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Sep 18 23:15:59 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/spi/discovery/tcp/ServerImpl.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/84a23008/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 3e50b94..4ce46e8 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
@@ -4437,9 +4437,8 @@ class ServerImpl extends TcpDiscoveryImpl {
LT.warn(log, null, "Unknown connection detected (is some other software connecting to " +
"this Ignite port?" +
- (!spi.isSslEnabled() ? " missed SSL configuration?" : "" ) +
- ") [rmtAddr=" + sock.getRemoteSocketAddress() +
- ", locAddr=" + sock.getLocalSocketAddress() + ']');
+ (!spi.isSslEnabled() ? " missing SSL configuration on remote node?" : "" ) +
+ ") [rmtAddr=" + sock.getInetAddress() + ']', true);
return;
}
@@ -4555,8 +4554,9 @@ class ServerImpl extends TcpDiscoveryImpl {
U.error(log, "Caught exception on handshake [err=" + e +", sock=" + sock + ']', e);
if (X.hasCause(e, SSLException.class) && spi.isSslEnabled() && !spi.isNodeStopping0())
- LT.warn(log, null, "Failed to initialize connection. Not encrypted data received. " +
- "Missed SSL configuration on node? [sock=" + sock + ']');
+ LT.warn(log, null, "Failed to initialize connection " +
+ "(missing SSL configuration on remote node?) " +
+ "[rmtAddr=" + sock.getInetAddress() + ']', true);
else if ((X.hasCause(e, ObjectStreamException.class) || !sock.isClosed())
&& !spi.isNodeStopping0()) {
if (U.isMacInvalidArgumentError(e))
@@ -5293,4 +5293,4 @@ class ServerImpl extends TcpDiscoveryImpl {
this.sock = sock;
}
}
-}
\ No newline at end of file
+}
[19/50] ignite git commit: Merge branch 'master' into
feature/ignite-535-mqtt
Posted by ag...@apache.org.
Merge branch 'master' into feature/ignite-535-mqtt
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f03f3a3b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f03f3a3b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f03f3a3b
Branch: refs/heads/ignite-257
Commit: f03f3a3b48fa105f318e9493440671188770f4ef
Parents: 53683e2 421a523
Author: Raul Kripalani <ra...@apache.org>
Authored: Mon Sep 21 16:36:53 2015 +0100
Committer: Raul Kripalani <ra...@apache.org>
Committed: Mon Sep 21 16:36:53 2015 +0100
----------------------------------------------------------------------
.../org/apache/ignite/IgniteAtomicLong.java | 15 +-
.../apache/ignite/IgniteAtomicReference.java | 9 +-
.../org/apache/ignite/IgniteAtomicSequence.java | 9 +-
.../org/apache/ignite/IgniteAtomicStamped.java | 13 +-
.../configuration/NearCacheConfiguration.java | 18 +-
.../apache/ignite/internal/IgniteKernal.java | 7 -
.../processors/cache/GridCacheContext.java | 6 +-
.../cache/GridCacheEvictionManager.java | 6 +-
.../cache/GridCacheEvictionResponse.java | 2 +-
.../processors/cache/GridCacheIoManager.java | 47 ++--
.../processors/cache/GridCacheMessage.java | 7 +
.../processors/cache/GridCacheMvccManager.java | 34 ++-
.../GridCachePartitionExchangeManager.java | 41 +++-
.../processors/cache/GridCacheProcessor.java | 28 ++-
.../GridDistributedLockResponse.java | 6 +-
.../GridDistributedTxPrepareResponse.java | 6 +-
.../distributed/dht/GridDhtLocalPartition.java | 26 +-
.../distributed/dht/GridDhtTopologyFuture.java | 6 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 2 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 2 +-
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 12 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 16 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 2 +
.../atomic/GridNearAtomicUpdateResponse.java | 11 +-
.../colocated/GridDhtColocatedLockFuture.java | 44 +++-
.../dht/preloader/GridDhtForceKeysFuture.java | 2 +-
.../dht/preloader/GridDhtForceKeysResponse.java | 6 +-
.../GridDhtPartitionsExchangeFuture.java | 19 +-
.../distributed/near/GridNearGetResponse.java | 6 +-
.../distributed/near/GridNearLockFuture.java | 26 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 20 +-
.../near/GridNearTxFinishResponse.java | 6 +-
.../query/GridCacheDistributedQueryFuture.java | 27 +-
.../cache/query/GridCacheLocalQueryFuture.java | 5 +
.../cache/query/GridCacheQueryAdapter.java | 170 ++++++++-----
.../query/GridCacheQueryFutureAdapter.java | 11 +-
.../cache/query/GridCacheQueryManager.java | 30 ++-
.../cache/query/GridCacheQueryResponse.java | 6 +-
.../continuous/CacheContinuousQueryHandler.java | 12 +-
.../transactions/IgniteTxLocalAdapter.java | 4 +-
.../ignite/internal/util/GridSpinBusyLock.java | 10 +
.../ignite/spi/discovery/tcp/ServerImpl.java | 12 +-
.../IgniteCacheEntryProcessorNodeJoinTest.java | 24 +-
.../distributed/CacheAffEarlySelfTest.java | 245 +++++++++++++++++++
.../GridCacheSwapScanQueryAbstractSelfTest.java | 118 ++++-----
.../processors/igfs/IgfsAbstractSelfTest.java | 5 +-
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../ignite/testframework/GridTestUtils.java | 14 +-
.../cache/CacheIndexStreamerTest.java | 137 +++++++++++
...CacheScanPartitionQueryFallbackSelfTest.java | 244 +++++-------------
.../IgniteCacheQueryNodeRestartSelfTest2.java | 2 -
.../Apache.Ignite.Core/Impl/IgniteManager.cs | 2 -
.../ignite/visor/commands/VisorConsole.scala | 37 ++-
.../config/benchmark-put-indexed-val.properties | 2 +-
modules/yardstick/config/ignite-base-config.xml | 2 +-
.../yardstick/IgniteBenchmarkArguments.java | 24 +-
.../org/apache/ignite/yardstick/IgniteNode.java | 12 +-
57 files changed, 1084 insertions(+), 535 deletions(-)
----------------------------------------------------------------------
[46/50] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by ag...@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-257
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
----------------------------------------------------------------------
[25/50] ignite git commit: Added test.
Posted by ag...@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-257
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();
[38/50] ignite git commit: IGNITE-1536 - Removed duplicated
continuous query notifications in REPLICATED cache
Posted by ag...@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-257
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
+}
[50/50] ignite git commit: IGNITE-257 - Merge from master.
Posted by ag...@apache.org.
IGNITE-257 - Merge from master.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/69f6f9b5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/69f6f9b5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/69f6f9b5
Branch: refs/heads/ignite-257
Commit: 69f6f9b511a5e11221ee86de083dea30eaa586c1
Parents: dce5792 bf7591b
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Sep 24 16:11:09 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Sep 24 16:11:09 2015 -0700
----------------------------------------------------------------------
RELEASE_NOTES.txt | 2 +-
examples/config/filesystem/README.txt | 2 +-
examples/config/filesystem/example-igfs.xml | 7 -
examples/pom.xml | 2 +-
examples/schema-import/pom.xml | 10 +-
.../socket/WordsSocketStreamerServer.java | 5 +-
modules/aop/pom.xml | 2 +-
modules/apache-license-gen/pom.xml | 2 +-
modules/aws/pom.xml | 2 +-
modules/clients/pom.xml | 2 +-
modules/cloud/pom.xml | 2 +-
modules/codegen/pom.xml | 2 +-
modules/core/pom.xml | 2 +-
.../org/apache/ignite/IgniteAtomicLong.java | 17 +-
.../apache/ignite/IgniteAtomicReference.java | 9 +-
.../org/apache/ignite/IgniteAtomicSequence.java | 9 +-
.../org/apache/ignite/IgniteAtomicStamped.java | 13 +-
.../org/apache/ignite/IgniteFileSystem.java | 2 +-
.../apache/ignite/cache/CacheAtomicityMode.java | 17 +-
.../configuration/CacheConfiguration.java | 17 +-
.../configuration/NearCacheConfiguration.java | 18 +-
.../ignite/configuration/TopologyValidator.java | 38 +-
.../ignite/internal/GridKernalContext.java | 7 +-
.../ignite/internal/GridKernalContextImpl.java | 10 +-
.../apache/ignite/internal/GridLoggerProxy.java | 6 +-
.../apache/ignite/internal/IgniteKernal.java | 17 +-
.../internal/executor/GridExecutorService.java | 4 +-
.../deployment/GridDeploymentStoreAdapter.java | 4 +-
.../internal/portable/api/IgnitePortables.java | 2 +-
.../processors/cache/CacheMetricsImpl.java | 2 +-
.../cache/DynamicCacheDescriptor.java | 10 +-
.../processors/cache/GridCacheAdapter.java | 33 +-
.../cache/GridCacheClearAllRunnable.java | 4 +-
.../processors/cache/GridCacheContext.java | 6 +-
.../processors/cache/GridCacheEntryEx.java | 13 +
.../cache/GridCacheEvictionManager.java | 24 +-
.../cache/GridCacheEvictionResponse.java | 2 +-
.../processors/cache/GridCacheIoManager.java | 47 +-
.../processors/cache/GridCacheLogger.java | 4 +-
.../processors/cache/GridCacheMapEntry.java | 103 +++-
.../processors/cache/GridCacheMessage.java | 7 +
.../processors/cache/GridCacheMvccManager.java | 34 +-
.../GridCachePartitionExchangeManager.java | 47 +-
.../processors/cache/GridCacheProcessor.java | 85 ++-
.../cache/GridCacheSharedContext.java | 4 +-
.../cache/GridCacheSwapEntryImpl.java | 55 +-
.../processors/cache/GridCacheSwapManager.java | 272 +++++++--
.../processors/cache/GridCacheUtils.java | 21 +-
.../processors/cache/IgniteCacheProxy.java | 4 +-
.../GridDistributedLockResponse.java | 6 +-
.../GridDistributedTxPrepareResponse.java | 6 +-
.../GridDistributedTxRemoteAdapter.java | 8 +-
.../dht/GridClientPartitionTopology.java | 104 ++--
.../distributed/dht/GridDhtLocalPartition.java | 32 +-
.../dht/GridDhtPartitionTopology.java | 4 +-
.../dht/GridDhtPartitionTopologyImpl.java | 16 +-
.../distributed/dht/GridDhtTopologyFuture.java | 6 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 2 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 7 +-
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 12 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 16 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 2 +
.../atomic/GridNearAtomicUpdateResponse.java | 11 +-
.../colocated/GridDhtColocatedLockFuture.java | 44 +-
.../dht/preloader/GridDhtForceKeysFuture.java | 2 +-
.../dht/preloader/GridDhtForceKeysResponse.java | 6 +-
.../GridDhtPartitionsExchangeFuture.java | 19 +-
.../distributed/near/GridNearGetResponse.java | 6 +-
.../distributed/near/GridNearLockFuture.java | 26 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 23 +-
.../near/GridNearTxFinishFuture.java | 50 +-
.../near/GridNearTxFinishResponse.java | 6 +-
.../query/GridCacheDistributedQueryFuture.java | 27 +-
.../cache/query/GridCacheLocalQueryFuture.java | 5 +
.../cache/query/GridCacheQueryAdapter.java | 170 +++---
.../query/GridCacheQueryFutureAdapter.java | 11 +-
.../cache/query/GridCacheQueryManager.java | 30 +-
.../cache/query/GridCacheQueryResponse.java | 6 +-
.../continuous/CacheContinuousQueryHandler.java | 12 +-
.../continuous/CacheContinuousQueryManager.java | 66 +-
.../cache/transactions/IgniteTxHandler.java | 9 +-
.../transactions/IgniteTxLocalAdapter.java | 2 +
.../continuous/GridContinuousProcessor.java | 25 +-
.../datastreamer/DataStreamerImpl.java | 2 -
.../datastructures/GridCacheAtomicLongImpl.java | 4 +-
.../GridCacheAtomicReferenceImpl.java | 4 +-
.../GridCacheAtomicSequenceImpl.java | 4 +-
.../GridCacheAtomicStampedImpl.java | 4 +-
.../GridCacheCountDownLatchImpl.java | 4 +-
.../processors/igfs/IgfsFileWorkerBatch.java | 15 +-
.../igfs/IgfsFragmentizerManager.java | 8 +-
.../internal/processors/igfs/IgfsImpl.java | 87 +--
.../processors/igfs/IgfsMetaManager.java | 193 +++++-
.../processors/igfs/IgfsServerManager.java | 5 +-
.../internal/processors/job/GridJobWorker.java | 4 +-
.../offheap/GridOffHeapProcessor.java | 25 +-
.../processors/task/GridTaskWorker.java | 4 +-
.../ignite/internal/util/GridSpinBusyLock.java | 10 +
.../ignite/internal/util/IgniteUtils.java | 16 +
.../util/offheap/GridOffHeapEvictListener.java | 5 +
.../internal/util/offheap/GridOffHeapMap.java | 13 +-
.../util/offheap/GridOffHeapMapFactory.java | 28 +-
.../util/offheap/GridOffHeapPartitionedMap.java | 12 +
.../util/offheap/unsafe/GridUnsafeMap.java | 128 ++--
.../unsafe/GridUnsafePartitionedMap.java | 9 +
.../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 +-
.../core/src/main/resources/ignite.properties | 2 +-
.../cache/CacheSwapUnswapGetTest.java | 85 ++-
.../cache/GridCacheAbstractFullApiSelfTest.java | 7 +-
.../GridCacheAbstractRemoveFailureTest.java | 205 ++++---
.../cache/GridCacheMemoryModeSelfTest.java | 9 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 60 ++
.../processors/cache/GridCacheTestEntryEx.java | 6 +
.../GridCacheVariableTopologySelfTest.java | 3 +-
.../cache/IgniteCacheCreateRestartSelfTest.java | 106 ++++
.../IgniteCacheEntryListenerAbstractTest.java | 65 +-
.../IgniteCacheEntryProcessorNodeJoinTest.java | 97 ++-
.../distributed/CacheAffinityEarlyTest.java | 168 +++++
.../GridCacheAbstractNodeRestartSelfTest.java | 149 ++++-
.../GridCacheDhtAtomicRemoveFailureTest.java | 16 +-
.../dht/GridCacheDhtRemoveFailureTest.java | 16 +-
.../dht/GridCacheTxNodeFailureSelfTest.java | 2 +-
.../IgniteCacheCrossCacheTxFailoverTest.java | 53 +-
.../IgniteCachePutRetryAbstractSelfTest.java | 199 +++++-
.../dht/IgniteCachePutRetryAtomicSelfTest.java | 2 +
...gniteCachePutRetryTransactionalSelfTest.java | 50 +-
...eAtomicInvalidPartitionHandlingSelfTest.java | 98 ++-
...tomicPrimaryWriteOrderRemoveFailureTest.java | 15 +-
.../GridCacheAtomicRemoveFailureTest.java | 15 +-
...GridCacheValueConsistencyAtomicSelfTest.java | 2 +-
.../GridCacheAtomicNearRemoveFailureTest.java | 15 +-
...cPrimaryWriteOrderNearRemoveFailureTest.java | 15 +-
.../near/GridCacheNearRemoveFailureTest.java | 15 +-
.../GridCachePartitionedNodeRestartTest.java | 9 +-
...ePartitionedOptimisticTxNodeRestartTest.java | 9 +-
.../near/NearCacheMultithreadedUpdateTest.java | 217 +++++++
.../GridCacheReplicatedNodeRestartSelfTest.java | 8 +-
.../GridCacheSwapScanQueryAbstractSelfTest.java | 118 ++--
...ontinuousQueryReplicatedOneNodeSelfTest.java | 120 ++++
.../processors/igfs/IgfsAbstractSelfTest.java | 257 +++++---
.../igfs/IgfsClientCacheSelfTest.java | 15 +-
.../igfs/IgfsDualAbstractSelfTest.java | 10 +-
.../igfs/IgfsMetaManagerSelfTest.java | 106 ++--
.../offheap/GridOffHeapMapAbstractSelfTest.java | 16 +-
.../GridOffHeapMapPerformanceAbstractTest.java | 4 +-
...idOffHeapPartitionedMapAbstractSelfTest.java | 20 +
.../unsafe/GridUnsafeMapPerformanceTest.java | 2 +-
.../offheap/unsafe/GridUnsafeMapSelfTest.java | 2 +-
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../GridOffHeapMapPerformanceAbstractTest.java | 4 +-
.../unsafe/GridUnsafeMapPerformanceTest.java | 2 +-
...lientDiscoverySpiFailureTimeoutSelfTest.java | 139 ++++-
.../tcp/TcpClientDiscoverySpiSelfTest.java | 13 +-
.../tcp/TcpDiscoveryMultiThreadedTest.java | 53 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 315 +++++++++-
.../stream/socket/SocketStreamerSelfTest.java | 112 +++-
.../ignite/testframework/GridTestUtils.java | 131 +++-
.../multijvm/IgniteCacheProcessProxy.java | 3 +-
.../IgniteCacheFailoverTestSuite.java | 10 -
.../IgniteCacheFailoverTestSuite3.java | 45 ++
.../testsuites/IgniteCacheRestartTestSuite.java | 15 +-
.../IgniteCacheRestartTestSuite2.java | 47 ++
.../testsuites/IgniteCacheTestSuite4.java | 2 +
modules/extdata/p2p/pom.xml | 2 +-
.../extdata/uri/modules/uri-dependency/pom.xml | 2 +-
modules/extdata/uri/pom.xml | 2 +-
modules/gce/pom.xml | 2 +-
modules/geospatial/pom.xml | 2 +-
modules/hadoop/pom.xml | 2 +-
.../hadoop/SecondaryFileSystemProvider.java | 4 +-
.../hadoop/igfs/HadoopIgfsWrapper.java | 100 +--
.../testsuites/IgniteHadoopTestSuite.java | 25 +-
modules/hibernate/pom.xml | 2 +-
modules/indexing/pom.xml | 2 +-
.../processors/query/h2/IgniteH2Indexing.java | 19 +-
.../query/h2/opt/GridH2AbstractKeyValueRow.java | 73 ++-
.../query/h2/opt/GridH2KeyValueRowOffheap.java | 11 +-
.../query/h2/opt/GridH2RowDescriptor.java | 5 +
.../processors/query/h2/opt/GridH2Table.java | 10 +-
.../cache/CacheIndexStreamerTest.java | 154 +++++
...CacheScanPartitionQueryFallbackSelfTest.java | 277 ++++-----
.../cache/GridCacheOffHeapAndSwapSelfTest.java | 4 +
.../processors/cache/GridCacheSwapSelfTest.java | 4 +-
.../IgniteCacheQueryMultiThreadedSelfTest.java | 9 +-
...QueryOffheapEvictsMultiThreadedSelfTest.java | 5 -
...lientQueryReplicatedNodeRestartSelfTest.java | 8 +-
.../IgniteCacheQueryNodeRestartSelfTest.java | 4 +-
.../IgniteCacheQueryNodeRestartSelfTest2.java | 10 +-
.../IgniteCacheQuerySelfTestSuite.java | 4 +-
.../IgniteCacheWithIndexingTestSuite.java | 2 +
modules/jcl/pom.xml | 2 +-
modules/jms11/pom.xml | 2 +-
modules/jta/pom.xml | 2 +-
modules/kafka/pom.xml | 2 +-
modules/log4j/pom.xml | 2 +-
modules/log4j2/pom.xml | 2 +-
modules/mesos/pom.xml | 2 +-
modules/mqtt/pom.xml | 114 ++++
.../apache/ignite/stream/mqtt/MqttStreamer.java | 611 +++++++++++++++++++
.../stream/mqtt/IgniteMqttStreamerTest.java | 553 +++++++++++++++++
.../mqtt/IgniteMqttStreamerTestSuite.java | 34 ++
modules/platform/pom.xml | 2 +-
.../platform/src/main/cpp/common/configure.ac | 2 +-
.../src/main/cpp/core-test/configure.ac | 2 +-
modules/platform/src/main/cpp/core/configure.ac | 2 +-
.../Apache.Ignite.Core/Impl/IgniteManager.cs | 2 -
.../Properties/AssemblyInfo.cs | 4 +-
.../Apache.Ignite/Properties/AssemblyInfo.cs | 4 +-
.../Properties/AssemblyInfo.cs | 4 +-
.../Properties/AssemblyInfo.cs | 4 +-
modules/rest-http/pom.xml | 2 +-
modules/scalar-2.10/pom.xml | 2 +-
modules/scalar/pom.xml | 2 +-
modules/schedule/pom.xml | 2 +-
modules/schema-import/pom.xml | 2 +-
modules/slf4j/pom.xml | 2 +-
modules/spark-2.10/pom.xml | 2 +-
modules/spark/pom.xml | 2 +-
modules/spring/pom.xml | 2 +-
modules/ssh/pom.xml | 2 +-
modules/tools/pom.xml | 2 +-
modules/urideploy/pom.xml | 2 +-
modules/visor-console-2.10/pom.xml | 2 +-
modules/visor-console/pom.xml | 2 +-
.../ignite/visor/commands/VisorConsole.scala | 37 +-
modules/visor-plugins/pom.xml | 2 +-
modules/web/pom.xml | 2 +-
.../config/benchmark-put-indexed-val.properties | 2 +-
modules/yardstick/config/ignite-base-config.xml | 2 +-
modules/yardstick/pom.xml | 2 +-
.../yardstick/IgniteBenchmarkArguments.java | 24 +-
.../org/apache/ignite/yardstick/IgniteNode.java | 12 +-
modules/yarn/pom.xml | 2 +-
modules/zookeeper/pom.xml | 2 +-
pom.xml | 4 +-
250 files changed, 6774 insertions(+), 1876 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/69f6f9b5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/69f6f9b5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
[20/50] ignite git commit: IGNITE-535 Finish MQTT Streamer docs and
tests. Upgrade latter to AMQ 5.12.0.
Posted by ag...@apache.org.
IGNITE-535 Finish MQTT Streamer docs and tests. Upgrade latter to AMQ 5.12.0.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/296dd6e7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/296dd6e7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/296dd6e7
Branch: refs/heads/ignite-257
Commit: 296dd6e7d86fe6d0914a9fbf8062632c04e4d22c
Parents: f03f3a3
Author: Raul Kripalani <ra...@apache.org>
Authored: Mon Sep 21 17:24:44 2015 +0100
Committer: Raul Kripalani <ra...@apache.org>
Committed: Mon Sep 21 17:24:44 2015 +0100
----------------------------------------------------------------------
modules/mqtt/pom.xml | 9 +-
.../apache/ignite/stream/mqtt/MqttStreamer.java | 156 ++++++++++++++++++-
.../stream/mqtt/IgniteMqttStreamerTest.java | 80 +++++++++-
3 files changed, 224 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/296dd6e7/modules/mqtt/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mqtt/pom.xml b/modules/mqtt/pom.xml
index 4b0b46c..21511e8 100644
--- a/modules/mqtt/pom.xml
+++ b/modules/mqtt/pom.xml
@@ -37,7 +37,7 @@
<properties>
<paho.version>1.0.2</paho.version>
- <activemq.version>5.11.1</activemq.version>
+ <activemq.version>5.12.0</activemq.version>
<guava-retryier.version>2.0.0</guava-retryier.version>
</properties>
@@ -69,13 +69,6 @@
<dependency>
<groupId>org.apache.activemq</groupId>
- <artifactId>activemq-kahadb-store</artifactId>
- <version>${activemq.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.activemq</groupId>
<artifactId>activemq-mqtt</artifactId>
<version>${activemq.version}</version>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/ignite/blob/296dd6e7/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/MqttStreamer.java
----------------------------------------------------------------------
diff --git a/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/MqttStreamer.java b/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/MqttStreamer.java
index b86d385..f18ae42 100644
--- a/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/MqttStreamer.java
+++ b/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/MqttStreamer.java
@@ -62,12 +62,17 @@ import org.eclipse.paho.client.mqttv3.MqttMessage;
* <li>Specifying the subscriber's QoS for a single topic or for multiple topics.</li>
* <li>Allows setting {@link MqttConnectOptions} to support features like last will testament, persistent
* sessions, etc.</li>
- * <li>Specifying the client ID.</li>
+ * <li>Specifying the client ID. A random one will be generated and maintained throughout reconnections if the user
+ * does not provide one.</li>
+ * <li>(Re-)Connection retries based on the <i>guava-retrying</i> library. Retry wait and retry stop policies
+ * can be configured.</li>
+ * <li>Blocking the start() method until connected for the first time.</li>
* </ul>
*
- * Note: features like durable subscriptions, last will testament, etc. must be configured via the
+ * Note: features like durable subscriptions, last will testament, etc. can be configured via the
* {@link #connectOptions} property.
*
+ * @see <a href="https://github.com/rholder/guava-retrying">guava-retrying library</a>
* @author Raul Kripalani
*/
public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> implements MqttCallback {
@@ -75,46 +80,65 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
/** Logger. */
private IgniteLogger log;
+ /** The MQTT client object for internal use. */
private MqttClient client;
+ /** The broker URL, set by the user. */
private String brokerUrl;
+ /** The topic to subscribe to, if a single topic. */
private String topic;
+ /** The quality of service to use for a single topic subscription (optional). */
private Integer qualityOfService;
+ /** The topics to subscribe to, if many. */
private List<String> topics;
+ /** The qualities of service to use for multiple topic subscriptions. If specified, it must contain the same
+ * number of elements as {@link #topics}. */
private List<Integer> qualitiesOfService;
- /** Client ID in case we're using durable subscribers. */
+ /** The MQTT client ID (optional). */
private String clientId;
+ /** A configurable persistence mechanism. If not set, Paho will use its default. */
private MqttClientPersistence persistence;
+ /** The MQTT client connect options, where users can configured the last will and testament, durability, etc. */
private MqttConnectOptions connectOptions;
- // disconnect parameters
+ /** Quiesce timeout on disconnection. */
private Integer disconnectQuiesceTimeout;
+ /** Whether to disconnect forcibly or not. */
private boolean disconnectForcibly;
+ /** If disconnecting forcibly, the timeout. */
private Integer disconnectForciblyTimeout;
+ /** The strategy to determine how long to wait between retry attempts. By default, this streamer uses a
+ * Fibonacci-based strategy. */
private WaitStrategy retryWaitStrategy = WaitStrategies.fibonacciWait();
+ /** The strategy to determine when to stop retrying to (re-)connect. By default, we never stop. */
private StopStrategy retryStopStrategy = StopStrategies.neverStop();
+ /** The internal connection retrier object with a thread pool of size 1. */
private MqttConnectionRetrier connectionRetrier;
+ /** Whether to block the start() method until connected for the first time. */
+ private boolean blockUntilConnected;
+
+ /** State keeping. */
private volatile boolean stopped = true;
+ /** State keeping. */
private volatile boolean connected;
+ /** Cached log prefix for cache messages. */
private String cachedLogPrefix;
- private boolean blockUntilConnected;
-
/**
* Starts streamer.
*
@@ -136,7 +160,11 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
A.ensure(getSingleTupleExtractor() == null || getMultipleTupleExtractor() == null, "cannot provide " +
"both single and multiple tuple extractor");
A.notNullOrEmpty(brokerUrl, "broker URL");
- A.notNullOrEmpty(clientId, "client ID");
+
+ // if the client ID is empty, generate one
+ if (clientId == null || clientId.length() == 0) {
+ clientId = MqttClient.generateClientId();
+ }
// if we have both a single topic and a list of topics (but the list of topic is not of
// size 1 and == topic, as this would be a case of re-initialization), fail
@@ -257,6 +285,9 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
// MQTT Client callback methods
// -------------------------------
+ /**
+ * {@inheritDoc}
+ */
@Override public void connectionLost(Throwable throwable) {
connected = false;
@@ -268,6 +299,9 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
connectionRetrier.connect();
}
+ /**
+ * {@inheritDoc}
+ */
@Override public void messageArrived(String topic, MqttMessage message) throws Exception {
if (getMultipleTupleExtractor() != null) {
Map<K, V> entries = getMultipleTupleExtractor().extract(message);
@@ -285,6 +319,9 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
}
}
+ /**
+ * {@inheritDoc}
+ */
@Override public void deliveryComplete(IMqttDeliveryToken token) {
// ignore, as we don't send messages
}
@@ -293,127 +330,229 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
// Getters and setters
// -------------------------------
+ /**
+ * @return
+ */
public String getBrokerUrl() {
return brokerUrl;
}
+ /**
+ * @param brokerUrl The Broker URL (compulsory).
+ */
public void setBrokerUrl(String brokerUrl) {
this.brokerUrl = brokerUrl;
}
+ /**
+ * @return
+ */
public String getTopic() {
return topic;
}
+ /**
+ * @param topic The topic to subscribe to, if a single topic.
+ */
public void setTopic(String topic) {
this.topic = topic;
}
+ /**
+ * @return
+ */
public Integer getQualityOfService() {
return qualityOfService;
}
+ /**
+ * @param qualityOfService The quality of service to use for a single topic subscription (optional).
+ */
public void setQualityOfService(Integer qualityOfService) {
this.qualityOfService = qualityOfService;
}
+ /**
+ * @return
+ */
public List<String> getTopics() {
return topics;
}
+ /**
+ * @param topics The topics to subscribe to, if many.
+ */
public void setTopics(List<String> topics) {
this.topics = topics;
}
+ /**
+ * @return
+ */
public List<Integer> getQualitiesOfService() {
return qualitiesOfService;
}
+ /**
+ * @param qualitiesOfService The qualities of service to use for multiple topic subscriptions.
+ * If specified, the list must contain the same number of elements as {@link #topics}.
+ */
public void setQualitiesOfService(List<Integer> qualitiesOfService) {
this.qualitiesOfService = qualitiesOfService;
}
+ /**
+ * @return
+ */
public String getClientId() {
return clientId;
}
+ /**
+ * @param clientId The MQTT client ID (optional). If one is not provided, we'll create one for you and maintain
+ * it througout any reconnection attempts.
+ */
public void setClientId(String clientId) {
this.clientId = clientId;
}
+ /**
+ * @return
+ */
public MqttClientPersistence getPersistence() {
return persistence;
}
+ /**
+ * @param persistence A configurable persistence mechanism. If not set, Paho will use its default.
+ */
public void setPersistence(MqttClientPersistence persistence) {
this.persistence = persistence;
}
+ /**
+ * @return
+ */
public MqttConnectOptions getConnectOptions() {
return connectOptions;
}
+ /**
+ * @param connectOptions The MQTT client connect options, where users can configured the last will and testament, durability, etc.
+ */
public void setConnectOptions(MqttConnectOptions connectOptions) {
this.connectOptions = connectOptions;
}
+ /**
+ * @return
+ */
public boolean isDisconnectForcibly() {
return disconnectForcibly;
}
+ /**
+ * @param disconnectForcibly Whether to disconnect forcibly or not. By default, it's false.
+ */
public void setDisconnectForcibly(boolean disconnectForcibly) {
this.disconnectForcibly = disconnectForcibly;
}
+ /**
+ * @return
+ */
public Integer getDisconnectQuiesceTimeout() {
return disconnectQuiesceTimeout;
}
+ /**
+ * @param disconnectQuiesceTimeout Quiesce timeout on disconnection. If not provided, this streamer won't use any.
+ */
public void setDisconnectQuiesceTimeout(Integer disconnectQuiesceTimeout) {
this.disconnectQuiesceTimeout = disconnectQuiesceTimeout;
}
+ /**
+ * @return
+ */
public Integer getDisconnectForciblyTimeout() {
return disconnectForciblyTimeout;
}
+ /**
+ * @param disconnectForciblyTimeout If disconnecting forcibly, the timeout. Compulsory in that case.
+ */
public void setDisconnectForciblyTimeout(Integer disconnectForciblyTimeout) {
this.disconnectForciblyTimeout = disconnectForciblyTimeout;
}
+ /**
+ * @return
+ */
public WaitStrategy getRetryWaitStrategy() {
return retryWaitStrategy;
}
+ /**
+ * @param retryWaitStrategy The strategy to determine how long to wait between retry attempts.
+ * By default, this streamer uses a Fibonacci-based strategy.
+ */
public void setRetryWaitStrategy(WaitStrategy retryWaitStrategy) {
this.retryWaitStrategy = retryWaitStrategy;
}
+ /**
+ * @return
+ */
public StopStrategy getRetryStopStrategy() {
return retryStopStrategy;
}
+ /**
+ * @param retryStopStrategy The strategy to determine when to stop retrying to (re-)connect. By default, we never stop.
+ */
public void setRetryStopStrategy(StopStrategy retryStopStrategy) {
this.retryStopStrategy = retryStopStrategy;
}
+ /**
+ * @return
+ */
public boolean isBlockUntilConnected() {
return blockUntilConnected;
}
+ /**
+ * @param blockUntilConnected Whether to block the start() method until connected for the first time. By default,
+ * false.
+ */
public void setBlockUntilConnected(boolean blockUntilConnected) {
this.blockUntilConnected = blockUntilConnected;
}
+ /**
+ * A utility class to help us with (re-)connecting to the MQTT broker. It uses a single-threaded executor to perform
+ * the (re-)connections.
+ */
private class MqttConnectionRetrier {
+ /** The guava-retrying retrier object. */
private final Retryer<Boolean> retrier;
+
+ /** Single-threaded pool. */
private ExecutorService executor = Executors.newSingleThreadExecutor();
+ /**
+ * Constructor.
+ * @param retrier The retryier object.
+ */
public MqttConnectionRetrier(Retryer<Boolean> retrier) {
this.retrier = retrier;
}
+ /**
+ * Method that is called by the streamer to ask us to (re-)connect.
+ */
public void connect() {
Callable<Boolean> callable = retrier.wrap(new Callable<Boolean>() {
@Override public Boolean call() throws Exception {
@@ -460,6 +599,9 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
}
}
+ /**
+ * Stops this connection utility class by shutting down the thread pool.
+ */
public void stop() {
executor.shutdownNow();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/296dd6e7/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
index 012486a..5ac7339 100644
--- a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
+++ b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
@@ -65,24 +65,41 @@ import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
*/
public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
+ /** The test data. */
private static final Map<Integer, String> TEST_DATA = new HashMap<>();
+
+ /** Topic name for single topic tests. */
private static final String SINGLE_TOPIC_NAME = "abc";
+
+ /** Topic names for multiple topic tests. */
private static final List<String> MULTIPLE_TOPIC_NAMES = Arrays.asList("def", "ghi", "jkl", "mno");
+ /** The AMQ broker with an MQTT interface. */
private BrokerService broker;
+
+ /** The MQTT client. */
private MqttClient client;
+
+ /** The broker URL. */
private String brokerUrl;
+
+ /** The broker port. **/
private int port;
+
+ /** The MQTT streamer currently under test. */
private MqttStreamer<Integer, String> streamer;
+
+ /** The UUID of the currently active remote listener. */
private UUID remoteListener;
+ /** The Ignite data streamer. */
+ private IgniteDataStreamer<Integer, String> dataStreamer;
+
static {
for (int i = 0; i < 100; i++)
TEST_DATA.put(i, "v" + i);
}
- private IgniteDataStreamer<Integer, String> dataStreamer;
-
/** Constructor. */
public IgniteMqttStreamerTest() {
super(true);
@@ -99,14 +116,17 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
// create the broker
broker = new BrokerService();
- broker.deleteAllMessages();
+ broker.setDeleteAllMessagesOnStartup(true);
broker.setPersistent(false);
+ broker.setPersistenceAdapter(null);
+ broker.setPersistenceFactory(null);
PolicyMap policyMap = new PolicyMap();
PolicyEntry policy = new PolicyEntry();
policy.setQueuePrefetch(1);
broker.setDestinationPolicy(policyMap);
broker.getDestinationPolicy().setDefaultEntry(policy);
+ broker.setSchedulerSupport(false);
// add the MQTT transport connector to the broker
broker.addConnector("mqtt://localhost:" + port);
@@ -143,6 +163,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
}
+ /**
+ * @throws Exception
+ */
public void testSingleTopic_NoQoS_OneEntryPerMessage() throws Exception {
// configure streamer
streamer.setSingleTupleExtractor(singleTupleExtractor());
@@ -162,6 +185,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
assertCacheEntriesLoaded(50);
}
+ /**
+ * @throws Exception
+ */
public void testMultipleTopics_NoQoS_OneEntryPerMessage() throws Exception {
// configure streamer
streamer.setSingleTupleExtractor(singleTupleExtractor());
@@ -185,6 +211,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
assertTrue(broker.getBroker().getDestinationMap().containsKey(new ActiveMQTopic("ghi")));
}
+ /**
+ * @throws Exception
+ */
public void testSingleTopic_NoQoS_MultipleEntriesOneMessage() throws Exception {
// configure streamer
streamer.setMultipleTupleExtractor(multipleTupleExtractor());
@@ -204,6 +233,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
assertCacheEntriesLoaded(50);
}
+ /**
+ * @throws Exception
+ */
public void testMultipleTopics_NoQoS_MultipleEntriesOneMessage() throws Exception {
// configure streamer
streamer.setMultipleTupleExtractor(multipleTupleExtractor());
@@ -227,6 +259,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
assertTrue(broker.getBroker().getDestinationMap().containsKey(new ActiveMQTopic("ghi")));
}
+ /**
+ * @throws Exception
+ */
public void testSingleTopic_NoQoS_ConnectOptions_Durable() throws Exception {
// configure streamer
streamer.setSingleTupleExtractor(singleTupleExtractor());
@@ -265,6 +300,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
assertCacheEntriesLoaded(100);
}
+ /**
+ * @throws Exception
+ */
public void testSingleTopic_NoQoS_Reconnect() throws Exception {
// configure streamer
streamer.setSingleTupleExtractor(singleTupleExtractor());
@@ -306,6 +344,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
assertCacheEntriesLoaded(100);
}
+ /**
+ * @throws Exception
+ */
public void testSingleTopic_NoQoS_RetryOnce() throws Exception {
// configure streamer
streamer.setSingleTupleExtractor(singleTupleExtractor());
@@ -339,6 +380,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
}
+ /**
+ * @throws Exception
+ */
public void testMultipleTopics_MultipleQoS_OneEntryPerMessage() throws Exception {
// configure streamer
streamer.setSingleTupleExtractor(singleTupleExtractor());
@@ -363,6 +407,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
assertTrue(broker.getBroker().getDestinationMap().containsKey(new ActiveMQTopic("ghi")));
}
+ /**
+ * @throws Exception
+ */
public void testMultipleTopics_MultipleQoS_Mismatch() throws Exception {
// configure streamer
streamer.setSingleTupleExtractor(singleTupleExtractor());
@@ -379,6 +426,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
}
+ /**
+ * @throws Exception
+ */
private MqttStreamer<Integer, String> createMqttStreamer(IgniteDataStreamer<Integer, String> dataStreamer) {
MqttStreamer<Integer, String> streamer = new MqttStreamer<>();
streamer.setIgnite(grid());
@@ -393,7 +443,10 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
return streamer;
}
- public void sendMessages(final List<String> topics, int fromIdx, int count, boolean singleMessage) throws MqttException {
+ /**
+ * @throws Exception
+ */
+ private void sendMessages(final List<String> topics, int fromIdx, int count, boolean singleMessage) throws MqttException {
if (singleMessage) {
final List<StringBuilder> sbs = new ArrayList<>(topics.size());
// initialize String Builders for each topic
@@ -423,6 +476,9 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
}
}
+ /**
+ * @throws Exception
+ */
private CountDownLatch subscribeToPutEvents(int expect) {
Ignite ignite = grid();
@@ -439,14 +495,16 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
return latch;
}
+ /**
+ * @throws Exception
+ */
private void assertCacheEntriesLoaded(int count) {
// get the cache and check that the entries are present
IgniteCache<Integer, String> cache = grid().cache(null);
// for each key from 0 to count from the TEST_DATA (ordered by key), check that the entry is present in cache
- for (Integer key : new ArrayList<>(new TreeSet<>(TEST_DATA.keySet())).subList(0, count)) {
+ for (Integer key : new ArrayList<>(new TreeSet<>(TEST_DATA.keySet())).subList(0, count))
assertEquals(TEST_DATA.get(key), cache.get(key));
- }
// assert that the cache exactly the specified amount of elements
assertEquals(count, cache.size(CachePeekMode.ALL));
@@ -455,6 +513,11 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
grid().events(grid().cluster().forCacheNodes(null)).stopRemoteListen(remoteListener);
}
+ /**
+ * Returns a {@link StreamSingleTupleExtractor} for testing.
+ *
+ * @throws Exception
+ */
public static StreamSingleTupleExtractor<MqttMessage, Integer, String> singleTupleExtractor() {
return new StreamSingleTupleExtractor<MqttMessage, Integer, String>() {
@Override public Map.Entry<Integer, String> extract(MqttMessage msg) {
@@ -464,6 +527,11 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
};
}
+ /**
+ * Returns a {@link StreamMultipleTupleExtractor} for testing.
+ *
+ * @throws Exception
+ */
public static StreamMultipleTupleExtractor<MqttMessage, Integer, String> multipleTupleExtractor() {
return new StreamMultipleTupleExtractor<MqttMessage, Integer, String>() {
@Override public Map<Integer, String> extract(MqttMessage msg) {
[24/50] ignite git commit: Cleaned documentation. Set ATOMIC mode as
default using specific constant.
Posted by ag...@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-257
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);
[48/50] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by ag...@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-257
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(-)
----------------------------------------------------------------------
[29/50] ignite git commit: ignite-1516 Optimize
GridH2AbstractKeyValueRow.getValue
Posted by ag...@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-257
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/50] ignite git commit: ignite-1500 Invalid docs in distributed
data structures classes
Posted by ag...@apache.org.
ignite-1500 Invalid docs in distributed data structures classes
Signed-off-by: Anton Vinogradov <av...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1021d4ea
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1021d4ea
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1021d4ea
Branch: refs/heads/ignite-257
Commit: 1021d4eaf4b8318786f3ea7e44e5acef2fbb9004
Parents: c28cec1
Author: agura <ag...@gridgain.com>
Authored: Fri Sep 18 15:24:46 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Mon Sep 21 10:34:35 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteAtomicLong.java | 15 ++++++---------
.../org/apache/ignite/IgniteAtomicReference.java | 9 +++------
.../java/org/apache/ignite/IgniteAtomicSequence.java | 9 +++------
.../java/org/apache/ignite/IgniteAtomicStamped.java | 13 +++++--------
4 files changed, 17 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1021d4ea/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..77a5830 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java
@@ -26,29 +26,26 @@ import java.io.Closeable;
* Distributed atomic long includes the following main functionality:
* <ul>
* <li>
- * Method {@link #get()} synchronously gets current value of atomic long.
+ * Method {@link #get()} gets current value of atomic long.
* </li>
* <li>
- * Various {@code get..(..)} methods synchronously get current value of atomic long
+ * Various {@code get..(..)} methods get current value of atomic long
* and increase or decrease value of atomic long.
* </li>
* <li>
- * Method {@link #addAndGet(long l)} synchronously sums {@code l} with current value of atomic long
+ * Method {@link #addAndGet(long l)} sums {@code l} with current value of atomic long
* and returns result.
* </li>
* <li>
- * Method {@link #incrementAndGet()} synchronously increases value of atomic long and returns result.
+ * Method {@link #incrementAndGet()} increases value of atomic long and returns result.
* </li>
* <li>
- * Method {@link #decrementAndGet()} synchronously decreases value of atomic long and returns result.
+ * Method {@link #decrementAndGet()} decreases value of atomic long and returns result.
* </li>
* <li>
- * Method {@link #getAndSet(long l)} synchronously gets current value of atomic long and sets {@code l}
+ * Method {@link #getAndSet(long l)} gets current value of atomic long and sets {@code l}
* as value of atomic long.
* </li>
- * </ul>
- * All previously described methods have asynchronous analogs.
- * <ul>
* <li>
* Method {@link #name()} gets name of atomic long.
* </li>
http://git-wip-us.apache.org/repos/asf/ignite/blob/1021d4ea/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java
index a33cf35..a1e6e8e 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java
@@ -26,17 +26,14 @@ import java.io.Closeable;
* Distributed atomic reference includes the following main functionality:
* <ul>
* <li>
- * Method {@link #get()} synchronously gets current value of an atomic reference.
+ * Method {@link #get()} gets current value of an atomic reference.
* </li>
* <li>
- * Method {@link #set(Object)} synchronously and unconditionally sets the value in the an atomic reference.
+ * Method {@link #set(Object)} unconditionally sets the value in the an atomic reference.
* </li>
* <li>
- * Methods {@code compareAndSet(...)} synchronously and conditionally set the value in the an atomic reference.
+ * Methods {@code compareAndSet(...)} conditionally set the value in the an atomic reference.
* </li>
- * </ul>
- * All previously described methods have asynchronous analogs.
- * <ul>
* <li>
* Method {@link #name()} gets name of atomic reference.
* </li>
http://git-wip-us.apache.org/repos/asf/ignite/blob/1021d4ea/modules/core/src/main/java/org/apache/ignite/IgniteAtomicSequence.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicSequence.java b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicSequence.java
index 313aba5..a1e1392 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicSequence.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicSequence.java
@@ -26,19 +26,16 @@ import java.io.Closeable;
* Distributed atomic sequence includes the following main functionality:
* <ul>
* <li>
- * Method {@link #get()} synchronously gets current value from atomic sequence.
+ * Method {@link #get()} gets current value from atomic sequence.
* </li>
* <li>
- * Various {@code get..(..)} methods synchronously get current value from atomic sequence
+ * Various {@code get..(..)} methods get current value from atomic sequence
* and increase atomic sequences value.
* </li>
* <li>
- * Various {@code add..(..)} {@code increment(..)} methods synchronously increase atomic sequences value
+ * Various {@code add..(..)} {@code increment(..)} methods increase atomic sequences value
* and return increased value.
* </li>
- * </ul>
- * All previously described methods have asynchronous analogs.
- * <ul>
* <li>
* Method {@link #batchSize(int size)} sets batch size of current atomic sequence.
* </li>
http://git-wip-us.apache.org/repos/asf/ignite/blob/1021d4ea/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java
index c05fdae..6c73248 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java
@@ -27,25 +27,22 @@ import org.apache.ignite.lang.IgniteBiTuple;
* Distributed atomic stamped includes the following main functionality:
* <ul>
* <li>
- * Method {@link #get()} synchronously gets both value and stamp of atomic.
+ * Method {@link #get()} gets both value and stamp of atomic.
* </li>
* <li>
- * Method {@link #value()} synchronously gets current value of atomic.
+ * Method {@link #value()} gets current value of atomic.
* </li>
* <li>
- * Method {@link #stamp()} synchronously gets current stamp of atomic.
+ * Method {@link #stamp()} gets current stamp of atomic.
* </li>
* <li>
- * Method {@link #set(Object, Object)} synchronously and unconditionally sets the value
+ * Method {@link #set(Object, Object)} unconditionally sets the value
* and the stamp in the atomic.
* </li>
* <li>
- * Methods {@code compareAndSet(...)} synchronously and conditionally set the value
+ * Methods {@code compareAndSet(...)} conditionally set the value
* and the stamp in the atomic.
* </li>
- * </ul>
- * All previously described methods have asynchronous analogs.
- * <ul>
* <li>
* Method {@link #name()} gets name of atomic stamped.
* </li>
[11/50] ignite git commit: Removed "incubator" paths from
IgniteManager.
Posted by ag...@apache.org.
Removed "incubator" paths from IgniteManager.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/90cccc92
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/90cccc92
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/90cccc92
Branch: refs/heads/ignite-257
Commit: 90cccc92a078d035eeb5ada47be8287901eaff3d
Parents: d64fc9d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 18 16:56:18 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 18 16:56:18 2015 +0300
----------------------------------------------------------------------
.../src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/90cccc92/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
index 0edaeab..8fd8825 100644
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
+++ b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
@@ -351,8 +351,6 @@ namespace Apache.Ignite.Core.Impl
{
AppendTestClasses(ggHome + "\\examples", cpStr);
AppendTestClasses(ggHome + "\\modules", cpStr);
- AppendTestClasses(ggHome + "\\..\\incubator-ignite\\examples", cpStr);
- AppendTestClasses(ggHome + "\\..\\incubator-ignite\\modules", cpStr);
}
string ggLibs = ggHome + "\\libs";
[39/50] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-1.4'
Posted by ag...@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-257
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
----------------------------------------------------------------------
[33/50] ignite git commit: ignite-1524 Fixed processing of
ClientReconnectMessage
Posted by ag...@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-257
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();
[04/50] ignite git commit: ignite-1452 Cancel cache operations on
node stop
Posted by ag...@apache.org.
ignite-1452 Cancel cache operations on node stop
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/585761f2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/585761f2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/585761f2
Branch: refs/heads/ignite-257
Commit: 585761f28e8b70487eaf2198d6ea39f7232b088d
Parents: b8c0b30
Author: sboikov <sb...@gridgain.com>
Authored: Thu Sep 17 16:26:02 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Sep 17 16:26:02 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/IgniteKernal.java | 7 ---
.../processors/cache/GridCacheContext.java | 6 +--
.../cache/GridCacheEvictionManager.java | 6 +--
.../cache/GridCacheEvictionResponse.java | 2 +-
.../processors/cache/GridCacheIoManager.java | 47 +++++++++++++-------
.../processors/cache/GridCacheMessage.java | 7 +++
.../processors/cache/GridCacheMvccManager.java | 34 +++++++++++---
.../GridCachePartitionExchangeManager.java | 41 +++++++++++++----
.../processors/cache/GridCacheProcessor.java | 28 ++++++++----
.../GridDistributedLockResponse.java | 6 +--
.../GridDistributedTxPrepareResponse.java | 6 +--
.../distributed/dht/GridDhtTopologyFuture.java | 6 ++-
.../dht/GridDhtTransactionalCacheAdapter.java | 2 +-
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 12 +++--
.../dht/atomic/GridNearAtomicUpdateFuture.java | 16 ++++---
.../dht/atomic/GridNearAtomicUpdateRequest.java | 2 +
.../atomic/GridNearAtomicUpdateResponse.java | 11 ++---
.../colocated/GridDhtColocatedLockFuture.java | 44 ++++++++++++++----
.../dht/preloader/GridDhtForceKeysFuture.java | 2 +-
.../dht/preloader/GridDhtForceKeysResponse.java | 6 +--
.../GridDhtPartitionsExchangeFuture.java | 19 ++++++--
.../distributed/near/GridNearGetResponse.java | 6 +--
.../distributed/near/GridNearLockFuture.java | 26 ++++++++---
.../near/GridNearOptimisticTxPrepareFuture.java | 20 +++++++--
.../near/GridNearTxFinishResponse.java | 6 +--
.../cache/query/GridCacheQueryResponse.java | 6 +--
.../continuous/CacheContinuousQueryHandler.java | 12 +++--
.../transactions/IgniteTxLocalAdapter.java | 4 +-
.../ignite/internal/util/GridSpinBusyLock.java | 10 +++++
.../IgniteCacheEntryProcessorNodeJoinTest.java | 24 +++++++---
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../IgniteCacheQueryNodeRestartSelfTest2.java | 2 -
32 files changed, 292 insertions(+), 138 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/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 daf7d23..82db059 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
@@ -1806,8 +1806,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
notifyLifecycleBeansEx(LifecycleEventType.BEFORE_NODE_STOP);
}
- GridCacheProcessor cacheProcessor = ctx.cache();
-
List<GridComponent> comps = ctx.components();
ctx.marshallerContext().onKernalStop();
@@ -1856,11 +1854,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
// Note that interrupted flag is cleared.
interrupted = true;
}
- finally {
- // Cleanup even on successful acquire.
- if (cacheProcessor != null)
- cacheProcessor.cancelUserOperations();
- }
}
if (interrupted)
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 86ba3e6..5385dec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -283,12 +283,12 @@ public class GridCacheContext<K, V> implements Externalizable {
GridCacheEvictionManager evictMgr,
GridCacheQueryManager<K, V> qryMgr,
CacheContinuousQueryManager contQryMgr,
- GridCacheAffinityManager affMgr,
CacheDataStructuresManager dataStructuresMgr,
GridCacheTtlManager ttlMgr,
GridCacheDrManager drMgr,
CacheConflictResolutionManager<K, V> rslvrMgr,
- CachePluginManager pluginMgr
+ CachePluginManager pluginMgr,
+ GridCacheAffinityManager affMgr
) {
assert ctx != null;
assert sharedCtx != null;
@@ -323,12 +323,12 @@ public class GridCacheContext<K, V> implements Externalizable {
this.evictMgr = add(evictMgr);
this.qryMgr = add(qryMgr);
this.contQryMgr = add(contQryMgr);
- this.affMgr = add(affMgr);
this.dataStructuresMgr = add(dataStructuresMgr);
this.ttlMgr = add(ttlMgr);
this.drMgr = add(drMgr);
this.rslvrMgr = add(rslvrMgr);
this.pluginMgr = add(pluginMgr);
+ this.affMgr = add(affMgr);
log = ctx.log(getClass());
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
index 3e0e2f9..1c34c76 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
@@ -1943,7 +1943,7 @@ public class GridCacheEvictionManager extends GridCacheManagerAdapter {
lock.readLock().unlock();
}
- if (res.error())
+ if (res.evictError())
// Complete future, since there was a class loading error on at least one node.
complete(false);
else
@@ -1985,14 +1985,14 @@ public class GridCacheEvictionManager extends GridCacheManagerAdapter {
boolean err = F.forAny(resMap.values(), new P1<GridCacheEvictionResponse>() {
@Override public boolean apply(GridCacheEvictionResponse res) {
- return res.error();
+ return res.evictError();
}
});
if (err) {
Collection<UUID> ids = F.view(resMap.keySet(), new P1<UUID>() {
@Override public boolean apply(UUID e) {
- return resMap.get(e).error();
+ return resMap.get(e).evictError();
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
index 4d40c8d..aa3911b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
@@ -116,7 +116,7 @@ public class GridCacheEvictionResponse extends GridCacheMessage {
/**
* @return {@code True} if request processing has finished with error.
*/
- boolean error() {
+ boolean evictError() {
return err;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index b55c84d..421ec82 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -182,8 +182,15 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
c = clsHandlers.get(new ListenerKey(cacheMsg.cacheId(), cacheMsg.getClass()));
if (c == null) {
- U.warn(log, "Received message without registered handler (will ignore) [msg=" + cacheMsg +
- ", nodeId=" + nodeId + ']');
+ if (cctx.kernalContext().isStopping()) {
+ if (log.isDebugEnabled())
+ log.debug("Received message without registered handler (will ignore) [msg=" + cacheMsg +
+ ", nodeId=" + nodeId + ']');
+ }
+ else {
+ U.warn(log, "Received message without registered handler (will ignore) [msg=" + cacheMsg +
+ ", nodeId=" + nodeId + ']');
+ }
return;
}
@@ -596,9 +603,13 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
*
* @param msg Message to send.
* @param destNodeId Destination node ID.
+ * @return {@code True} if should send message.
* @throws IgniteCheckedException If failed.
*/
- private void onSend(GridCacheMessage msg, @Nullable UUID destNodeId) throws IgniteCheckedException {
+ private boolean onSend(GridCacheMessage msg, @Nullable UUID destNodeId) throws IgniteCheckedException {
+ if (msg.error() != null && cctx.kernalContext().isStopping())
+ return false;
+
if (msg.messageId() < 0)
// Generate and set message ID.
msg.messageId(idGen.incrementAndGet());
@@ -609,6 +620,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
if (depEnabled && msg instanceof GridCacheDeployable)
cctx.deploy().prepare((GridCacheDeployable)msg);
}
+
+ return true;
}
/**
@@ -624,7 +637,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
public void send(ClusterNode node, GridCacheMessage msg, byte plc) throws IgniteCheckedException {
assert !node.isLocal();
- onSend(msg, node.id());
+ if (!onSend(msg, node.id()))
+ return;
if (log.isDebugEnabled())
log.debug("Sending cache message [msg=" + msg + ", node=" + U.toShortString(node) + ']');
@@ -663,12 +677,10 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
* @param msg Message to send.
* @param plc IO policy.
* @param fallback Callback for failed nodes.
- * @return {@code True} if nodes are empty or message was sent, {@code false} if
- * all nodes have left topology while sending this message.
* @throws IgniteCheckedException If send failed.
*/
@SuppressWarnings({"BusyWait", "unchecked"})
- public boolean safeSend(Collection<? extends ClusterNode> nodes, GridCacheMessage msg, byte plc,
+ public void safeSend(Collection<? extends ClusterNode> nodes, GridCacheMessage msg, byte plc,
@Nullable IgnitePredicate<ClusterNode> fallback) throws IgniteCheckedException {
assert nodes != null;
assert msg != null;
@@ -677,10 +689,11 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
if (log.isDebugEnabled())
log.debug("Message will not be sent as collection of nodes is empty: " + msg);
- return true;
+ return;
}
- onSend(msg, null);
+ if (!onSend(msg, null))
+ return;
if (log.isDebugEnabled())
log.debug("Sending cache message [msg=" + msg + ", nodes=" + U.toShortString(nodes) + ']');
@@ -709,7 +722,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
if (fallback != null && !fallback.apply(n))
// If fallback signalled to stop.
- return false;
+ return;
added = true;
}
@@ -721,7 +734,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
log.debug("Message will not be sent because all nodes left topology [msg=" + msg +
", nodes=" + U.toShortString(nodes) + ']');
- return false;
+ return;
}
}
@@ -737,7 +750,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
if (fallback != null && !fallback.apply(n))
// If fallback signalled to stop.
- return false;
+ return;
added = true;
}
@@ -757,7 +770,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
log.debug("Message will not be sent because all nodes left topology [msg=" + msg + ", nodes=" +
U.toShortString(nodes) + ']');
- return false;
+ return;
}
if (log.isDebugEnabled())
@@ -768,8 +781,6 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
if (log.isDebugEnabled())
log.debug("Sent cache message [msg=" + msg + ", nodes=" + U.toShortString(nodes) + ']');
-
- return true;
}
/**
@@ -800,7 +811,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
*/
public void sendOrderedMessage(ClusterNode node, Object topic, GridCacheMessage msg, byte plc,
long timeout) throws IgniteCheckedException {
- onSend(msg, node.id());
+ if (!onSend(msg, node.id()))
+ return;
int cnt = 0;
@@ -854,7 +866,8 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
assert node != null;
assert msg != null;
- onSend(msg, null);
+ if (!onSend(msg, null))
+ return;
try {
cctx.gridIO().send(node, TOPIC_CACHE, msg, plc);
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
index 4e737a0..55688e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
@@ -77,6 +77,13 @@ public abstract class GridCacheMessage implements Message {
protected int cacheId;
/**
+ * @return Error, if any.
+ */
+ @Nullable public Throwable error() {
+ return null;
+ }
+
+ /**
* Gets next ID for indexed message ID.
*
* @return Message ID.
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index 555bbda..e2d0302 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -120,6 +120,9 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
@SuppressWarnings( {"FieldAccessedSynchronizedAndUnsynchronized"})
private IgniteLogger exchLog;
+ /** */
+ private volatile boolean stopping;
+
/** Lock callback. */
@GridToStringExclude
private final GridCacheMvccCallback cb = new GridCacheMvccCallback() {
@@ -325,8 +328,10 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
/**
* Cancels all client futures.
*/
- public void cancelClientFutures() {
- cancelClientFutures(new IgniteCheckedException("Operation has been cancelled (node is stopping)."));
+ public void onStop() {
+ stopping = true;
+
+ cancelClientFutures(stopError());
}
/** {@inheritDoc} */
@@ -362,6 +367,13 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
}
/**
+ * @return Node stop exception.
+ */
+ private IgniteCheckedException stopError() {
+ return new IgniteCheckedException("Operation has been cancelled (node is stopping).");
+ }
+
+ /**
* @param from From version.
* @return To version.
*/
@@ -385,8 +397,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
assert old == null : "Old future is not null [futVer=" + futVer + ", fut=" + fut + ", old=" + old + ']';
- if (cctx.kernalContext().clientDisconnected())
- ((GridFutureAdapter)fut).onDone(disconnectedError(null));
+ onFutureAdded(fut);
}
/**
@@ -507,17 +518,26 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
fut.onNodeLeft(n.id());
}
- if (cctx.kernalContext().clientDisconnected())
- ((GridFutureAdapter)fut).onDone(disconnectedError(null));
-
// Just in case if future was completed before it was added.
if (fut.isDone())
removeFuture(fut);
+ else
+ onFutureAdded(fut);
return true;
}
/**
+ * @param fut Future.
+ */
+ private void onFutureAdded(IgniteInternalFuture<?> fut) {
+ if (stopping)
+ ((GridFutureAdapter)fut).onDone(stopError());
+ else if (cctx.kernalContext().clientDisconnected())
+ ((GridFutureAdapter)fut).onDone(disconnectedError(null));
+ }
+
+ /**
* @param fut Future to remove.
* @return {@code True} if removed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/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 20340d1..34c571c 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
@@ -147,6 +147,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
*/
private ExchangeFutureSet exchFuts = new ExchangeFutureSet();
+ /** */
+ private volatile IgniteCheckedException stopErr;
+
/** Discovery listener. */
private final GridLocalEventListener discoLsnr = new GridLocalEventListener() {
@Override public void onEvent(Event evt) {
@@ -381,7 +384,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
cctx.io().removeHandler(0, GridDhtPartitionsFullMessage.class);
cctx.io().removeHandler(0, GridDhtPartitionsSingleRequest.class);
- IgniteCheckedException err = cctx.kernalContext().clientDisconnected() ?
+ stopErr = cctx.kernalContext().clientDisconnected() ?
new IgniteClientDisconnectedCheckedException(cctx.kernalContext().cluster().clientReconnectFuture(),
"Client node disconnected: " + cctx.gridName()) :
new IgniteInterruptedCheckedException("Node is stopping: " + cctx.gridName());
@@ -391,11 +394,17 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (exchFuts0 != null) {
for (GridDhtPartitionsExchangeFuture f : exchFuts.values())
- f.onDone(err);
+ f.onDone(stopErr);
}
for (AffinityReadyFuture f : readyFuts.values())
- f.onDone(err);
+ f.onDone(stopErr);
+
+ for (GridDhtPartitionsExchangeFuture f : pendingExchangeFuts)
+ f.onDone(stopErr);
+
+ if (locExchFut != null)
+ locExchFut.onDone(stopErr);
U.cancel(exchWorker);
@@ -519,6 +528,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
fut.onDone(topVer);
}
+ else if (stopErr != null)
+ fut.onDone(stopErr);
return fut;
}
@@ -791,6 +802,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (discoEvt != null)
fut.onEvent(exchId, discoEvt);
+ if (stopErr != null)
+ fut.onDone(stopErr);
+
return fut;
}
@@ -799,12 +813,12 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
* @param err Error.
*/
public void onExchangeDone(GridDhtPartitionsExchangeFuture exchFut, @Nullable Throwable err) {
- if (err == null) {
- AffinityTopologyVersion topVer = exchFut.topologyVersion();
+ AffinityTopologyVersion topVer = exchFut.topologyVersion();
- if (log.isDebugEnabled())
- log.debug("Exchange done [topVer=" + topVer + ", fut=" + exchFut + ']');
+ if (log.isDebugEnabled())
+ log.debug("Exchange done [topVer=" + topVer + ", fut=" + exchFut + ", err=" + err + ']');
+ if (err == null) {
while (true) {
AffinityTopologyVersion readyVer = readyTopVer.get();
@@ -825,8 +839,17 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
}
}
- else if (log.isDebugEnabled())
- log.debug("Exchange done with error [fut=" + exchFut + ", err=" + err + ']');
+ else {
+ for (Map.Entry<AffinityTopologyVersion, AffinityReadyFuture> entry : readyFuts.entrySet()) {
+ if (entry.getKey().compareTo(topVer) <= 0) {
+ if (log.isDebugEnabled())
+ log.debug("Completing created topology ready future with error " +
+ "[ver=" + topVer + ", fut=" + entry.getValue() + ']');
+
+ entry.getValue().onDone(err);
+ }
+ }
+ }
ExchangeFutureSet exchFuts0 = exchFuts;
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/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 4ae0baa..c92de7d 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
@@ -960,6 +960,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
}
+ cancelFutures();
+
List<? extends GridCacheSharedManager<?, ?>> sharedMgrs = sharedCtx.managers();
for (ListIterator<? extends GridCacheSharedManager<?, ?>> it = sharedMgrs.listIterator(sharedMgrs.size());
@@ -1323,12 +1325,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
evictMgr,
qryMgr,
contQryMgr,
- affMgr,
dataStructuresMgr,
ttlMgr,
drMgr,
rslvrMgr,
- pluginMgr
+ pluginMgr,
+ affMgr
);
cacheCtx.cacheObjectContext(cacheObjCtx);
@@ -1452,12 +1454,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
evictMgr,
qryMgr,
contQryMgr,
- affMgr,
dataStructuresMgr,
ttlMgr,
drMgr,
rslvrMgr,
- pluginMgr
+ pluginMgr,
+ affMgr
);
cacheCtx.cacheObjectContext(cacheObjCtx);
@@ -2325,9 +2327,14 @@ public class GridCacheProcessor extends GridProcessorAdapter {
try {
ctx.discovery().sendCustomEvent(new DynamicCacheChangeBatch(sndReqs));
- if (ctx.clientDisconnected())
+ if (ctx.isStopping()) {
+ err = new IgniteCheckedException("Failed to execute dynamic cache change request, " +
+ "node is stopping.");
+ }
+ else if (ctx.clientDisconnected()) {
err = new IgniteClientDisconnectedCheckedException(ctx.cluster().clientReconnectFuture(),
"Failed to execute dynamic cache change request, client node disconnected.");
+ }
}
catch (IgniteCheckedException e) {
err = e;
@@ -3036,9 +3043,14 @@ public class GridCacheProcessor extends GridProcessorAdapter {
try {
ctx.discovery().sendCustomEvent(new DynamicCacheChangeBatch(Collections.singleton(req)));
- if (ctx.clientDisconnected())
+ if (ctx.isStopping()) {
+ err = new IgniteCheckedException("Failed to execute dynamic cache change request, " +
+ "node is stopping.");
+ }
+ else if (ctx.clientDisconnected()) {
err = new IgniteClientDisconnectedCheckedException(ctx.cluster().clientReconnectFuture(),
"Failed to execute dynamic cache change request, client node disconnected.");
+ }
}
catch (IgniteCheckedException e) {
err = e;
@@ -3104,8 +3116,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/**
* Cancel all user operations.
*/
- public void cancelUserOperations() {
- sharedCtx.mvcc().cancelClientFutures();
+ private void cancelFutures() {
+ sharedCtx.mvcc().onStop();
Exception err = new IgniteCheckedException("Operation has been cancelled (node is stopping).");
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
index cdb878d..8a95b14 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
@@ -137,10 +137,8 @@ public class GridDistributedLockResponse extends GridDistributedBaseMessage {
return futId;
}
- /**
- * @return Error.
- */
- public Throwable error() {
+ /** {@inheritDoc} */
+ @Override public Throwable error() {
return err;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
index 4264830..e798458 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
@@ -67,10 +67,8 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseMessage
this.err = err;
}
- /**
- * @return Error.
- */
- public Throwable error() {
+ /** {@inheritDoc} */
+ @Override public Throwable error() {
return err;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTopologyFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTopologyFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTopologyFuture.java
index c11a3d7..6ade26f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTopologyFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTopologyFuture.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.distributed.dht;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.jetbrains.annotations.Nullable;
/**
* Future that implements a barrier after which dht topology is safe to use. Topology is considered to be
@@ -38,9 +39,10 @@ public interface GridDhtTopologyFuture extends IgniteInternalFuture<AffinityTopo
public AffinityTopologyVersion topologyVersion();
/**
- * Returns is cache topology valid.
+ * Returns error is cache topology is not valid.
+ *
* @param cctx Cache context.
* @return valid ot not.
*/
- public boolean isCacheTopologyValid(GridCacheContext cctx);
+ @Nullable public Throwable validateCache(GridCacheContext cctx);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index b9514a9..1a869e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -1217,7 +1217,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
Throwable err = res.error();
// Log error before sending reply.
- if (err != null && !(err instanceof GridCacheLockTimeoutException))
+ if (err != null && !(err instanceof GridCacheLockTimeoutException) && !ctx.kernalContext().isStopping())
U.error(log, "Failed to acquire lock for request: " + req, err);
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index 33651bc..04d36e5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -97,16 +97,15 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements Gri
/**
* Sets update error.
- * @param err
+ *
+ * @param err Error.
*/
public void onError(IgniteCheckedException err){
this.err = err;
}
- /**
- * @return Gets update error.
- */
- public IgniteCheckedException error() {
+ /** {@inheritDoc} */
+ @Override public IgniteCheckedException error() {
return err;
}
@@ -154,8 +153,7 @@ public class GridDhtAtomicUpdateResponse extends GridCacheMessage implements Gri
nearEvicted.add(key);
}
- /** {@inheritDoc}
- * @param ctx*/
+ /** {@inheritDoc} */
@Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index d93f68f..fb2c5ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -385,9 +385,10 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
GridDhtTopologyFuture fut = cache.topology().topologyVersionFuture();
if (fut.isDone()) {
- if (!fut.isCacheTopologyValid(cctx)) {
- onDone(new IgniteCheckedException("Failed to perform cache operation (cache topology is not valid): " +
- cctx.name()));
+ Throwable err = fut.validateCache(cctx);
+
+ if (err != null) {
+ onDone(err);
return;
}
@@ -811,6 +812,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
}
Exception err = null;
+ GridNearAtomicUpdateRequest singleReq0 = null;
Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = null;
int size = keys.size();
@@ -837,13 +839,13 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
if (size == 1 && !fastMap) {
assert remapKeys == null || remapKeys.size() == 1;
- singleReq = mapSingleUpdate();
+ singleReq0 = singleReq = mapSingleUpdate();
}
else {
pendingMappings = mapUpdate(topNodes);
if (pendingMappings.size() == 1)
- singleReq = F.firstValue(pendingMappings);
+ singleReq0 = singleReq = F.firstValue(pendingMappings);
else {
if (syncMode == PRIMARY_SYNC) {
mappings = U.newHashMap(pendingMappings.size());
@@ -874,8 +876,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
}
// Optimize mapping for single key.
- if (singleReq != null)
- mapSingle(singleReq.nodeId(), singleReq);
+ if (singleReq0 != null)
+ mapSingle(singleReq0.nodeId(), singleReq0);
else {
assert pendingMappings != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index 5f5fbb5..ccb67d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -198,6 +198,8 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements Gri
boolean skipStore,
boolean clientReq
) {
+ assert futVer != null;
+
this.cacheId = cacheId;
this.nodeId = nodeId;
this.futVer = futVer;
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 8bc145c..376f4ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -116,6 +116,8 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
* @param futVer Future version.
*/
public GridNearAtomicUpdateResponse(int cacheId, UUID nodeId, GridCacheVersion futVer) {
+ assert futVer != null;
+
this.cacheId = cacheId;
this.nodeId = nodeId;
this.futVer = futVer;
@@ -149,16 +151,15 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements Gr
/**
* Sets update error.
- * @param err
+ *
+ * @param err Error.
*/
public void error(IgniteCheckedException err){
this.err = err;
}
- /**
- * @return Update error, if any.
- */
- public IgniteCheckedException error() {
+ /** {@inheritDoc} */
+ @Override public IgniteCheckedException error() {
return err;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index 596ec77..1a08265 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -57,6 +57,7 @@ import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.C1;
import org.apache.ignite.internal.util.typedef.C2;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
@@ -524,7 +525,22 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(GridDhtColocatedLockFuture.class, this, "inTx", inTx(), "super", super.toString());
+ Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() {
+ @Override public String apply(IgniteInternalFuture<?> f) {
+ if (isMini(f)) {
+ MiniFuture m = (MiniFuture)f;
+
+ return "[node=" + m.node().id() + ", loc=" + m.node().isLocal() + ", done=" + f.isDone() + "]";
+ }
+ else
+ return "[loc=true, done=" + f.isDone() + "]";
+ }
+ });
+
+ return S.toString(GridDhtColocatedLockFuture.class, this,
+ "innerFuts", futs,
+ "inTx", inTx(),
+ "super", super.toString());
}
/**
@@ -565,9 +581,10 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
if (topVer != null) {
for (GridDhtTopologyFuture fut : cctx.shared().exchange().exchangeFutures()){
if (fut.topologyVersion().equals(topVer)){
- if (!fut.isCacheTopologyValid(cctx)) {
- onDone(new IgniteCheckedException("Failed to perform cache operation (cache topology is not valid): " +
- cctx.name()));
+ Throwable err = fut.validateCache(cctx);
+
+ if (err != null) {
+ onDone(err);
return;
}
@@ -612,9 +629,10 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
GridDhtTopologyFuture fut = cctx.topologyVersionFuture();
if (fut.isDone()) {
- if (!fut.isCacheTopologyValid(cctx)) {
- onDone(new IgniteCheckedException("Failed to perform cache operation (cache topology is not valid): " +
- cctx.name()));
+ Throwable err = fut.validateCache(cctx);
+
+ if (err != null) {
+ onDone(err);
return;
}
@@ -643,10 +661,15 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
}
else {
fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
- @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> t) {
+ @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> fut) {
try {
+ fut.get();
+
mapOnTopology(remap, c);
}
+ catch (IgniteCheckedException e) {
+ onDone(e);
+ }
finally {
cctx.shared().txContextReset();
}
@@ -1327,8 +1350,13 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
affFut.listen(new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> fut) {
try {
+ fut.get();
+
remap();
}
+ catch (IgniteCheckedException e) {
+ onDone(e);
+ }
finally {
cctx.shared().txContextReset();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
index 36a2da1..eaed424 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
@@ -283,7 +283,7 @@ public final class GridDhtForceKeysFuture<K, V> extends GridCompoundFuture<Objec
// Fail the whole thing.
if (e instanceof ClusterTopologyCheckedException)
fut.onResult((ClusterTopologyCheckedException)e);
- else
+ else if (!cctx.kernalContext().isStopping())
fut.onResult(e);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
index d31f096..93e39ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
@@ -98,10 +98,8 @@ public class GridDhtForceKeysResponse extends GridCacheMessage implements GridCa
this.err = err;
}
- /**
- * @return Error, if any.
- */
- public IgniteCheckedException error() {
+ /** {@inheritDoc} */
+ @Override public IgniteCheckedException error() {
return err;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 865bbdc..a1b03c1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1081,9 +1081,22 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
}
/** {@inheritDoc} */
- @Override public boolean isCacheTopologyValid(GridCacheContext cctx) {
- return cctx.config().getTopologyValidator() != null && cacheValidRes.containsKey(cctx.cacheId()) ?
- cacheValidRes.get(cctx.cacheId()) : true;
+ @Override public Throwable validateCache(GridCacheContext cctx) {
+ Throwable err = error();
+
+ if (err != null)
+ return err;
+
+ if (cctx.config().getTopologyValidator() != null) {
+ Boolean res = cacheValidRes.get(cctx.cacheId());
+
+ if (res != null && !res) {
+ return new IgniteCheckedException("Failed to perform cache operation " +
+ "(cache topology is not valid): " + cctx.name());
+ }
+ }
+
+ return null;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
index 3276377..d4493a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
@@ -163,10 +163,8 @@ public class GridNearGetResponse extends GridCacheMessage implements GridCacheDe
return topVer != null ? topVer : super.topologyVersion();
}
- /**
- * @return Error.
- */
- public IgniteCheckedException error() {
+ /** {@inheritDoc} */
+ @Override public IgniteCheckedException error() {
return err;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
index f3e5ca3..dcc8da6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
@@ -703,9 +703,10 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
if (topVer != null) {
for (GridDhtTopologyFuture fut : cctx.shared().exchange().exchangeFutures()){
if (fut.topologyVersion().equals(topVer)){
- if (!fut.isCacheTopologyValid(cctx)) {
- onDone(new IgniteCheckedException("Failed to perform cache operation (cache topology is not valid): " +
- cctx.name()));
+ Throwable err = fut.validateCache(cctx);
+
+ if (err != null) {
+ onDone(err);
return;
}
@@ -749,9 +750,10 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
GridDhtTopologyFuture fut = cctx.topologyVersionFuture();
if (fut.isDone()) {
- if (!fut.isCacheTopologyValid(cctx)) {
- onDone(new IgniteCheckedException("Failed to perform cache operation (cache topology is not valid): " +
- cctx.name()));
+ Throwable err = fut.validateCache(cctx);
+
+ if (err != null) {
+ onDone(err);
return;
}
@@ -777,10 +779,15 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
}
else {
fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
- @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> t) {
+ @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> fut) {
try {
+ fut.get();
+
mapOnTopology(remap);
}
+ catch (IgniteCheckedException e) {
+ onDone(e);
+ }
finally {
cctx.shared().txContextReset();
}
@@ -1435,8 +1442,13 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
affFut.listen(new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> fut) {
try {
+ fut.get();
+
remap();
}
+ catch (IgniteCheckedException e) {
+ onDone(e);
+ }
finally {
cctx.shared().txContextReset();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index 2048fdf..25028c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -319,7 +319,9 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
assert ctx != null : cacheId;
- if (!topFut.isCacheTopologyValid(ctx)) {
+ Throwable err = topFut.validateCache(ctx);
+
+ if (err != null) {
if (invalidCaches != null)
invalidCaches.append(", ");
else
@@ -343,12 +345,17 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
}
else {
topFut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>() {
- @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion> t) {
+ @Override public void apply(final IgniteInternalFuture<AffinityTopologyVersion> fut) {
cctx.kernalContext().closure().runLocalSafe(new GridPlainRunnable() {
@Override public void run() {
try {
+ fut.get();
+
prepareOnTopology(remap, c);
}
+ catch (IgniteCheckedException e) {
+ onDone(e);
+ }
finally {
cctx.txContextReset();
}
@@ -841,7 +848,14 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
if (affFut != null && !affFut.isDone()) {
affFut.listen(new CI1<IgniteInternalFuture<?>>() {
@Override public void apply(IgniteInternalFuture<?> fut) {
- remap();
+ try {
+ fut.get();
+
+ remap();
+ }
+ catch (IgniteCheckedException e) {
+ onDone(e);
+ }
}
});
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
index cec7d73..c860baa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
@@ -75,10 +75,8 @@ public class GridNearTxFinishResponse extends GridDistributedTxFinishResponse {
this.err = err;
}
- /**
- * @return Error.
- */
- @Nullable public Throwable error() {
+ /** {@inheritDoc} */
+ @Nullable @Override public Throwable error() {
return err;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
index 3e4cdeb..78e2ac7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
@@ -193,10 +193,8 @@ public class GridCacheQueryResponse extends GridCacheMessage implements GridCach
return reqId;
}
- /**
- * @return Error.
- */
- public Throwable error() {
+ /** {@inheritDoc} */
+ @Override public Throwable error() {
return err;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index df6b4b7..c99e07f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -47,6 +47,7 @@ import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
import org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryFilter;
import org.apache.ignite.internal.util.typedef.C1;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;
@@ -97,6 +98,9 @@ class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler {
/** Whether to skip primary check for REPLICATED cache. */
private transient boolean skipPrimaryCheck;
+ /** */
+ private transient int cacheId;
+
/**
* Required by {@link Externalizable}.
*/
@@ -145,6 +149,8 @@ class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler {
this.ignoreExpired = ignoreExpired;
this.taskHash = taskHash;
this.skipPrimaryCheck = skipPrimaryCheck;
+
+ cacheId = CU.cacheId(cacheName);
}
/** {@inheritDoc} */
@@ -457,6 +463,8 @@ class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler {
sync = in.readBoolean();
ignoreExpired = in.readBoolean();
taskHash = in.readInt();
+
+ cacheId = CU.cacheId(cacheName);
}
/**
@@ -466,9 +474,7 @@ class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler {
private GridCacheContext<K, V> cacheContext(GridKernalContext ctx) {
assert ctx != null;
- GridCacheAdapter<K, V> cache = ctx.cache().internalCache(cacheName);
-
- return cache == null ? null : cache.context();
+ return ctx.cache().<K, V>context().cacheContext(cacheId);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/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 00b91dd..6ca1f72 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
@@ -1105,6 +1105,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
/**
* Commits transaction to transaction manager. Used for one-phase commit transactions only.
+ *
+ * @param commit If {@code true} commits transaction, otherwise rollbacks.
*/
public void tmFinish(boolean commit) {
assert onePhaseCommit();
@@ -1118,7 +1120,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
state(commit ? COMMITTED : ROLLED_BACK);
- boolean needsCompletedVersions = needsCompletedVersions();
+ boolean needsCompletedVersions = commit && needsCompletedVersions();
assert !needsCompletedVersions || completedBase != null;
assert !needsCompletedVersions || committedVers != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpinBusyLock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpinBusyLock.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpinBusyLock.java
index 2aae6ef..6bfd4fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpinBusyLock.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpinBusyLock.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.util;
+import java.util.concurrent.TimeUnit;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
/**
@@ -76,6 +77,15 @@ public class GridSpinBusyLock {
}
/**
+ * @param millis Timeout.
+ * @return {@code True} if lock was acquired.
+ * @throws InterruptedException If interrupted.
+ */
+ public boolean tryBlock(long millis) throws InterruptedException {
+ return lock.tryWriteLock(millis, TimeUnit.MILLISECONDS);
+ }
+
+ /**
* Makes possible for activities entering busy state again.
*/
public void unblock() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
index 6b4d473..151167a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
@@ -25,6 +25,7 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.EntryProcessorResult;
import javax.cache.processor.MutableEntry;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
@@ -184,20 +185,29 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
String val = "value-" + k;
- cache.invoke(key, new Processor(val));
+ procs.put(key, new Processor(val));
}
- cache.invokeAll(procs);
+ Map<String, EntryProcessorResult<Integer>> resMap = cache.invokeAll(procs);
+
+ for (String key : procs.keySet()) {
+ EntryProcessorResult<Integer> res = resMap.get(key);
+
+ assertNotNull(res);
+ assertEquals(k + 1, (Object) res.get());
+ }
}
else {
+ IgniteCache<String, Set<String>> cache = ignite(0).cache(null);
+
for (int i = 0; i < NUM_SETS; i++) {
String key = "set-" + i;
String val = "value-" + k;
- IgniteCache<String, Set<String>> cache = ignite(0).cache(null);
+ Integer valsCnt = cache.invoke(key, new Processor(val));
- cache.invoke(key, new Processor(val));
+ assertEquals(k + 1, (Object)valsCnt);
}
}
}
@@ -275,7 +285,7 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
}
/** */
- private static class Processor implements EntryProcessor<String, Set<String>, Void>, Serializable {
+ private static class Processor implements EntryProcessor<String, Set<String>, Integer>, Serializable {
/** */
private String val;
@@ -287,7 +297,7 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
}
/** {@inheritDoc} */
- @Override public Void process(MutableEntry<String, Set<String>> e, Object... args) {
+ @Override public Integer process(MutableEntry<String, Set<String>> e, Object... args) {
Set<String> vals = e.getValue();
if (vals == null)
@@ -297,7 +307,7 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
e.setValue(vals);
- return null;
+ return vals.size();
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
index 7aae48c..88605b4 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
@@ -79,12 +79,12 @@ public class GridCacheTestContext<K, V> extends GridCacheContext<K, V> {
new GridCacheEvictionManager(),
new GridCacheLocalQueryManager<K, V>(),
new CacheContinuousQueryManager(),
- new GridCacheAffinityManager(),
new CacheDataStructuresManager(),
new GridCacheTtlManager(),
new GridOsCacheDrManager(),
new CacheOsConflictResolutionManager<K, V>(),
- new CachePluginManager(ctx, new CacheConfiguration())
+ new CachePluginManager(ctx, new CacheConfiguration()),
+ new GridCacheAffinityManager()
);
store().initialize(null, new IdentityHashMap<CacheStore, ThreadLocal>());
http://git-wip-us.apache.org/repos/asf/ignite/blob/585761f2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
index 1276405..e00611b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
@@ -185,8 +185,6 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
* @throws Exception If failed.
*/
public void testRestarts() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1452");
-
int duration = 90 * 1000;
int qryThreadNum = 4;
int restartThreadsNum = 2; // 4 + 2 = 6 nodes
[17/50] ignite git commit: IGNITE-535 (WIP) MQTT Streamer.
Posted by ag...@apache.org.
IGNITE-535 (WIP) MQTT Streamer.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/53683e20
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/53683e20
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/53683e20
Branch: refs/heads/ignite-257
Commit: 53683e20d304dfd96d544f286e8460d3829598d8
Parents: 6b53f1b
Author: Raul Kripalani <ra...@apache.org>
Authored: Mon Sep 21 16:23:28 2015 +0100
Committer: Raul Kripalani <ra...@apache.org>
Committed: Mon Sep 21 16:23:28 2015 +0100
----------------------------------------------------------------------
modules/mqtt/pom.xml | 39 +-
.../apache/ignite/stream/mqtt/MqttStreamer.java | 336 +++++++++++---
.../stream/mqtt/IgniteMqttStreamerTest.java | 435 +++++++++++++++++++
.../ignite/stream/mqtt/TestTupleExtractors.java | 28 --
4 files changed, 741 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/53683e20/modules/mqtt/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mqtt/pom.xml b/modules/mqtt/pom.xml
index b108180..4b0b46c 100644
--- a/modules/mqtt/pom.xml
+++ b/modules/mqtt/pom.xml
@@ -37,7 +37,8 @@
<properties>
<paho.version>1.0.2</paho.version>
- <mosquette.version>0.7</mosquette.version>
+ <activemq.version>5.11.1</activemq.version>
+ <guava-retryier.version>2.0.0</guava-retryier.version>
</properties>
<dependencies>
@@ -54,9 +55,29 @@
</dependency>
<dependency>
- <groupId>org.eclipse.moquette</groupId>
- <artifactId>moquette-broker</artifactId>
- <version>${mosquette.version}</version>
+ <groupId>com.github.rholder</groupId>
+ <artifactId>guava-retrying</artifactId>
+ <version>${guava-retryier.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-broker</artifactId>
+ <version>${activemq.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-kahadb-store</artifactId>
+ <version>${activemq.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-mqtt</artifactId>
+ <version>${activemq.version}</version>
<scope>test</scope>
</dependency>
@@ -86,16 +107,6 @@
<!-- Repository for Mosquette (embedded MQTT broker for tests) and for Eclipse Paho (MQTT client) -->
<repositories>
<repository>
- <id>bintray</id>
- <url>http://dl.bintray.com/andsel/maven/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
<id>Eclipse Paho Repo</id>
<url>https://repo.eclipse.org/content/repositories/paho-releases/</url>
<releases>
http://git-wip-us.apache.org/repos/asf/ignite/blob/53683e20/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/MqttStreamer.java
----------------------------------------------------------------------
diff --git a/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/MqttStreamer.java b/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/MqttStreamer.java
index 00a89ab..b86d385 100644
--- a/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/MqttStreamer.java
+++ b/modules/mqtt/src/main/java/org/apache/ignite/stream/mqtt/MqttStreamer.java
@@ -20,6 +20,10 @@ package org.apache.ignite.stream.mqtt;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteException;
@@ -29,12 +33,19 @@ import org.apache.ignite.stream.StreamAdapter;
import org.apache.ignite.stream.StreamMultipleTupleExtractor;
import org.apache.ignite.stream.StreamSingleTupleExtractor;
+import com.github.rholder.retry.Retryer;
+import com.github.rholder.retry.RetryerBuilder;
+import com.github.rholder.retry.StopStrategies;
+import com.github.rholder.retry.StopStrategy;
+import com.github.rholder.retry.WaitStrategies;
+import com.github.rholder.retry.WaitStrategy;
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicate;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttClientPersistence;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
-import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
/**
@@ -90,8 +101,20 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
private Integer disconnectForciblyTimeout;
+ private WaitStrategy retryWaitStrategy = WaitStrategies.fibonacciWait();
+
+ private StopStrategy retryStopStrategy = StopStrategies.neverStop();
+
+ private MqttConnectionRetrier connectionRetrier;
+
private volatile boolean stopped = true;
+ private volatile boolean connected;
+
+ private String cachedLogPrefix;
+
+ private boolean blockUntilConnected;
+
/**
* Starts streamer.
*
@@ -109,18 +132,21 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
// parameter validations
A.notNull(getStreamer(), "streamer");
A.notNull(getIgnite(), "ignite");
- A.ensure(getSingleTupleExtractor() == null && getMultipleTupleExtractor() == null, "tuple extractor missing");
+ A.ensure(!(getSingleTupleExtractor() == null && getMultipleTupleExtractor() == null), "tuple extractor missing");
A.ensure(getSingleTupleExtractor() == null || getMultipleTupleExtractor() == null, "cannot provide " +
"both single and multiple tuple extractor");
A.notNullOrEmpty(brokerUrl, "broker URL");
A.notNullOrEmpty(clientId, "client ID");
- // if we have both a single topic and a list of topics, fail
- if (topic != null && topic.length() > 0 && !topics.isEmpty())
+ // if we have both a single topic and a list of topics (but the list of topic is not of
+ // size 1 and == topic, as this would be a case of re-initialization), fail
+ if (topic != null && topic.length() > 0 && !topics.isEmpty() &&
+ topics.size() != 1 && !topics.get(0).equals(topic))
throw new IllegalArgumentException("Cannot specify both a single topic and a list at the same time");
- // if we have both a single QoS and list, fail
- if (qualityOfService != null && !qualitiesOfService.isEmpty()) {
+ // same as above but for QoS
+ if (qualityOfService != null && !qualitiesOfService.isEmpty() && qualitiesOfService.size() != 1 &&
+ !qualitiesOfService.get(0).equals(qualityOfService)) {
throw new IllegalArgumentException("Cannot specify both a single QoS and a list at the same time");
}
@@ -131,12 +157,22 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
}
// if we have multiple topics
- if (topics != null && !topics.isEmpty()) {
- for (String t : topics) {
+ if (!topics.isEmpty()) {
+ for (String t : topics)
A.notNullOrEmpty(t, "topic in list of topics");
- }
+
A.ensure(qualitiesOfService.isEmpty() || qualitiesOfService.size() == topics.size(), "qualities of " +
"service must be either empty or have the same size as topics list");
+
+ cachedLogPrefix = "[" + Joiner.on(",").join(topics) + "]";
+ }
+ else { // just the single topic
+ topics.add(topic);
+
+ if (qualityOfService != null)
+ qualitiesOfService.add(qualityOfService);
+
+ cachedLogPrefix = "[" + topic + "]";
}
// create logger
@@ -148,10 +184,28 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
else
client = new MqttClient(brokerUrl, clientId, persistence);
- connectAndSubscribe();
+ // set this as a callback
+ client.setCallback(this);
+ // set stopped to false, as the connection will start async
stopped = false;
+ // build retrier
+ Retryer<Boolean> retrier = RetryerBuilder.<Boolean>newBuilder()
+ .retryIfResult(new Predicate<Boolean>() {
+ @Override public boolean apply(Boolean connected) {
+ return !connected;
+ }
+ })
+ .retryIfException().retryIfRuntimeException()
+ .withWaitStrategy(retryWaitStrategy)
+ .withStopStrategy(retryStopStrategy)
+ .build();
+
+ // create the connection retrier
+ connectionRetrier = new MqttConnectionRetrier(retrier);
+ connectionRetrier.connect();
+
}
catch (Throwable t) {
throw new IgniteException("Exception while initializing MqttStreamer", t);
@@ -159,34 +213,6 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
}
- private void connectAndSubscribe() throws MqttException {
- // connect
- if (connectOptions != null)
- client.connect();
- else
- client.connect(connectOptions);
-
- // subscribe to multiple topics
- if (!topics.isEmpty()) {
- if (qualitiesOfService.isEmpty()) {
- client.subscribe(topics.toArray(new String[0]));
- } else {
- int[] qoses = new int[qualitiesOfService.size()];
- for (int i = 0; i < qualitiesOfService.size(); i++)
- qoses[i] = qualitiesOfService.get(i);
-
- client.subscribe(topics.toArray(new String[0]), qoses);
- }
- } else {
- // subscribe to a single topic
- if (qualityOfService == null) {
- client.subscribe(topic);
- } else {
- client.subscribe(topic, qualityOfService);
- }
- }
- }
-
/**
* Stops streamer.
*/
@@ -194,50 +220,250 @@ public class MqttStreamer<K, V> extends StreamAdapter<MqttMessage, K, V> impleme
if (stopped)
throw new IgniteException("Attempted to stop an already stopped MQTT Streamer");
+ // stop the retrier
+ connectionRetrier.stop();
+
try {
if (disconnectForcibly) {
- if (disconnectQuiesceTimeout == null && disconnectForciblyTimeout == null) {
+ if (disconnectQuiesceTimeout == null && disconnectForciblyTimeout == null)
client.disconnectForcibly();
- } else if (disconnectForciblyTimeout != null && disconnectQuiesceTimeout == null) {
+
+ else if (disconnectForciblyTimeout != null && disconnectQuiesceTimeout == null)
client.disconnectForcibly(disconnectForciblyTimeout);
- } else {
+
+ else
client.disconnectForcibly(disconnectQuiesceTimeout, disconnectForciblyTimeout);
- }
+
} else {
- if (disconnectQuiesceTimeout == null) {
+ if (disconnectQuiesceTimeout == null)
client.disconnect();
- } else {
+
+ else
client.disconnect(disconnectQuiesceTimeout);
- }
+
}
+
+ client.close();
+ connected = false;
+ stopped = true;
+
}
catch (Throwable t) {
throw new IgniteException("Exception while stopping MqttStreamer", t);
}
}
+ // -------------------------------
+ // MQTT Client callback methods
+ // -------------------------------
+
@Override public void connectionLost(Throwable throwable) {
- log.warning(String.format("MQTT Connection to server %s was lost due to", brokerUrl), throwable);
- // TODO: handle reconnect attempts with an optional backoff mechanism (linear, exponential, finonacci)
- try {
- connectAndSubscribe();
- }
- catch (MqttException e) {
- e.printStackTrace();
- }
+ connected = false;
+
+ // if we have been stopped, we do not try to establish the connection again
+ if (stopped)
+ return;
+
+ log.warning(String.format("MQTT Connection to server %s was lost.", brokerUrl), throwable);
+ connectionRetrier.connect();
}
@Override public void messageArrived(String topic, MqttMessage message) throws Exception {
if (getMultipleTupleExtractor() != null) {
Map<K, V> entries = getMultipleTupleExtractor().extract(message);
+ if (log.isTraceEnabled()) {
+ log.trace("Adding cache entries: " + entries);
+ }
getStreamer().addData(entries);
- } else {
+ }
+ else {
Map.Entry<K, V> entry = getSingleTupleExtractor().extract(message);
+ if (log.isTraceEnabled()) {
+ log.trace("Adding cache entry: " + entry);
+ }
getStreamer().addData(entry);
}
}
@Override public void deliveryComplete(IMqttDeliveryToken token) {
- // ignore, we don't send messages
+ // ignore, as we don't send messages
+ }
+
+ // -------------------------------
+ // Getters and setters
+ // -------------------------------
+
+ public String getBrokerUrl() {
+ return brokerUrl;
+ }
+
+ public void setBrokerUrl(String brokerUrl) {
+ this.brokerUrl = brokerUrl;
+ }
+
+ public String getTopic() {
+ return topic;
+ }
+
+ public void setTopic(String topic) {
+ this.topic = topic;
+ }
+
+ public Integer getQualityOfService() {
+ return qualityOfService;
+ }
+
+ public void setQualityOfService(Integer qualityOfService) {
+ this.qualityOfService = qualityOfService;
+ }
+
+ public List<String> getTopics() {
+ return topics;
+ }
+
+ public void setTopics(List<String> topics) {
+ this.topics = topics;
+ }
+
+ public List<Integer> getQualitiesOfService() {
+ return qualitiesOfService;
+ }
+
+ public void setQualitiesOfService(List<Integer> qualitiesOfService) {
+ this.qualitiesOfService = qualitiesOfService;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ public MqttClientPersistence getPersistence() {
+ return persistence;
+ }
+
+ public void setPersistence(MqttClientPersistence persistence) {
+ this.persistence = persistence;
+ }
+
+ public MqttConnectOptions getConnectOptions() {
+ return connectOptions;
+ }
+
+ public void setConnectOptions(MqttConnectOptions connectOptions) {
+ this.connectOptions = connectOptions;
+ }
+
+ public boolean isDisconnectForcibly() {
+ return disconnectForcibly;
+ }
+
+ public void setDisconnectForcibly(boolean disconnectForcibly) {
+ this.disconnectForcibly = disconnectForcibly;
+ }
+
+ public Integer getDisconnectQuiesceTimeout() {
+ return disconnectQuiesceTimeout;
+ }
+
+ public void setDisconnectQuiesceTimeout(Integer disconnectQuiesceTimeout) {
+ this.disconnectQuiesceTimeout = disconnectQuiesceTimeout;
+ }
+
+ public Integer getDisconnectForciblyTimeout() {
+ return disconnectForciblyTimeout;
+ }
+
+ public void setDisconnectForciblyTimeout(Integer disconnectForciblyTimeout) {
+ this.disconnectForciblyTimeout = disconnectForciblyTimeout;
}
+
+ public WaitStrategy getRetryWaitStrategy() {
+ return retryWaitStrategy;
+ }
+
+ public void setRetryWaitStrategy(WaitStrategy retryWaitStrategy) {
+ this.retryWaitStrategy = retryWaitStrategy;
+ }
+
+ public StopStrategy getRetryStopStrategy() {
+ return retryStopStrategy;
+ }
+
+ public void setRetryStopStrategy(StopStrategy retryStopStrategy) {
+ this.retryStopStrategy = retryStopStrategy;
+ }
+
+ public boolean isBlockUntilConnected() {
+ return blockUntilConnected;
+ }
+
+ public void setBlockUntilConnected(boolean blockUntilConnected) {
+ this.blockUntilConnected = blockUntilConnected;
+ }
+
+ private class MqttConnectionRetrier {
+
+ private final Retryer<Boolean> retrier;
+ private ExecutorService executor = Executors.newSingleThreadExecutor();
+
+ public MqttConnectionRetrier(Retryer<Boolean> retrier) {
+ this.retrier = retrier;
+ }
+
+ public void connect() {
+ Callable<Boolean> callable = retrier.wrap(new Callable<Boolean>() {
+ @Override public Boolean call() throws Exception {
+ // if we're already connected, return immediately
+ if (connected)
+ return true;
+
+ if (stopped)
+ return false;
+
+ // connect to broker
+ if (connectOptions == null)
+ client.connect();
+ else
+ client.connect(connectOptions);
+
+ // always use the multiple topics variant of the mqtt client; even if the user specified a single
+ // topic and/or QoS, the initialization code would have placed it inside the 1..n structures
+ if (qualitiesOfService.isEmpty())
+ client.subscribe(topics.toArray(new String[0]));
+
+ else {
+ int[] qoses = new int[qualitiesOfService.size()];
+ for (int i = 0; i < qualitiesOfService.size(); i++)
+ qoses[i] = qualitiesOfService.get(i);
+
+ client.subscribe(topics.toArray(new String[0]), qoses);
+ }
+
+ connected = true;
+ return connected;
+ }
+ });
+
+ Future<Boolean> result = executor.submit(callable);
+
+ if (blockUntilConnected) {
+ try {
+ result.get();
+ }
+ catch (Throwable e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ public void stop() {
+ executor.shutdownNow();
+ }
+
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/53683e20/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
index 59730fa..012486a 100644
--- a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
+++ b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
@@ -17,11 +17,47 @@
package org.apache.ignite.stream.mqtt;
+import java.net.ServerSocket;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.region.policy.PolicyEntry;
+import org.apache.activemq.broker.region.policy.PolicyMap;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.events.CacheEvent;
+import org.apache.ignite.internal.util.lang.GridMapEntry;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.stream.StreamMultipleTupleExtractor;
+import org.apache.ignite.stream.StreamSingleTupleExtractor;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import com.github.rholder.retry.StopStrategies;
+import com.github.rholder.retry.WaitStrategies;
+import com.google.common.base.Splitter;
+import org.eclipse.paho.client.mqttv3.MqttClient;
+import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
+import org.eclipse.paho.client.mqttv3.MqttException;
+import org.eclipse.paho.client.mqttv3.MqttMessage;
+import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.junit.After;
import org.junit.Before;
+import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
+
/**
* Test for {@link MqttStreamer}.
*
@@ -29,6 +65,24 @@ import org.junit.Before;
*/
public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
+ private static final Map<Integer, String> TEST_DATA = new HashMap<>();
+ private static final String SINGLE_TOPIC_NAME = "abc";
+ private static final List<String> MULTIPLE_TOPIC_NAMES = Arrays.asList("def", "ghi", "jkl", "mno");
+
+ private BrokerService broker;
+ private MqttClient client;
+ private String brokerUrl;
+ private int port;
+ private MqttStreamer<Integer, String> streamer;
+ private UUID remoteListener;
+
+ static {
+ for (int i = 0; i < 100; i++)
+ TEST_DATA.put(i, "v" + i);
+ }
+
+ private IgniteDataStreamer<Integer, String> dataStreamer;
+
/** Constructor. */
public IgniteMqttStreamerTest() {
super(true);
@@ -38,13 +92,394 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
public void beforeTest() throws Exception {
grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration());
+ // find an available local port
+ try (ServerSocket ss = new ServerSocket(0)) {
+ port = ss.getLocalPort();
+ }
+
+ // create the broker
+ broker = new BrokerService();
+ broker.deleteAllMessages();
+ broker.setPersistent(false);
+
+ PolicyMap policyMap = new PolicyMap();
+ PolicyEntry policy = new PolicyEntry();
+ policy.setQueuePrefetch(1);
+ broker.setDestinationPolicy(policyMap);
+ broker.getDestinationPolicy().setDefaultEntry(policy);
+
+ // add the MQTT transport connector to the broker
+ broker.addConnector("mqtt://localhost:" + port);
+ broker.setStartAsync(false);
+ broker.start(true);
+
+ // create the broker URL
+ brokerUrl = "tcp://localhost:" + port;
+
+ // create the client and connect
+ client = new MqttClient(brokerUrl, UUID.randomUUID().toString(), new MemoryPersistence());
+ client.connect();
+
+ // create mqtt streamer
+ dataStreamer = grid().dataStreamer(null);
+ streamer = createMqttStreamer(dataStreamer);
}
@After
public void afterTest() throws Exception {
+ try {
+ streamer.stop();
+ }
+ catch (Exception e) {
+ // ignore if already stopped
+ }
+
+ dataStreamer.close();
+
grid().cache(null).clear();
+ broker.stop();
+ broker.deleteAllMessages();
+
+ }
+
+ public void testSingleTopic_NoQoS_OneEntryPerMessage() throws Exception {
+ // configure streamer
+ streamer.setSingleTupleExtractor(singleTupleExtractor());
+ streamer.setTopic(SINGLE_TOPIC_NAME);
+
+ // subscribe to cache PUT events
+ CountDownLatch latch = subscribeToPutEvents(50);
+
+ // action time
+ streamer.start();
+
+ // send messages
+ sendMessages(Arrays.asList(SINGLE_TOPIC_NAME), 0, 50, false);
+
+ // assertions
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertCacheEntriesLoaded(50);
+ }
+
+ public void testMultipleTopics_NoQoS_OneEntryPerMessage() throws Exception {
+ // configure streamer
+ streamer.setSingleTupleExtractor(singleTupleExtractor());
+ streamer.setTopics(MULTIPLE_TOPIC_NAMES);
+
+ // subscribe to cache PUT events
+ CountDownLatch latch = subscribeToPutEvents(50);
+
+ // action time
+ streamer.start();
+
+ // send messages
+ sendMessages(MULTIPLE_TOPIC_NAMES, 0, 50, false);
+
+ // assertions
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertCacheEntriesLoaded(50);
+
+ assertTrue(broker.getBroker().getDestinationMap().size() >= 4);
+ assertTrue(broker.getBroker().getDestinationMap().containsKey(new ActiveMQTopic("def")));
+ assertTrue(broker.getBroker().getDestinationMap().containsKey(new ActiveMQTopic("ghi")));
+ }
+
+ public void testSingleTopic_NoQoS_MultipleEntriesOneMessage() throws Exception {
+ // configure streamer
+ streamer.setMultipleTupleExtractor(multipleTupleExtractor());
+ streamer.setTopic(SINGLE_TOPIC_NAME);
+
+ // subscribe to cache PUT events
+ CountDownLatch latch = subscribeToPutEvents(50);
+
+ // action time
+ streamer.start();
+
+ // send messages
+ sendMessages(Arrays.asList(SINGLE_TOPIC_NAME), 0, 50, true);
+
+ // assertions
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertCacheEntriesLoaded(50);
+ }
+
+ public void testMultipleTopics_NoQoS_MultipleEntriesOneMessage() throws Exception {
+ // configure streamer
+ streamer.setMultipleTupleExtractor(multipleTupleExtractor());
+ streamer.setTopics(MULTIPLE_TOPIC_NAMES);
+
+ // subscribe to cache PUT events
+ CountDownLatch latch = subscribeToPutEvents(50);
+
+ // action time
+ streamer.start();
+
+ // send messages
+ sendMessages(MULTIPLE_TOPIC_NAMES, 0, 50, true);
+
+ // assertions
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertCacheEntriesLoaded(50);
+
+ assertTrue(broker.getBroker().getDestinationMap().size() >= 4);
+ assertTrue(broker.getBroker().getDestinationMap().containsKey(new ActiveMQTopic("def")));
+ assertTrue(broker.getBroker().getDestinationMap().containsKey(new ActiveMQTopic("ghi")));
+ }
+
+ public void testSingleTopic_NoQoS_ConnectOptions_Durable() throws Exception {
+ // configure streamer
+ streamer.setSingleTupleExtractor(singleTupleExtractor());
+ streamer.setTopic(SINGLE_TOPIC_NAME);
+
+ MqttConnectOptions connOptions = new MqttConnectOptions();
+ connOptions.setCleanSession(false);
+ streamer.setConnectOptions(connOptions);
+
+ // subscribe to cache PUT events
+ CountDownLatch latch = subscribeToPutEvents(50);
+
+ // action time
+ streamer.start();
+
+ // send messages
+ sendMessages(Arrays.asList(SINGLE_TOPIC_NAME), 0, 50, false);
+
+ // assertions
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertCacheEntriesLoaded(50);
+
+ // explicitly stop the streamer
+ streamer.stop();
+
+ // send messages while stopped
+ sendMessages(Arrays.asList(SINGLE_TOPIC_NAME), 50, 50, false);
+
+ latch = subscribeToPutEvents(50);
+
+ // start the streamer again
+ streamer.start();
+
+ // assertions - make sure that messages sent during disconnection were also received
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertCacheEntriesLoaded(100);
+ }
+
+ public void testSingleTopic_NoQoS_Reconnect() throws Exception {
+ // configure streamer
+ streamer.setSingleTupleExtractor(singleTupleExtractor());
+ streamer.setRetryWaitStrategy(WaitStrategies.noWait());
+ streamer.setRetryStopStrategy(StopStrategies.neverStop());
+ streamer.setTopic(SINGLE_TOPIC_NAME);
+
+ // subscribe to cache PUT events
+ CountDownLatch latch = subscribeToPutEvents(50);
+
+ // action time
+ streamer.start();
+
+ // send messages
+ sendMessages(Arrays.asList(SINGLE_TOPIC_NAME), 0, 50, false);
+
+ // assertions
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertCacheEntriesLoaded(50);
+
+ // now shutdown the broker, wait 2 seconds and start it again
+ broker.stop();
+ broker.start(true);
+ broker.waitUntilStarted();
+ Thread.sleep(2000);
+ client.connect();
+
+ // let's ensure we have 2 connections: Ignite and our test
+ assertEquals(2, broker.getTransportConnectorByScheme("mqtt").getConnections().size());
+
+ // subscribe to cache PUT events again
+ latch = subscribeToPutEvents(50);
+
+ // send messages
+ sendMessages(Arrays.asList(SINGLE_TOPIC_NAME), 50, 50, false);
+
+ // assertions
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertCacheEntriesLoaded(100);
+ }
+
+ public void testSingleTopic_NoQoS_RetryOnce() throws Exception {
+ // configure streamer
+ streamer.setSingleTupleExtractor(singleTupleExtractor());
+ streamer.setRetryWaitStrategy(WaitStrategies.noWait());
+ streamer.setRetryStopStrategy(StopStrategies.stopAfterAttempt(1));
+ streamer.setTopic(SINGLE_TOPIC_NAME);
+
+ // subscribe to cache PUT events
+ CountDownLatch latch = subscribeToPutEvents(50);
+
+ // action time
+ streamer.start();
+
+ // send messages
+ sendMessages(Arrays.asList(SINGLE_TOPIC_NAME), 0, 50, false);
+
+ // assertions
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertCacheEntriesLoaded(50);
+
+ // now shutdown the broker, wait 2 seconds and start it again
+ broker.stop();
+ broker.start(true);
+ broker.waitUntilStarted();
+ client.connect();
+
+ // lets send messages and ensure they are not received, because our retrier desisted
+ sendMessages(Arrays.asList(SINGLE_TOPIC_NAME), 50, 50, false);
+ Thread.sleep(3000);
+ assertNull(grid().cache(null).get(50));
+
+ }
+
+ public void testMultipleTopics_MultipleQoS_OneEntryPerMessage() throws Exception {
+ // configure streamer
+ streamer.setSingleTupleExtractor(singleTupleExtractor());
+ streamer.setTopics(MULTIPLE_TOPIC_NAMES);
+ streamer.setQualitiesOfService(Arrays.asList(1, 1, 1, 1));
+
+ // subscribe to cache PUT events
+ CountDownLatch latch = subscribeToPutEvents(50);
+
+ // action time
+ streamer.start();
+
+ // send messages
+ sendMessages(MULTIPLE_TOPIC_NAMES, 0, 50, false);
+
+ // assertions
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertCacheEntriesLoaded(50);
+
+ assertTrue(broker.getBroker().getDestinationMap().size() >= 4);
+ assertTrue(broker.getBroker().getDestinationMap().containsKey(new ActiveMQTopic("def")));
+ assertTrue(broker.getBroker().getDestinationMap().containsKey(new ActiveMQTopic("ghi")));
+ }
+
+ public void testMultipleTopics_MultipleQoS_Mismatch() throws Exception {
+ // configure streamer
+ streamer.setSingleTupleExtractor(singleTupleExtractor());
+ streamer.setTopics(MULTIPLE_TOPIC_NAMES);
+ streamer.setQualitiesOfService(Arrays.asList(1, 1, 1));
+
+ try {
+ streamer.start();
+ }
+ catch (Exception e) {
+ return;
+ }
+ fail("Expected an exception reporting invalid parameters");
+
+ }
+
+ private MqttStreamer<Integer, String> createMqttStreamer(IgniteDataStreamer<Integer, String> dataStreamer) {
+ MqttStreamer<Integer, String> streamer = new MqttStreamer<>();
+ streamer.setIgnite(grid());
+ streamer.setStreamer(dataStreamer);
+ streamer.setBrokerUrl(brokerUrl);
+ streamer.setClientId(UUID.randomUUID().toString());
+ streamer.setBlockUntilConnected(true);
+
+ dataStreamer.allowOverwrite(true);
+ dataStreamer.autoFlushFrequency(1);
+
+ return streamer;
+ }
+
+ public void sendMessages(final List<String> topics, int fromIdx, int count, boolean singleMessage) throws MqttException {
+ if (singleMessage) {
+ final List<StringBuilder> sbs = new ArrayList<>(topics.size());
+ // initialize String Builders for each topic
+ F.forEach(topics, new IgniteInClosure<String>() {
+ @Override public void apply(String s) {
+ sbs.add(new StringBuilder());
+ }
+ });
+ // fill String Builders for each topic
+ F.forEach(F.range(fromIdx, fromIdx + count), new IgniteInClosure<Integer>() {
+ @Override public void apply(Integer integer) {
+ sbs.get(integer % topics.size()).append(integer.toString() + "," + TEST_DATA.get(integer) + "\n");
+ }
+ });
+ // send each buffer out
+ for (int i = 0; i < topics.size(); i++) {
+ MqttMessage msg = new MqttMessage(sbs.get(i).toString().getBytes());
+ client.publish(topics.get(i % topics.size()), msg);
+ }
+ }
+ else {
+ for (int i = fromIdx; i < fromIdx + count; i++) {
+ byte[] payload = (i + "," + TEST_DATA.get(i)).getBytes();
+ MqttMessage msg = new MqttMessage(payload);
+ client.publish(topics.get(i % topics.size()), msg);
+ }
+ }
+ }
+
+ private CountDownLatch subscribeToPutEvents(int expect) {
+ Ignite ignite = grid();
+
+ // Listen to cache PUT events and expect as many as messages as test data items
+ final CountDownLatch latch = new CountDownLatch(expect);
+ @SuppressWarnings("serial") IgniteBiPredicate<UUID, CacheEvent> callback = new IgniteBiPredicate<UUID, CacheEvent>() {
+ @Override public boolean apply(UUID uuid, CacheEvent evt) {
+ latch.countDown();
+ return true;
+ }
+ };
+
+ remoteListener = ignite.events(ignite.cluster().forCacheNodes(null)).remoteListen(callback, null, EVT_CACHE_OBJECT_PUT);
+ return latch;
+ }
+
+ private void assertCacheEntriesLoaded(int count) {
+ // get the cache and check that the entries are present
+ IgniteCache<Integer, String> cache = grid().cache(null);
+
+ // for each key from 0 to count from the TEST_DATA (ordered by key), check that the entry is present in cache
+ for (Integer key : new ArrayList<>(new TreeSet<>(TEST_DATA.keySet())).subList(0, count)) {
+ assertEquals(TEST_DATA.get(key), cache.get(key));
+ }
+
+ // assert that the cache exactly the specified amount of elements
+ assertEquals(count, cache.size(CachePeekMode.ALL));
+
+ // remove the event listener
+ grid().events(grid().cluster().forCacheNodes(null)).stopRemoteListen(remoteListener);
+ }
+
+ public static StreamSingleTupleExtractor<MqttMessage, Integer, String> singleTupleExtractor() {
+ return new StreamSingleTupleExtractor<MqttMessage, Integer, String>() {
+ @Override public Map.Entry<Integer, String> extract(MqttMessage msg) {
+ List<String> s = Splitter.on(",").splitToList(new String(msg.getPayload()));
+ return new GridMapEntry<>(Integer.parseInt(s.get(0)), s.get(1));
+ }
+ };
+ }
+ public static StreamMultipleTupleExtractor<MqttMessage, Integer, String> multipleTupleExtractor() {
+ return new StreamMultipleTupleExtractor<MqttMessage, Integer, String>() {
+ @Override public Map<Integer, String> extract(MqttMessage msg) {
+ final Map<String, String> map = Splitter.on("\n")
+ .omitEmptyStrings()
+ .withKeyValueSeparator(",")
+ .split(new String(msg.getPayload()));
+ final Map<Integer, String> answer = new HashMap<>();
+ F.forEach(map.keySet(), new IgniteInClosure<String>() {
+ @Override public void apply(String s) {
+ answer.put(Integer.parseInt(s), map.get(s));
+ }
+ });
+ return answer;
+ }
+ };
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/53683e20/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/TestTupleExtractors.java
----------------------------------------------------------------------
diff --git a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/TestTupleExtractors.java b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/TestTupleExtractors.java
deleted file mode 100644
index e2ed0f0..0000000
--- a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/TestTupleExtractors.java
+++ /dev/null
@@ -1,28 +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.stream.mqtt;
-
-/**
- * Test transformers for MqttStreamer tests.
- *
- * @author Raul Kripalani
- */
-public class TestTupleExtractors {
-
-
-}
\ No newline at end of file
[23/50] ignite git commit: IGNITE-1522 - Made cache entry listener
configurations transient in cache configuration
Posted by ag...@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-257
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.
+ }
+ }
+}
[10/50] ignite git commit: Yardstick properties file fixed
Posted by ag...@apache.org.
Yardstick properties file fixed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c28cec1c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c28cec1c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c28cec1c
Branch: refs/heads/ignite-257
Commit: c28cec1cd3b893adb4b5168af86d67bf5a998854
Parents: b6139f8
Author: agura <ag...@gridgain.com>
Authored: Fri Sep 18 14:50:19 2015 +0300
Committer: agura <ag...@gridgain.com>
Committed: Fri Sep 18 14:50:19 2015 +0300
----------------------------------------------------------------------
modules/yardstick/config/benchmark-put-indexed-val.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c28cec1c/modules/yardstick/config/benchmark-put-indexed-val.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-put-indexed-val.properties b/modules/yardstick/config/benchmark-put-indexed-val.properties
index 8f3a505..e81ae6f 100644
--- a/modules/yardstick/config/benchmark-put-indexed-val.properties
+++ b/modules/yardstick/config/benchmark-put-indexed-val.properties
@@ -21,7 +21,7 @@
# JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
-JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" \
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false \
-XX:+UseParNewGC \
-XX:+UseConcMarkSweepGC \
-XX:+UseTLAB \
[42/50] ignite git commit: Fixed imports.
Posted by ag...@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-257
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);
[35/50] ignite git commit: Fixed test.
Posted by ag...@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-257
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);
}
[34/50] ignite git commit: IGNITE-586: Fixed IGFS rename problem
causing corrupted file system structure.
Posted by ag...@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-257
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;
}
[09/50] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.4' into ignite-1.4
Posted by ag...@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/d08ecf11
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d08ecf11
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d08ecf11
Branch: refs/heads/ignite-257
Commit: d08ecf11704b9b4b56ea81f9f03d10311ff9d27c
Parents: 4c101dc d64fc9d
Author: sboikov <sb...@gridgain.com>
Authored: Fri Sep 18 14:11:41 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Sep 18 14:11:41 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[30/50] ignite git commit: Check for WeakValue in
GridH2AbstractKeyValueRow.onUnswap
Posted by ag...@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-257
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()));
[02/50] ignite git commit: ignite-1.4 Fixed Visor cmd options.
Posted by ag...@apache.org.
ignite-1.4 Fixed Visor cmd options.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5cfb6e68
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5cfb6e68
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5cfb6e68
Branch: refs/heads/ignite-257
Commit: 5cfb6e6878dea2fa78d7593766035a5b535763a1
Parents: cd6a1d5
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Sep 17 16:24:25 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Sep 17 16:24:25 2015 +0700
----------------------------------------------------------------------
.../main/scala/org/apache/ignite/visor/commands/VisorConsole.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cfb6e68/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
index 627f795..2abe8a7 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
@@ -91,7 +91,7 @@ class VisorConsole {
println(" -np - no pause on exit (pause by default).")
println(" -cfg=<path> - connect with specified configuration.")
println(" -b=<path> - batch mode with file.")
- println(" -e==cmd1;cmd2;... - batch mode with commands.")
+ println(" -e=cmd1;cmd2;... - batch mode with commands.")
visor.quit()
}
[37/50] ignite git commit: Exposed IgniteKernal.dumpDebugInfo() to MX
bean
Posted by ag...@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-257
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();
+}
[21/50] ignite git commit: IGNITE-535 Merge MQTT Streamer into master.
Posted by ag...@apache.org.
IGNITE-535 Merge MQTT Streamer into master.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/88acd318
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/88acd318
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/88acd318
Branch: refs/heads/ignite-257
Commit: 88acd318b84ce3bff8c061bb34718e0e5f7127fb
Parents: 421a523 296dd6e
Author: Raul Kripalani <ra...@apache.org>
Authored: Mon Sep 21 17:26:04 2015 +0100
Committer: Raul Kripalani <ra...@apache.org>
Committed: Mon Sep 21 17:26:04 2015 +0100
----------------------------------------------------------------------
modules/mqtt/pom.xml | 114 ++++
.../apache/ignite/stream/mqtt/MqttStreamer.java | 611 +++++++++++++++++++
.../stream/mqtt/IgniteMqttStreamerTest.java | 553 +++++++++++++++++
.../mqtt/IgniteMqttStreamerTestSuite.java | 34 ++
pom.xml | 1 +
5 files changed, 1313 insertions(+)
----------------------------------------------------------------------
[41/50] ignite git commit: Fixed test.
Posted by ag...@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-257
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
[40/50] ignite git commit: Added test.
Posted by ag...@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-257
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;
+ }
+}
[44/50] ignite git commit: schema-import examples fix (cherry picked
from commit b054fdc)
Posted by ag...@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-257
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>
[14/50] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.4' into ignite-1.4
Posted by ag...@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/8b94494a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8b94494a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8b94494a
Branch: refs/heads/ignite-257
Commit: 8b94494a4817780961c203e0b2b52715baa3b6da
Parents: 84a2300 7ccd0b3
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Sep 18 23:16:10 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Sep 18 23:16:10 2015 +0300
----------------------------------------------------------------------
.../src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs | 2 --
modules/yardstick/config/ignite-base-config.xml | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
[07/50] ignite git commit: Merge branch 'ignite-1.4'
Posted by ag...@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/b6139f86
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b6139f86
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b6139f86
Branch: refs/heads/ignite-257
Commit: b6139f86f8994dbbdd8acabedcd65b89e2b5aa92
Parents: c311c3c d64fc9d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 18 11:44:13 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 18 11:44:13 2015 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/IgniteKernal.java | 7 -
.../processors/cache/GridCacheContext.java | 6 +-
.../cache/GridCacheEvictionManager.java | 6 +-
.../cache/GridCacheEvictionResponse.java | 2 +-
.../processors/cache/GridCacheIoManager.java | 47 ++++---
.../processors/cache/GridCacheMessage.java | 7 +
.../processors/cache/GridCacheMvccManager.java | 34 ++++-
.../GridCachePartitionExchangeManager.java | 41 ++++--
.../processors/cache/GridCacheProcessor.java | 28 ++--
.../GridDistributedLockResponse.java | 6 +-
.../GridDistributedTxPrepareResponse.java | 6 +-
.../distributed/dht/GridDhtTopologyFuture.java | 6 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 2 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 2 +-
.../dht/atomic/GridDhtAtomicUpdateResponse.java | 12 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 16 ++-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 2 +
.../atomic/GridNearAtomicUpdateResponse.java | 11 +-
.../colocated/GridDhtColocatedLockFuture.java | 44 ++++--
.../dht/preloader/GridDhtForceKeysFuture.java | 2 +-
.../dht/preloader/GridDhtForceKeysResponse.java | 6 +-
.../GridDhtPartitionsExchangeFuture.java | 19 ++-
.../distributed/near/GridNearGetResponse.java | 6 +-
.../distributed/near/GridNearLockFuture.java | 26 +++-
.../near/GridNearOptimisticTxPrepareFuture.java | 20 ++-
.../near/GridNearTxFinishResponse.java | 6 +-
.../cache/query/GridCacheQueryResponse.java | 6 +-
.../continuous/CacheContinuousQueryHandler.java | 12 +-
.../transactions/IgniteTxLocalAdapter.java | 4 +-
.../ignite/internal/util/GridSpinBusyLock.java | 10 ++
.../IgniteCacheEntryProcessorNodeJoinTest.java | 24 +++-
.../loadtests/hashmap/GridCacheTestContext.java | 4 +-
.../ignite/testframework/GridTestUtils.java | 14 +-
.../cache/CacheIndexStreamerTest.java | 137 +++++++++++++++++++
.../IgniteCacheQueryNodeRestartSelfTest2.java | 2 -
.../ignite/visor/commands/VisorConsole.scala | 8 +-
36 files changed, 450 insertions(+), 141 deletions(-)
----------------------------------------------------------------------
[45/50] ignite git commit: schema-import examples fix (cherry picked
from commit b054fdc)
Posted by ag...@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-257
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>
[49/50] ignite git commit: Changed
IgniteCacheProcessProxy.localEntries to avoid issues with Cache.Entry
serialization.
Posted by ag...@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-257
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;
}
[31/50] ignite git commit: Added test.
Posted by ag...@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-257
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,
/** */
[03/50] ignite git commit: ignite-1.4 Fixed Visor cmd options.
Posted by ag...@apache.org.
ignite-1.4 Fixed Visor cmd options.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b8c0b308
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b8c0b308
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b8c0b308
Branch: refs/heads/ignite-257
Commit: b8c0b308a7f02f0495315e280936f6bacd170e44
Parents: 5cfb6e6
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Sep 17 17:17:05 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Sep 17 17:17:05 2015 +0700
----------------------------------------------------------------------
.../scala/org/apache/ignite/visor/commands/VisorConsole.scala | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b8c0b308/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
index 2abe8a7..6d91b05 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
@@ -105,6 +105,12 @@ class VisorConsole {
val batchCommand = argValue("e", argLst)
cfgFile.foreach(cfg => {
+ if (cfg.trim.isEmpty) {
+ visor.warn("Expected path to configuration after \"-cfg\" option.")
+
+ visor.quit()
+ }
+
if (batchFile.isDefined || batchCommand.isDefined) {
visor.warn("Options can't contains both -cfg and one of -b or -e options.")
[28/50] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.4' into ignite-1.4
Posted by ag...@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-257
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(-)
----------------------------------------------------------------------
[26/50] ignite git commit: Merge remote-tracking branch
'origin/ignite-1.4' into ignite-1.4
Posted by ag...@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-257
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(-)
----------------------------------------------------------------------