ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [22/27] incubator-ignite git commit: #Reduced exchange map size.
Date Fri, 13 Feb 2015 06:11:44 GMT
#Reduced exchange map size.


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

Branch: refs/heads/ignite-238
Commit: b778387cb1bb21155ffc37977b2b4779e70f45cd
Parents: 36ecaff
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Thu Feb 12 16:49:40 2015 -0800
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Thu Feb 12 16:49:40 2015 -0800

----------------------------------------------------------------------
 .../dht/preloader/GridDhtPartitionMap.java      | 32 ++++++++++++-
 .../preloader/GridDhtPartitionsFullMessage.java | 47 +-------------------
 2 files changed, 32 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b778387c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
index 8e6be93..0a2a1bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
@@ -118,7 +118,26 @@ public class GridDhtPartitionMap extends HashMap<Integer, GridDhtPartitionState>
 
         out.writeLong(updateSeq);
 
-        U.writeMap(out, this);
+        int size = size();
+
+        out.writeInt(size);
+
+        int i = 0;
+
+        for (Map.Entry<Integer, GridDhtPartitionState> entry : entrySet()) {
+            int ordinal = entry.getValue().ordinal();
+
+            assert ordinal == (ordinal & 0x3);
+            assert entry.getKey() == (entry.getKey() & 0x3FFF);
+
+            int coded = (ordinal << 14) | entry.getKey();
+
+            out.writeShort((short)coded);
+
+            i++;
+        }
+
+        assert i == size;
     }
 
     /** {@inheritDoc} */
@@ -127,7 +146,16 @@ public class GridDhtPartitionMap extends HashMap<Integer, GridDhtPartitionState>
 
         updateSeq = in.readLong();
 
-        putAll(U.<Integer, GridDhtPartitionState>readMap(in));
+        int size = in.readInt();
+
+        for (int i = 0; i < size; i++) {
+            int entry = in.readShort() & 0xFFFF;
+
+            int part = entry & 0x3FFF;
+            int ordinal = entry >> 14;
+
+            put(part, GridDhtPartitionState.fromOrdinal(ordinal));
+        }
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b778387c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
index d8dd3b1..feb5580 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed.dht.preloader;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.version.*;
@@ -49,12 +48,6 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac
     /** Topology version. */
     private long topVer;
 
-    @GridDirectTransient
-    private List<List<ClusterNode>> affAssignment;
-
-    /** */
-    private byte[] affAssignmentBytes;
-
     /**
      * Required by {@link Externalizable}.
      */
@@ -98,9 +91,6 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac
 
         if (parts != null)
             partsBytes = ctx.marshaller().marshal(parts);
-
-        if (affAssignment != null)
-            affAssignmentBytes = ctx.marshaller().marshal(affAssignment);
     }
 
     /**
@@ -117,29 +107,12 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac
         this.topVer = topVer;
     }
 
-    /**
-     * @return Affinity assignment for topology version.
-     */
-    public List<List<ClusterNode>> affinityAssignment() {
-        return affAssignment;
-    }
-
-    /**
-     * @param affAssignment Affinity assignment for topology version.
-     */
-    public void affinityAssignment(List<List<ClusterNode>> affAssignment) {
-        this.affAssignment = affAssignment;
-    }
-
     /** {@inheritDoc} */
     @Override public void finishUnmarshal(GridCacheSharedContext<K, V> ctx, ClassLoader
ldr) throws IgniteCheckedException {
         super.finishUnmarshal(ctx, ldr);
 
         if (partsBytes != null)
             parts = ctx.marshaller().unmarshal(partsBytes, ldr);
-
-        if (affAssignmentBytes != null)
-            affAssignment = ctx.marshaller().unmarshal(affAssignmentBytes, ldr);
     }
 
     /** {@inheritDoc} */
@@ -161,8 +134,6 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac
         _clone.parts = parts;
         _clone.partsBytes = partsBytes;
         _clone.topVer = topVer;
-        _clone.affAssignment = affAssignment;
-        _clone.affAssignmentBytes = affAssignmentBytes;
     }
 
     /** {@inheritDoc} */
@@ -182,18 +153,12 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac
 
         switch (state) {
             case 5:
-                if (!writer.writeByteArray("affAssignmentBytes", affAssignmentBytes))
-                    return false;
-
-                state++;
-
-            case 6:
                 if (!writer.writeByteArray("partsBytes", partsBytes))
                     return false;
 
                 state++;
 
-            case 7:
+            case 6:
                 if (!writer.writeLong("topVer", topVer))
                     return false;
 
@@ -214,14 +179,6 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac
 
         switch (state) {
             case 5:
-                affAssignmentBytes = reader.readByteArray("affAssignmentBytes");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                state++;
-
-            case 6:
                 partsBytes = reader.readByteArray("partsBytes");
 
                 if (!reader.isLastRead())
@@ -229,7 +186,7 @@ public class GridDhtPartitionsFullMessage<K, V> extends GridDhtPartitionsAbstrac
 
                 state++;
 
-            case 7:
+            case 6:
                 topVer = reader.readLong("topVer");
 
                 if (!reader.isLastRead())


Mime
View raw message