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 2014/12/19 04:22:03 UTC

[6/8] incubator-ignite git commit: GG-9141 - Fixing tests

GG-9141 - Fixing tests


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

Branch: refs/heads/ignite-1
Commit: 738e553a8b089528fbdb9559df7f0f391ed53d34
Parents: 246bc86
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Thu Dec 18 17:45:16 2014 -0800
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Thu Dec 18 17:45:16 2014 -0800

----------------------------------------------------------------------
 .../processors/cache/GridCacheSharedContext.java   | 17 ++++++++++++++---
 .../processors/cache/GridCacheTxLocalAdapter.java  | 12 +++++-------
 .../cache/distributed/dht/GridDhtTxLocal.java      |  2 +-
 .../preloader/GridDhtPartitionsExchangeFuture.java |  5 +++--
 .../cache/GridCacheInterceptorSelfTestSuite.java   |  6 +++---
 5 files changed, 26 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/738e553a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSharedContext.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSharedContext.java
index 10256b0..ba2bfe1 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheSharedContext.java
@@ -385,13 +385,24 @@ public class GridCacheSharedContext<K, V> {
     }
 
     /**
+     * @param tx Transaction to check.
      * @param activeCacheIds Active cache IDs.
      * @param cacheCtx Cache context.
      * @return {@code True} if cross-cache transaction can include this new cache.
      */
-    public boolean txCompatible(Set<Integer> activeCacheIds, GridCacheContext<K, V> cacheCtx) {
-        // TODO GG-9141 implement.
-        return false;
+    public boolean txCompatible(GridCacheTxEx<K, V> tx, Iterable<Integer> activeCacheIds, GridCacheContext<K, V> cacheCtx) {
+        if (cacheCtx.system() ^ tx.system())
+            return false;
+
+        for (Integer cacheId : activeCacheIds) {
+            GridCacheContext<K, V> activeCacheCtx = cacheContext(cacheId);
+
+            // Check that caches have the same store.
+            if (activeCacheCtx.store().store() != cacheCtx.store().store())
+                return false;
+        }
+
+        return true;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/738e553a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalAdapter.java
index 16ed64f..4af716a 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxLocalAdapter.java
@@ -2612,12 +2612,9 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K
     private void addActiveCache(GridCacheContext<K, V> cacheCtx) throws IgniteCheckedException {
         int cacheId = cacheCtx.cacheId();
 
-        // If this is a first cache to work on, capture cache settings.
-        if (activeCacheIds.isEmpty())
-            activeCacheIds.add(cacheId);
-        // Else check if we can enlist new cache to transaction.
-        else if (!activeCacheIds.contains(cacheId)) {
-            if (!cctx.txCompatible(activeCacheIds, cacheCtx)) {
+        // Check if we can enlist new cache to transaction.
+        if (!activeCacheIds.contains(cacheId)) {
+            if (!cctx.txCompatible(this, activeCacheIds, cacheCtx)) {
                 StringBuilder cacheNames = new StringBuilder();
 
                 for (Integer activeCacheId : activeCacheIds) {
@@ -2630,7 +2627,8 @@ public abstract class GridCacheTxLocalAdapter<K, V> extends GridCacheTxAdapter<K
 
                 throw new IgniteCheckedException("Failed to enlist new cache to existing transaction " +
                     "(cache configurations are not compatible) [activeCaches=[" + cacheNames +
-                    "], cacheName=" + cacheCtx.name() + ']');
+                    "], cacheName=" + cacheCtx.name() + ", txSystem=" + system() +
+                    ", cacheSystem=" + cacheCtx.system() + ']');
             }
             else
                 activeCacheIds.add(cacheId);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/738e553a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxLocal.java
index 9fa40d3..c21fc19 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -604,7 +604,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements
     /** {@inheritDoc} */
     @SuppressWarnings({"CatchGenericClass", "ThrowableInstanceNeverThrown"})
     @Override public boolean finish(boolean commit) throws IgniteCheckedException {
-        assert nearFinFutId != null || isInvalidate() || !commit || isSystemInvalidate() //|| !isNearEnabled(cctx) TODO GG-9141
+        assert nearFinFutId != null || isInvalidate() || !commit || isSystemInvalidate()
             || onePhaseCommit() || state() == PREPARED :
             "Invalid state [nearFinFutId=" + nearFinFutId + ", isInvalidate=" + isInvalidate() + ", commit=" + commit +
             ", sysInvalidate=" + isSystemInvalidate() + ", state=" + state() + ']';

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/738e553a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 65b4522..2c676e2 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -612,8 +612,9 @@ public class GridDhtPartitionsExchangeFuture<K, V> extends GridFutureAdapter<Lon
         catch (IgniteCheckedException e) {
             scheduleRecheck();
 
-            U.error(log, "Failed to send full partition map to nodes (will retry after timeout) [nodes=" +
-                F.nodeId8s(rmtNodes) + ", exchangeId=" + exchId + ']', e);
+            if (!X.hasCause(e, InterruptedException.class))
+                U.error(log, "Failed to send full partition map to nodes (will retry after timeout) [nodes=" +
+                    F.nodeId8s(rmtNodes) + ", exchangeId=" + exchId + ']', e);
 
             return false;
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/738e553a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheInterceptorSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheInterceptorSelfTestSuite.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheInterceptorSelfTestSuite.java
index 160210b..01ef118 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheInterceptorSelfTestSuite.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheInterceptorSelfTestSuite.java
@@ -39,9 +39,9 @@ public class GridCacheInterceptorSelfTestSuite extends TestSuite {
 
         suite.addTestSuite(GridCacheInterceptorSelfTest.class);
         suite.addTestSuite(GridCacheInterceptorNearEnabledSelfTest.class);
-//        suite.addTestSuite(GridCacheInterceptorWithStoreSelfTest.class);
-//        suite.addTestSuite(GridCacheInterceptorReplicatedSelfTest.class);
-//        suite.addTestSuite(GridCacheInterceptorReplicatedWithStoreSelfTest.class);
+//        suite.addTestSuite(GridCacheInterceptorWithStoreSelfTest.class); TODO GG-9141
+        suite.addTestSuite(GridCacheInterceptorReplicatedSelfTest.class);
+        suite.addTestSuite(GridCacheInterceptorReplicatedWithStoreSelfTest.class);
 
         return suite;
     }