ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [2/8] incubator-ignite git commit: IGNITE-1265 - Rebuilt messages.
Date Wed, 19 Aug 2015 12:21:16 GMT
IGNITE-1265 - Rebuilt messages.


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

Branch: refs/heads/ignite-1.3.3-p3
Commit: 574c6793adb96caa614b9c0c540f4812cfc52ee5
Parents: 7a43dde
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Tue Aug 18 11:11:43 2015 -0700
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Tue Aug 18 11:11:43 2015 -0700

----------------------------------------------------------------------
 .../processors/cache/GridCacheUtils.java        | 11 +++++---
 .../distributed/dht/GridDhtTxPrepareFuture.java |  6 ++--
 .../dht/GridDhtTxPrepareResponse.java           | 29 +++++++++++++++-----
 3 files changed, 32 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/574c6793/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 1e3cd67..80e0d69 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1684,15 +1684,18 @@ public class GridCacheUtils {
      * @param partsMap Cache ID to partition IDs collection map.
      * @return Cache ID to partition ID array map.
      */
-    public static Map<Integer, Integer[]> convertInvalidPartitions(Map<Integer,
Set<Integer>> partsMap) {
-        Map<Integer, Integer[]> res = new HashMap<>(partsMap.size());
+    public static Map<Integer, int[]> convertInvalidPartitions(Map<Integer, Set<Integer>>
partsMap) {
+        Map<Integer, int[]> res = new HashMap<>(partsMap.size());
 
         for (Map.Entry<Integer, Set<Integer>> entry : partsMap.entrySet()) {
             Set<Integer> parts = entry.getValue();
 
-            Integer[] partsArray = new Integer[parts.size()];
+            int[] partsArray = new int[parts.size()];
 
-            partsArray = parts.toArray(partsArray);
+            int idx = 0;
+
+            for (Integer part : parts)
+                partsArray[idx++] = part;
 
             res.put(entry.getKey(), partsArray);
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/574c6793/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 27de8cf..2b7e1bc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -1212,14 +1212,14 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
 
                 // Process invalid partitions (no need to remap).
                 if (!F.isEmpty(res.invalidPartitionsByCacheId())) {
-                    Map<Integer, Integer[]> invalidPartsMap = res.invalidPartitionsByCacheId();
+                    Map<Integer, int[]> invalidPartsMap = res.invalidPartitionsByCacheId();
 
                     for (Iterator<IgniteTxEntry> it = dhtMapping.entries().iterator();
it.hasNext();) {
                         IgniteTxEntry entry  = it.next();
 
-                        Integer[] invalidParts = invalidPartsMap.get(entry.cacheId());
+                        int[] invalidParts = invalidPartsMap.get(entry.cacheId());
 
-                        if (F.contains(invalidParts, entry.cached().partition())) {
+                        if (invalidParts != null && F.contains(invalidParts, entry.cached().partition()))
{
                             it.remove();
 
                             if (log.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/574c6793/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
index cc85628..bcf7f8b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
@@ -56,7 +56,8 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse
{
     private Collection<Integer> invalidParts;
 
     /** Invalid partitions by cache ID. */
-    private Map<Integer, Integer[]> invalidPartsByCacheId;
+    @GridDirectMap(keyType = Integer.class, valueType = int[].class)
+    private Map<Integer, int[]> invalidPartsByCacheId;
 
     /** Preload entries. */
     @GridDirectCollection(GridCacheEntryInfo.class)
@@ -145,7 +146,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse
{
     /**
      * @return Map from cacheId to an array of invalid partitions.
      */
-    public Map<Integer, Integer[]> invalidPartitionsByCacheId() {
+    public Map<Integer, int[]> invalidPartitionsByCacheId() {
         return invalidPartsByCacheId;
     }
 
@@ -255,18 +256,24 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse
{
                 writer.incrementState();
 
             case 10:
-                if (!writer.writeIgniteUuid("miniId", miniId))
+                if (!writer.writeMap("invalidPartsByCacheId", invalidPartsByCacheId, MessageCollectionItemType.INT,
MessageCollectionItemType.INT_ARR))
                     return false;
 
                 writer.incrementState();
 
             case 11:
-                if (!writer.writeCollection("nearEvicted", nearEvicted, MessageCollectionItemType.MSG))
+                if (!writer.writeIgniteUuid("miniId", miniId))
                     return false;
 
                 writer.incrementState();
 
             case 12:
+                if (!writer.writeCollection("nearEvicted", nearEvicted, MessageCollectionItemType.MSG))
+                    return false;
+
+                writer.incrementState();
+
+            case 13:
                 if (!writer.writeCollection("preloadEntries", preloadEntries, MessageCollectionItemType.MSG))
                     return false;
 
@@ -305,7 +312,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse
{
                 reader.incrementState();
 
             case 10:
-                miniId = reader.readIgniteUuid("miniId");
+                invalidPartsByCacheId = reader.readMap("invalidPartsByCacheId", MessageCollectionItemType.INT,
MessageCollectionItemType.INT_ARR, false);
 
                 if (!reader.isLastRead())
                     return false;
@@ -313,7 +320,7 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse
{
                 reader.incrementState();
 
             case 11:
-                nearEvicted = reader.readCollection("nearEvicted", MessageCollectionItemType.MSG);
+                miniId = reader.readIgniteUuid("miniId");
 
                 if (!reader.isLastRead())
                     return false;
@@ -321,6 +328,14 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse
{
                 reader.incrementState();
 
             case 12:
+                nearEvicted = reader.readCollection("nearEvicted", MessageCollectionItemType.MSG);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 13:
                 preloadEntries = reader.readCollection("preloadEntries", MessageCollectionItemType.MSG);
 
                 if (!reader.isLastRead())
@@ -340,6 +355,6 @@ public class GridDhtTxPrepareResponse extends GridDistributedTxPrepareResponse
{
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 13;
+        return 14;
     }
 }


Mime
View raw message