fix wrong set of IO_TUNING is_inited_

This commit is contained in:
zhjc1124
2024-08-14 07:25:47 +00:00
committed by ob-robot
parent df87f4f90a
commit 0881d89dd1

View File

@ -843,28 +843,23 @@ void ObIOTuner::destroy()
void ObIOTuner::run1() void ObIOTuner::run1()
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (OB_UNLIKELY(!is_inited_)) { const int64_t thread_id = get_thread_idx();
ret = OB_NOT_INIT; set_thread_name("IO_TUNING", thread_id);
LOG_WARN("not init", K(ret), K(is_inited_)); LOG_INFO("io tuner thread started");
} else { while (!has_set_stop()) {
const int64_t thread_id = get_thread_idx(); //try to update callback_thread_count.
set_thread_name("IO_TUNING", thread_id); (void) try_release_thread();
LOG_INFO("io tuner thread started"); // print interval must <= 1s, for ensuring real_iops >= 1 in gv$ob_io_quota.
while (!has_set_stop()) { if (REACH_TIME_INTERVAL(1000L * 1000L * 1L)) {
//try to update callback_thread_count. print_io_status();
(void) try_release_thread(); print_sender_status();
// print interval must <= 1s, for ensuring real_iops >= 1 in gv$ob_io_quota. if (OB_FAIL(send_detect_task())) {
if (REACH_TIME_INTERVAL(1000L * 1000L * 1L)) { LOG_WARN("fail to send detect task", K(ret));
print_io_status();
print_sender_status();
if (OB_FAIL(send_detect_task())) {
LOG_WARN("fail to send detect task", K(ret));
}
} }
ob_usleep(100 * 1000); // 100ms
} }
LOG_INFO("io tuner thread stopped"); ob_usleep(100 * 1000); // 100ms
} }
LOG_INFO("io tuner thread stopped");
} }
int64_t ObIOTuner::to_string(char *buf, const int64_t len) const int64_t ObIOTuner::to_string(char *buf, const int64_t len) const
@ -2763,9 +2758,10 @@ int ObIORunner::init(const int64_t queue_capacity, ObIAllocator &allocator)
LOG_WARN("init queue failed", K(ret), K(queue_capacity), KP(buf)); LOG_WARN("init queue failed", K(ret), K(queue_capacity), KP(buf));
} else if (OB_FAIL(TG_CREATE_TENANT(lib::TGDefIDs::IO_CALLBACK, tg_id_))) { } else if (OB_FAIL(TG_CREATE_TENANT(lib::TGDefIDs::IO_CALLBACK, tg_id_))) {
LOG_WARN("create runner thread failed", K(ret)); LOG_WARN("create runner thread failed", K(ret));
} else if (FALSE_IT(is_inited_ = true)) {
} else if (OB_FAIL(TG_SET_RUNNABLE_AND_START(tg_id_, *this))) { } else if (OB_FAIL(TG_SET_RUNNABLE_AND_START(tg_id_, *this))) {
LOG_WARN("start runner thread failed", K(ret), K(tg_id_)); LOG_WARN("start runner thread failed", K(ret), K(tg_id_));
} else {
is_inited_ = true;
} }
if (OB_UNLIKELY(!is_inited_)) { if (OB_UNLIKELY(!is_inited_)) {
destroy(); destroy();
@ -2811,29 +2807,24 @@ void ObIORunner::destroy()
void ObIORunner::run1() void ObIORunner::run1()
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (OB_UNLIKELY(!is_inited_)) { lib::set_thread_name("DiskCB");
ret = OB_NOT_INIT; LOG_INFO("io callback thread started");
LOG_WARN("not init", K(ret), K(is_inited_)); while (!has_set_stop()) {
} else { ObIORequest *req = nullptr;
lib::set_thread_name("DiskCB"); if (OB_FAIL(pop(req))) {
LOG_INFO("io callback thread started"); if (OB_ENTRY_NOT_EXIST == ret) {
while (!has_set_stop()) { ret = OB_SUCCESS;
ObIORequest *req = nullptr;
if (OB_FAIL(pop(req))) {
if (OB_ENTRY_NOT_EXIST == ret) {
ret = OB_SUCCESS;
} else {
LOG_WARN("pop request failed", K(ret));
}
} else { } else {
RequestHolder holder(req); LOG_WARN("pop request failed", K(ret));
if (OB_FAIL(handle(req))) { }
LOG_WARN("handle request failed", K(ret), KPC(req)); } else {
} RequestHolder holder(req);
if (OB_FAIL(handle(req))) {
LOG_WARN("handle request failed", K(ret), KPC(req));
} }
} }
LOG_INFO("io callback thread stopped");
} }
LOG_INFO("io callback thread stopped");
} }
int ObIORunner::push(ObIORequest &req) int ObIORunner::push(ObIORequest &req)