fix view wrong display
This commit is contained in:
@ -911,9 +911,11 @@ int ObAllVirtualGroupIOStat::record_user_group_io_status(const int64_t tenant_id
|
||||
read_item.tenant_id_ = tenant_id;
|
||||
read_item.mode_ = ObIOMode::READ;
|
||||
read_item.group_id_ = io_config.group_configs_.at(local_group_config_index).group_id_;
|
||||
const int64_t read_item_group_name_len = std::strlen(io_config.group_configs_.at(local_group_config_index).group_name_) + 1;
|
||||
memcpy(read_item.group_name_,
|
||||
io_config.group_configs_.at(local_group_config_index).group_name_,
|
||||
std::strlen(io_config.group_configs_.at(local_group_config_index).group_name_));
|
||||
read_item_group_name_len);
|
||||
read_item.group_name_[read_item_group_name_len] = '\0';
|
||||
|
||||
read_item.min_iops_ = group_min_iops;
|
||||
read_item.max_iops_ = group_max_iops;
|
||||
@ -938,9 +940,11 @@ int ObAllVirtualGroupIOStat::record_user_group_io_status(const int64_t tenant_id
|
||||
write_item.tenant_id_ = tenant_id;
|
||||
write_item.mode_ = ObIOMode::WRITE;
|
||||
write_item.group_id_ = io_config.group_configs_.at(local_group_config_index).group_id_;
|
||||
const int64_t write_item_group_name_len = std::strlen(io_config.group_configs_.at(local_group_config_index).group_name_) + 1;
|
||||
memcpy(write_item.group_name_,
|
||||
io_config.group_configs_.at(local_group_config_index).group_name_,
|
||||
std::strlen(io_config.group_configs_.at(local_group_config_index).group_name_));
|
||||
write_item_group_name_len);
|
||||
write_item.group_name_[write_item_group_name_len] = '\0';
|
||||
|
||||
write_item.min_iops_ = group_min_iops;
|
||||
write_item.max_iops_ = group_max_iops;
|
||||
@ -1005,7 +1009,9 @@ int ObAllVirtualGroupIOStat::record_sys_group_io_status(const int64_t tenant_id,
|
||||
read_item.mode_ = ObIOMode::READ;
|
||||
read_item.group_id_ = sys_group_id;
|
||||
const char *tmp_name = get_io_sys_group_name(static_cast<common::ObIOModule>(sys_group_id));
|
||||
memcpy(read_item.group_name_, tmp_name, std::strlen(tmp_name));
|
||||
const int64_t read_item_group_name_len = std::strlen(tmp_name) + 1;
|
||||
memcpy(read_item.group_name_, tmp_name, read_item_group_name_len);
|
||||
read_item.group_name_[read_item_group_name_len] = '\0';
|
||||
read_item.min_iops_ = 0;
|
||||
read_item.max_iops_ = INT64_MAX;
|
||||
read_item.max_net_bandwidth_ = INT64_MAX;
|
||||
@ -1030,7 +1036,9 @@ int ObAllVirtualGroupIOStat::record_sys_group_io_status(const int64_t tenant_id,
|
||||
write_item.mode_ = ObIOMode::WRITE;
|
||||
write_item.group_id_ = sys_group_id;
|
||||
const char *tmp_name = get_io_sys_group_name(static_cast<common::ObIOModule>(sys_group_id));
|
||||
const int64_t write_item_group_name_len = std::strlen(tmp_name) + 1;
|
||||
memcpy(write_item.group_name_, tmp_name, std::strlen(tmp_name));
|
||||
write_item.group_name_[write_item_group_name_len] = '\0';
|
||||
write_item.min_iops_ = 0;
|
||||
write_item.max_iops_ = INT64_MAX;
|
||||
write_item.max_net_bandwidth_ = INT64_MAX;
|
||||
|
@ -2020,6 +2020,7 @@ ObTenantIOConfig::ObTenantIOConfig()
|
||||
for (uint8_t i = (uint8_t)ObIOMode::READ; i <= (uint8_t)ObIOMode::MAX_MODE; ++i) {
|
||||
tmp_group_config.mode_ = (ObIOMode)i;
|
||||
memcpy(tmp_group_config.group_name_, other_group_name.ptr(), other_group_name.length());
|
||||
tmp_group_config.group_name_[other_group_name.length()] = '\0';
|
||||
if (OB_FAIL(group_configs_.push_back(tmp_group_config))) {
|
||||
LOG_WARN("push back group config failed", K(ret));
|
||||
}
|
||||
|
@ -45,10 +45,13 @@ int ObStorageIOUsageProxy::update_storage_io_usage(
|
||||
const int64_t total)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t meta_tenant_id = gen_meta_tenant_id(tenant_id);
|
||||
if (!is_valid_tenant_id(tenant_id)) {
|
||||
ret = OB_INVALID_CONFIG;
|
||||
LOG_WARN("invalid config", K(ret), K(tenant_id));
|
||||
const uint64_t meta_tenant_id = gen_meta_tenant_id(tenant_id);
|
||||
const uint64_t user_tenant_id = gen_user_tenant_id(tenant_id);
|
||||
if (!is_valid_tenant_id(tenant_id) ||
|
||||
!is_valid_tenant_id(user_tenant_id) ||
|
||||
!is_valid_tenant_id(meta_tenant_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid tenant id", K(ret), K(tenant_id), K(user_tenant_id), K(meta_tenant_id));
|
||||
} else if (storage_id == OB_INVALID_ID && dest_id == OB_INVALID_ID) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", K(ret), K(storage_id), K(dest_id));
|
||||
@ -57,29 +60,25 @@ int ObStorageIOUsageProxy::update_storage_io_usage(
|
||||
LOG_WARN("invalid argument", K(ret), K(total));
|
||||
} else if (0 == total ) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(trans.start(GCTX.sql_proxy_, meta_tenant_id, true))){
|
||||
LOG_WARN("fail to start trans", K(ret));
|
||||
} else if (OB_FAIL(trans.start(GCTX.sql_proxy_, meta_tenant_id))) {
|
||||
LOG_WARN("fail to start trans", K(ret), K(meta_tenant_id));
|
||||
} else {
|
||||
ObSqlString sql;
|
||||
int64_t affected_rows = 0;
|
||||
uint64_t real_tenant_id = tenant_id;
|
||||
// if tenant_id is meta_tenant_id and not sys tenant, use real tenant id
|
||||
if (tenant_id == meta_tenant_id) {
|
||||
real_tenant_id = gen_user_tenant_id(tenant_id);
|
||||
}
|
||||
if (OB_FAIL(sql.append_fmt(update_storage_io_usage_sql,
|
||||
OB_ALL_STORAGE_IO_USAGE_TNAME,
|
||||
real_tenant_id,
|
||||
user_tenant_id,
|
||||
storage_id,
|
||||
dest_id,
|
||||
storage_mod.ptr(),
|
||||
type.ptr(),
|
||||
total))) {
|
||||
LOG_WARN("fail to append fmt", K(ret));
|
||||
LOG_WARN("fail to append fmt", K(ret), K(sql),
|
||||
K(tenant_id), K(storage_id), K(dest_id), K(total));
|
||||
} else if (OB_FAIL(trans.write(meta_tenant_id,
|
||||
sql.ptr(),
|
||||
affected_rows))) {
|
||||
LOG_WARN("fail to exec sql", K(ret), K(sql));
|
||||
LOG_WARN("fail to exec sql", K(ret), K(sql));
|
||||
}
|
||||
bool is_commit = true;
|
||||
// single means insert new row
|
||||
@ -91,10 +90,11 @@ int ObStorageIOUsageProxy::update_storage_io_usage(
|
||||
}
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_TMP_FAIL(trans.end(is_commit))) {
|
||||
ret = tmp_ret;
|
||||
ret = OB_SUCC(ret) ? ret = tmp_ret:ret;
|
||||
LOG_WARN("fail to commit/rollback trans", K(ret), K(is_commit));
|
||||
}
|
||||
LOG_DEBUG("update storage io usage", K(ret), K(sql));
|
||||
LOG_INFO("update storage io usage", K(ret), K(user_tenant_id),
|
||||
K(tenant_id), K(dest_id), K(storage_id), K(storage_mod), K(type), K(total));
|
||||
}
|
||||
return ret;
|
||||
}
|
@ -151,8 +151,8 @@ int ObStorageIOUsageRepoter::UpdateIOUsageFunctor::
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
if (entry.first.tenant_id_ == tenant_id_) {
|
||||
int64_t tmp_storage_id = INT64_MAX;
|
||||
int64_t tmp_dest_id = INT64_MAX;
|
||||
uint64_t tmp_storage_id = OB_INVALID_ID;
|
||||
uint64_t tmp_dest_id = OB_INVALID_ID;
|
||||
const ObStorageInfoType table_type = entry.first.id_.get_category();
|
||||
ObString storage_mod_str;
|
||||
// get storage id and storage str
|
||||
@ -170,7 +170,8 @@ int ObStorageIOUsageRepoter::UpdateIOUsageFunctor::
|
||||
entry.second.reset_total_size(usages);
|
||||
|
||||
for (int64_t i = 0; i < ResourceType::ResourceTypeCnt; ++i) {
|
||||
if (usages[i].type_ >= ResourceType::ResourceTypeCnt || (ResourceType::iops == usages[i].type_ || ResourceType::iobw == usages[i].type_)) {
|
||||
if (usages[i].type_ >= ResourceType::ResourceTypeCnt ||
|
||||
(ResourceType::iops == usages[i].type_ || ResourceType::iobw == usages[i].type_)) {
|
||||
// skip
|
||||
} else if (usages[i].total_ <= 0 ) {
|
||||
// skip
|
||||
@ -195,8 +196,8 @@ int ObStorageIOUsageRepoter::report_tenant_io_usage(const uint64_t tenant_id)
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id))) {
|
||||
ret = OB_INVALID_CONFIG;
|
||||
LOG_WARN("invalid config", K(ret), K(tenant_id));
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", K(ret), K(tenant_id));
|
||||
} else {
|
||||
// for each tenant and meta tenant to report io usage
|
||||
UpdateIOUsageFunctor fn(tenant_id);
|
||||
@ -204,8 +205,8 @@ int ObStorageIOUsageRepoter::report_tenant_io_usage(const uint64_t tenant_id)
|
||||
if (is_sys_tenant(tenant_id)) {
|
||||
// do nothing
|
||||
} else {
|
||||
UpdateIOUsageFunctor meta_fn(tenant_id);
|
||||
OB_IO_MANAGER.get_tc().foreach_record(fn);
|
||||
UpdateIOUsageFunctor meta_fn(gen_meta_tenant_id(tenant_id));
|
||||
OB_IO_MANAGER.get_tc().foreach_record(meta_fn);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user