fix add group fail

This commit is contained in:
obdev 2024-12-12 15:15:07 +00:00 committed by ob-robot
parent 976ace7e8d
commit 04d61c5e0f
7 changed files with 50 additions and 16 deletions

View File

@ -18,7 +18,7 @@ public:
}
~QSchedStat() {}
void try_report(int n_chan, int64_t cur_us, bool leaf_only) {
char buf[4096];
char buf[7168];
int idx[128];
StrFormat f(buf, sizeof(buf));
int active_cnt = 0;

View File

@ -289,6 +289,9 @@ int64_t ObTenantIOSchedulerV2::get_qindex(ObIORequest& req)
} else if (OB_FAIL(req.tenant_io_mgr_.get_ptr()->get_group_index(grp_key, (uint64_t&)index))) {
if (ret == OB_HASH_NOT_EXIST || ret == OB_STATE_NOT_MATCH) {
ret = OB_SUCCESS;
if (REACH_TIME_INTERVAL(1 * 1000L * 1000L)) {
LOG_INFO("get group index failed, but maybe it is ok", K(ret), K(grp_key), K(index)); // group is not build
}
} else {
LOG_WARN("get group index failed", K(ret), K(grp_key), K(index));
}
@ -298,19 +301,20 @@ int64_t ObTenantIOSchedulerV2::get_qindex(ObIORequest& req)
}
return index;
}
int ObTenantIOSchedulerV2::get_qid(int64_t index)
int ObTenantIOSchedulerV2::get_qid(int64_t index, ObIORequest& req, bool& is_default_q)
{
int qid = -1;
if (index >= 0 && index < qid_.count()) {
qid = qid_.at(index);
}
if (qid < 0 && index >= 0) {
qid = default_qid_[index % N_SUB_ROOT];
if (qid < 0) {
is_default_q = true;
ObIOGroupKey grp_key = req.get_group_key();
int default_index = static_cast<int>(grp_key.mode_);
qid = default_qid_[default_index % N_SUB_ROOT];
}
return qid;
}
static uint32_t g_io_chan_id = 0;
static uint32_t assign_chan_id()
{
@ -320,17 +324,23 @@ static uint32_t assign_chan_id()
int ObTenantIOSchedulerV2::schedule_request(ObIORequest &req)
{
int ret = OB_SUCCESS;
bool is_default_q = false;
int root = OB_IO_MANAGER_V2.get_root_qid();
int64_t index = get_qindex(req);
int qid = get_qid(index);
int qid = get_qid(index, req, is_default_q);
fill_qsched_req(req, qid);
req.inc_ref("phyqueue_inc"); //ref for phy_queue
if (OB_ISNULL(req.io_result_)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("io result is null", K(ret), K(req));
} else if (FALSE_IT(req.io_result_->time_log_.enqueue_ts_ = ObTimeUtility::fast_current_time())) {
} else if (OB_UNLIKELY(is_default_q)) {
if (0 != qsched_submit(root, &req.qsched_req_, assign_chan_id())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("qsched_submit fail", K(ret), K(req));
}
} else if (OB_FAIL(OB_IO_MANAGER.get_tc().register_bucket(req, qid))) {
LOG_WARN("register bucket fail", K(ret), K(req));
} else if (FALSE_IT(req.io_result_->time_log_.enqueue_ts_ = ObTimeUtility::fast_current_time())) {
} else if (0 != qsched_submit(root, &req.qsched_req_, assign_chan_id())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("qsched_submit fail", K(ret), K(req));

View File

@ -71,7 +71,7 @@ public:
int schedule_request(ObIORequest &req);
private:
static int64_t get_qindex(ObIORequest& req);
int get_qid(int64_t index);
int get_qid(int64_t index, ObIORequest& req, bool& is_default_q);
private:
DRWLock rwlock_;
uint64_t tenant_id_;

View File

@ -774,7 +774,6 @@ ObIOMode ObIOResult::get_mode() const
return flag_.get_mode();
}
ObIOGroupKey ObIOResult::get_group_key() const
{
return ObIOGroupKey(flag_.get_resource_group_id(), is_object_device_req_ ? get_mode() : ObIOMode::MAX_MODE);
@ -1271,7 +1270,7 @@ const ObIOFlag &ObIORequest::get_flag() const
ObIOMode ObIORequest::get_mode() const
{
return io_result_->flag_.get_mode();
return io_result_->flag_.get_mode(); // 2 mode : read and write
}
ObIOGroupMode ObIORequest::get_group_mode() const

View File

@ -532,7 +532,7 @@ public:
void cancel();
int wait(int64_t wait_ms);
void finish(const ObIORetCode &ret_code, ObIORequest *req = nullptr);
ObIOMode get_mode() const;
ObIOMode get_mode() const; // 2 mode : read and write
ObIOGroupKey get_group_key() const;
uint64_t get_sys_module_id() const;
bool is_sys_module() const;
@ -609,8 +609,8 @@ public:
bool is_sys_module() const;
char *calc_io_buf(); // calc the aligned io_buf of raw_buf_, which interact with the operating system
const ObIOFlag &get_flag() const;
ObIOMode get_mode() const;
ObIOGroupMode get_group_mode() const;
ObIOMode get_mode() const; // 2 mode
ObIOGroupMode get_group_mode() const; // 4 mode
ObIOCallback *get_callback() const;
int alloc_io_buf(char *&io_buf);
int get_buf_size() const;

View File

@ -198,7 +198,7 @@ int ObTrafficControl::ObSharedDeviceControlV2::fill_qsched_req_storage_key(ObIOR
}
int ObTrafficControl::ObSharedDeviceControlV2::add_group(const ObIOSSGrpKey &grp_key, const int qid) {
return group_list_.add_group(grp_key, qid, limit_ids_, ResourceType::ResourceTypeCnt);
return transform_ret(group_list_.add_group(grp_key, qid, limit_ids_, ResourceType::ResourceTypeCnt));
}
@ -341,6 +341,31 @@ int ObTrafficControl::calc_usage(ObIORequest &req)
}
return ret;
}
int ObTrafficControl::transform_ret(int ret)
{
switch (ret) {
case 0:
ret = OB_SUCCESS;
break;
case ENOENT:
ret = OB_EAGAIN;
break;
case -ENOENT:
ret = OB_EAGAIN;
break;
case ENOMEM:
ret = OB_ALLOCATE_MEMORY_FAILED;
break;
case -ENOMEM:
ret = OB_ALLOCATE_MEMORY_FAILED;
break;
default:
LOG_WARN("unknow ret", K(ret));
ret = OB_ERR_UNEXPECTED;
break;
}
return ret;
}
void ObTrafficControl::print_server_status()
{

View File

@ -298,7 +298,7 @@ public:
int gc_tenant_infos();
private:
void inner_calc_();
static int transform_ret(int ret);
private:
// for device limitation
hash::ObHashMap<ObStorageKey, ObSharedDeviceControl> shared_device_map_;