ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [6/6] ignite git commit: Fixing hang for concurrent cache start
Date Fri, 28 Aug 2015 02:03:06 GMT
Fixing hang for concurrent cache start


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

Branch: refs/heads/ignite-1.3.3-p6
Commit: 56fd27251f3f66ad80db9a1719b722051cdff3ab
Parents: ea75a5a
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Thu Aug 27 18:51:45 2015 -0700
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Thu Aug 27 18:51:45 2015 -0700

----------------------------------------------------------------------
 .../processors/cache/GridCacheIoManager.java        | 10 +++++++++-
 .../processors/cache/GridCacheSharedContext.java    | 16 +++++++++-------
 .../near/GridNearOptimisticTxPrepareFuture.java     |  3 +++
 .../cache/transactions/IgniteTxAdapter.java         |  1 +
 4 files changed, 22 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/56fd2725/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index c128aa6..a7fb460 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
 import org.apache.ignite.internal.util.*;
+import org.apache.ignite.internal.util.future.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
@@ -516,7 +517,14 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter
{
     private IgniteInternalFuture<Object> startFuture(GridCacheMessage cacheMsg) {
         int cacheId = cacheMsg.cacheId();
 
-        return cacheId != 0 ? cctx.cacheContext(cacheId).preloader().startFuture() : cctx.preloadersStartFuture();
+        if (cacheId != 0)
+            return cctx.cacheContext(cacheId).preloader().startFuture();
+        else {
+            if (F.eq(cacheMsg.topologyVersion(), AffinityTopologyVersion.NONE))
+                return new GridFinishedFuture<>();
+
+            return cctx.preloadersStartFuture(cacheMsg.topologyVersion());
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/56fd2725/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 6562257..262d17a 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
@@ -238,18 +238,20 @@ public class GridCacheSharedContext<K, V> {
     /**
      * @return Compound preloaders start future.
      */
-    public IgniteInternalFuture<Object> preloadersStartFuture() {
+    public IgniteInternalFuture<Object> preloadersStartFuture(AffinityTopologyVersion
topVer) {
         if (preloadersStartFut == null) {
             GridCompoundFuture<Object, Object> compound = null;
 
-            for (GridCacheContext<K, V> cacheCtx : cacheContexts()) {
-                IgniteInternalFuture<Object> startFut = cacheCtx.preloader().startFuture();
+            for (GridCacheContext cacheCtx : cacheContexts()) {
+                if (cacheCtx.startTopologyVersion() != null && cacheCtx.startTopologyVersion().compareTo(topVer)
<= 0) {
+                    IgniteInternalFuture<Object> startFut = cacheCtx.preloader().startFuture();
 
-                if (!startFut.isDone()) {
-                    if (compound == null)
-                        compound = new GridCompoundFuture<>();
+                    if (!startFut.isDone()) {
+                        if (compound == null)
+                            compound = new GridCompoundFuture<>();
 
-                    compound.add(startFut);
+                        compound.add(startFut);
+                    }
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/56fd2725/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 305840b..c8d04ec 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
@@ -672,6 +672,9 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
 
         return S.toString(GridNearOptimisticTxPrepareFuture.class, this,
             "futs", futs,
+            "xidVer", tx.xidVersion(),
+            "nearXidVer", tx.nearXidVersion(),
+            "topVer", tx.topologyVersionSnapshot(),
             "super", super.toString());
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/56fd2725/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 4fc6f0c..ad40430 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -183,6 +183,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
     private AtomicReference<GridFutureAdapter<IgniteInternalTx>> finFut = new
AtomicReference<>();
 
     /** Topology version. */
+    @GridToStringInclude
     protected AtomicReference<AffinityTopologyVersion> topVer = new AtomicReference<>(AffinityTopologyVersion.NONE);
 
     /** Mutex. */


Mime
View raw message