ignite-gg-12324 fix caches start after restore hangs if concurrent transactions 
run


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

Branch: refs/heads/ignite-2.1.2-exchange
Commit: 6391b3d0db2b0ea36fde50301951dfef6aacb5ff
Parents: e35358c
Author: Dmitriy Govorukhin <[email protected]>
Authored: Mon Jun 26 12:41:57 2017 +0300
Committer: Dmitriy Govorukhin <[email protected]>
Committed: Mon Jun 26 12:41:57 2017 +0300

----------------------------------------------------------------------
 .../cache/CacheAffinitySharedManager.java       | 21 +++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6391b3d0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index 35f7a0e..5984ef5 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -772,9 +772,28 @@ public class CacheAffinitySharedManager<K, V> extends 
GridCacheSharedManagerAdap
         for (ExchangeActions.ActionData action : 
exchActions.cacheStopRequests())
             cctx.cache().blockGateway(action.request().cacheName(), true, 
action.request().restart());
 
-        for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop())
+        for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop()) {
             cctx.exchange().clearClientTopology(grpDesc.groupId());
 
+            CacheGroupContext gctx = 
cctx.cache().cacheGroup(grpDesc.groupId());
+
+            if (gctx != null) {
+                IgniteCheckedException ex;
+
+                String msg = "Failed to wait for topology update, cache group 
is stopping.";
+
+                // If snapshot operation in progress we must throw 
CacheStoppedException
+                // for correct cache proxy restart. For more details see
+                // IgniteCacheProxy.cacheException()
+                if 
(cctx.cache().context().snapshot().snapshotOperationInProgress())
+                    ex = new CacheStoppedException(msg);
+                else
+                    ex = new IgniteCheckedException(msg);
+
+                gctx.affinity().cancelFutures(ex);
+            }
+        }
+
         Set<Integer> stoppedGrps = null;
 
         if (crd && lateAffAssign) {

Reply via email to