ddl scheduler: only copy dependent index when index status not final

This commit is contained in:
simonjoylet
2023-07-20 10:53:57 +00:00
committed by ob-robot
parent 60eeedcb27
commit 12f4cb584d
4 changed files with 14 additions and 9 deletions

View File

@ -327,9 +327,10 @@ int ObColumnRedefinitionTask::copy_table_indexes()
} else if (OB_ISNULL(index_schema)) { } else if (OB_ISNULL(index_schema)) {
ret = OB_ERR_SYS; ret = OB_ERR_SYS;
LOG_WARN("error sys, index schema must not be nullptr", K(ret), K(tenant_id_), K(index_ids.at(i))); LOG_WARN("error sys, index schema must not be nullptr", K(ret), K(tenant_id_), K(index_ids.at(i)));
} else if (index_schema->can_read_index()) { } else if (is_final_index_status(index_schema->get_index_status())) {
// index is already built // index status is final
need_rebuild_index = false; need_rebuild_index = false;
LOG_INFO("index status is final", K(ret), K(task_id_), K(index_id), K(need_rebuild_index));
} else { } else {
create_index_arg.index_type_ = index_schema->get_index_type(); create_index_arg.index_type_ = index_schema->get_index_type();
ObCreateDDLTaskParam param(tenant_id_, ObCreateDDLTaskParam param(tenant_id_,

View File

@ -947,12 +947,15 @@ int ObDDLTask::switch_status(const ObDDLTaskStatus new_status, const bool enable
const ObDDLTaskStatus old_status = task_status_; const ObDDLTaskStatus old_status = task_status_;
const bool error_need_retry = OB_SUCCESS != ret_code && is_error_need_retry(ret_code); const bool error_need_retry = OB_SUCCESS != ret_code && is_error_need_retry(ret_code);
if (OB_TMP_FAIL(check_ddl_task_is_cancel(trace_id_, is_cancel))) { if (OB_TMP_FAIL(check_ddl_task_is_cancel(trace_id_, is_cancel))) {
LOG_WARN("check ddl task is cancel failed", K(tmp_ret), K_(trace_id)); LOG_WARN("check ddl task is cancel failed", K(tmp_ret), K(task_id_), K(parent_task_id_), K_(trace_id));
} }
if (is_cancel) { if (is_cancel) {
real_ret_code = (OB_SUCCESS == ret_code || error_need_retry) ? OB_CANCELED : ret_code; real_ret_code = (OB_SUCCESS == ret_code || error_need_retry) ? OB_CANCELED : ret_code;
FLOG_INFO("ddl task is canceled", K(task_id_), K(parent_task_id_), K(object_id_),
K(target_object_id_), K(ret_code), K(error_need_retry), K(real_ret_code));
} else if (SUCCESS == old_status || error_need_retry) { } else if (SUCCESS == old_status || error_need_retry) {
LOG_INFO("error code found, but execute again", K(ret_code), K(ret_code_), K(old_status), K(new_status), K(err_code_occurence_cnt_)); LOG_INFO("error code found, but execute again", K(task_id_), K(parent_task_id_),
K(ret_code), K(ret_code_), K(old_status), K(new_status), K(err_code_occurence_cnt_));
real_new_status = old_status; real_new_status = old_status;
real_ret_code = OB_SUCCESS; real_ret_code = OB_SUCCESS;
} }
@ -967,12 +970,12 @@ int ObDDLTask::switch_status(const ObDDLTaskStatus new_status, const bool enable
LOG_WARN("check if tenant has been dropped failed", K(ret), K(tenant_id_)); LOG_WARN("check if tenant has been dropped failed", K(ret), K(tenant_id_));
} else if (is_tenant_dropped) { } else if (is_tenant_dropped) {
need_retry_ = false; need_retry_ = false;
LOG_INFO("tenant has been dropped, exit anyway", K(ret), K(tenant_id_)); LOG_INFO("tenant has been dropped, exit anyway", K(ret), K(task_id_), K(parent_task_id_), K(tenant_id_));
} else if (OB_FAIL(ObAllTenantInfoProxy::is_standby_tenant(&root_service->get_sql_proxy(), tenant_id_, is_standby_tenant))) { } else if (OB_FAIL(ObAllTenantInfoProxy::is_standby_tenant(&root_service->get_sql_proxy(), tenant_id_, is_standby_tenant))) {
LOG_WARN("check is standby tenant failed", K(ret), K(tenant_id_)); LOG_WARN("check is standby tenant failed", K(ret), K(tenant_id_));
} else if (is_standby_tenant) { } else if (is_standby_tenant) {
need_retry_ = false; need_retry_ = false;
LOG_INFO("tenant is standby, exit anyway", K(ret), K(tenant_id_)); LOG_INFO("tenant is standby, exit anyway", K(ret), K(task_id_), K(parent_task_id_), K(tenant_id_));
} else if (OB_FAIL(trans.start(&root_service->get_sql_proxy(), tenant_id_))) { } else if (OB_FAIL(trans.start(&root_service->get_sql_proxy(), tenant_id_))) {
LOG_WARN("start transaction failed", K(ret)); LOG_WARN("start transaction failed", K(ret));
} else { } else {

View File

@ -461,9 +461,10 @@ int ObTableRedefinitionTask::copy_table_indexes()
} else if (OB_ISNULL(index_schema)) { } else if (OB_ISNULL(index_schema)) {
ret = OB_ERR_SYS; ret = OB_ERR_SYS;
LOG_WARN("error sys, index schema must not be nullptr", K(ret), K(index_ids.at(i))); LOG_WARN("error sys, index schema must not be nullptr", K(ret), K(index_ids.at(i)));
} else if (index_schema->can_read_index()) { } else if (is_final_index_status(index_schema->get_index_status())) {
// index is already built // index status is final
need_rebuild_index = false; need_rebuild_index = false;
LOG_INFO("index status is final", K(ret), K(task_id_), K(index_id), K(need_rebuild_index));
} else { } else {
create_index_arg.index_type_ = index_schema->get_index_type(); create_index_arg.index_type_ = index_schema->get_index_type();
ObCreateDDLTaskParam param(tenant_id_, ObCreateDDLTaskParam param(tenant_id_,

View File

@ -331,7 +331,7 @@ int ObDDLErrorMessageTableOperator::report_ddl_error_message(const ObBuildDDLErr
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected affected rows", K(ret), K(affected_rows)); LOG_WARN("unexpected affected rows", K(ret), K(affected_rows));
} else { } else {
LOG_INFO("process ddl error message report success", K(ret), K(schema_version), K(table_id), K(addr), K(error_message), K(update_sql.ptr())); LOG_INFO("process ddl error message report success", K(ret), K(task_id), K(schema_version), K(table_id), K(addr), K(error_message), K(update_sql.ptr()));
} }
} }
return ret; return ret;