ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-1349 Cleanup thread local context for system pool threads.
Date Wed, 02 Sep 2015 14:19:12 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1349 [created] 71db9d323


ignite-1349 Cleanup thread local context for system pool threads.


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

Branch: refs/heads/ignite-1349
Commit: 71db9d323bd129d1c22d669fd7c850b2f3bdebcc
Parents: 6769956
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Sep 2 15:52:15 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Sep 2 17:16:51 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheAdapter.java   | 11 ++++++++++-
 .../processors/cache/GridCacheMvccCandidate.java      |  6 ++++--
 .../processors/cache/GridCacheSharedContext.java      |  7 +++++++
 .../cache/distributed/dht/GridDhtTxPrepareFuture.java |  3 +++
 .../dht/colocated/GridDhtColocatedLockFuture.java     | 14 ++++++++++++--
 .../cache/distributed/near/GridNearLockFuture.java    | 14 ++++++++++++--
 .../near/GridNearOptimisticTxPrepareFuture.java       |  7 ++++++-
 .../testsuites/IgniteCacheFailoverTestSuite2.java     |  3 +++
 8 files changed, 57 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/71db9d32/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 68749b9..79c5e4b 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
@@ -4235,6 +4235,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
                                         throw e1;
                                     }
+                                    finally {
+                                        ctx.shared().txContextReset();
+                                    }
                                 }
                             });
                         }
@@ -4245,7 +4248,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                 return f;
             }
 
-            IgniteInternalFuture<T> f = op.op(tx).chain(new CX1<IgniteInternalFuture<T>,
T>() {
+            final IgniteInternalFuture<T> f = op.op(tx).chain(new CX1<IgniteInternalFuture<T>,
T>() {
                 @Override public T applyx(IgniteInternalFuture<T> tFut) throws IgniteCheckedException
{
                     try {
                         return tFut.get();
@@ -4255,6 +4258,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
 
                         throw e1;
                     }
+                    finally {
+                        ctx.shared().txContextReset();
+                    }
                 }
             });
 
@@ -4881,6 +4887,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
                                         catch (IgniteCheckedException e) {
                                             onDone(e);
                                         }
+                                        finally {
+                                            ctx.shared().txContextReset();
+                                        }
                                     }
                                 });
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/71db9d32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
index 0e75d3b..2df103d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccCandidate.java
@@ -523,14 +523,16 @@ public class GridCacheMvccCandidate implements Externalizable,
     /**
      * @return Lock that comes before in the same thread, possibly <tt>null</tt>.
      */
-    public GridCacheMvccCandidate previous() {
+    @Nullable public GridCacheMvccCandidate previous() {
         return prev;
     }
 
     /**
-     * @param prev Lock that comes before in the same thread, possibly <tt>null</tt>.
+     * @param prev Lock that comes before in the same thread.
      */
     public void previous(GridCacheMvccCandidate prev) {
+        assert threadId == prev.threadId;
+
         this.prev = prev;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/71db9d32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
index beffdd1..90e0921 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
@@ -678,4 +678,11 @@ public class GridCacheSharedContext<K, V> {
 
         return mgr;
     }
+
+    /**
+     * Reset thread-local context for transactional cache.
+     */
+    public void txContextReset() {
+        mvccMgr.contextReset();
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71db9d32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index f1771d4..6e8460f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -537,6 +537,9 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
                         catch (IgniteCheckedException e) {
                             onError(e);
                         }
+                        finally {
+                            cctx.txContextReset();
+                        }
                     }
                 });
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/71db9d32/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 ce547b6..f7093b8 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
@@ -635,7 +635,12 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
             else {
                 fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>()
{
                     @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion>
t) {
-                        mapOnTopology(remap, c);
+                        try {
+                            mapOnTopology(remap, c);
+                        }
+                        finally {
+                            cctx.shared().txContextReset();
+                        }
                     }
                 });
             }
@@ -1312,7 +1317,12 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
                     if (affFut != null && !affFut.isDone()) {
                         affFut.listen(new CI1<IgniteInternalFuture<?>>() {
                             @Override public void apply(IgniteInternalFuture<?> fut)
{
-                                remap();
+                                try {
+                                    remap();
+                                }
+                                finally {
+                                    cctx.shared().txContextReset();
+                                }
                             }
                         });
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/71db9d32/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 629dbb7..26276f0 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
@@ -769,7 +769,12 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
             else {
                 fut.listen(new CI1<IgniteInternalFuture<AffinityTopologyVersion>>()
{
                     @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion>
t) {
-                        mapOnTopology(remap);
+                        try {
+                            mapOnTopology(remap);
+                        }
+                        finally {
+                            cctx.shared().txContextReset();
+                        }
                     }
                 });
             }
@@ -1420,7 +1425,12 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
                     if (affFut != null && !affFut.isDone()) {
                         affFut.listen(new CI1<IgniteInternalFuture<?>>() {
                             @Override public void apply(IgniteInternalFuture<?> fut)
{
-                                remap();
+                                try {
+                                    remap();
+                                }
+                                finally {
+                                    cctx.shared().txContextReset();
+                                }
                             }
                         });
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/71db9d32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index e825e70..529f29c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -324,7 +324,12 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
                 @Override public void apply(IgniteInternalFuture<AffinityTopologyVersion>
t) {
                     cctx.kernalContext().closure().runLocalSafe(new GridPlainRunnable() {
                         @Override public void run() {
-                            prepareOnTopology(remap, c);
+                            try {
+                                prepareOnTopology(remap, c);
+                            }
+                            finally {
+                                cctx.txContextReset();
+                            }
                         }
                     });
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/71db9d32/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite2.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite2.java
index 20cc6b6..60ada78 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite2.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.processors.cache.CacheGetFromJobTest;
 import org.apache.ignite.internal.processors.cache.distributed.CacheAsyncOperationsFailoverAtomicTest;
 import org.apache.ignite.internal.processors.cache.distributed.CacheAsyncOperationsFailoverTxTest;
 import org.apache.ignite.internal.processors.cache.distributed.CachePutAllFailoverAtomicTest;
+import org.apache.ignite.internal.processors.cache.distributed.CachePutAllFailoverTxTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedFailoverSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheCrossCacheTxFailoverTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicFailoverSelfTest;
@@ -57,7 +58,9 @@ public class IgniteCacheFailoverTestSuite2 {
 
         suite.addTestSuite(CacheAsyncOperationsFailoverAtomicTest.class);
         suite.addTestSuite(CacheAsyncOperationsFailoverTxTest.class);
+
         suite.addTestSuite(CachePutAllFailoverAtomicTest.class);
+        suite.addTestSuite(CachePutAllFailoverTxTest.class);
 
         return suite;
     }


Mime
View raw message