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-gg-12389
Date Wed, 05 Jul 2017 07:32:32 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-gg-12389 70d23ddaa -> 53e83f3b9


ignite-gg-12389


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

Branch: refs/heads/ignite-gg-12389
Commit: 53e83f3b9ae5e31bd6d1aab4392246b8b13b0cb0
Parents: 70d23dd
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Jul 5 10:32:26 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Jul 5 10:32:26 2017 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/GridComponent.java   |   2 +
 .../apache/ignite/internal/IgniteKernal.java    |   3 +-
 .../cache/CacheAffinitySharedManager.java       |   2 +-
 .../processors/cache/ClusterCachesInfo.java     |   8 +-
 .../GridCachePartitionExchangeManager.java      | 162 ++++++++++---------
 .../processors/cache/GridCacheProcessor.java    |   6 +-
 .../processors/cache/StateChangeRequest.java    |  11 +-
 .../GridCacheDatabaseSharedManager.java         |   2 +-
 .../cluster/ChangeGlobalStateMessage.java       |  16 +-
 .../cluster/DiscoveryDataClusterState.java      |  18 +--
 .../cluster/GridClusterStateProcessor.java      |   1 +
 .../AbstractNodeJoinTemplate.java               | 127 +++++++++++----
 .../IgniteChangeGlobalStateAbstractTest.java    |  23 +--
 .../IgniteChangeGlobalStateTest.java            |   3 +-
 14 files changed, 233 insertions(+), 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/modules/core/src/main/java/org/apache/ignite/internal/GridComponent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridComponent.java b/modules/core/src/main/java/org/apache/ignite/internal/GridComponent.java
