ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject incubator-ignite git commit: IGNITE-1133 - Fixed transaction overlapping.
Date Fri, 17 Jul 2015 22:40:20 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-1133 f557728b3 -> 6a0d58b72


IGNITE-1133 - Fixed transaction overlapping.


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

Branch: refs/heads/ignite-1133
Commit: 6a0d58b724555a57a4e6e006ed79e08570b129f6
Parents: f557728
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Fri Jul 17 15:40:13 2015 -0700
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Fri Jul 17 15:40:13 2015 -0700

----------------------------------------------------------------------
 .../processors/cache/GridCacheContext.java      |  2 +-
 .../cache/IgniteInternalCacheTypesTest.java     |  4 +--
 .../GridCacheSequenceApiSelfAbstractTest.java   | 17 ++++++++++++
 .../GridCacheSetAbstractSelfTest.java           | 27 ++++++++++++++++++++
 .../IgniteAtomicLongApiAbstractSelfTest.java    | 20 +++++++++++++++
 .../processors/igfs/IgfsStartCacheTest.java     |  2 +-
 6 files changed, 68 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6a0d58b7/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 5f17746..bf83448 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
@@ -440,7 +440,7 @@ public class GridCacheContext<K, V> implements Externalizable {
      * @return {@code True} if should use system transactions which are isolated from user
transactions.
      */
     public boolean systemTx() {
-        return cacheType == CacheType.UTILITY;
+        return !cacheType.userCache();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6a0d58b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteInternalCacheTypesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteInternalCacheTypesTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteInternalCacheTypesTest.java
index 8c2a0f8..f0fc769 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteInternalCacheTypesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteInternalCacheTypesTest.java
@@ -127,9 +127,9 @@ public class IgniteInternalCacheTypesTest extends GridCommonAbstractTest
{
 
         checkCache(ignite, CU.UTILITY_CACHE_NAME, UTILITY_CACHE_POOL, false, true);
 
-        checkCache(ignite, CU.MARSH_CACHE_NAME, MARSH_CACHE_POOL, false, false);
+        checkCache(ignite, CU.MARSH_CACHE_NAME, MARSH_CACHE_POOL, false, true);
 
-        checkCache(ignite, CU.ATOMICS_CACHE_NAME, SYSTEM_POOL, false, false);
+        checkCache(ignite, CU.ATOMICS_CACHE_NAME, SYSTEM_POOL, false, true);
 
         for (String cache : userCaches)
             checkCache(ignite, cache, SYSTEM_POOL, true, false);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6a0d58b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java
index 49e78c9..4668404 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java
@@ -165,6 +165,23 @@ public abstract class GridCacheSequenceApiSelfAbstractTest extends IgniteAtomics
     /**
      * @throws Exception If failed.
      */
+    public void testSequenceWithinUserTx() throws Exception {
+        String seqName = UUID.randomUUID().toString();
+
+        IgniteEx ig = grid();
+
+        try (Transaction tx = ig.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+            IgniteAtomicSequence seq = ig.atomicSequence(seqName, 0, true);
+
+            assertEquals(1, seq.incrementAndGet());
+
+            tx.commit();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testAddWrongValue() throws Exception {
         for (IgniteAtomicSequence seq : seqArr) {
             try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6a0d58b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
index 0494bcc..e23976b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
@@ -27,12 +27,15 @@ import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.testframework.*;
+import org.apache.ignite.transactions.*;
 
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
 import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
 
 /**
  * Cache set tests.
@@ -384,6 +387,30 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
     /**
      * @throws Exception If failed.
      */
+    public void testSetWithinUserTx() throws Exception {
+        IgniteEx ig = grid(0);
+
+        ig.set("warmup", new CollectionConfiguration()).close();
+
+        try (Transaction tx = ig.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+            String setName = UUID.randomUUID().toString();
+
+            IgniteSet<Object> set = ig.set(setName, new CollectionConfiguration());
+
+            set.add("1");
+            set.add("2");
+            set.add("3");
+            set.add("1");
+
+            assertEquals(3, set.size());
+
+            tx.commit();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testIteratorCollocated() throws Exception {
         testIterator(true);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6a0d58b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
index 2c0d8d5..685dbf2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
@@ -19,11 +19,14 @@ package org.apache.ignite.internal.processors.cache.datastructures;
 
 import org.apache.ignite.*;
 import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.transactions.*;
 
 import java.util.*;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.transactions.TransactionConcurrency.*;
+import static org.apache.ignite.transactions.TransactionIsolation.*;
 
 /**
  * Cache atomic long api test.
@@ -98,6 +101,23 @@ public abstract class IgniteAtomicLongApiAbstractSelfTest extends IgniteAtomicsA
     /**
      * @throws Exception If failed.
      */
+    public void testAtomicLongWithinUserTransaction() throws Exception {
+        IgniteEx ig = grid(0);
+
+        try (Transaction tx = ig.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+            String name = UUID.randomUUID().toString();
+
+            IgniteAtomicLong atomic = ig.atomicLong(name, 0, true);
+
+            assertEquals(1, atomic.incrementAndGet());
+
+            tx.commit();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testIncrementAndGet() throws Exception {
         info("Running test [name=" + getName() + ", cacheMode=" + atomicsCacheMode() + ']');
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6a0d58b7/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
index b5162e2..e251502 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
@@ -152,7 +152,7 @@ public class IgfsStartCacheTest extends IgfsCommonAbstractTest {
     private void checkCache(GridCacheAdapter cache) {
         assertNotNull(cache);
         assertFalse(cache.context().userCache());
-        assertFalse(cache.context().systemTx());
+        assertTrue(cache.context().systemTx());
         assertEquals(SYSTEM_POOL, cache.context().ioPolicy());
     }
 }


Mime
View raw message