ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [13/50] incubator-ignite git commit: ignite-446
Date Fri, 24 Apr 2015 06:00:29 GMT
ignite-446


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

Branch: refs/heads/ignite-784
Commit: 842bf40ac3dad7a35f1e8bb8239e017e625f0a65
Parents: 5619659
Author: avinogradov <avinogradov@gridgain.com>
Authored: Tue Apr 21 14:01:07 2015 +0300
Committer: avinogradov <avinogradov@gridgain.com>
Committed: Tue Apr 21 14:01:07 2015 +0300

----------------------------------------------------------------------
 .../GridCachePartitionExchangeManager.java      |  5 +--
 .../colocated/GridDhtColocatedLockFuture.java   | 11 ++++++
 .../distributed/near/GridNearLockFuture.java    | 11 ++++++
 ...gniteTopologyValidatorAbstractCacheTest.java |  7 +++-
 ...iteTopologyValidatorAbstractTxCacheTest.java | 39 ++++++++++++++++----
 5 files changed, 61 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/842bf40a/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 7a1324f..851fc44 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
@@ -471,9 +471,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
     /**
      * @return Exchange futures.
      */
-    @SuppressWarnings( {"unchecked", "RedundantCast"})
-    public List<IgniteInternalFuture<?>> exchangeFutures() {
-        return (List<IgniteInternalFuture<?>>)(List)exchFuts.values();
+    public List<GridDhtPartitionsExchangeFuture> exchangeFutures() {
+        return exchFuts.values();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/842bf40a/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 c6746ba..336e890 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
@@ -528,6 +528,17 @@ public final class GridDhtColocatedLockFuture<K, V> extends GridCompoundIdentity
             topVer = tx.topologyVersionSnapshot();
 
         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()));
+
+                        return;
+                    }
+                }
+            }
+
             // Continue mapping on the same topology version as it was before.
             this.topVer.compareAndSet(null, topVer);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/842bf40a/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 58b7c4d..70c45bc 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
@@ -660,6 +660,17 @@ public final class GridNearLockFuture<K, V> extends GridCompoundIdentityFuture<B
             topVer = tx.topologyVersionSnapshot();
 
         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()));
+
+                        return;
+                    }
+                }
+            }
+
             // Continue mapping on the same topology version as it was before.
             this.topVer.compareAndSet(null, topVer);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/842bf40a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
index 167c535..420dc91 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
@@ -116,6 +116,7 @@ public abstract class IgniteTopologyValidatorAbstractCacheTest extends
IgniteCac
 
     /**
      * Commits with error.
+     *
      * @param tx transaction.
      */
     protected void commitFailed(Transaction tx) {
@@ -129,18 +130,20 @@ public abstract class IgniteTopologyValidatorAbstractCacheTest extends
IgniteCac
     }
 
     /**
-     * Removes key-value
+     * Removes key-value.
      *
      * @param cacheName cache name.
      */
     public void remove(String cacheName) {
+        assert grid(0).cache(cacheName).get(KEY_VALUE) != null;
+
         grid(0).cache(cacheName).remove(KEY_VALUE);
     }
 
     /**
      * Asserts that cache doesn't contains key.
      *
-     * @param cacheName
+     * @param cacheName cache name.
      */
     public void assertEmpty(String cacheName) {
         assert grid(0).cache(cacheName).get(KEY_VALUE) == null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/842bf40a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java
index 3db22d3..ac02734 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java
@@ -59,15 +59,15 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheTest extends
IgniteT
 
         assertEmpty(null); // rolled back
         assertEmpty(CACHE_NAME_1); // rolled back
+        assertEmpty(CACHE_NAME_2); // rolled back
 
-//        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC,
TransactionIsolation.REPEATABLE_READ)) {
-//            putValid(null);
-//            putInvalid(CACHE_NAME_1);
-//        }
-//
-//        assertEmpty(null); // rolled back
-//        assertEmpty(CACHE_NAME_1); // rolled back
+        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC,
TransactionIsolation.REPEATABLE_READ)) {
+            putValid(null);
+            putInvalid(CACHE_NAME_1);
+        }
 
+        assertEmpty(null); // rolled back
+        assertEmpty(CACHE_NAME_1); // rolled back
 
         startGrid(1);
 
@@ -87,6 +87,14 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheTest extends
IgniteT
 
         startGrid(2);
 
+        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC,
TransactionIsolation.REPEATABLE_READ)) {
+            putValid(null);
+            putInvalid(CACHE_NAME_1);
+        }
+
+        assertEmpty(null); // rolled back
+        assertEmpty(CACHE_NAME_1); // rolled back
+
         try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.OPTIMISTIC,
TransactionIsolation.REPEATABLE_READ)) {
             putValid(CACHE_NAME_1);
             commitFailed(tx);
@@ -96,5 +104,22 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheTest extends
IgniteT
             putInvalid(CACHE_NAME_1);
         }
 
+        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.OPTIMISTIC,
TransactionIsolation.REPEATABLE_READ)) {
+            putValid(null);
+            putValid(CACHE_NAME_2);
+            tx.commit();
+        }
+
+        remove(null);
+        remove(CACHE_NAME_2);
+
+        try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC,
TransactionIsolation.REPEATABLE_READ)) {
+            putValid(null);
+            putValid(CACHE_NAME_2);
+            tx.commit();
+        }
+
+        remove(null);
+        remove(CACHE_NAME_2);
     }
 }


Mime
View raw message