Repository: helix
Updated Branches:
  refs/heads/helix-0.6.x 384978a2e -> c9216c48e


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/helix-0.6.x
Commit: c9216c48ea5b900a661fbc1ced7d2f41c8bed38d
Parents: 384978a
Author: kishoreg <[email protected]>
Authored: Tue Mar 28 14:22:14 2017 -0700
Committer: kishoreg <[email protected]>
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) {

Reply via email to