ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [5/7] ignite git commit: ignite-1016 Rendezvous affinity function fixed
Date Tue, 13 Oct 2015 16:41:57 GMT
ignite-1016 Rendezvous affinity function fixed


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

Branch: refs/heads/pull-80-head
Commit: 8f718a22275fc552dc79703991c4601570608fe5
Parents: ae32d86
Author: agura <agura@gridgain.com>
Authored: Sun Sep 13 22:49:26 2015 +0300
Committer: agura <agura@gridgain.com>
Committed: Sun Sep 13 22:49:26 2015 +0300

----------------------------------------------------------------------
 .../ClientAbstractMultiThreadedSelfTest.java       |  2 +-
 .../ClientAbstractMultiNodeSelfTest.java           |  2 +-
 .../rendezvous/RendezvousAffinityFunction.java     | 15 ++-------------
 .../cache/CrossCacheTxRandomOperationsTest.java    |  4 ++--
 .../cache/GridCacheAbstractLocalStoreSelfTest.java |  4 ++--
 .../GridCacheConfigurationConsistencySelfTest.java | 17 -----------------
 .../dht/GridCacheDhtPreloadPutGetSelfTest.java     |  2 +-
 ...RendezvousAffinityMultiNodeFullApiSelfTest.java |  2 +-
 .../cache/IgniteCacheAbstractQuerySelfTest.java    |  2 +-
 9 files changed, 11 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8f718a22/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
index aa943b5..9f6bf2b 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
@@ -194,7 +194,7 @@ public abstract class ClientAbstractMultiThreadedSelfTest extends GridCommonAbst
     private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception
{
         CacheConfiguration cfg = defaultCacheConfiguration();
 
-        cfg.setAffinity(new RendezvousAffinityFunction(false));
+        cfg.setAffinity(new RendezvousAffinityFunction());
 
         cfg.setAtomicityMode(TRANSACTIONAL);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f718a22/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
index c496f8b..5e5a68d 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
@@ -222,7 +222,7 @@ public abstract class ClientAbstractMultiNodeSelfTest extends GridCommonAbstract
 
         cfg.setWriteSynchronizationMode(REPLICATED_ASYNC_CACHE_NAME.equals(cacheName) ? FULL_ASYNC
: FULL_SYNC);
 
-        cfg.setAffinity(new RendezvousAffinityFunction(false));
+        cfg.setAffinity(new RendezvousAffinityFunction());
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f718a22/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
index 797fd3c..cfc7d06 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
@@ -363,20 +363,9 @@ public class RendezvousAffinityFunction implements AffinityFunction,
Externaliza
 
         Collections.sort(lst, COMPARATOR);
 
-        int primaryAndBackups;
+        int primaryAndBackups = backups == Integer.MAX_VALUE ? nodes.size() : Math.min(backups
+ 1, nodes.size());
 
-        List<ClusterNode> res;
-
-        if (backups == Integer.MAX_VALUE) {
-            primaryAndBackups = Integer.MAX_VALUE;
-
-            res = new ArrayList<>();
-        }
-        else {
-            primaryAndBackups = backups + 1;
-
-            res = new ArrayList<>(primaryAndBackups);
-        }
+        List<ClusterNode> res = new ArrayList<>(primaryAndBackups);
 
         ClusterNode primary = lst.get(0).get2();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f718a22/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
index aa59216..cedb693 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
@@ -124,7 +124,7 @@ public class CrossCacheTxRandomOperationsTest extends GridCommonAbstractTest
{
     /**
      * @throws Exception If failed.
      */
-    public void _testCrossCacheTxOperationsFairAffinity() throws Exception {
+    public void testCrossCacheTxOperationsFairAffinity() throws Exception {
         txOperations(PARTITIONED, FULL_SYNC, true, true);
     }
 
@@ -163,7 +163,7 @@ public class CrossCacheTxRandomOperationsTest extends GridCommonAbstractTest
{
         if (cacheMode == PARTITIONED)
             ccfg.setBackups(1);
 
-        ccfg.setAffinity(fairAff ? new FairAffinityFunction(false) : new RendezvousAffinityFunction(false));
+        ccfg.setAffinity(fairAff ? new FairAffinityFunction() : new RendezvousAffinityFunction());
 
         return ccfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f718a22/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
index 79e7182..3e12ebf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
@@ -97,11 +97,11 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
 
         CacheConfiguration cacheCfg = cache(gridName, null, 0);
 
-        cacheCfg.setAffinity(new RendezvousAffinityFunction(false));
+        cacheCfg.setAffinity(new RendezvousAffinityFunction());
 
         CacheConfiguration cacheBackupCfg = cache(gridName, BACKUP_CACHE, 2);
 
-        cacheBackupCfg.setAffinity(new RendezvousAffinityFunction(false));
+        cacheBackupCfg.setAffinity(new RendezvousAffinityFunction());
 
         cfg.setCacheConfiguration(cacheCfg, cacheBackupCfg);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f718a22/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
index 31e34bb..e28e89f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
@@ -806,23 +806,6 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
     public void testAffinityForReplicatedCache() throws Exception {
         cacheEnabled = true;
 
-        aff = new FairAffinityFunction(); // Check cannot use FairAffinityFunction.
-
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                return startGrid(1);
-            }
-        }, IgniteCheckedException.class, null);
-
-        aff = new RendezvousAffinityFunction(true); // Check cannot set 'excludeNeighbors'
flag.
-        backups = Integer.MAX_VALUE;
-
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                return startGrid(1);
-            }
-        }, IgniteCheckedException.class, null);
-
         aff = new RendezvousAffinityFunction(false, 100);
 
         startGrid(1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f718a22/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
index dcc7223..c12e1ba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
@@ -77,7 +77,7 @@ public class GridCacheDhtPreloadPutGetSelfTest extends GridCommonAbstractTest
{
         cacheCfg.setRebalanceMode(preloadMode);
         cacheCfg.setBackups(backups);
 
-        cacheCfg.setAffinity(new RendezvousAffinityFunction(false));
+        cacheCfg.setAffinity(new RendezvousAffinityFunction());
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f718a22/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/CacheReplicatedRendezvousAffinityMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/CacheReplicatedRendezvousAffinityMultiNodeFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/CacheReplicatedRendezvousAffinityMultiNodeFullApiSelfTest.java
index da7fd41..c6900a5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/CacheReplicatedRendezvousAffinityMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/CacheReplicatedRendezvousAffinityMultiNodeFullApiSelfTest.java
@@ -29,7 +29,7 @@ public class CacheReplicatedRendezvousAffinityMultiNodeFullApiSelfTest
     @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception
{
         CacheConfiguration cfg = super.cacheConfiguration(gridName);
 
-        cfg.setAffinity(new RendezvousAffinityFunction(false));
+        cfg.setAffinity(new RendezvousAffinityFunction());
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f718a22/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index 2a00973..42173e3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@ -179,7 +179,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
                 UUID.class, Person.class,
                 IgniteCacheReplicatedQuerySelfTest.CacheKey.class, IgniteCacheReplicatedQuerySelfTest.CacheValue.class
             );
-            cc.setAffinity(new RendezvousAffinityFunction(false));
+            cc.setAffinity(new RendezvousAffinityFunction());
 
             // Explicitly set number of backups equal to number of grids.
             if (cacheMode() == CacheMode.PARTITIONED)


Mime
View raw message