add group index check for group_clocks
This commit is contained in:
parent
1ab36fb893
commit
2d051e6b00
@ -249,6 +249,7 @@ int ObTenantIOClock::calc_phyqueue_clock(ObPhyQueue *phy_queue, ObIORequest &req
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t current_ts = ObTimeUtility::fast_current_time();
|
||||
bool is_unlimited = false;
|
||||
ObMClock *mclock = nullptr;
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("not init", K(ret), K(is_inited_));
|
||||
@ -265,8 +266,9 @@ int ObTenantIOClock::calc_phyqueue_clock(ObPhyQueue *phy_queue, ObIORequest &req
|
||||
if (cur_queue_index < 0 || (cur_queue_index >= group_clocks_.count())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("index out of boundary", K(ret), K(cur_queue_index), K(group_clocks_.count()));
|
||||
} else if (OB_FAIL(get_mclock(cur_queue_index, mclock))) {
|
||||
LOG_WARN("get mclock failed", K(ret), K(cur_queue_index), K(group_clocks_.count()));
|
||||
} else {
|
||||
ObMClock &mclock = get_mclock(cur_queue_index);
|
||||
double iops_scale = 0;
|
||||
bool is_io_ability_valid = true;
|
||||
ObAtomIOClock* unit_clock = &unit_clocks_[static_cast<int>(ObIOMode::MAX_MODE)];
|
||||
@ -281,8 +283,8 @@ int ObTenantIOClock::calc_phyqueue_clock(ObPhyQueue *phy_queue, ObIORequest &req
|
||||
}
|
||||
// if we want to enable iops_limit without configuration of __all_disk_io_calibration,
|
||||
// ignore is_io_ability_valid firstly.
|
||||
if (OB_UNLIKELY(is_io_ability_valid == false || mclock.is_unlimited())) {
|
||||
//unlimited
|
||||
if (OB_UNLIKELY(is_io_ability_valid == false || OB_ISNULL(mclock) || mclock->is_unlimited())) {
|
||||
// unlimited
|
||||
is_unlimited = true;
|
||||
} else {
|
||||
const ObStorageIdMod &storage_info = ((ObObjectDevice*)(req.fd_.device_handle_))->get_storage_id_mod();
|
||||
@ -295,12 +297,12 @@ int ObTenantIOClock::calc_phyqueue_clock(ObPhyQueue *phy_queue, ObIORequest &req
|
||||
}
|
||||
} else {
|
||||
// min_iops of group
|
||||
mclock.reservation_clock_.atom_update(current_ts - PHY_QUEUE_BURST_USEC, iops_scale, phy_queue->reservation_ts_);
|
||||
mclock->reservation_clock_.atom_update(current_ts - PHY_QUEUE_BURST_USEC, iops_scale, phy_queue->reservation_ts_);
|
||||
}
|
||||
// iops/bandwidth weight of tenant & group, TODO fengshuo.fs: THIS IS NOT CORRECT
|
||||
mclock.proportion_clock_.atom_update(current_ts - PHY_QUEUE_BURST_USEC, iops_scale, phy_queue->proportion_ts_);
|
||||
mclock->proportion_clock_.atom_update(current_ts - PHY_QUEUE_BURST_USEC, iops_scale, phy_queue->proportion_ts_);
|
||||
// max iops/bandwidth of group
|
||||
mclock.limitation_clock_.compare_and_update(current_ts - PHY_QUEUE_BURST_USEC, iops_scale, phy_queue->limitation_ts_);
|
||||
mclock->limitation_clock_.compare_and_update(current_ts - PHY_QUEUE_BURST_USEC, iops_scale, phy_queue->limitation_ts_);
|
||||
// max iops/bandwidth of tenant
|
||||
unit_clock->compare_and_update(current_ts, iops_scale, phy_queue->limitation_ts_);
|
||||
}
|
||||
@ -379,14 +381,19 @@ int ObTenantIOClock::adjust_reservation_clock(ObPhyQueue *phy_queue, ObIORequest
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t cur_queue_index = phy_queue->queue_index_;
|
||||
ObMClock *mclock = nullptr;
|
||||
if(cur_queue_index < 0 || (cur_queue_index >= group_clocks_.count() && cur_queue_index != 0)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("index out of boundary", K(ret), K(cur_queue_index));
|
||||
} else if (OB_ISNULL(req.io_result_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("io result is null", K(ret));
|
||||
} else if (OB_FAIL(get_mclock(cur_queue_index, mclock))) {
|
||||
LOG_WARN("get mclock failed", K(ret), K(cur_queue_index), K(group_clocks_.count()));
|
||||
} else if (OB_ISNULL(mclock)) {
|
||||
ret = OB_INNER_STAT_ERROR;
|
||||
LOG_WARN("mclock is null", K(ret), K(cur_queue_index), K(group_clocks_.count()));
|
||||
} else {
|
||||
ObMClock &mclock = get_mclock(cur_queue_index);
|
||||
double iops_scale = 0;
|
||||
bool is_io_ability_valid = true;
|
||||
if (req.fd_.device_handle_->is_object_device()) {
|
||||
@ -396,7 +403,7 @@ int ObTenantIOClock::adjust_reservation_clock(ObPhyQueue *phy_queue, ObIORequest
|
||||
iops_scale,
|
||||
is_io_ability_valid))) {
|
||||
LOG_WARN("get iops scale failed", K(ret), K(req));
|
||||
} else if (is_io_ability_valid && OB_FAIL(mclock.dial_back_reservation_clock(iops_scale))) {
|
||||
} else if (is_io_ability_valid && OB_FAIL(mclock->dial_back_reservation_clock(iops_scale))) {
|
||||
LOG_WARN("dial back reservation clock failed", K(ret), K(iops_scale), K(req), K(mclock));
|
||||
}
|
||||
}
|
||||
@ -525,9 +532,16 @@ int64_t ObTenantIOClock::get_max_proportion_ts()
|
||||
return max_proportion_ts;
|
||||
}
|
||||
|
||||
ObMClock &ObTenantIOClock::get_mclock(const int64_t queue_index)
|
||||
int ObTenantIOClock::get_mclock(const int64_t queue_index, ObMClock *mclock)
|
||||
{
|
||||
return group_clocks_.at(queue_index);
|
||||
int ret = OB_SUCCESS;
|
||||
if (queue_index >= group_clocks_.count()) {
|
||||
ret = OB_INNER_STAT_ERROR;
|
||||
LOG_WARN("index out of boundary", K(ret), K(queue_index), K(group_clocks_.count()));
|
||||
} else {
|
||||
mclock = &group_clocks_.at(queue_index);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t ObTenantIOClock::calc_iops(const int64_t iops, const int64_t percentage)
|
||||
|
@ -74,11 +74,19 @@ public:
|
||||
bool is_unlimited_config(const ObMClock &clock, const ObTenantIOConfig::GroupConfig &cur_config);
|
||||
void stop_clock(const uint64_t index);
|
||||
int64_t get_group_clocks_count() { return group_clocks_.count(); }
|
||||
int64_t get_group_limit(const int64_t idx) const { return group_clocks_.at(idx).get_limit(); }
|
||||
int get_group_limit(const int64_t idx, int64_t &group_limit) const {
|
||||
int ret = OB_SUCCESS;
|
||||
if (idx >= group_clocks_.count()) {
|
||||
ret = OB_INNER_STAT_ERROR;
|
||||
} else {
|
||||
group_limit = group_clocks_.at(idx).get_limit();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int64_t get_unit_limit(const ObIOMode mode) const { return unit_clocks_[static_cast<int>(mode)].iops_; }
|
||||
TO_STRING_KV(K(is_inited_), K(io_config_), K(io_usage_), K(group_clocks_));
|
||||
private:
|
||||
ObMClock &get_mclock(const int64_t queue_index);
|
||||
int get_mclock(const int64_t queue_index, ObMClock *mclock);
|
||||
int64_t calc_iops(const int64_t iops, const int64_t percentage);
|
||||
int64_t calc_weight(const int64_t weight, const int64_t percentage);
|
||||
private:
|
||||
|
@ -1991,7 +1991,7 @@ int ObTenantIOManager::print_io_status()
|
||||
for (int64_t i = 0; i < info.count(); ++i) {
|
||||
if (OB_TMP_FAIL(transform_usage_index_to_group_config_index(i, group_config_index))) {
|
||||
continue;
|
||||
} else if (group_config_index >= io_config_.group_configs_.count() || io_clock_.get_group_clocks_count() || info.count() != failed_req_info.count() || info.count() != mem_stat.group_mem_infos_.count()) {
|
||||
} else if (group_config_index >= io_config_.group_configs_.count() || group_config_index >= io_clock_.get_group_clocks_count() || info.count() != failed_req_info.count() || info.count() != mem_stat.group_mem_infos_.count()) {
|
||||
continue;
|
||||
}
|
||||
mode = static_cast<ObIOMode>(group_config_index % MODE_COUNT);
|
||||
@ -2014,8 +2014,10 @@ int ObTenantIOManager::print_io_status()
|
||||
double iops_scale = 1.0;
|
||||
double failed_iops_scale = 1.0;
|
||||
bool is_io_ability_valid = false; // unused
|
||||
int64_t limit = io_clock_.get_group_limit(group_config_index);
|
||||
if (OB_TMP_FAIL(failed_req_info.at(i).calc(failed_avg_size,
|
||||
int64_t limit = 0;
|
||||
if (OB_TMP_FAIL(io_clock_.get_group_limit(group_config_index, limit))) {
|
||||
LOG_WARN("get group limit failed", K(ret), K(group_config_index));
|
||||
} else if (OB_TMP_FAIL(failed_req_info.at(i).calc(failed_avg_size,
|
||||
failed_req_iops,
|
||||
failed_req_bw,
|
||||
failed_avg_prepare_delay,
|
||||
|
Loading…
x
Reference in New Issue
Block a user