ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: #ignite-286: refactoring.
Date Mon, 27 Apr 2015 14:58:14 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-286 83f972149 -> f19cb584d


#ignite-286: refactoring.


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

Branch: refs/heads/ignite-286
Commit: f19cb584d2c30c01a75cae717cc24bc59370cb7d
Parents: 83f9721
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Mon Apr 27 17:58:06 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Mon Apr 27 17:58:06 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheSwapManager.java   | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f19cb584/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index 208f1a8..0f23e07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -1626,16 +1626,25 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter
{
      * @return Partitions.
      */
     private int[] partitions(boolean primary, boolean backup) {
-        if (primary && backup)
-            return cctx.grid().affinity(cctx.name()).allPartitions(cctx.localNode());
+        AffinityTopologyVersion ver = cctx.affinity().affinityTopologyVersion();
+
+        Set<Integer> parts = null;
+
+        if (primary && backup) {
+            int[] primaryParts = U.toIntArray(cctx.affinity().primaryPartitions(cctx.localNodeId(),
ver));
+
+            int[] backupParts = U.toIntArray(cctx.affinity().backupPartitions(cctx.localNodeId(),
ver));
+
+            return U.addAll(primaryParts, backupParts);
+        }
 
         if (primary)
-            return cctx.grid().affinity(cctx.name()).primaryPartitions(cctx.localNode());
+            parts = cctx.affinity().primaryPartitions(cctx.localNodeId(), ver);
 
         if (backup)
-            return cctx.grid().affinity(cctx.name()).backupPartitions(cctx.localNode());
+            parts = cctx.affinity().backupPartitions(cctx.localNodeId(), ver);
 
-        return new int[0];
+        return parts != null ? U.toIntArray(parts)  : new int[0];
     }
 
     /**


Mime
View raw message