pkuwm commented on a change in pull request #809: Add system property options 
to config auto compression
URL: https://github.com/apache/helix/pull/809#discussion_r384862115
 
 

 ##########
 File path: 
zookeeper-api/src/main/java/org/apache/helix/zookeeper/datamodel/serializer/ZNRecordSerializer.java
 ##########
 @@ -86,7 +98,8 @@ private static int getListFieldBound(ZNRecord record) {
       mapper.writeValue(baos, data);
       serializedBytes = baos.toByteArray();
       // apply compression if needed
-      if (record.getBooleanField("enableCompression", false) || 
serializedBytes.length > ZNRecord.SIZE_LIMIT) {
+      if (record.getBooleanField("enableCompression", false) || 
(autoCompressionEnabled
+          && serializedBytes.length > autoCompressionThreshold)) {
 
 Review comment:
   @jiajunwang Actually I don't think it could go the ZNRecord as you said. We 
actually have 2 conditions:
   ```
   if (record.getBooleanField("enableCompression", false) || 
(autoCompressionEnabled
              && serializedBytes.length > autoCompressionThreshold))
   ```
   We can not only rely on the configs of `enableCompression` and 
`autoCompressionEnabled`, but also the serializedBytes' length. Current 
behavior is that if enableCompression is enabled, we ignore length. If 
enableCompression is disabled, we still have to check the length.
   
   We can't simply do 
   ```
   znrecord.autoCompressionEnabled() {
       return record.getBooleanField("enableCompression", false) || 
autoCompressionEnabled;
   }
   ```
   
   Maybe you meat this:
   ```
   znrecord.autoCompressionEnabled(serializedBytes.length) {
       return record.getBooleanField("enableCompression", false) || 
(autoCompressionEnabled
              && serializedBytes.length > autoCompressionThreshold));
   }
   ```
   With above, I don't see benefit.  
   
   Discussed offline, we decided to add the logic as a static util method.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to