ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-4154
Date Thu, 03 Nov 2016 06:49:26 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-4154 0f9843ebb -> 6ac53178e


ignite-4154


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

Branch: refs/heads/ignite-4154
Commit: 6ac53178e191e05e7a01f8def652c19a3413d8de
Parents: 0f9843e
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Nov 3 09:49:26 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Nov 3 09:49:26 2016 +0300

----------------------------------------------------------------------
 .../preloader/GridDhtPartitionsFullMessage.java | 40 +++++++++++++-------
 .../GridDhtPartitionsSingleMessage.java         | 40 +++++++++++++-------
 .../ignite/internal/util/IgniteUtils.java       |  5 +++
 3 files changed, 57 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6ac53178/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 ea51f6b..63d63e2 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
@@ -140,25 +140,37 @@ public class GridDhtPartitionsFullMessage extends GridDhtPartitionsAbstractMessa
     @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException
{
         super.prepareMarshal(ctx);
 
-        if (parts != null && partsBytes == null)
-            partsBytes = U.marshal(ctx, parts);
+        boolean marshal = (parts != null && partsBytes == null) || (partCntrs !=
null && partCntrsBytes == null);
 
-        if (partCntrs != null && partCntrsBytes == null)
-            partCntrsBytes = U.marshal(ctx, partCntrs);
+        if (marshal) {
+            byte[] partsBytes0 = null;
+            byte[] partCntrsBytes0 = null;
 
-        if (compress && !compressed()) {
-            try {
-                byte[] partsBytesZip = U.zip(partsBytes);
-                byte[] partCntrsBytesZip = U.zip(partCntrsBytes);
+            if (parts != null && partsBytes == null)
+                partsBytes0 = U.marshal(ctx, parts);
 
-                partsBytes = partsBytesZip;
-                partCntrsBytes = partCntrsBytesZip;
+            if (partCntrs != null && partCntrsBytes == null)
+                partCntrsBytes0 = U.marshal(ctx, partCntrs);
 
-                compressed(true);
-            }
-            catch (IgniteCheckedException e) {
-                U.error(ctx.logger(getClass()), "Failed to compress partitions data: " +
e, e);
+            if (compress) {
+                assert !compressed();
+
+                try {
+                    byte[] partsBytesZip = U.zip(partsBytes0);
+                    byte[] partCntrsBytesZip = U.zip(partCntrsBytes0);
+
+                    partsBytes0 = partsBytesZip;
+                    partCntrsBytes0 = partCntrsBytesZip;
+
+                    compressed(true);
+                }
+                catch (IgniteCheckedException e) {
+                    U.error(ctx.logger(getClass()), "Failed to compress partitions data:
" + e, e);
+                }
             }
+
+            partsBytes = partsBytes0;
+            partCntrsBytes = partCntrsBytes0;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ac53178/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
index fdfc485..a37e092 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
@@ -141,25 +141,37 @@ public class GridDhtPartitionsSingleMessage extends GridDhtPartitionsAbstractMes
     @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException
{
         super.prepareMarshal(ctx);
 
-        if (partsBytes == null && parts != null)
-            partsBytes = U.marshal(ctx, parts);
+        boolean marshal = (parts != null && partsBytes == null) || (partCntrs !=
null && partCntrsBytes == null);
 
-        if (partCntrsBytes == null && partCntrs != null)
-            partCntrsBytes = U.marshal(ctx, partCntrs);
+        if (marshal) {
+            byte[] partsBytes0 = null;
+            byte[] partCntrsBytes0 = null;
 
-        if (compress && !compressed()) {
-            try {
-                byte[] partsBytesZip = U.zip(partsBytes);
-                byte[] partCntrsBytesZip = U.zip(partCntrsBytes);
+            if (parts != null && partsBytes == null)
+                partsBytes0 = U.marshal(ctx, parts);
 
-                partsBytes = partsBytesZip;
-                partCntrsBytes = partCntrsBytesZip;
+            if (partCntrs != null && partCntrsBytes == null)
+                partCntrsBytes0 = U.marshal(ctx, partCntrs);
 
-                compressed(true);
-            }
-            catch (IgniteCheckedException e) {
-                U.error(ctx.logger(getClass()), "Failed to compress partitions data: " +
e, e);
+            if (compress) {
+                assert !compressed();
+
+                try {
+                    byte[] partsBytesZip = U.zip(partsBytes0);
+                    byte[] partCntrsBytesZip = U.zip(partCntrsBytes0);
+
+                    partsBytes0 = partsBytesZip;
+                    partCntrsBytes0 = partCntrsBytesZip;
+
+                    compressed(true);
+                }
+                catch (IgniteCheckedException e) {
+                    U.error(ctx.logger(getClass()), "Failed to compress partitions data:
" + e, e);
+                }
             }
+
+            partsBytes = partsBytes0;
+            partCntrsBytes = partCntrsBytes0;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6ac53178/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index da4edc0..544b809 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -9904,6 +9904,11 @@ public abstract class IgniteUtils {
             LOC_IGNITE_NAME.set(oldName);
     }
 
+    /**
+     * @param bytes Byte array to compress.
+     * @return Compressed bytes.
+     * @throws IgniteCheckedException If failed.
+     */
     public static byte[] zip(@Nullable byte[] bytes) throws IgniteCheckedException {
         try {
             if (bytes == null)


Mime
View raw message