ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [30/50] [abbrv] ignite git commit: IGNITE-6181 wip.
Date Tue, 19 Sep 2017 14:45:56 GMT
IGNITE-6181 wip.


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

Branch: refs/heads/ignite-6181-1
Commit: ec4b16cc51a623c9f8106b7b3d3359881a46f4ae
Parents: 02f94ae
Author: ascherbakoff <alexey.scherbakoff@gmail.com>
Authored: Sun Sep 10 14:17:19 2017 +0300
Committer: ascherbakoff <alexey.scherbakoff@gmail.com>
Committed: Sun Sep 10 14:17:19 2017 +0300

----------------------------------------------------------------------
 .../internal/IgniteDiagnosticPrepareContext.java     |  2 +-
 .../internal/processors/cache/GridCacheAdapter.java  |  2 +-
 .../cache/distributed/near/GridNearLockFuture.java   |  5 ++++-
 .../cache/distributed/near/GridNearTxLocal.java      |  6 ++----
 .../cache/transactions/IgniteTransactionsImpl.java   |  1 -
 .../cache/transactions/IgniteTxLocalAdapter.java     |  4 ++++
 .../cache/transactions/IgniteTxManager.java          | 10 ++++------
 .../cache/transactions/TxRollbackOnTimeoutTest.java  | 15 ++++++++-------
 8 files changed, 24 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ec4b16cc/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
index 14783d5..ed8d35e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
@@ -280,4 +280,4 @@ public class IgniteDiagnosticPrepareContext {
             }
         }
     }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec4b16cc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 2be738a..18fb2ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -4035,7 +4035,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
         GridNearTxLocal tx = ctx.tm().threadLocalTx(ctx);
 
         if (tx != null && tx.state() == TransactionState.ROLLED_BACK && tx.timedOut())
