fix the min_size of memory_limit
This commit is contained in:
@ -1794,10 +1794,20 @@ int ObServer::init_config()
|
||||
config_.rootservice_list.set_version(start_time_);
|
||||
}
|
||||
|
||||
if (opts_.startup_mode_) {
|
||||
config_.ob_startup_mode.set_value(opts_.startup_mode_);
|
||||
config_.ob_startup_mode.set_version(start_time_);
|
||||
LOG_INFO("mode is not null", "mode", opts_.startup_mode_);
|
||||
}
|
||||
// update gctx_.startup_mode_
|
||||
if (FAILEDx(parse_mode())) {
|
||||
LOG_ERROR("parse_mode failed", KR(ret));
|
||||
}
|
||||
|
||||
config_.syslog_level.set_value(OB_LOGGER.get_level_str());
|
||||
|
||||
if (opts_.optstr_ && strlen(opts_.optstr_) > 0) {
|
||||
if (OB_FAIL(config_.add_extra_config(opts_.optstr_, start_time_))) {
|
||||
if (FAILEDx(config_.add_extra_config(opts_.optstr_, start_time_))) {
|
||||
LOG_ERROR("invalid config from cmdline options", K(opts_.optstr_), KR(ret));
|
||||
}
|
||||
}
|
||||
@ -1832,16 +1842,6 @@ int ObServer::init_config()
|
||||
config_.use_ipv6.set_version(start_time_);
|
||||
}
|
||||
|
||||
if (opts_.startup_mode_) {
|
||||
config_.ob_startup_mode.set_value(opts_.startup_mode_);
|
||||
config_.ob_startup_mode.set_version(start_time_);
|
||||
LOG_INFO("mode is not null", "mode", opts_.startup_mode_);
|
||||
}
|
||||
// update gctx_.startup_mode_
|
||||
if (FAILEDx(parse_mode())) {
|
||||
LOG_ERROR("parse_mode failed", KR(ret));
|
||||
}
|
||||
|
||||
config_.print();
|
||||
|
||||
// local_ip is a critical parameter, if it is set, then verify it; otherwise, set it via devname.
|
||||
|
@ -333,8 +333,7 @@ int ObTenantConfig::publish_special_config_after_dump()
|
||||
|
||||
int ObTenantConfig::add_extra_config(const char *config_str,
|
||||
int64_t version /* = 0 */ ,
|
||||
bool check_name /* = false */,
|
||||
bool check_unit /* = true */)
|
||||
bool check_config /* = true */)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t MAX_OPTS_LENGTH = sysconf(_SC_ARG_MAX);
|
||||
@ -394,8 +393,7 @@ int ObTenantConfig::add_extra_config(const char *config_str,
|
||||
LOG_WARN("failed to alloc", K(ret));
|
||||
} else if (FALSE_IT(external_info_val[0] = '\0')) {
|
||||
} else if (OB_ISNULL(pp_item = container_.get(ObConfigStringKey(name)))) {
|
||||
/* make compatible with previous configuration */
|
||||
ret = check_name ? OB_INVALID_CONFIG : OB_SUCCESS;
|
||||
ret = OB_SUCCESS;
|
||||
LOG_WARN("Invalid config string, no such config item", K(name), K(value), K(ret));
|
||||
}
|
||||
if (OB_FAIL(ret) || OB_ISNULL(pp_item)) {
|
||||
@ -408,25 +406,20 @@ int ObTenantConfig::add_extra_config(const char *config_str,
|
||||
(*pp_item)->set_version(version);
|
||||
LOG_INFO("Load tenant config dump value succ", K(name), K((*pp_item)->spfile_str()), K((*pp_item)->str()));
|
||||
}
|
||||
} else if (check_unit && !(*pp_item)->check_unit(value)) {
|
||||
} else if (!(*pp_item)->set_value(value)) {
|
||||
ret = OB_INVALID_CONFIG;
|
||||
LOG_ERROR("Invalid config value", K(name), K(value), K(ret));
|
||||
} else {
|
||||
if (!(*pp_item)->set_value(value)) {
|
||||
ret = OB_INVALID_CONFIG;
|
||||
LOG_WARN("Invalid config value", K(name), K(value), K(ret));
|
||||
} else if (!(*pp_item)->check()) {
|
||||
ret = OB_INVALID_CONFIG;
|
||||
const char* range = (*pp_item)->range();
|
||||
if (OB_ISNULL(range) || strlen(range) == 0) {
|
||||
LOG_ERROR("Invalid config, value out of range", K(name), K(value), K(ret));
|
||||
} else {
|
||||
_LOG_ERROR("Invalid config, value out of %s (for reference only). name=%s, value=%s, ret=%d", range, name, value, ret);
|
||||
}
|
||||
LOG_WARN("Invalid config value", K(name), K(value), K(ret));
|
||||
} else if (check_config && (!(*pp_item)->check_unit(value) || !(*pp_item)->check())) {
|
||||
ret = OB_INVALID_CONFIG;
|
||||
const char* range = (*pp_item)->range();
|
||||
if (OB_ISNULL(range) || strlen(range) == 0) {
|
||||
LOG_ERROR("Invalid config, value out of range", K(name), K(value), K(ret));
|
||||
} else {
|
||||
(*pp_item)->set_version(version);
|
||||
LOG_INFO("Load tenant config succ", K(name), K(value));
|
||||
_LOG_ERROR("Invalid config, value out of %s (for reference only). name=%s, value=%s, ret=%d", range, name, value, ret);
|
||||
}
|
||||
} else {
|
||||
(*pp_item)->set_version(version);
|
||||
LOG_INFO("Load tenant config succ", K(name), K(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,8 +92,7 @@ public:
|
||||
bool save2file = true);
|
||||
int add_extra_config(const char *config_str,
|
||||
int64_t version = 0 ,
|
||||
bool check_name = false,
|
||||
bool check_unit = true);
|
||||
bool check_config = true);
|
||||
|
||||
OB_UNIS_VERSION(1);
|
||||
private:
|
||||
|
@ -285,8 +285,7 @@ ObCommonConfig::~ObCommonConfig()
|
||||
|
||||
int ObCommonConfig::add_extra_config(const char *config_str,
|
||||
int64_t version /* = 0 */ ,
|
||||
bool check_name /* = false */,
|
||||
bool check_unit /* = true */)
|
||||
bool check_config /* = true */)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t MAX_OPTS_LENGTH = sysconf(_SC_ARG_MAX);
|
||||
@ -340,8 +339,7 @@ int ObCommonConfig::add_extra_config(const char *config_str,
|
||||
LOG_ERROR("failed to alloc", K(ret));
|
||||
} else if (FALSE_IT(external_info_val[0] = '\0')) {
|
||||
} else if (OB_ISNULL(pp_item = container_.get(ObConfigStringKey(name)))) {
|
||||
/* make compatible with previous configuration */
|
||||
ret = check_name ? OB_INVALID_CONFIG : OB_SUCCESS;
|
||||
ret = OB_SUCCESS;
|
||||
LOG_WARN("Invalid config string, no such config item", K(name), K(value), K(ret));
|
||||
} else if (external_kms_info_cfg.case_compare(name) == 0
|
||||
|| ssl_external_kms_info_cfg.case_compare(name) == 0) {
|
||||
@ -353,13 +351,10 @@ int ObCommonConfig::add_extra_config(const char *config_str,
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret) || OB_ISNULL(pp_item)) {
|
||||
} else if (check_unit && !(*pp_item)->check_unit(value)) {
|
||||
ret = OB_INVALID_CONFIG;
|
||||
LOG_ERROR("Invalid config value", K(name), K(value), K(ret));
|
||||
} else if (!(*pp_item)->set_value(value)) {
|
||||
ret = OB_INVALID_CONFIG;
|
||||
LOG_ERROR("Invalid config value", K(name), K(value), K(ret));
|
||||
} else if (!(*pp_item)->check()) {
|
||||
} else if (check_config && (!(*pp_item)->check_unit(value) || !(*pp_item)->check())) {
|
||||
ret = OB_INVALID_CONFIG;
|
||||
const char* range = (*pp_item)->range();
|
||||
if (OB_ISNULL(range) || strlen(range) == 0) {
|
||||
@ -463,7 +458,7 @@ OB_DEF_DESERIALIZE(ObCommonConfig)
|
||||
} else {
|
||||
MEMSET(copy_buf, '\0', data_len + 1);
|
||||
MEMCPY(copy_buf, buf + pos, data_len);
|
||||
if (OB_FAIL(ObCommonConfig::add_extra_config(copy_buf, 0, false, false))) {
|
||||
if (OB_FAIL(ObCommonConfig::add_extra_config(copy_buf, 0, false))) {
|
||||
LOG_ERROR("Read server config failed", K(ret));
|
||||
}
|
||||
|
||||
|
@ -95,8 +95,7 @@ public:
|
||||
virtual ObServerRole get_server_type() const = 0;
|
||||
virtual int add_extra_config(const char *config_str,
|
||||
const int64_t version = 0,
|
||||
const bool check_name = false,
|
||||
const bool check_unit = true);
|
||||
const bool check_config = true);
|
||||
virtual bool is_debug_sync_enabled() const { return false; }
|
||||
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "sql/optimizer/ob_log_join_filter.h"
|
||||
#include "share/ob_encryption_util.h"
|
||||
#include "share/ob_resource_limit.h"
|
||||
#include "src/observer/ob_server.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -376,7 +377,9 @@ bool ObConfigMemoryLimitChecker::check(const ObConfigItem &t) const
|
||||
bool is_valid = false;
|
||||
int64_t value = ObConfigCapacityParser::get(t.str(), is_valid, false);
|
||||
if (is_valid) {
|
||||
is_valid = 0 == value || value >= lib::ObRunningModeConfig::instance().MIN_MEM;
|
||||
int64_t min_memory_size = OBSERVER.is_arbitration_mode() ? lib::ObRunningModeConfig::instance().MIN_MEM :
|
||||
lib::ObRunningModeConfig::instance().MINI_MEM_LOWER;
|
||||
is_valid = 0 == value || value >= min_memory_size;
|
||||
}
|
||||
return is_valid;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ int ObServerConfig::deserialize_with_compat(const char *buf, const int64_t data_
|
||||
K(data_len), K(pos_data), K_(header.data_zlength), K(ret));
|
||||
} else if (OB_FAIL(header.check_payload_checksum(p_data, data_len - pos_data))) {
|
||||
LOG_ERROR("check data checksum failed", K(ret));
|
||||
} else if (OB_FAIL(add_extra_config(buf + pos, 0, false, false))) {
|
||||
} else if (OB_FAIL(add_extra_config(buf + pos, 0, false))) {
|
||||
LOG_ERROR("Read server config failed", K(ret));
|
||||
} else {
|
||||
pos += header.data_length_;
|
||||
|
Reference in New Issue
Block a user