ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [59/67] [abbrv] ignite git commit: ignite-5075
Date Thu, 04 May 2017 13:38:03 GMT
ignite-5075


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

Branch: refs/heads/ignite-5075
Commit: 758779abec07cc55d236307b1751d35bcc66289a
Parents: 988784a
Author: sboikov <sboikov@gridgain.com>
Authored: Wed May 3 22:43:34 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed May 3 22:59:35 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/ClusterCachesInfo.java     | 12 +++++-----
 .../cache/DynamicCacheChangeRequest.java        | 24 ++++++++++++--------
 .../processors/cache/ExchangeActions.java       |  6 +++++
 .../GridDhtPartitionsExchangeFuture.java        | 17 +++++---------
 .../cluster/GridClusterStateProcessor.java      |  4 +---
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  2 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  4 +++-
 7 files changed, 38 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/758779ab/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index 369a1cc..fa723be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -261,7 +261,7 @@ class ClusterCachesInfo {
                 continue;
             }
 
-            DynamicCacheDescriptor desc = registeredCaches.get(req.cacheName());
+            DynamicCacheDescriptor desc = req.globalStateChange() ? null : registeredCaches.get(req.cacheName());
 
             boolean needExchange = false;
 
@@ -355,7 +355,7 @@ class ClusterCachesInfo {
                 }
             }
             else if (req.globalStateChange())
-                needExchange = true;
+                exchangeActions.newClusterState(req.state());
             else if (req.resetLostPartitions()) {
                 if (desc != null) {
                     needExchange = true;
@@ -472,7 +472,7 @@ class ClusterCachesInfo {
             return new CacheClientReconnectDiscoveryData(cachesInfo);
         }
         else {
-            assert ctx.config().isDaemon() || joinDiscoData != null;
+            assert ctx.config().isDaemon() || joinDiscoData != null || !ctx.state().active();
 
             return joinDiscoData;
         }
@@ -536,14 +536,14 @@ class ClusterCachesInfo {
                 if (gridData == null) { // First node starts.
                     assert registeredCaches.isEmpty();
                     assert registeredTemplates.isEmpty();
-                    assert joinDiscoData != null;
+                    assert joinDiscoData != null || !ctx.state().active();
                 }
 
                 assert locJoinStartCaches == null;
 
                 locJoinStartCaches = new ArrayList<>();
 
-                if (!disconnectedState()) {
+                if (!disconnectedState() && joinDiscoData != null) {
                     processJoiningNode(joinDiscoData, node.id(), topVer);
 
                     for (DynamicCacheDescriptor desc : registeredCaches.values()) {
@@ -644,7 +644,7 @@ class ClusterCachesInfo {
         if (ctx.isDaemon() || data.commonData() == null)
             return;
 
-        assert joinDiscoData != null || disconnectedState();
+        assert joinDiscoData != null || disconnectedState() || !ctx.state().active();
         assert data.commonData() instanceof CacheNodeCommonDiscoveryData : data;
 
         CacheNodeCommonDiscoveryData cachesData = (CacheNodeCommonDiscoveryData)data.commonData();

http://git-wip-us.apache.org/repos/asf/ignite/blob/758779ab/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index 8fa763c..f8c2c7d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -89,8 +89,6 @@ public class DynamicCacheChangeRequest implements Serializable {
     private QuerySchema schema;
 
     /**
-     * Constructor creates cache stop request.
-     *
      * @param reqId Unique request ID.
      * @param cacheName Cache stop name.
      * @param initiatingNodeId Initiating node ID.
@@ -106,6 +104,21 @@ public class DynamicCacheChangeRequest implements Serializable {
     }
 
     /**
+     * @param reqId Unique request ID.
+     * @param state New cluster state.
+     * @param initiatingNodeId Initiating node ID.
+     */
+    public DynamicCacheChangeRequest(UUID reqId, ClusterState state, UUID initiatingNodeId)
{
+        assert reqId != null;
+        assert state != null;
+        assert initiatingNodeId != null;
+
+        this.reqId = reqId;
+        this.state = state;
+        this.initiatingNodeId = initiatingNodeId;
+    }
+
+    /**
      * @param ctx Context.
      * @param cacheName Cache name.
      * @return Request to reset lost partitions.
@@ -179,13 +192,6 @@ public class DynamicCacheChangeRequest implements Serializable {
     }
 
     /**
-     * @param state State.
-     */
-    public void state(ClusterState state) {
-        this.state = state;
-    }
-
-    /**
      * @return {@code True} if global caches state is changes.
      */
     public boolean globalStateChange() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/758779ab/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
index bcc77f6..eed60ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
@@ -194,6 +194,12 @@ public class ExchangeActions {
         return false;
     }
 
+    public void newClusterState(ClusterState state) {
+        assert state != null;
+
+        newState = state;
+    }
+
     /**
      * @return New cluster state if state change was requested.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/758779ab/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index bcfd8e0..34235c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1563,20 +1563,15 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
                 assert discoEvt instanceof DiscoveryCustomEvent;
 
                 if (((DiscoveryCustomEvent)discoEvt).customMessage() instanceof DynamicCacheChangeBatch)
{
-                    DynamicCacheChangeBatch batch = (DynamicCacheChangeBatch)((DiscoveryCustomEvent)discoEvt)
-                        .customMessage();
+                    if (exchActions != null) {
+                        if (exchActions.newClusterState() == ClusterState.ACTIVE)
+                            assignPartitionsStates();
 
-                    Set<String> caches = new HashSet<>();
+                        Set<String> caches = exchActions.cachesToResetLostPartitions();
 
-                    for (DynamicCacheChangeRequest req : batch.requests()) {
-                        if (req.resetLostPartitions())
-                            caches.add(req.cacheName());
-                        else if (req.globalStateChange() && req.state() != ClusterState.INACTIVE)
-                            assignPartitionsStates();
+                        if (!F.isEmpty(caches))
+                            resetLostPartitions(caches);
                     }
-
-                    if (!F.isEmpty(caches))
-                        resetLostPartitions(caches);
                 }
             }
             else if (discoEvt.type() == EVT_NODE_LEFT || discoEvt.type() == EVT_NODE_FAILED)

http://git-wip-us.apache.org/repos/asf/ignite/blob/758779ab/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index a20ee41..b25b229 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -280,9 +280,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
                 List<DynamicCacheChangeRequest> reqs = new ArrayList<>();
 
                 DynamicCacheChangeRequest changeGlobalStateReq = new DynamicCacheChangeRequest(
-                    requestId, null, ctx.localNodeId());
-
-                changeGlobalStateReq.state(activate ? ACTIVE : INACTIVE);
+                    requestId, activate ? ACTIVE : INACTIVE, ctx.localNodeId());
 
                 reqs.add(changeGlobalStateReq);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/758779ab/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
index 81f5c28..59c2656 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
@@ -427,7 +427,7 @@ public abstract class IgniteSpiAdapter implements IgniteSpi {
      */
     protected final void unregisterMBean() throws IgniteSpiException {
         // Unregister SPI MBean.
-        if (spiMBean != null) {
+        if (spiMBean != null && ignite != null) {
             MBeanServer jmx = ignite.configuration().getMBeanServer();
 
             assert jmx != null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/758779ab/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 99a7dac..708af1d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1974,7 +1974,9 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi
{
      *
      */
     void printStopInfo() {
-        if (log.isDebugEnabled())
+        IgniteLogger log = this.log;
+
+        if (log != null && log.isDebugEnabled())
             log.debug(stopInfo());
     }
 


Mime
View raw message