You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2017/06/22 22:57:44 UTC

[25/50] [abbrv] helix git commit: Auto compress ZNode that are greater than 1MB

Auto compress ZNode that are greater than 1MB


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

Branch: refs/heads/master
Commit: c9216c48ea5b900a661fbc1ced7d2f41c8bed38d
Parents: 384978a
Author: kishoreg <ki...@apache.org>
Authored: Tue Mar 28 14:22:14 2017 -0700
Committer: kishoreg <ki...@apache.org>
Committed: Tue Mar 28 14:22:14 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/helix/manager/zk/ZNRecordSerializer.java  | 2 +-
 .../org/apache/helix/manager/zk/ZNRecordStreamingSerializer.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/c9216c48/helix-core/src/main/java/org/apache/helix/manager/zk/ZNRecordSerializer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZNRecordSerializer.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZNRecordSerializer.java
index f8d3160..75d9aa5 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZNRecordSerializer.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZNRecordSerializer.java
@@ -88,7 +88,7 @@ public class ZNRecordSerializer implements ZkSerializer {
       mapper.writeValue(baos, data);
       serializedBytes = baos.toByteArray();
       // apply compression if needed
-      if (record.getBooleanField("enableCompression", false)) {
+      if (record.getBooleanField("enableCompression", false) || serializedBytes.length > ZNRecord.SIZE_LIMIT) {
         serializedBytes = GZipCompressionUtil.compress(serializedBytes);
       }
     } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/helix/blob/c9216c48/helix-core/src/main/java/org/apache/helix/manager/zk/ZNRecordStreamingSerializer.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZNRecordStreamingSerializer.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZNRecordStreamingSerializer.java
index 53db50a..8f7402c 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZNRecordStreamingSerializer.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZNRecordStreamingSerializer.java
@@ -156,7 +156,7 @@ public class ZNRecordStreamingSerializer implements ZkSerializer {
       g.close();
       serializedBytes = baos.toByteArray();
       // apply compression if needed
-      if (record.getBooleanField("enableCompression", false)) {
+      if (record.getBooleanField("enableCompression", false) || serializedBytes.length > ZNRecord.SIZE_LIMIT) {
         serializedBytes = GZipCompressionUtil.compress(serializedBytes);
       }
     } catch (Exception e) {