ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [22/50] incubator-ignite git commit: # ignite-23
Date Fri, 29 May 2015 12:46:29 GMT
# ignite-23


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

Branch: refs/heads/ignite-929
Commit: 8980b615587b6837f6bd3baab2ac13c07f3f09e0
Parents: 00eadd6
Author: sboikov <sboikov@gridgain.com>
Authored: Mon May 25 16:26:53 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon May 25 17:04:08 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheSharedContext.java           |  1 -
 .../dht/atomic/GridNearAtomicUpdateFuture.java  | 12 ++++--
 .../colocated/GridDhtColocatedLockFuture.java   | 16 ++------
 .../GridDhtPartitionsExchangeFuture.java        |  4 ++
 ...niteCacheClientNodeChangingTopologyTest.java | 12 +++++-
 ...teCacheClientNodePartitionsExchangeTest.java | 42 ++++++++++++++++++--
 6 files changed, 63 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8980b615/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
index 3d70db7..4c08beb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
@@ -415,7 +415,6 @@ public class GridCacheSharedContext<K, V> {
         GridCompoundFuture f = new GridCompoundFuture();
 
         f.add(mvcc().finishExplicitLocks(topVer));
-        f.add(mvcc().finishLocks(topVer));
         f.add(tm().finishTxs(topVer));
         f.add(mvcc().finishAtomicUpdates(topVer));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8980b615/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 64a4882..55cc027 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
@@ -128,6 +128,12 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
     /** Fast map flag. */
     private final boolean fastMap;
 
+    /** */
+    private boolean fastMapRemap;
+
+    /** */
+    private GridCacheVersion updVer;
+
     /** Near cache flag. */
     private final boolean nearEnabled;
 
@@ -143,9 +149,6 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
     /** Skip store flag. */
     private final boolean skipStore;
 
-    /** */
-    private boolean fastMapRemap;
-
     /**
      * @param cctx Cache context.
      * @param cache Cache instance.
@@ -537,7 +540,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
         CacheConfiguration ccfg = cctx.config();
 
         // Assign version on near node in CLOCK ordering mode even if fastMap is false.
-        GridCacheVersion updVer = ccfg.getAtomicWriteOrderMode() == CLOCK ? cctx.versions().next(topVer)
: null;
+        if (updVer == null)
+            updVer = ccfg.getAtomicWriteOrderMode() == CLOCK ? cctx.versions().next(topVer)
: null;
 
         if (updVer != null && log.isDebugEnabled())
             log.debug("Assigned fast-map version for update on near node: " + updVer);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8980b615/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 cc8f064..5a4c91d 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
@@ -341,25 +341,12 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
                 else if (log.isDebugEnabled())
                     log.debug("Transaction was not marked rollback-only while locks were
not acquired: " + tx);
             }
-
-            for (KeyCacheObject key : GridDhtColocatedLockFuture.this.keys)
-                cctx.mvcc().removeExplicitLock(threadId, key, lockVer);
         }
 
         cctx.mvcc().recheckPendingLocks();
     }
 
     /**
-     *
-     * @param dist {@code True} if need to distribute lock release.
-     */
-    private void onFailed(boolean dist) {
-        undoLocks(dist, true);
-
-        complete(false);
-    }
-
-    /**
      * @param success Success flag.
      */
     public void complete(boolean success) {
@@ -1376,6 +1363,9 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
         private void remap() {
             undoLocks(false, false);
 
+            for (KeyCacheObject key : GridDhtColocatedLockFuture.this.keys)
+                cctx.mvcc().removeExplicitLock(threadId, key, lockVer);
+
             mapOnTopology(true);
 
             onDone(true);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8980b615/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 af7fa5c..a4cdfcd 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
@@ -507,6 +507,8 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                         if (exchId.isLeft())
                             cctx.mvcc().removeExplicitNodeLocks(exchId.nodeId(), exchId.topologyVersion());
 
+                        cctx.mvcc().finishLocks(exchId.topologyVersion()).get();
+
                         onDone(exchId.topologyVersion());
 
                         skipPreload = true;
@@ -692,6 +694,8 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                 if (exchId.isLeft())
                     cctx.mvcc().removeExplicitNodeLocks(exchId.nodeId(), exchId.topologyVersion());
 
+                cctx.mvcc().finishLocks(exchId.topologyVersion()).get();
+
                 for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
                     if (cacheCtx.isLocal())
                         continue;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8980b615/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 5a5a648..1de78aa 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
@@ -841,14 +841,22 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         IgniteCache<Integer, Integer> cache2 = ignite2.cache(null);
 
-        Lock lock2 = cache2.lock(0);
+        final Integer key = 0;
+
+        Lock lock2 = cache2.lock(key);
 
         lock2.lock();
 
         ignite2.close();
 
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+
+        assertFalse(cache0.isLocalLocked(key, false));
+
         IgniteCache<Integer, Integer> cache1 = ignite1.cache(null);
 
+        assertFalse(cache1.isLocalLocked(key, false));
+
         Lock lock1 = cache1.lock(0);
 
         assertTrue(lock1.tryLock(5000, TimeUnit.MILLISECONDS));
@@ -1163,7 +1171,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
                 }));
             }
 
