Copilot commented on code in PR #16724:
URL: https://github.com/apache/iotdb/pull/16724#discussion_r2509042485


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java:
##########
@@ -807,7 +807,10 @@ public class IoTDBConfig {
   private float udfCollectorMemoryBudgetInMB = (float) (1.0 / 3 * 
udfMemoryBudgetInMB);
 
   /** Unit: byte */
-  private int thriftMaxFrameSize = 536870912;
+  private int thriftMaxFrameSize =
+      Math.min(
+          64 * 1024 * 1024,
+          (int) Math.min(Runtime.getRuntime().maxMemory() / 64, 
Integer.MAX_VALUE));
 

Review Comment:
   The default calculation `Math.min(64 * 1024 * 1024, (int) 
Math.min(Runtime.getRuntime().maxMemory() / 64, Integer.MAX_VALUE))` is 
duplicated in the `setThriftMaxFrameSize` method (lines 2579-2581). Consider 
extracting this into a private static method or constant to avoid code 
duplication and ensure consistency.
   ```suggestion
     private int thriftMaxFrameSize = getDefaultThriftMaxFrameSize();
   
     private static int getDefaultThriftMaxFrameSize() {
       return Math.min(
           64 * 1024 * 1024,
           (int) Math.min(Runtime.getRuntime().maxMemory() / 64, 
Integer.MAX_VALUE));
     }
   ```



##########
iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template:
##########
@@ -533,10 +533,10 @@ dn_rpc_selector_thread_count=1
 # Datatype: int
 dn_rpc_max_concurrent_client_num=1000
 
-# thrift max frame size, 512MB by default
+# thrift max frame size in bytes, When = 0, use min(64MB, datanode heap memory 
/ 64)

Review Comment:
   Grammatical issue: "When = 0" should be "When set to 0" or "When equal to 0" 
for better readability.
   ```suggestion
   # thrift max frame size in bytes. When set to 0, use min(64MB, datanode heap 
memory / 64)
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to