index 32db7eb..93ffe95 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridComponent.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridComponent.java
@@ -84,6 +84,8 @@ public interface GridComponent {
      * Callback that notifies that kernal has successfully started,
      * including all managers and processors.
      *
+     * @param active Cluster active flag (note: should be used carefully since state can
+     *     change concurrently).
      * @throws IgniteCheckedException Thrown in case of any errors.
      */
     public void onKernalStart(boolean active) throws IgniteCheckedException;

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/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 b22bb8f..0c17b32 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
@@ -999,9 +999,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
             boolean active;
 
             if (transitionWaitFut != null) {
-                if (log.isInfoEnabled())
+                if (log.isInfoEnabled()) {
                     log.info("Join cluster while cluster state transition is in progress,
" +
                         "waiting when transition finish.");
+                }
 
                 active = transitionWaitFut.get();
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/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 6f7f4c2..8d08c3f 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
@@ -111,7 +111,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
     /** */
     private final ThreadLocal<ClientCacheChangeDiscoveryMessage> clientCacheChanges
= new ThreadLocal<>();
 
-    /** */
+    /** Caches initialized flag (initialized when join activate cluster or after activation.
*/
     private boolean cachesInitialized;
 
     /** Discovery listener. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/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 0c9d5b4..5452bd2 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
@@ -373,7 +373,7 @@ class ClusterCachesInfo {
      * @param reqs Requests.
      * @param topVer Topology version.
      * @param persistedCfgs {@code True} if process start of persisted caches during cluster
activation.
-     * @return {@code True} if minor topology version should be increased.
+     * @return Process result.
      */
     private CacheChangeProcessResult processCacheChangeRequests(
         ExchangeActions exchangeActions,
@@ -1603,10 +1603,10 @@ class ClusterCachesInfo {
             }
 
             for (Map.Entry<String, DynamicCacheDescriptor> e : cachesOnDisconnect.caches.entrySet())
{
-                String cacheName = e.getKey();
-
                 DynamicCacheDescriptor desc = e.getValue();
 
+                String cacheName = e.getKey();
+
                 boolean stopped;
 
                 if (!surviveReconnect(cacheName)) {
@@ -1621,7 +1621,7 @@ class ClusterCachesInfo {
                     stoppedCaches.add(cacheName);
             }
 
-            if (!cachesOnDisconnect.state.active())
+            if (!cachesOnDisconnect.clusterActive())
                 initStartCachesForLocalJoin(false);
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 5d10b07..22345d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -89,7 +89,6 @@ import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
 import org.apache.ignite.internal.util.GridListSet;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.GridPartitionStateMap;
-import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.IgnitePair;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
@@ -199,82 +198,6 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
     /** Events received while cluster state transition was in progress. */
     private final List<PendingDiscoveryEvent> pendingEvts = new ArrayList<>();
 
-    /** {@inheritDoc} */
-    @Override protected void start0() throws IgniteCheckedException {
-        super.start0();
-
-        exchWorker = new ExchangeWorker();
-
-        cctx.gridEvents().addDiscoveryEventListener(discoLsnr, EVT_NODE_JOINED, EVT_NODE_LEFT,
EVT_NODE_FAILED,
-            EVT_DISCOVERY_CUSTOM_EVT);
-
-        cctx.io().addCacheHandler(0, GridDhtPartitionsSingleMessage.class,
-            new MessageHandler<GridDhtPartitionsSingleMessage>() {
-                @Override public void onMessage(ClusterNode node, GridDhtPartitionsSingleMessage
msg) {
-                    processSinglePartitionUpdate(node, msg);
-                }
-            });
-
-        cctx.io().addCacheHandler(0, GridDhtPartitionsFullMessage.class,
-            new MessageHandler<GridDhtPartitionsFullMessage>() {
-                @Override public void onMessage(ClusterNode node, GridDhtPartitionsFullMessage
msg) {
-                    processFullPartitionUpdate(node, msg);
-                }
-            });
-
-        cctx.io().addCacheHandler(0, GridDhtPartitionsSingleRequest.class,
-            new MessageHandler<GridDhtPartitionsSingleRequest>() {
-                @Override public void onMessage(ClusterNode node, GridDhtPartitionsSingleRequest
msg) {
-                    processSinglePartitionRequest(node, msg);
-                }
-            });
-
-        if (!cctx.kernalContext().clientNode()) {
-            for (int cnt = 0; cnt < cctx.gridConfig().getRebalanceThreadPoolSize(); cnt++)
{
-                final int idx = cnt;
-
-                cctx.io().addOrderedCacheGroupHandler(cctx, rebalanceTopic(cnt), new CI2<UUID,
GridCacheGroupIdMessage>() {
-                    @Override public void apply(final UUID id, final GridCacheGroupIdMessage
m) {
-                        if (!enterBusy())
-                            return;
-
-                        try {
-                            CacheGroupContext grp = cctx.cache().cacheGroup(m.groupId());
-
-                            if (grp != null) {
-                                if (m instanceof GridDhtPartitionSupplyMessage) {
-                                    grp.preloader().handleSupplyMessage(idx, id, (GridDhtPartitionSupplyMessage)
m);
-
-                                    return;
-                                }
-                                else if (m instanceof GridDhtPartitionDemandMessage) {
-                                    grp.preloader().handleDemandMessage(idx, id, (GridDhtPartitionDemandMessage)
m);
-
-                                    return;
-                                }
-                            }
-
-                            U.error(log, "Unsupported message type: " + m.getClass().getName());
-                        }
-                        finally {
-                            leaveBusy();
-                        }
-                    }
-                });
-            }
-        }
-    }
-
-    /**
-     * Callback for local join event (needed since now regular event for local join is not
generated).
-     *
-     * @param evt Event.
-     * @param cache Cache.
-     */
-    public void onLocalJoin(DiscoveryEvent evt, DiscoCache cache) {
-        discoLsnr.onEvent(evt, cache);
-    }
-
     /** Discovery listener. */
     private final DiscoveryEventListener discoLsnr = new DiscoveryEventListener() {
         @Override public void onEvent(DiscoveryEvent evt, DiscoCache cache) {
@@ -301,7 +224,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
 
                     if (stateFinishMsg.clusterActive()) {
                         for (PendingDiscoveryEvent pendingEvt : pendingEvts) {
-                            log.info("Process pending event: " + pendingEvt.event());
+                            if (log.isDebugEnabled())
+                                log.debug("Process pending event: " + pendingEvt.event());
 
                             onDiscoveryEvent(pendingEvt.event(), pendingEvt.discoCache());
                         }
@@ -317,7 +241,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                 }
 
                 if (cache.state().transition()) {
-                    log.info("Add pending event: " + evt);
+                    if (log.isDebugEnabled())
+                        log.debug("Add pending event: " + evt);
 
                     pendingEvts.add(new PendingDiscoveryEvent(evt, cache));
                 }
@@ -353,9 +278,86 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
      * @param cache Discovery data cache.
      */
     private void processEventInactive(DiscoveryEvent evt, DiscoCache cache) {
-        log.info("Ignore event: " + evt);
+        if (log.isDebugEnabled())
+            log.debug("Ignore event, cluster is inactive: " + evt);
    }
 
+    /** {@inheritDoc} */
+    @Override protected void start0() throws IgniteCheckedException {
+        super.start0();
+
+        exchWorker = new ExchangeWorker();
+
+        cctx.gridEvents().addDiscoveryEventListener(discoLsnr, EVT_NODE_JOINED, EVT_NODE_LEFT,
EVT_NODE_FAILED,
+            EVT_DISCOVERY_CUSTOM_EVT);
+
+        cctx.io().addCacheHandler(0, GridDhtPartitionsSingleMessage.class,
+            new MessageHandler<GridDhtPartitionsSingleMessage>() {
+                @Override public void onMessage(ClusterNode node, GridDhtPartitionsSingleMessage
msg) {
+                    processSinglePartitionUpdate(node, msg);
+                }
+            });
+
+        cctx.io().addCacheHandler(0, GridDhtPartitionsFullMessage.class,
+            new MessageHandler<GridDhtPartitionsFullMessage>() {
+                @Override public void onMessage(ClusterNode node, GridDhtPartitionsFullMessage
msg) {
+                    processFullPartitionUpdate(node, msg);
+                }
+            });
+
+        cctx.io().addCacheHandler(0, GridDhtPartitionsSingleRequest.class,
+            new MessageHandler<GridDhtPartitionsSingleRequest>() {
+                @Override public void onMessage(ClusterNode node, GridDhtPartitionsSingleRequest
msg) {
+                    processSinglePartitionRequest(node, msg);
+                }
+            });
+
+        if (!cctx.kernalContext().clientNode()) {
+            for (int cnt = 0; cnt < cctx.gridConfig().getRebalanceThreadPoolSize(); cnt++)
{
+                final int idx = cnt;
+
+                cctx.io().addOrderedCacheGroupHandler(cctx, rebalanceTopic(cnt), new CI2<UUID,
GridCacheGroupIdMessage>() {
+                    @Override public void apply(final UUID id, final GridCacheGroupIdMessage
m) {
+                        if (!enterBusy())
+                            return;
+
+                        try {
+                            CacheGroupContext grp = cctx.cache().cacheGroup(m.groupId());
+
+                            if (grp != null) {
+                                if (m instanceof GridDhtPartitionSupplyMessage) {
+                                    grp.preloader().handleSupplyMessage(idx, id, (GridDhtPartitionSupplyMessage)
m);
+
+                                    return;
+                                }
+                                else if (m instanceof GridDhtPartitionDemandMessage) {
+                                    grp.preloader().handleDemandMessage(idx, id, (GridDhtPartitionDemandMessage)
m);
+
+                                    return;
+                                }
+                            }
+
+                            U.error(log, "Unsupported message type: " + m.getClass().getName());
+                        }
+                        finally {
+                            leaveBusy();
+                        }
+                    }
+                });
+            }
+        }
+    }
+
+    /**
+     * Callback for local join event (needed since regular event for local join is not generated).
+     *
+     * @param evt Event.
+     * @param cache Cache.
+     */
+    public void onLocalJoin(DiscoveryEvent evt, DiscoCache cache) {
+        discoLsnr.onEvent(evt, cache);
+    }
+
     /**
      * @param evt Event.
      * @param cache Discovery data cache.

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/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 f6292ec..624dec0 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
@@ -829,8 +829,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             return;
 
         try {
-            boolean checkConsistency =
-                !ctx.config().isDaemon() && !getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
+            boolean checkConsistency = !getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
 
             if (checkConsistency)
                 checkConsistency();
@@ -1738,7 +1737,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @param exchTopVer Current exchange version.
      * @throws IgniteCheckedException If failed.
      */
-    public void startCachesOnLocalJoin(List<T2<DynamicCacheDescriptor, NearCacheConfiguration>>
caches, AffinityTopologyVersion exchTopVer)
+    public void startCachesOnLocalJoin(List<T2<DynamicCacheDescriptor, NearCacheConfiguration>>
caches,
+        AffinityTopologyVersion exchTopVer)
         throws IgniteCheckedException {
         if (!F.isEmpty(caches)) {
             for (T2<DynamicCacheDescriptor, NearCacheConfiguration> t : caches) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StateChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StateChangeRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StateChangeRequest.java
index d10aa58..2d35e81 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StateChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StateChangeRequest.java
@@ -42,20 +42,29 @@ public class StateChangeRequest {
         this.topVer = topVer;
     }
 
+    /**
+     * @return State change exchange version.
+     */
     public AffinityTopologyVersion topologyVersion() {
         return topVer;
     }
 
+    /**
+     * @return State change request ID.
+     */
     public UUID requestId() {
         return msg.requestId();
     }
 
+    /**
+     * @return New state.
+     */
     public boolean activate() {
         return msg.activate();
     }
 
     /**
-     *
+     * @return Node initiated state change process.
      */
     public UUID initiatorNodeId() {
         return msg.initiatorNodeId();

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index d6d956c..c700ef4 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -470,7 +470,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     }
 
     /**
-     *
+     * @throws IgniteCheckedException If failed.
      */
     private void registrateMetricsMBean() throws IgniteCheckedException {
         try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateMessage.java
index 6cba0df..6579399 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ChangeGlobalStateMessage.java
@@ -38,7 +38,7 @@ public class ChangeGlobalStateMessage implements DiscoveryCustomMessage
{
     private IgniteUuid id = IgniteUuid.randomUuid();
 
     /** Request ID */
-    private UUID requestId;
+    private UUID reqId;
 
     /** Initiator node ID. */
     private UUID initiatingNodeId;
@@ -54,21 +54,21 @@ public class ChangeGlobalStateMessage implements DiscoveryCustomMessage
{
     private transient ExchangeActions exchangeActions;
 
     /**
-     * @param requestId State change request ID.
+     * @param reqId State change request ID.
      * @param initiatingNodeId Node initiated state change.
      * @param storedCfgs Configurations read from persistent store.
      * @param activate New cluster state.
      */
     public ChangeGlobalStateMessage(
-        UUID requestId,
+        UUID reqId,
         UUID initiatingNodeId,
         @Nullable List<StoredCacheData> storedCfgs,
         boolean activate
     ) {
-        assert requestId != null;
+        assert reqId != null;
         assert initiatingNodeId != null;
 
-        this.requestId = requestId;
+        this.reqId = reqId;
         this.initiatingNodeId = initiatingNodeId;
         this.storedCfgs = storedCfgs;
         this.activate = activate;
@@ -82,9 +82,9 @@ public class ChangeGlobalStateMessage implements DiscoveryCustomMessage
{
     }
 
     /**
-     * @return Cache updates to be executed on exchange.
+     * @return Cache updates to be executed on exchange. If {@code null} exchange is not
needed.
      */
-    public ExchangeActions exchangeActions() {
+    @Nullable public ExchangeActions exchangeActions() {
         return exchangeActions;
     }
 
@@ -130,7 +130,7 @@ public class ChangeGlobalStateMessage implements DiscoveryCustomMessage
{
      * @return State change request ID.
      */
     public UUID requestId() {
-        return requestId;
+        return reqId;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/DiscoveryDataClusterState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/DiscoveryDataClusterState.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/DiscoveryDataClusterState.java
index 1342000..71bf90b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/DiscoveryDataClusterState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/DiscoveryDataClusterState.java
@@ -28,7 +28,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
 
 /**
- *
+ * Discovery data related to cluster state.
  */
 public class DiscoveryDataClusterState implements Serializable {
     /** */
@@ -40,15 +40,15 @@ public class DiscoveryDataClusterState implements Serializable {
     /** */
     private final UUID transitionReqId;
 
-    /** */
+    /** Topology version for state change exchange. */
     @GridToStringInclude
     private final AffinityTopologyVersion transitionTopVer;
 
-    /** */
+    /** Nodes participating in state change exchange. */
     @GridToStringExclude
     private final Set<UUID> transitionNodes;
 
-    /** */
+    /** Local flag for state transition result (global state is updated asynchronously by
custom message). */
     private transient volatile Boolean transitionRes;
 
     /**
@@ -78,10 +78,10 @@ public class DiscoveryDataClusterState implements Serializable {
     }
 
     /**
-     * @param active
-     * @param transitionReqId
-     * @param transitionTopVer
-     * @param transitionNodes
+     * @param active New state.
+     * @param transitionReqId State change request ID.
+     * @param transitionTopVer State change topology version.
+     * @param transitionNodes Nodes participating in state change exchange.
      */
     private DiscoveryDataClusterState(boolean active,
         @Nullable UUID transitionReqId,
@@ -94,7 +94,7 @@ public class DiscoveryDataClusterState implements Serializable {
     }
 
     /**
-     * @return
+     * @return Local flag for state transition result (global state is updated asynchronously
by custom message).
      */
     @Nullable public Boolean transitionResult() {
         return transitionRes;

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/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 6963020..8cea13f 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
@@ -684,6 +684,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
 
     /**
      * @param activate Activate.
+     * @return Activate flag string.
      */
     private static String prettyStr(boolean activate) {
         return activate ? "activate" : "deactivate";

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
index ed0faef..675aca5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
@@ -53,7 +53,6 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
     /** Cache 2. */
     protected static final String cache2 = "cache2";
 
-    //Todo Cache with node filter.
     /** */
     protected static final String cache3 = "cache3";
 
@@ -61,77 +60,102 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
     protected static final String cache4 = "cache4";
 
     /** */
-    protected static final String cache5 = "cache5";
+    private static final String cache5 = "cache5";
 
     /** Caches info. */
-    public static final String CACHES_INFO = "cachesInfo";
+    private static final String CACHES_INFO = "cachesInfo";
 
     /** Registered caches. */
-    public static final String REGISTERED_CACHES = "registeredCaches";
+    private static final String REGISTERED_CACHES = "registeredCaches";
 
     /** Caches. */
     public static final String CACHES = "caches";
 
     /**
-     * @param ig Ig.
+     * @param ig Node.
+     * @return Cache descriptors.
      */
     protected static Map<String, DynamicCacheDescriptor> cacheDescriptors(IgniteEx
ig) {
         return field((Object)field(ig.context().cache(), CACHES_INFO), REGISTERED_CACHES);
     }
 
     /**
-     * @param ig Ig.
+     * @param ig Node.
+     * @return Node caches.
      */
     protected static Map<String, GridCacheAdapter> caches(IgniteEx ig){
         return field(ig.context().cache(), CACHES);
     }
 
     /**
-     *
+     * @return Test builder.
+     * @throws Exception If failed.
      */
     public abstract JoinNodeTestPlanBuilder withOutConfigurationTemplate() throws Exception;
 
     /**
-     *
+     * @return Test builder.
+     * @throws Exception If failed.
      */
     public abstract JoinNodeTestPlanBuilder staticCacheConfigurationOnJoinTemplate() throws
Exception;
 
     /**
-     *
+     * @return Test builder.
+     * @throws Exception If failed.
      */
     public abstract JoinNodeTestPlanBuilder staticCacheConfigurationInClusterTemplate() throws
Exception;
 
     /**
-     *
+     * @return Test builder.
+     * @throws Exception If failed.
      */
     public abstract JoinNodeTestPlanBuilder staticCacheConfigurationSameOnBothTemplate()
throws Exception;
 
     /**
-     *
+     * @return Test builder.
+     * @throws Exception If failed.
      */
     public abstract JoinNodeTestPlanBuilder staticCacheConfigurationDifferentOnBothTemplate()
throws Exception;
 
     // Client node join.
 
+    /**
+     * @return Test builder.
+     * @throws Exception If failed.
+     */
     public abstract JoinNodeTestPlanBuilder joinClientWithOutConfigurationTemplate() throws
Exception;
 
+    /**
+     * @return Test builder.
+     * @throws Exception If failed.
+     */
     public abstract JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationOnJoinTemplate()
throws Exception;
 
+    /**
+     * @return Test builder.
+     * @throws Exception If failed.
+     */
     public abstract JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationInClusterTemplate()
throws Exception;
 
+    /**
+     * @return Test builder.
+     * @throws Exception If failed.
+     */
     public abstract JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationSameOnBothTemplate()
throws Exception;
 
+    /**
+     * @return Test builder.
+     * @throws Exception If failed.
+     */
     public abstract JoinNodeTestPlanBuilder joinClientStaticCacheConfigurationDifferentOnBothTemplate()
throws Exception;
 
     /**
      * @throws Exception If failed.
-     *
      */
     public abstract void testJoinWithOutConfiguration() throws Exception;
 
     /**
      * @throws Exception If failed.
-     *
      */
     public abstract void testStaticCacheConfigurationOnJoin() throws Exception;
 
@@ -182,6 +206,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
      */
     public abstract void testJoinClientStaticCacheConfigurationDifferentOnBoth() throws Exception;
 
+    /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         super.beforeTest();
 
@@ -190,6 +215,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
     }
 
+    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         super.afterTest();
 
@@ -200,6 +226,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
 
     /**
      * @param idx Index.
+     * @return Ignite instance name.
      */
     protected String name(int idx) {
         return getTestIgniteInstanceName(idx);
@@ -207,6 +234,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
 
     /**
      * @param name Name.
+     * @return Igntie configuration.
+     * @throws Exception If failed.
      */
     protected IgniteConfiguration cfg(String name) throws Exception {
         try {
@@ -218,7 +247,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
     }
 
     /**
-     *
+     * @return Test builder.
      */
     protected JoinNodeTestPlanBuilder builder() {
         return JoinNodeTestPlanBuilder.builder();
@@ -226,13 +255,14 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
 
     /**
      * @param cfgs Cfgs.
+     * @return Configurations.
      */
-    protected static <T> T[] buildConfiguration(T... cfgs) {
+    private static <T> T[] buildConfiguration(T... cfgs) {
         return cfgs;
     }
 
     /**
-     *
+     * @return Cache configuration.
      */
     protected CacheConfiguration atomicCfg() {
         return new CacheConfiguration(cache1)
@@ -240,6 +270,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
     }
 
     /**
+     * @return Cache configuration.
      *
      */
     protected CacheConfiguration transactionCfg() {
@@ -248,7 +279,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
     }
 
     /**
-     *
+     * @return Cache configurations.
      */
     protected CacheConfiguration[] allCacheConfigurations() {
         return buildConfiguration(atomicCfg(), transactionCfg());
@@ -347,7 +378,9 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         private Runnable end = Noop;
 
         /**
-         *
+         * @param cfgs Configurations.
+         * @return Test builder.
+         * @throws Exception If failed.
          */
         public JoinNodeTestPlanBuilder clusterConfiguration(IgniteConfiguration... cfgs)
throws Exception {
             clusterCfg = cfgs;
@@ -375,7 +408,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @param cfg Configuration.
+         * @return Test builder.
          */
         public JoinNodeTestPlanBuilder nodeConfiguration(IgniteConfiguration cfg) {
             nodeCfg = cfg;
@@ -398,6 +432,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
 
         /**
          * @param func Func.
+         * @return Test builder.
          */
         public JoinNodeTestPlanBuilder nodeConfiguration(
             IgniteClosure<IgniteConfiguration, IgniteConfiguration> func
@@ -409,7 +444,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @param r Cluster start callback.
+         * @return Test builder.
          */
         public JoinNodeTestPlanBuilder afterClusterStarted(Runnable r) {
             strPlanBuilder.append("Check after cluster start\n");
@@ -420,7 +456,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @param r Node join callback.
+         * @return Test builder.
          */
         public JoinNodeTestPlanBuilder afterNodeJoin(Runnable r) {
             strPlanBuilder.append("Check after node join")
@@ -432,7 +469,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @param state State after join.
+         * @return Test builder.
          */
         public JoinNodeTestPlanBuilder stateAfterJoin(boolean state) {
             strPlanBuilder.append("Check state on all nodes after join, must be ")
@@ -445,7 +483,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @param r Activate callback.
+         * @return Test builder.
          */
         public JoinNodeTestPlanBuilder afterActivate(Runnable r) {
             strPlanBuilder.append("Check after activate")
@@ -457,7 +496,8 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @param r Deactivate callback.
+         * @return Test builder.
          */
         public JoinNodeTestPlanBuilder afterDeActivate(Runnable r) {
             strPlanBuilder.append("Check after deActivate")
@@ -468,6 +508,10 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
             return this;
         }
 
+        /**
+         * @param caches Callback.
+         * @return Test builder.
+         */
         public JoinNodeTestPlanBuilder dynamicCacheStart(IgniteCallable<List<CacheConfiguration>>
caches){
             strPlanBuilder.append("Dynamic caches start")
                 .append("\n");
@@ -477,6 +521,10 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
             return this;
         }
 
+        /**
+         * @param r Cache start callback.
+         * @return Test builder.
+         */
         public JoinNodeTestPlanBuilder afterDynamicCacheStarted(Runnable r){
             strPlanBuilder.append("Check after dynamic caches start")
                 .append("\n");
@@ -486,6 +534,10 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
             return this;
         }
 
+        /**
+         * @param caches Callback.
+         * @return Test builder.
+         */
         public JoinNodeTestPlanBuilder dynamicCacheStop(IgniteCallable<List<String>>
caches){
             strPlanBuilder.append("Dynamic caches stop")
                 .append("\n");
@@ -495,6 +547,10 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
             return this;
         }
 
+        /**
+         * @param r Callback.
+         * @return Test builder.
+         */
         public JoinNodeTestPlanBuilder afterDynamicCacheStopped(Runnable r){
             strPlanBuilder.append("Check after dynamic caches stop")
                 .append("\n");
@@ -506,6 +562,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
 
         /**
          * @param end End.
+         * @return Test builder.
          */
         public JoinNodeTestPlanBuilder setEnd(Runnable end) {
             strPlanBuilder.append("Check before stop")
@@ -517,7 +574,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @throws Exception If failed.
          */
         public void execute() throws Exception {
             try {
@@ -627,12 +684,19 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
             }
         }
 
+        /**
+         * @param ig Node.
+         * @return Next minor version.
+         */
         private AffinityTopologyVersion nextMinorVersion(IgniteEx ig){
             AffinityTopologyVersion cur = ig.context().discovery().topologyVersionEx();
 
-           return new AffinityTopologyVersion(cur.topologyVersion(), cur.minorTopologyVersion()
+ 1);
+           return cur.nextMinorVersion();
         }
 
+        /**
+         * @param ver Version.
+         */
         private void awaitTopologyVersion(final AffinityTopologyVersion ver){
             onAllNode(new CI1<IgniteEx>() {
                 @Override public void apply(IgniteEx ig) {
@@ -659,7 +723,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @return Started nodes.
          */
         protected List<IgniteEx> grids() {
             List<IgniteEx> res = new ArrayList<>();
@@ -671,14 +735,14 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @return Test builder.
          */
         public static JoinNodeTestPlanBuilder builder() {
             return new JoinNodeTestPlanBuilder();
         }
 
         /**
-         *
+         * @return Callback.
          */
         public Runnable checkCacheOnlySystem() {
             return onAllNode(new IgniteInClosure<IgniteEx>() {
@@ -702,7 +766,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @return Callback.
          */
         public Runnable checkCacheEmpty() {
             return onAllNode(new IgniteInClosure<IgniteEx>() {
@@ -718,7 +782,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
         }
 
         /**
-         *
+         * @return Callback.
          */
         public Runnable checkCacheNotEmpty() {
             return onAllNode(new IgniteInClosure<IgniteEx>() {
@@ -747,6 +811,7 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest
{
 
         /**
          * @param cls Closure.
+         * @return Callback.
          */
         private Runnable onAllNode(final IgniteInClosure<IgniteEx> cls) {
             return new Runnable() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
index dcca1ea..4e575cc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
@@ -117,6 +117,7 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
 
     /**
      * @param idx idx.
+     * @return Primary cluster node.
      */
     protected Ignite primary(int idx) {
         return nodes.get("node" + idx + primarySuffix);
@@ -124,20 +125,23 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
 
     /**
      * @param idx idx.
+     * @return Primary cluster client node.
      */
-    protected Ignite primaryClient(int idx) {
+    Ignite primaryClient(int idx) {
         return nodes.get("node" + idx + primarySuffix + clientSuffix);
     }
 
     /**
      * @param idx idx.
+     * @return Backup cluster node.
      */
-    protected Ignite backUp(int idx) {
+    Ignite backUp(int idx) {
         return nodes.get("node" + idx + backUpSuffix);
     }
 
     /**
      * @param idx idx.
+     * @return Backup cluster client node.
      */
     Ignite backUpClient(int idx) {
         return nodes.get("node" + idx + backUpSuffix + clientSuffix);
@@ -206,7 +210,7 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
      * @param cnt Count.
      * @throws Exception If failed.
      */
-    protected void startPrimaryClientNodes(int cnt) throws Exception {
+    void startPrimaryClientNodes(int cnt) throws Exception {
         for (int i = 0; i < cnt; i++) {
             String node = "node" + i;
 
@@ -229,7 +233,7 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
      * @param cnt Count.
      * @throws Exception If failed.
      */
-    protected void startBackUpClientNodes(int cnt) throws Exception {
+    private void startBackUpClientNodes(int cnt) throws Exception {
         for (int i = 0; i < cnt; i++) {
             String node = "node" + i;
 
@@ -248,9 +252,9 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
     }
 
     /**
-     *
+     * @return All nodes from backup cluster.
      */
-    protected Iterable<Ignite> allBackUpNodes() {
+    Iterable<Ignite> allBackUpNodes() {
         List<Ignite> r = new ArrayList<>();
 
         for (String name : this.nodes.keySet())
@@ -287,7 +291,7 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
     /**
      * @param i Idx.
      */
-    protected void stopPrimary(int i) {
+    void stopPrimary(int i) {
         String name = "node" + i + primarySuffix;
 
         nodes.get(name).close();
@@ -298,7 +302,7 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
     /**
      *
      */
-    protected void stopAllPrimary() {
+    void stopAllPrimary() {
         stopAll(primarySuffix);
     }
 
@@ -363,10 +367,9 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
     }
 
     /**
-     *
+     * @return Test class name.
      */
     protected String testName() {
         return getClass().getSimpleName();
     }
-
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/53e83f3b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
index 9f033e0..80bf1fb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
@@ -393,8 +393,6 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
             @Override public Void call() throws Exception {
                 IgniteCache cache = ig.cache("cache");
 
-                fail();
-
                 return null;
             }
         }, IgniteException.class, "Can not perform the operation because the cluster is inactive.");
@@ -478,6 +476,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
         assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
                 IgniteAtomicSequence seq = ig.atomicSequence("seq", 0, true);
+
                 return null;
             }
         }, IgniteException.class, "Can not perform the operation because the cluster is inactive.");


Mime
View raw message