fix some bug of tables, log show and tenant gc

This commit is contained in:
obdev 2024-10-29 04:52:49 +00:00 committed by ob-robot
parent 0ea64addcb
commit a0afc03a62
5 changed files with 93 additions and 6 deletions

View File

@ -133,6 +133,10 @@ int ObSharedStorageNetThrotManager::clear_expired_infos()
const int64_t current_time = ObTimeUtility::current_time();
ObSpinLockGuard guard(lock_);
if (OB_SUCCESS != OB_IO_MANAGER.get_tc().gc_tenant_infos()) {
LOG_WARN("SSNT:failed to gc tenant infos for IO MANAGER", K(ret));
}
// clean up expired storages
if (storage_key_limit_map_.size() == 0) {
} else if (REACH_TIME_INTERVAL(1 * 60 * 1000L * 1000L)){ // 1min

View File

@ -1249,6 +1249,7 @@ int ObAllVirtualFunctionIOStat::record_function_info(const uint64_t tenant_id,
for (int i = 0; OB_SUCC(ret) && i < FUNC_NUM; ++i) {
for (int j = 0; OB_SUCC(ret) && j < GROUP_MODE_NUM; ++j) {
FuncInfo item;
item.tenant_id_ = tenant_id;
item.function_type_ = static_cast<share::ObFunctionType>(i);
item.group_mode_ = static_cast<ObIOGroupMode>(j);
if (i >= func_usages.count()) {

View File

@ -243,7 +243,11 @@ int ObVirtualSharedStorageQuota::add_row(
break;
}
case ASSIGN: {
cells[i].set_int(limit.value_);
if (limit.value_ <= 0 || limit.value_ >= INT64_MAX) {
cells[i].set_int(INT64_MAX);
} else {
cells[i].set_int(limit.value_);
}
break;
}
default: {

View File

@ -256,13 +256,13 @@ void ObTrafficControl::print_status()
entry.first.get_tenant_id(),
entry.first.get_storage_id(),
bw_in / 1024,
entry.second.ibw_clock_.iops_ / 1024,
entry.second.ibw_clock_.iops_ == 0 ? INT64_MAX : entry.second.ibw_clock_.iops_ / 1024,
bw_out / 1024,
entry.second.obw_clock_.iops_ / 1024,
entry.second.obw_clock_.iops_ == 0 ? INT64_MAX : entry.second.obw_clock_.iops_ / 1024,
req_in,
entry.second.ips_clock_.iops_,
entry.second.ips_clock_.iops_ == 0 ? INT64_MAX : entry.second.ips_clock_.iops_,
req_out,
entry.second.ops_clock_.iops_,
entry.second.ops_clock_.iops_ == 0 ? INT64_MAX : entry.second.ops_clock_.iops_,
tag,
entry.second.tagps_clock_.iops_ / 1024);
}
@ -320,6 +320,82 @@ void ObTrafficControl::inner_calc_()
}
}
int ObTrafficControl::gc_tenant_infos()
{
int ret = OB_SUCCESS;
if (REACH_TIME_INTERVAL(1 * 60 * 1000L * 1000L)) { // 60s
struct GCTenantSharedDeviceInfos
{
GCTenantSharedDeviceInfos(
const ObVector<uint64_t> &tenant_ids, ObSEArray<ObTrafficControl::ObStorageKey, 7> &gc_tenant_infos)
: tenant_ids_(tenant_ids), gc_tenant_infos_(gc_tenant_infos)
{}
int operator()(hash::HashMapPair<ObTrafficControl::ObStorageKey, ObTrafficControl::ObSharedDeviceControl> &pair)
{
bool is_find = false;
for (int i = 0; !is_find && i < tenant_ids_.size(); ++i) {
if (0 == pair.first.get_tenant_id() || tenant_ids_.at(i) == pair.first.get_tenant_id()) {
is_find = true;
}
}
if (false == is_find) {
gc_tenant_infos_.push_back(pair.first);
}
return OB_SUCCESS;
}
const ObVector<uint64_t> &tenant_ids_;
ObSEArray<ObTrafficControl::ObStorageKey, 7> &gc_tenant_infos_;
};
struct GCTenantRecordInfos
{
GCTenantRecordInfos(
const ObVector<uint64_t> &tenant_ids, ObSEArray<ObTrafficControl::ObIORecordKey, 7> &gc_tenant_infos)
: tenant_ids_(tenant_ids), gc_tenant_infos_(gc_tenant_infos)
{}
int operator()(hash::HashMapPair<ObTrafficControl::ObIORecordKey, ObTrafficControl::ObSharedDeviceIORecord> &pair)
{
bool is_find = false;
for (int i = 0; !is_find && i < tenant_ids_.size(); ++i) {
if (0 == pair.first.id_.get_tenant_id() || tenant_ids_.at(i) == pair.first.id_.get_tenant_id()) {
is_find = true;
}
}
if (false == is_find) {
gc_tenant_infos_.push_back(pair.first);
}
return OB_SUCCESS;
}
const ObVector<uint64_t> &tenant_ids_;
ObSEArray<ObTrafficControl::ObIORecordKey, 7> &gc_tenant_infos_;
};
ObVector<uint64_t> tenant_ids;
ObSEArray<ObTrafficControl::ObIORecordKey, 7> gc_tenant_record_infos;
ObSEArray<ObTrafficControl::ObStorageKey, 7> gc_tenant_shared_device_infos;
GCTenantRecordInfos fn(tenant_ids, gc_tenant_record_infos);
GCTenantSharedDeviceInfos fn2(tenant_ids, gc_tenant_shared_device_infos);
if(OB_ISNULL(GCTX.omt_)) {
} else if (FALSE_IT(GCTX.omt_->get_tenant_ids(tenant_ids))) {
} else if (OB_FAIL(io_record_map_.foreach_refactored(fn))) {
LOG_WARN("SSNT:failed to get gc tenant record infos", K(ret));
} else if (OB_FAIL(shared_device_map_.foreach_refactored(fn2))) {
LOG_WARN("SSNT:failed to get gc tenant shared device infos", K(ret));
} else {
for (int i = 0; i < gc_tenant_record_infos.count(); ++i) {
if (OB_SUCCESS != io_record_map_.erase_refactored(gc_tenant_record_infos.at(i))) {
LOG_WARN("SSNT:failed to erase gc tenant record infos", K(ret), K(gc_tenant_record_infos.at(i)));
}
}
for (int i = 0; i < gc_tenant_shared_device_infos.count(); ++i) {
if (OB_SUCCESS != shared_device_map_.erase_refactored(gc_tenant_shared_device_infos.at(i))) {
LOG_WARN(
"SSNT:failed to erase gc tenant shared device infos", K(ret), K(gc_tenant_shared_device_infos.at(i)));
}
}
}
}
return ret;
}
ObIOManager::ObIOManager()
: is_inited_(false),
is_working_(false),
@ -2349,4 +2425,4 @@ int ObTenantIOManager::get_throttled_time(uint64_t group_id, int64_t &throttled_
const ObIOFuncUsages& ObTenantIOManager::get_io_func_infos()
{
return io_func_infos_;
}
}

View File

@ -128,6 +128,7 @@ public:
{
return tenant_id_ == that.tenant_id_ && id_ == that.id_;
}
TO_STRING_KV(K(tenant_id_), K(id_));
uint64_t tenant_id_; // tenant_id of req
ObStorageKey id_;
};
@ -188,6 +189,7 @@ public:
int64_t get_net_obw() { return net_obw_.calc(); }
int64_t get_device_bandwidth() const { return device_bandwidth_; }
void set_device_bandwidth(int64_t bw) { device_bandwidth_ = ibw_clock_.iops_ = obw_clock_.iops_ = bw; }
int gc_tenant_infos();
private:
void inner_calc_();
private: