ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [14/19] incubator-ignite git commit: IGNITE-104 - Ordered ATOMIC updates
Date Wed, 05 Aug 2015 01:46:14 GMT
IGNITE-104 - Ordered ATOMIC updates


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/aeac6aaa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/aeac6aaa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/aeac6aaa

Branch: refs/heads/ignite-104
Commit: aeac6aaa2641a4afaa38ec57c0046649601e1184
Parents: b73fa67
Author: Valentin Kulichenko <vkulichenko@gridgain.com>
Authored: Tue Aug 4 17:11:48 2015 -0700
Committer: Valentin Kulichenko <vkulichenko@gridgain.com>
Committed: Tue Aug 4 17:11:48 2015 -0700

----------------------------------------------------------------------
 .../IgniteLocalNodeStoppedException.java        | 55 ++++++++++++++++++++
 .../processors/cache/GridCacheMvccManager.java  |  2 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |  2 +-
 ...heExpiredEntriesPreloadAbstractSelfTest.java |  2 +-
 .../GridCacheTransformEventSelfTest.java        | 14 +----
 ...niteCacheClientNodeChangingTopologyTest.java |  4 +-
 .../dht/GridCacheAtomicNearCacheSelfTest.java   |  4 +-
 7 files changed, 65 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/main/java/org/apache/ignite/internal/IgniteLocalNodeStoppedException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteLocalNodeStoppedException.java
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteLocalNodeStoppedException.java
new file mode 100644
index 0000000..bc8eb5c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteLocalNodeStoppedException.java
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+import org.apache.ignite.*;
+import org.jetbrains.annotations.*;
+
+/**
+ * Exception used when local node is stopping.
+ */
+public class IgniteLocalNodeStoppedException extends IgniteCheckedException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Creates new exception with default error message.
+     */
+    public IgniteLocalNodeStoppedException() {
+        super("Local node is stopping.");
+    }
+
+    /**
+     * Creates new exception with given error message.
+     *
+     * @param msg Error message.
+     */
+    public IgniteLocalNodeStoppedException(String msg) {
+        super(msg);
+    }
+
+    /**
+     * Creates a new exception with given error message and optional nested cause exception.
+     *
+     * @param msg Error message.
+     * @param cause Optional nested exception (can be {@code null}).
+     */
+    public IgniteLocalNodeStoppedException(String msg, @Nullable Throwable cause) {
+        super(msg, cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/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 6a8c6fe..7416672 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
@@ -296,7 +296,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter
{
      * Cancels all client futures.
      */
     public void cancelClientFutures() {
-        cancelClientFutures(new IgniteCheckedException("Operation has been cancelled (node
is stopping)."));
+        cancelClientFutures(new IgniteLocalNodeStoppedException());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/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 52d59ed..7823a52 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
@@ -324,7 +324,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
         if (super.onDone(res, err)) {
             cctx.mvcc().removeAtomicFuture(version());
 
-            if (updateReq.writeSynchronizationMode() == FULL_SYNC)
+            if (updateReq.writeSynchronizationMode() == FULL_SYNC && !(err instanceof
IgniteLocalNodeStoppedException))
                 completionCb.apply(updateReq, updateRes);
 
             return true;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
index ccc9b64..8b9373d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheExpiredEntriesPreloadAbstractSelfTest.java
@@ -105,7 +105,7 @@ public abstract class GridCacheExpiredEntriesPreloadAbstractSelfTest extends
Gri
 
         Collection<Event> evts = g1.events().localQuery(F.<Event>alwaysTrue(),
EVT_CACHE_REBALANCE_OBJECT_LOADED);
 
-        assertEquals("Expected all entries are preloaded.", KEYS_NUM, evts.size());
+        assertEquals("Expected all entries are preloaded.", cache1.isDhtAtomic() ? 0 : KEYS_NUM,
evts.size());
 
         boolean rmv = GridTestUtils.waitForCondition(new PAX() {
             @Override public boolean applyx() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
index 459e015..31edb8f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
@@ -457,13 +457,13 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest
{
 
         caches[0].invoke(key1, new Transformer());
 
-        checkEventNodeIdsStrict(primaryIdsForKeys(key1));
+        checkEventNodeIdsStrict(idsForKeys(key1));
 
         assert evts.isEmpty();
 
         caches[0].invokeAll(keys, new Transformer());
 
-        checkEventNodeIdsStrict(primaryIdsForKeys(key1, key2));
+        checkEventNodeIdsStrict(idsForKeys(key1, key2));
     }
 
     /**
@@ -505,16 +505,6 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest
{
     }
 
     /**
-     * Get primary node IDs where the given keys must reside.
-     *
-     * @param keys Keys.
-     * @return Node IDs.
-     */
-    private UUID[] primaryIdsForKeys(int... keys) {
-        return idsForKeys(true, keys);
-    }
-
-    /**
      * Get node IDs where the given keys must reside.
      *
      * @param primaryOnly Primary only flag.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 58c5f95..3c6e5e4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -295,6 +295,8 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         IgniteEx ignite1 = startGrid(1);
         IgniteEx ignite2 = startGrid(2);
 
+        awaitPartitionMapExchange();
+
         client = true;
 
         Ignite ignite3 = startGrid(3);
@@ -348,7 +350,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         List<Object> msgs = spi.recordedMessages();
 
-        assertEquals(3, msgs.size());
+        assertEquals(6, msgs.size());
 
         for (Object msg : msgs)
             assertTrue(((GridNearAtomicUpdateRequest)msg).clientRequest());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aeac6aaa/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
index 2d28328..6d12f5e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
@@ -668,7 +668,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest
{
         cache0.remove(nearKey); // Remove from grid0, this should remove readers on primary
node.
 
         for (int i = 0; i < GRID_CNT; i++)
-            checkEntry(grid(i), nearKey, null, i == 0);
+            checkEntry(grid(i), nearKey, null, false);
 
         Ignite primaryNode = G.ignite((String) aff.mapKeyToNode(nearKey).attribute(ATTR_GRID_NAME));
 
@@ -698,7 +698,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest
{
 
         GridCacheEntryEx nearEntry = near.peekEx(key);
 
-        boolean expectDht = near.affinity().isPrimaryOrBackup(ignite.cluster().localNode(),
key);
+        boolean expectDht = val != null && near.affinity().isPrimaryOrBackup(ignite.cluster().localNode(),
key);
 
         if (expectNear) {
             assertNotNull("No near entry for: " + key + ", grid: " + ignite.name(), nearEntry);


Mime
View raw message