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-1452 Cancel cache operations on node stop
Date Wed, 16 Sep 2015 10:34:14 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1452 9ba0b222c -> 4ee280f02


ignite-1452 Cancel cache operations on node stop


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

Branch: refs/heads/ignite-1452
Commit: 4ee280f025273fb3a97074b3a1b01401a87cf113
Parents: 9ba0b22
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Sep 16 13:15:50 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Sep 16 13:32:26 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/internal/IgniteKernal.java  |  2 +-
 .../processors/cache/GridCacheMvccManager.java         | 13 +++++++++----
 .../internal/processors/cache/GridCacheProcessor.java  |  4 ++--
 .../dht/atomic/GridNearAtomicUpdateFuture.java         |  9 +++++----
 .../dht/atomic/GridNearAtomicUpdateRequest.java        |  2 ++
 .../dht/atomic/GridNearAtomicUpdateResponse.java       |  2 ++
 6 files changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4ee280f0/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index daf7d23..fd72b94 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1859,7 +1859,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
                 finally {
                     // Cleanup even on successful acquire.
                     if (cacheProcessor != null)
-                        cacheProcessor.cancelUserOperations();
+                        cacheProcessor.onStop();
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ee280f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index c04b401..e233a53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -116,6 +116,9 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter
{
     /** Finish futures. */
     private final Queue<FinishLockFuture> finishFuts = new ConcurrentLinkedDeque8<>();
 
+    /** */
+    private volatile boolean stopped;
+
     /** Logger. */
     @SuppressWarnings( {"FieldAccessedSynchronizedAndUnsynchronized"})
     private IgniteLogger exchLog;
@@ -325,7 +328,9 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter
{
     /**
      * Cancels all client futures.
      */
-    public void cancelClientFutures() {
+    public void onStop() {
+        stopped = true;
+
         cancelClientFutures(stopError());
     }
 
@@ -513,11 +518,11 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter
{
                 fut.onNodeLeft(n.id());
         }
 
-        onFutureAdded(fut);
-
         // Just in case if future was completed before it was added.
         if (fut.isDone())
             removeFuture(fut);
+        else
+            onFutureAdded(fut);
 
         return true;
     }
@@ -526,7 +531,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter
{
      * @param fut Future.
      */
     private void onFutureAdded(IgniteInternalFuture<?> fut) {
-        if (cctx.kernalContext().isStopping())
+        if (stopped)
             ((GridFutureAdapter)fut).onDone(stopError());
         else if (cctx.kernalContext().clientDisconnected())
             ((GridFutureAdapter)fut).onDone(disconnectedError(null));

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ee280f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 4ae0baa..fa2d568 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -3104,8 +3104,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     /**
      * Cancel all user operations.
      */
-    public void cancelUserOperations() {
-        sharedCtx.mvcc().cancelClientFutures();
+    public void onStop() {
+        sharedCtx.mvcc().onStop();
 
         Exception err = new IgniteCheckedException("Operation has been cancelled (node is
stopping).");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ee280f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index d93f68f..da03d1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -811,6 +811,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
             }
 
             Exception err = null;
+            GridNearAtomicUpdateRequest singleReq0 = null;
             Map<UUID, GridNearAtomicUpdateRequest> pendingMappings = null;
 
             int size = keys.size();
@@ -837,13 +838,13 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
                     if (size == 1 && !fastMap) {
                         assert remapKeys == null || remapKeys.size() == 1;
 
-                        singleReq = mapSingleUpdate();
+                        singleReq0 = singleReq = mapSingleUpdate();
                     }
                     else {
                         pendingMappings = mapUpdate(topNodes);
 
                         if (pendingMappings.size() == 1)
-                            singleReq = F.firstValue(pendingMappings);
+                            singleReq0 = singleReq = F.firstValue(pendingMappings);
                         else {
                             if (syncMode == PRIMARY_SYNC) {
                                 mappings = U.newHashMap(pendingMappings.size());
@@ -874,8 +875,8 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
             }
 
             // Optimize mapping for single key.
-            if (singleReq != null)
-                mapSingle(singleReq.nodeId(), singleReq);
+            if (singleReq0 != null)
+                mapSingle(singleReq0.nodeId(), singleReq0);
             else {
                 assert pendingMappings != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ee280f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index 5f5fbb5..ccb67d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -198,6 +198,8 @@ public class GridNearAtomicUpdateRequest extends GridCacheMessage implements
Gri
         boolean skipStore,
         boolean clientReq
     ) {
+        assert futVer != null;
+
         this.cacheId = cacheId;
         this.nodeId = nodeId;
         this.futVer = futVer;

http://git-wip-us.apache.org/repos/asf/ignite/blob/4ee280f0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 8bc145c..52896c7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -116,6 +116,8 @@ public class GridNearAtomicUpdateResponse extends GridCacheMessage implements
Gr
      * @param futVer Future version.
      */
     public GridNearAtomicUpdateResponse(int cacheId, UUID nodeId, GridCacheVersion futVer)
{
+        assert futVer != null;
+
         this.cacheId = cacheId;
         this.nodeId = nodeId;
         this.futVer = futVer;


Mime
View raw message