ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [3/5] ignite git commit: 5578
Date Tue, 25 Jul 2017 15:10:07 GMT
5578


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

Branch: refs/heads/ignite-5578
Commit: e11355a93a5a9c6eff3923bbcd572043aae4ccc1
Parents: ccb855e
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Jul 24 19:30:54 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Jul 25 11:20:43 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/ExchangeContext.java       |  8 ++++-
 .../GridCachePartitionExchangeManager.java      |  6 +---
 .../GridDhtPartitionsExchangeFuture.java        | 12 ++++----
 .../distributed/CacheExchangeMergeTest.java     | 32 ++++++++++++--------
 4 files changed, 34 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e11355a9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeContext.java
index 1f5d3ba..70c896e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeContext.java
@@ -19,11 +19,13 @@ package org.apache.ignite.internal.processors.cache;
 
 import java.util.HashSet;
 import java.util.Set;
+import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.events.DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT;
+import static org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager.exchangeProtocolVersion;
 
 /**
  *
@@ -45,7 +47,7 @@ public class ExchangeContext {
      * @param fut Exchange future.
      */
     public ExchangeContext(GridDhtPartitionsExchangeFuture fut) {
-        int protocolVer = GridCachePartitionExchangeManager.exchangeProtocolVersion(
+        int protocolVer = exchangeProtocolVersion(
             fut.discoCache().minimumNodeVersion());
 
         fetchAffOnJoin = protocolVer == 1;
@@ -55,6 +57,10 @@ public class ExchangeContext {
         evts = new ExchangeDiscoveryEvents(fut);
     }
 
+    boolean supportsMergeExchanges(ClusterNode node) {
+        return exchangeProtocolVersion(node.version()) > 1;
+    }
+
     /**
      * @return Discovery events.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/e11355a9/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 b2cf940..d991599 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
@@ -1748,10 +1748,6 @@ public class GridCachePartitionExchangeManager<K, V> extends
GridCacheSharedMana
             ((IgniteDiagnosticAware)fut).addDiagnosticRequest(ctx);
     }
 
-    private boolean supportsMergeExchanges(ClusterNode node) {
-        return exchangeProtocolVersion(node.version()) > 1;
-    }
-
     /** */
     private volatile AffinityTopologyVersion exchMergeTestWaitVer;
 
@@ -1870,7 +1866,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
 
                     ClusterNode node = evt.eventNode();
 
-                    if (!supportsMergeExchanges(node)) {
+                    if (!curFut.context().supportsMergeExchanges(node)) {
                         log.info("Stop merge, node does not support merge: " + node);
 
                         break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/e11355a9/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 34ebe41..b5fc0e7 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
@@ -2181,14 +2181,14 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
 
                     grp.topology().beforeExchange(this, true);
                 }
-            }
 
-            synchronized (this) {
-                if (mergedJoinExchMsgs != null) {
-                    for (Map.Entry<UUID, GridDhtPartitionsSingleMessage> e : mergedJoinExchMsgs.entrySet())
{
-                        msgs.put(e.getKey(), e.getValue());
+                synchronized (this) {
+                    if (mergedJoinExchMsgs != null) {
+                        for (Map.Entry<UUID, GridDhtPartitionsSingleMessage> e : mergedJoinExchMsgs.entrySet())
{
+                            msgs.put(e.getKey(), e.getValue());
 
-                        updatePartitionSingleMap(e.getKey(), e.getValue());
+                            updatePartitionSingleMap(e.getKey(), e.getValue());
+                        }
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e11355a9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheExchangeMergeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheExchangeMergeTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheExchangeMergeTest.java
index 7359bde..6d45ae8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheExchangeMergeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheExchangeMergeTest.java
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -59,6 +60,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.*;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
 /**
@@ -74,6 +76,9 @@ public class CacheExchangeMergeTest extends GridCommonAbstractTest {
     /** */
     private boolean testSpi;
 
+    /** */
+    private static String[] cacheNames = {"c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8",
"c9", "c10"};
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws
Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
@@ -92,14 +97,16 @@ public class CacheExchangeMergeTest extends GridCommonAbstractTest {
         }
 
         cfg.setCacheConfiguration(
-            cacheConfiguration("c1", ATOMIC, 0),
-            cacheConfiguration("c2", ATOMIC, 1),
-            cacheConfiguration("c3", ATOMIC, 2),
-            cacheConfiguration("c4", ATOMIC, 10),
-            cacheConfiguration("c5", TRANSACTIONAL, 0),
-            cacheConfiguration("c6", TRANSACTIONAL, 1),
-            cacheConfiguration("c7", TRANSACTIONAL, 2),
-            cacheConfiguration("c8", TRANSACTIONAL, 10));
+            cacheConfiguration("c1", ATOMIC, PARTITIONED, 0),
+            cacheConfiguration("c2", ATOMIC, PARTITIONED, 1),
+            cacheConfiguration("c3", ATOMIC, PARTITIONED, 2),
+            cacheConfiguration("c4", ATOMIC, PARTITIONED, 10),
+            cacheConfiguration("c5", ATOMIC, REPLICATED, 0),
+            cacheConfiguration("c6", TRANSACTIONAL, PARTITIONED, 0),
+            cacheConfiguration("c7", TRANSACTIONAL, PARTITIONED, 1),
+            cacheConfiguration("c8", TRANSACTIONAL, PARTITIONED, 2),
+            cacheConfiguration("c9", TRANSACTIONAL, PARTITIONED, 10),
+            cacheConfiguration("c10", TRANSACTIONAL, REPLICATED, 0));
 
         return cfg;
     }
@@ -117,12 +124,15 @@ public class CacheExchangeMergeTest extends GridCommonAbstractTest {
      * @param backups Number of backups.
      * @return Cache configuration.
      */
-    private CacheConfiguration cacheConfiguration(String name, CacheAtomicityMode atomicityMode,
int backups) {
+    private CacheConfiguration cacheConfiguration(String name, CacheAtomicityMode atomicityMode,
CacheMode cacheMode, int backups) {
         CacheConfiguration ccfg = new CacheConfiguration(name);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setBackups(backups);
+        ccfg.setCacheMode(cacheMode);
+
+        if (cacheMode == PARTITIONED)
+            ccfg.setBackups(backups);
 
         return ccfg;
     }
@@ -713,8 +723,6 @@ public class CacheExchangeMergeTest extends GridCommonAbstractTest {
      * @param node Node.
      */
     private void checkNodeCaches(Ignite node) {
-        String[] cacheNames = {"c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8"};
-
         ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
         for (String cacheName : cacheNames) {


Mime
View raw message