diff --git a/deps/oblib/src/lib/tc/ob_tc_stat.cpp b/deps/oblib/src/lib/tc/ob_tc_stat.cpp index 4ab2e7647..a245d9f3f 100644 --- a/deps/oblib/src/lib/tc/ob_tc_stat.cpp +++ b/deps/oblib/src/lib/tc/ob_tc_stat.cpp @@ -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; diff --git a/src/share/io/io_schedule/ob_io_schedule_v2.cpp b/src/share/io/io_schedule/ob_io_schedule_v2.cpp index 25b3a2c03..30718fe42 100644 --- a/src/share/io/io_schedule/ob_io_schedule_v2.cpp +++ b/src/share/io/io_schedule/ob_io_schedule_v2.cpp @@ -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(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)); diff --git a/src/share/io/io_schedule/ob_io_schedule_v2.h b/src/share/io/io_schedule/ob_io_schedule_v2.h index faadb4544..db1f481d4 100644 --- a/src/share/io/io_schedule/ob_io_schedule_v2.h +++ b/src/share/io/io_schedule/ob_io_schedule_v2.h @@ -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_; diff --git a/src/share/io/ob_io_define.cpp b/src/share/io/ob_io_define.cpp index e392ab023..858ec3764 100644 --- a/src/share/io/ob_io_define.cpp +++ b/src/share/io/ob_io_define.cpp @@ -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 diff --git a/src/share/io/ob_io_define.h b/src/share/io/ob_io_define.h index 6641fe5a9..f27dd2077 100644 --- a/src/share/io/ob_io_define.h +++ b/src/share/io/ob_io_define.h @@ -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; diff --git a/src/share/io/ob_io_manager.cpp b/src/share/io/ob_io_manager.cpp index 5e04f873e..435983a3f 100644 --- a/src/share/io/ob_io_manager.cpp +++ b/src/share/io/ob_io_manager.cpp @@ -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() { diff --git a/src/share/io/ob_io_manager.h b/src/share/io/ob_io_manager.h index 68dee88c8..3db4c67ed 100644 --- a/src/share/io/ob_io_manager.h +++ b/src/share/io/ob_io_manager.h @@ -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 shared_device_map_;