You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by lt...@apache.org on 2020/02/05 08:27:23 UTC

[incubator-iotdb] 02/02: fix a bug of cal table size range overflow

This is an automated email from the ASF dual-hosted git repository.

lta pushed a commit to branch fix_calmem_bug
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 9990aa4e21861eb7aea743b56f7b7569b888b800
Author: lta <li...@163.com>
AuthorDate: Wed Feb 5 16:26:59 2020 +0800

    fix a bug of cal table size range overflow
---
 .../org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapter.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapter.java b/server/src/main/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapter.java
index bb9d8be..2069043 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapter.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapter.java
@@ -174,7 +174,7 @@ public class IoTDBConfigDynamicAdapter implements IDynamicAdapter {
    *
    * @return MemTable byte size. If the value is -1, there is no valid solution.
    */
-  private int calcMemTableSize(double ratio) {
+  private long calcMemTableSize(double ratio) {
     // when unit is byte, it's likely to cause Long type overflow.
     // so when b is larger than Integer.MAC_VALUE use the unit KB.
     double a = maxMemTableNum;
@@ -187,7 +187,7 @@ public class IoTDBConfigDynamicAdapter implements IDynamicAdapter {
             / magnification / magnification;
     double tempValue = b * b - 4 * a * c;
     double memTableSize = ((b + Math.sqrt(tempValue)) / (2 * a));
-    return tempValue < 0 ? -1 : (int) (memTableSize * magnification);
+    return tempValue < 0 ? -1 : (long) (memTableSize * magnification);
   }
 
   /**