You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2021/07/06 05:58:53 UTC

[GitHub] [ratis] szetszwo commented on a change in pull request #483: RATIS-1384.Change pending request limit unit to MB

szetszwo commented on a change in pull request #483:
URL: https://github.com/apache/ratis/pull/483#discussion_r664255023



##########
File path: ratis-common/src/main/java/org/apache/ratis/protocol/Message.java
##########
@@ -65,6 +68,10 @@ static int getSize(Message message) {
   ByteString getContent();
 
   default int size() {
-    return Optional.ofNullable(getContent()).map(ByteString::size).orElse(0);
+    int size = Optional.ofNullable(getContent()).map(ByteString::size).orElse(0);
+    if (size > 0 && size < (double) (ONE_MB.getSizeInt())) {
+      return 1;
+    }
+    return size/ SizeInBytes.valueOf("1mb").getSizeInt();

Review comment:
       Since this method is a in the protocol package.  We cannot change it.  Otherwise, it is an incompatible change.

##########
File path: ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java
##########
@@ -100,15 +100,17 @@ static void setElementLimit(RaftProperties properties, int limit) {
       setInt(properties::setInt, ELEMENT_LIMIT_KEY, limit, requireMin(1));
     }
 
-    String BYTE_LIMIT_KEY = PREFIX + ".byte-limit";
-    SizeInBytes BYTE_LIMIT_DEFAULT = SizeInBytes.valueOf("64MB");
-    static SizeInBytes byteLimit(RaftProperties properties) {
-      return getSizeInBytes(properties::getSizeInBytes,
-          BYTE_LIMIT_KEY, BYTE_LIMIT_DEFAULT, getDefaultLog());
+    String MEGA_BYTE_LIMIT_KEY = PREFIX + ".megabyte-limit";

Review comment:
       We cannot rename the key.  It is an incompatible change.




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

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org