[Physical Standby] Modify the log level and Fixed an issue with high CPU usage when removed the primary tenant

This commit is contained in:
obdev
2023-05-22 10:17:12 +00:00
committed by ob-robot
parent 190faa5a4f
commit 4e0d79e6c6
11 changed files with 101 additions and 78 deletions

View File

@ -107,7 +107,7 @@ int ObLogFetcherIdlePool::push(LSFetchCtx *task)
} else {
task->dispatch_in_idle_pool();
LOG_DEBUG("[STAT] [IDLE_POOL] [DISPATCH_IN]", K(task), KPC(task));
LOG_TRACE("[STAT] [IDLE_POOL] [DISPATCH_IN]", K(task), KPC(task));
if (OB_FAIL(TG_PUSH_TASK(tg_id_, task, task->hash()))) {
LOG_ERROR("push task into thread queue fail", KR(ret), K(task));
@ -167,7 +167,7 @@ void ObLogFetcherIdlePool::handle(void *data, volatile bool &stop_flag)
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("ls_fetch_ctx is nullptt", KR(ret), K(thread_index), K(get_thread_cnt()));
} else {
LOG_INFO("fetcher idle pool thread start", K(thread_index), "tls_id", ls_fetch_ctx->get_tls_id());
LOG_TRACE("fetcher idle pool thread start", K(thread_index), "tls_id", ls_fetch_ctx->get_tls_id());
if (OB_FAIL(do_request_(thread_index, *ls_fetch_ctx))) {
if (OB_IN_STOP_STATE != ret) {
@ -205,8 +205,7 @@ int ObLogFetcherIdlePool::do_request_(const int64_t thread_index, LSFetchCtx &ls
if (OB_FAIL(handle_task_(&ls_fetch_ctx, need_dispatch))) {
LOG_ERROR("handle task fail", KR(ret), K(ls_fetch_ctx));
} else if (need_dispatch) {
LOG_DEBUG("[STAT] [IDLE_POOL] [DISPATCH_OUT]", K(ls_fetch_ctx), K(thread_index),
K(ls_fetch_ctx));
LOG_TRACE("[STAT] [IDLE_POOL] [DISPATCH_OUT]", K(thread_index), K(ls_fetch_ctx));
const char *dispatch_reason = "SvrListReady";
if (OB_FAIL(stream_worker_->dispatch_fetch_task(ls_fetch_ctx, dispatch_reason))) {
@ -254,6 +253,11 @@ int ObLogFetcherIdlePool::handle_task_(LSFetchCtx *task, bool &need_dispatch)
} else {
need_dispatch = false;
const bool enable_continue_use_cache_server_list = (1 == cfg_->enable_continue_use_cache_server_list);
const int64_t dispatched_count_from_idle_to_idle = task->get_dispatched_count_from_idle_to_idle();
if (1 == (dispatched_count_from_idle_to_idle % IDLE_HANDLE_COUNT)) {
ob_usleep(IDLE_WAIT_TIME);
}
if (OB_SUCCESS == ret) {
// Update the server list
@ -262,32 +266,38 @@ int ObLogFetcherIdlePool::handle_task_(LSFetchCtx *task, bool &need_dispatch)
if (OB_FAIL(task->update_svr_list())) {
LOG_ERROR("update server list fail", KR(ret), KPC(task));
}
}
// locate the start LSN
// Requires a successful location to leave the idle pool
else if (task->need_locate_start_lsn()) {
if (is_standby(log_fetcher_user_)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("LS need to specifies start_lsn in the Physical standby", KR(ret), KPC(task));
} else if (OB_FAIL(task->locate_start_lsn(*start_lsn_locator_))) {
LOG_ERROR("locate start lsn fail", KR(ret), K(start_lsn_locator_), KPC(task));
}
} else if (task->need_locate_end_lsn()) {
if (is_standby(log_fetcher_user_)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("LS need to specifies start_lsn in the Physical standby", KR(ret), KPC(task));
} else if (OB_FAIL(task->locate_end_lsn(*start_lsn_locator_))) {
LOG_ERROR("locate end lsn fail", KR(ret), K(start_lsn_locator_), KPC(task));
} else if (is_standby(log_fetcher_user_)) {
need_dispatch = true;
} else if (is_cdc(log_fetcher_user_)) {
// locate the start LSN
// Requires a successful location to leave the idle pool
if (task->need_locate_start_lsn()) {
if (is_standby(log_fetcher_user_)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("LS need to specifies start_lsn in the Physical standby", KR(ret), KPC(task));
} else if (OB_FAIL(task->locate_start_lsn(*start_lsn_locator_))) {
LOG_ERROR("locate start lsn fail", KR(ret), K(start_lsn_locator_), KPC(task));
}
} else if (task->need_locate_end_lsn()) {
if (is_standby(log_fetcher_user_)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("LS need to specifies start_lsn in the Physical standby", KR(ret), KPC(task));
} else if (OB_FAIL(task->locate_end_lsn(*start_lsn_locator_))) {
LOG_ERROR("locate end lsn fail", KR(ret), K(start_lsn_locator_), KPC(task));
}
} else {
// After all the above conditions are met, allow distribution to the fetch log stream
need_dispatch = true;
}
} else {
// After all the above conditions are met, allow distribution to the fetch log stream
need_dispatch = true;
ret = OB_NOT_SUPPORTED;
LOG_ERROR("not support", KR(ret), K(log_fetcher_user_), KPC(task));
}
}
if (enable_continue_use_cache_server_list) {
need_dispatch = true;
LOG_DEBUG("enable_continue_use_cache_server_list", KPC(task), K(need_dispatch));
LOG_TRACE("enable_continue_use_cache_server_list", KPC(task), K(need_dispatch));
}
}