[FEAT MERGE]4_1_sql_feature
Co-authored-by: leslieyuchen <leslieyuchen@gmail.com> Co-authored-by: Charles0429 <xiezhenjiang@gmail.com> Co-authored-by: raywill <hustos@gmail.com>
This commit is contained in:
@ -63,6 +63,7 @@ int ObDropIndexTask::init(
|
||||
parent_task_id_ = parent_task_id;
|
||||
task_version_ = OB_DROP_INDEX_TASK_VERSION;
|
||||
is_inited_ = true;
|
||||
ddl_tracing_.open();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -96,6 +97,8 @@ int ObDropIndexTask::init(
|
||||
if (OB_FAIL(ret)) {
|
||||
} else {
|
||||
is_inited_ = true;
|
||||
// set up span during recover task
|
||||
ddl_tracing_.open_for_recovery();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -150,7 +153,7 @@ int ObDropIndexTask::prepare(const ObDDLTaskStatus new_status)
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObDropIndexTask has not been inited", K(ret));
|
||||
} else if (OB_FAIL(switch_status(new_status, ret))) {
|
||||
} else if (OB_FAIL(switch_status(new_status, true, ret))) {
|
||||
LOG_WARN("switch status failed", K(ret));
|
||||
}
|
||||
return ret;
|
||||
@ -163,7 +166,7 @@ int ObDropIndexTask::set_write_only(const share::ObDDLTaskStatus new_status)
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObDropIndexTask has not been inited", K(ret));
|
||||
} else if (OB_FAIL(switch_status(new_status, ret))) {
|
||||
} else if (OB_FAIL(switch_status(new_status, true, ret))) {
|
||||
LOG_WARN("switch status failed", K(ret));
|
||||
}
|
||||
return ret;
|
||||
@ -177,7 +180,7 @@ int ObDropIndexTask::set_unusable(const ObDDLTaskStatus new_status)
|
||||
LOG_WARN("ObDropIndexTask has not been inited", K(ret));
|
||||
} else if (OB_FAIL(update_index_status(INDEX_STATUS_UNUSABLE))) {
|
||||
LOG_WARN("update index status failed", K(ret));
|
||||
} else if (OB_FAIL(switch_status(new_status, ret))) {
|
||||
} else if (OB_FAIL(switch_status(new_status, true, ret))) {
|
||||
LOG_WARN("switch status failed", K(ret));
|
||||
}
|
||||
return ret;
|
||||
@ -245,7 +248,7 @@ int ObDropIndexTask::drop_index(const ObDDLTaskStatus new_status)
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(drop_index_impl())) {
|
||||
LOG_WARN("send drop index rpc failed", K(ret));
|
||||
} else if (OB_FAIL(switch_status(new_status, ret))) {
|
||||
} else if (OB_FAIL(switch_status(new_status, true, ret))) {
|
||||
LOG_WARN("switch status failed", K(ret));
|
||||
}
|
||||
return ret;
|
||||
@ -267,7 +270,7 @@ int ObDropIndexTask::fail()
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObDropIndexTask::cleanup()
|
||||
int ObDropIndexTask::cleanup_impl()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObString unused_str;
|
||||
@ -300,6 +303,7 @@ int ObDropIndexTask::process()
|
||||
} else if (OB_FAIL(check_switch_succ())) {
|
||||
LOG_WARN("check need retry failed", K(ret));
|
||||
} else {
|
||||
ddl_tracing_.restore_span_hierarchy();
|
||||
const ObDDLTaskStatus status = static_cast<ObDDLTaskStatus>(task_status_);
|
||||
switch (status) {
|
||||
case ObDDLTaskStatus::PREPARE:
|
||||
@ -346,6 +350,7 @@ int ObDropIndexTask::process()
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("error unexpected, task status is not valid", K(ret), K(task_status_));
|
||||
}
|
||||
ddl_tracing_.release_span_hierarchy();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -406,6 +411,8 @@ int ObDropIndexTask::serialize_params_to_message(char *buf, const int64_t buf_si
|
||||
LOG_WARN("invalid arg", K(ret), KP(buf), K(buf_size));
|
||||
} else if (OB_FAIL(drop_index_arg_.serialize(buf, buf_size, pos))) {
|
||||
LOG_WARN("serialize failed", K(ret));
|
||||
} else if (OB_FAIL(ddl_tracing_.serialize(buf, buf_size, pos))) {
|
||||
LOG_WARN("fail to serialize ddl_flt_ctx", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -421,11 +428,65 @@ int ObDropIndexTask::deserlize_params_from_message(const char *buf, const int64_
|
||||
LOG_WARN("deserialize failed", K(ret));
|
||||
} else if (OB_FAIL(deep_copy_index_arg(allocator_, tmp_drop_index_arg, drop_index_arg_))) {
|
||||
LOG_WARN("deep copy drop index arg failed", K(ret));
|
||||
} else {
|
||||
if (pos < buf_size) {
|
||||
if (OB_FAIL(ddl_tracing_.deserialize(buf, buf_size, pos))) {
|
||||
LOG_WARN("fail to deserialize ddl_tracing_", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t ObDropIndexTask::get_serialize_param_size() const
|
||||
{
|
||||
return drop_index_arg_.get_serialize_size();
|
||||
return drop_index_arg_.get_serialize_size() + ddl_tracing_.get_serialize_size();
|
||||
}
|
||||
|
||||
void ObDropIndexTask::flt_set_task_span_tag() const
|
||||
{
|
||||
FLT_SET_TAG(ddl_task_id, task_id_, ddl_parent_task_id, parent_task_id_,
|
||||
ddl_data_table_id, object_id_, ddl_index_table_id, target_object_id_,
|
||||
ddl_schema_version, schema_version_);
|
||||
}
|
||||
|
||||
void ObDropIndexTask::flt_set_status_span_tag() const
|
||||
{
|
||||
switch (task_status_) {
|
||||
case ObDDLTaskStatus::PREPARE: {
|
||||
FLT_SET_TAG(ddl_ret_code, ret_code_);
|
||||
break;
|
||||
}
|
||||
case ObDDLTaskStatus::SET_WRITE_ONLY: {
|
||||
FLT_SET_TAG(ddl_ret_code, ret_code_);
|
||||
break;
|
||||
}
|
||||
case ObDDLTaskStatus::WAIT_TRANS_END_FOR_WRITE_ONLY: {
|
||||
FLT_SET_TAG(ddl_data_table_id, object_id_, ddl_snapshot_version, snapshot_version_, ddl_ret_code, ret_code_);
|
||||
break;
|
||||
}
|
||||
case ObDDLTaskStatus::SET_UNUSABLE: {
|
||||
FLT_SET_TAG(ddl_ret_code, ret_code_);
|
||||
break;
|
||||
}
|
||||
case ObDDLTaskStatus::WAIT_TRANS_END_FOR_UNUSABLE: {
|
||||
FLT_SET_TAG(ddl_data_table_id, object_id_, ddl_snapshot_version, snapshot_version_, ddl_ret_code, ret_code_);
|
||||
break;
|
||||
}
|
||||
case ObDDLTaskStatus::DROP_SCHEMA: {
|
||||
FLT_SET_TAG(ddl_index_table_id, target_object_id_, ddl_ret_code, ret_code_);
|
||||
break;
|
||||
}
|
||||
case ObDDLTaskStatus::FAIL: {
|
||||
FLT_SET_TAG(ddl_ret_code, ret_code_);
|
||||
break;
|
||||
}
|
||||
case ObDDLTaskStatus::SUCCESS: {
|
||||
FLT_SET_TAG(ddl_ret_code, ret_code_);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user