-            throw new IgniteTxTimeoutCheckedException("Previous transaction was rolled back
by timeout. " +
+            throw new IgniteTxTimeoutCheckedException("Previous transaction was rolled back
due to timeout. " +
                 "Please start new transaction and retry an operation.");
 
         if (tx == null || tx.implicit()) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec4b16cc/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 9cad49e..bb71337 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
@@ -770,7 +770,10 @@ public final class GridNearLockFuture extends GridCacheCompoundIdentityFuture<Bo
      * part. Note that if primary node leaves grid, the future will fail and transaction
will be rolled back.
      */
     void map() {
-        AffinityTopologyVersion topVer = cctx.mvcc().lastExplicitLockTopologyVersion(Thread.currentThread().getId());
+        // Obtain the topology version to use.
+        long threadId = Thread.currentThread().getId();
+
+        AffinityTopologyVersion topVer = cctx.mvcc().lastExplicitLockTopologyVersion(threadId);
 
         // If there is another system transaction in progress, use it's topology version
to prevent deadlock.
         if (topVer == null && tx != null && tx.system())

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec4b16cc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index fb4c5e1..67782ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -3151,9 +3151,6 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements
GridTimeou
             // Prepare was called explicitly.
             return fut;
 
-        if (timeout() > 0 && !implicit())
-            cctx.time().removeTimeoutObject(this);
-
         mapExplicitLocks();
 
         fut.prepare();
@@ -3701,7 +3698,8 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements
GridTimeou
         if (state != ROLLING_BACK && state != ROLLED_BACK && state != COMMITTING
&& state != COMMITTED)
             rollback();
 
-        cctx.tm().onLocalClose();
+        if (!system())
+            cctx.tm().resetUserTx();
 
         synchronized (this) {
             try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec4b16cc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
index df5c90e..12f655a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTransactionsImpl.java
@@ -29,7 +29,6 @@ import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.apache.ignite.transactions.TransactionMetrics;
 import org.apache.ignite.transactions.TransactionException;
-import org.apache.ignite.transactions.TransactionState;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec4b16cc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index e6e19e3..e7ebaae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -92,6 +92,7 @@ import static org.apache.ignite.internal.processors.dr.GridDrType.DR_NONE;
 import static org.apache.ignite.internal.processors.dr.GridDrType.DR_PRIMARY;
 import static org.apache.ignite.transactions.TransactionState.COMMITTED;
 import static org.apache.ignite.transactions.TransactionState.COMMITTING;
+import static org.apache.ignite.transactions.TransactionState.MARKED_ROLLBACK;
 import static org.apache.ignite.transactions.TransactionState.PREPARING;
 import static org.apache.ignite.transactions.TransactionState.ROLLED_BACK;
 import static org.apache.ignite.transactions.TransactionState.ROLLING_BACK;
@@ -1236,6 +1237,9 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements
Ig
      * @throws IgniteCheckedException If transaction check failed.
      */
     protected void checkValid() throws IgniteCheckedException {
+        if (local() && !dht() && remainingTime() == -1)
+            state(MARKED_ROLLBACK, true);
+
         if (isRollbackOnly()) {
             if (remainingTime() == -1)
                 throw new IgniteTxTimeoutCheckedException("Cache transaction timed out: "
+ this);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec4b16cc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index d65832c..0722275 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -282,9 +282,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
      * @param cacheId Cache ID.
      */
     public void rollbackTransactionsForCache(int cacheId) {
-        rollbackTransactionsForCache(cacheId, nearIdMap.values());
-
-        rollbackTransactionsForCache(cacheId, Collections.singleton(userTx.get()));
+        rollbackTransactionsForCache(cacheId, activeTransactions());
     }
 
     /**
@@ -2278,12 +2276,12 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter
{
         }
 
         if (userTx.get() != null)
-            throw new IgniteCheckedException("Thread already has started transaction.");
+            throw new IgniteCheckedException("Thread already has active transaction.");
 
         userTx.set(tx);
 
         if (transactionMap(tx).putIfAbsent(tx.xidVersion(), tx) != null)
-            throw new IgniteCheckedException("Thread already has started transaction.");
+            throw new IgniteCheckedException("Thread already has active transaction.");
     }
 
     /**
@@ -2305,7 +2303,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     }
 
     /** */
-    public void onLocalClose() {
+    public void resetUserTx() {
         userTx.set(null);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec4b16cc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
index cdbceda..01829ce 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
@@ -18,12 +18,10 @@
 package org.apache.ignite.internal.processors.cache.transactions;
 
 import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.locks.LockSupport;
 import javax.cache.CacheException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.TransactionConfiguration;
@@ -50,12 +48,15 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
  */
 public class TxRollbackOnTimeoutTest extends GridCommonAbstractTest {
     /** */
-    private static final long TX_TIMEOUT_MIN = 1;
+    private static final long TX_MIN_TIMEOUT = 1;
 
     /** */
     private static final long TX_TIMEOUT = 300;
 
     /** */
+    private static final long TX_DEFAULT_TIMEOUT = 3_000;
+
+    /** */
     private static final String CACHE_NAME = "test";
 
     /** IP finder. */
@@ -79,7 +80,7 @@ public class TxRollbackOnTimeoutTest extends GridCommonAbstractTest {
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
         TransactionConfiguration txCfg = new TransactionConfiguration();
-        txCfg.setDefaultTxTimeout(TX_TIMEOUT);
+        txCfg.setDefaultTxTimeout(TX_DEFAULT_TIMEOUT);
 
         cfg.setTransactionConfiguration(txCfg);
 
@@ -223,14 +224,14 @@ public class TxRollbackOnTimeoutTest extends GridCommonAbstractTest
{
             testTimeoutRemoval0(client, i, TX_TIMEOUT);
 
         for (int i = 0; i < 5; i++)
-            testTimeoutRemoval0(grid(0), i, TX_TIMEOUT_MIN);
+            testTimeoutRemoval0(grid(0), i, TX_MIN_TIMEOUT);
 
         for (int i = 0; i < 5; i++)
-            testTimeoutRemoval0(client, i, TX_TIMEOUT_MIN);
+            testTimeoutRemoval0(client, i, TX_MIN_TIMEOUT);
 
         // Repeat with more iterations to make sure everything is cleared.
         for (int i = 0; i < 500; i++)
-            testTimeoutRemoval0(client, 2, TX_TIMEOUT_MIN);
+            testTimeoutRemoval0(client, 2, TX_MIN_TIMEOUT);
     }
 
     /**


Mime
View raw message