ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [25/50] [abbrv] ignite git commit: ignite-2008 Added test reproducing issue.
Date Mon, 07 Dec 2015 10:55:06 GMT
ignite-2008 Added test reproducing issue.


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

Branch: refs/heads/master
Commit: f7709543c7e6652dc276e38629f2f1d1315fa84e
Parents: e7298ad
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Dec 3 10:42:15 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Dec 3 10:42:15 2015 +0300

----------------------------------------------------------------------
 .../CacheLockReleaseNodeLeaveTest.java          | 51 ++++++++++++++++++++
 1 file changed, 51 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f7709543/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
index 956aaef..e84fd3f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
@@ -29,9 +29,12 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
 
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
 
 /**
  *
@@ -107,4 +110,52 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest
{
 
         fut2.get(5, SECONDS);
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTxLockRelease() throws Exception {
+        startGrids(2);
+
+        final Ignite ignite0 = ignite(0);
+        final Ignite ignite1 = ignite(1);
+
+        final Integer key = primaryKey(ignite1.cache(null));
+
+        IgniteInternalFuture<?> fut1 = GridTestUtils.runAsync(new Callable<Void>()
{
+            @Override public Void call() throws Exception {
+                Transaction tx = ignite0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
+
+                ignite0.cache(null).get(key);
+
+                return null;
+            }
+        }, "lock-thread1");
+
+        fut1.get();
+
+        IgniteInternalFuture<?> fut2 = GridTestUtils.runAsync(new Callable<Void>()
{
+            @Override public Void call() throws Exception {
+                try (Transaction tx = ignite1.transactions().txStart(PESSIMISTIC, REPEATABLE_READ))
{
+                    log.info("Start tx lock.");
+
+                    ignite1.cache(null).get(key);
+
+                    log.info("Tx locked key.");
+
+                    tx.commit();
+                }
+
+                return null;
+            }
+        }, "lock-thread2");
+
+        U.sleep(1000);
+
+        log.info("Stop node.");
+
+        ignite0.close();
+
+        fut2.get(5, SECONDS);
+    }
 }


Mime
View raw message