From 5d8300bebfa0ce1988740ca455c651938c54d29d Mon Sep 17 00:00:00 2001 From: LINxiansheng Date: Wed, 16 Mar 2022 14:37:44 +0800 Subject: [PATCH] Support double data config --- src/share/config/ob_config_helper.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/share/config/ob_config_helper.cpp b/src/share/config/ob_config_helper.cpp index 3714f5c134..79c2918bd0 100644 --- a/src/share/config/ob_config_helper.cpp +++ b/src/share/config/ob_config_helper.cpp @@ -336,38 +336,41 @@ int64_t ObConfigIntParser::get(const char* str, bool& valid) int64_t ObConfigCapacityParser::get(const char* str, bool& valid) { char* p_unit = NULL; + double split_num = 0.0; int64_t value = 0; if (OB_ISNULL(str) || '\0' == str[0]) { valid = false; } else { valid = true; - value = strtol(str, &p_unit, 0); - + split_num = strtod(str, &p_unit); if (OB_ISNULL(p_unit)) { valid = false; - } else if (value < 0) { + } else if (split_num < 0) { + valid = false; + } else if ('.' == p_unit[0]){ valid = false; } else if ('\0' == *p_unit) { - value <<= CAP_MB; // default + split_num *= (int64_t)1<