add config value range in ERROR LOG

This commit is contained in:
nroskill
2022-11-07 03:38:05 +00:00
committed by wangzelin.wzl
parent 8fb6841278
commit 8d2d0ef53a
5 changed files with 28 additions and 13 deletions

View File

@ -72,7 +72,7 @@ void *ObMallocAllocator::alloc(const int64_t size, const oceanbase::lib::ObMemAt
} else if (OB_UNLIKELY(0 == inner_attr.tenant_id_)
|| OB_UNLIKELY(INT64_MAX == inner_attr.tenant_id_)) {
ret = OB_INVALID_ARGUMENT;
LOG_ERROR("invalid argument", KCSTRING(lbt()), K(inner_attr.tenant_id_), K(ret));
LOG_ERROR("invalid argument", K(inner_attr.tenant_id_), K(ret));
} else if (OB_NOT_NULL(allocator = get_tenant_ctx_allocator(inner_attr.tenant_id_, inner_attr.ctx_id_))) {
// do nothing
} else if (OB_FAIL(create_tenant_ctx_allocator(inner_attr.tenant_id_, inner_attr.ctx_id_))) {

View File

@ -402,7 +402,12 @@ int ObTenantConfig::add_extra_config(char *config_str,
LOG_WARN("Invalid config value", K(name), K(value), K(ret));
} else if (!(*pp_item)->check()) {
ret = OB_INVALID_CONFIG;
LOG_WARN("Invalid config, value out of range", K(name), K(value), K(ret));
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);
}
} else {
(*pp_item)->set_version(version);
LOG_INFO("Load tenant config succ", K(name), K(value));

View File

@ -121,7 +121,12 @@ int ObCommonConfig::add_extra_config(const char *config_str,
LOG_ERROR("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);
}
} else {
(*pp_item)->set_version(version);
LOG_INFO("Load config succ", K(name), K(value));

View File

@ -54,12 +54,11 @@ const char *log_archive_encryption_algorithm_values[] =
// ObConfigItem
ObConfigItem::ObConfigItem()
: ck_(NULL), version_(0), dumped_version_(0), inited_(false), initial_value_set_(false),
value_updated_(false), value_valid_(false), lock_()
value_updated_(false), value_valid_(false), name_str_(nullptr), info_str_(nullptr),
range_str_(nullptr), lock_()
{
MEMSET(value_str_, 0, sizeof(value_str_));
MEMSET(value_reboot_str_, 0, sizeof(value_reboot_str_));
MEMSET(name_str_, 0, sizeof(name_str_));
MEMSET(info_str_, 0, sizeof(info_str_));
}
ObConfigItem::~ObConfigItem()
@ -291,6 +290,7 @@ void ObConfigIntegralItem::init(Scope::ScopeInfo scope_info,
const ObParameterAttr attr)
{
ObConfigItem::init(scope_info, name, def, info, attr);
set_range(range);
if (OB_ISNULL(range)) {
OB_LOG(ERROR, "Range is NULL");
} else if (!parse_range(range)) {
@ -402,6 +402,7 @@ void ObConfigDoubleItem::init(Scope::ScopeInfo scope_info,
const ObParameterAttr attr)
{
ObConfigItem::init(scope_info, name, def, info, attr);
set_range(range);
if (OB_ISNULL(range)) {
OB_LOG(ERROR, "Range is NULL");
} else if (!parse_range(range)) {

View File

@ -115,13 +115,15 @@ public:
}
void set_name(const char *name)
{
int64_t pos = 0;
(void) databuff_printf(name_str_, sizeof(name_str_), pos, "%s", name);
name_str_ = name;
}
void set_info(const char *info)
{
int64_t pos = 0;
(void) databuff_printf(info_str_, sizeof(info_str_), pos, "%s", info);
info_str_ = info;;
}
void set_range(const char* range)
{
range_str_ = range;
}
void set_version(int64_t version) { version_ = version; }
void set_dumped_version(int64_t version) { dumped_version_ = version; }
@ -144,6 +146,7 @@ public:
}
const char *name() const { return name_str_; }
const char *info() const { return info_str_; }
const char *range() const { return range_str_; }
const char *section() const { return attr_.get_section(); }
const char *scope() const { return attr_.get_scope(); }
@ -190,8 +193,9 @@ protected:
bool value_valid_;
char value_str_[OB_MAX_CONFIG_VALUE_LEN];
char value_reboot_str_[OB_MAX_CONFIG_VALUE_LEN];
char name_str_[OB_MAX_CONFIG_NAME_LEN];
char info_str_[OB_MAX_CONFIG_INFO_LEN];
const char* name_str_;
const char* info_str_;
const char* range_str_;
common::ObLatch lock_;
private:
ObParameterAttr attr_;