-            long stopTime = System.currentTimeMillis() + 2 * 60_000;
+            long stopTime = System.currentTimeMillis() + 60_000;
 
             while (System.currentTimeMillis() < stopTime) {
                 int idx = ThreadLocalRandom.current().nextInt(0, SRV_CNT);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8980b615/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
index d680d26..726ff22 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.managers.communication.*;
+import org.apache.ignite.internal.managers.discovery.*;
 import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.*;
@@ -428,14 +429,31 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
      * @throws Exception If failed.
      */
     public void testClientOnlyCacheStart() throws Exception {
+        clientOnlyCacheStart(false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNearOnlyCacheStart() throws Exception {
+        clientOnlyCacheStart(true);
+    }
+
+    /**
+     * @param nearCache If {@code true} creates near cache on client.
+     * @throws Exception If failed.
+     */
+    public void clientOnlyCacheStart(boolean nearCache) throws Exception {
         Ignite ignite0 = startGrid(0);
         Ignite ignite1 = startGrid(1);
 
         waitForTopologyUpdate(2, 2);
 
+        final String CACHE_NAME = "cache1";
+
         CacheConfiguration ccfg = new CacheConfiguration();
 
-        ccfg.setName("cache1");
+        ccfg.setName(CACHE_NAME);
 
         ignite0.createCache(ccfg);
 
@@ -453,11 +471,17 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
         spi1.reset();
         spi2.reset();
 
-        assertNull(((IgniteKernal) ignite2).context().cache().context().cache().internalCache("cache1"));
+        assertNull(((IgniteKernal)ignite2).context().cache().context().cache().internalCache("cache1"));
+
+        if (nearCache)
+            ignite2.getOrCreateNearCache(CACHE_NAME, new NearCacheConfiguration<>());
+        else
+            ignite2.cache(CACHE_NAME);
 
-        ignite2.cache("cache1");
+        GridCacheAdapter cache = ((IgniteKernal)ignite2).context().cache().context().cache().internalCache("cache1");
 
-        assertNotNull(((IgniteKernal) ignite2).context().cache().context().cache().internalCache("cache1"));
+        assertNotNull(cache);
+        assertEquals(nearCache, cache.context().isNear());
 
         assertEquals(0, spi0.partitionsSingleMessages());
         assertEquals(0, spi0.partitionsFullMessages());
@@ -465,6 +489,16 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
         assertEquals(0, spi1.partitionsFullMessages());
         assertEquals(0, spi2.partitionsSingleMessages());
         assertEquals(0, spi2.partitionsFullMessages());
+
+        ClusterNode clientNode = ((IgniteKernal)ignite2).localNode();
+
+        for (Ignite ignite : Ignition.allGrids()) {
+            GridDiscoveryManager disco = ((IgniteKernal)ignite).context().discovery();
+
+            assertTrue(disco.cacheNode(clientNode, CACHE_NAME));
+            assertFalse(disco.cacheAffinityNode(clientNode, CACHE_NAME));
+            assertEquals(nearCache, disco.cacheNearNode(clientNode, CACHE_NAME));
+        }
     }
 
     /**


Mime
View raw message