jiajunwang commented on a change in pull request #1072:
URL: https://github.com/apache/helix/pull/1072#discussion_r439679811



##########
File path: 
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java
##########
@@ -2216,4 +2236,24 @@ private void validateCurrentThread() {
       throw new IllegalArgumentException("Must not be done in the zookeeper 
event thread.");
     }
   }
+
+  private void validateWriteSizeLimitConfig() {
+    int serializerSize = ZNRecordUtil.getSerializerWriteSizeLimit();
+    int zkClientSize = getWriteSizeLimit();
+    // ZNRecord serializer write size limit should not be set greater than 
size limit in ZkClient
+    if (serializerSize > zkClientSize) {
+      throw new IllegalStateException("ZNRecord serializer write size limit: " 
+ serializerSize
+          + " is greater than size limit in ZkClient: " + zkClientSize);
+    }
+  }
+
+  private int getWriteSizeLimit() {
+    // The size margin left in default SIZE_LIMIT
+    int sizeMargin = DEFAULT_JUTE_MAXBUFFER - ZNRecord.SIZE_LIMIT;

Review comment:
       This is awkward. How about just create a constant for margin and 
deprecate the SIZE_LIMIT?




----------------------------------------------------------------
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]



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

Reply via email to