[bug fix]add pre_check
This commit is contained in:
6
deps/oblib/src/lib/ob_define.h
vendored
6
deps/oblib/src/lib/ob_define.h
vendored
@ -183,6 +183,12 @@ OB_INLINE bool is_sys_group(const int64_t group_id)
|
|||||||
return group_id >= SYS_RESOURCE_GROUP_START_ID && group_id <= SYS_RESOURCE_GROUP_START_ID + SYS_RESOURCE_GROUP_CNT;
|
return group_id >= SYS_RESOURCE_GROUP_START_ID && group_id <= SYS_RESOURCE_GROUP_START_ID + SYS_RESOURCE_GROUP_CNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OB_INLINE bool is_valid_resource_group(const int64_t group_id)
|
||||||
|
{
|
||||||
|
//other group or user group
|
||||||
|
return group_id == 0 || (group_id >= USER_RESOURCE_GROUP_START_ID && group_id <= USER_RESOURCE_GROUP_END_ID);
|
||||||
|
}
|
||||||
|
|
||||||
// See ObDeviceHealthStatus for more information
|
// See ObDeviceHealthStatus for more information
|
||||||
const int64_t OB_MAX_DEVICE_HEALTH_STATUS_STR_LENGTH = 20;
|
const int64_t OB_MAX_DEVICE_HEALTH_STATUS_STR_LENGTH = 20;
|
||||||
|
|
||||||
|
|||||||
@ -1012,7 +1012,7 @@ int ObTenantIOManager::modify_io_config(const uint64_t group_id,
|
|||||||
} else {
|
} else {
|
||||||
uint64_t index = INT64_MAX;
|
uint64_t index = INT64_MAX;
|
||||||
DRWLock::WRLockGuard guard(io_config_lock_);
|
DRWLock::WRLockGuard guard(io_config_lock_);
|
||||||
if (OB_UNLIKELY(!is_user_group(group_id))) {
|
if (OB_UNLIKELY(!is_valid_resource_group(group_id))) {
|
||||||
ret = OB_INVALID_CONFIG;
|
ret = OB_INVALID_CONFIG;
|
||||||
LOG_WARN("invalid group id", K(ret), K(tenant_id_), K(group_id));
|
LOG_WARN("invalid group id", K(ret), K(tenant_id_), K(group_id));
|
||||||
} else if (min_percent < 0 || min_percent > 100 ||
|
} else if (min_percent < 0 || min_percent > 100 ||
|
||||||
|
|||||||
Reference in New Issue
Block a user