[SCN] fix farm failure
This commit is contained in:
@ -66,6 +66,7 @@ int ObColumnRedefinitionTask::init(const uint64_t tenant_id, const int64_t task_
|
||||
task_version_ = OB_COLUMN_REDEFINITION_TASK_VERSION;
|
||||
task_id_ = task_id;
|
||||
parallelism_ = parallelism;
|
||||
execution_id_ = 1L;
|
||||
is_inited_ = true;
|
||||
}
|
||||
return ret;
|
||||
@ -96,7 +97,9 @@ int ObColumnRedefinitionTask::init(const ObDDLTaskRecord &task_record)
|
||||
schema_version_ = schema_version;
|
||||
task_status_ = static_cast<ObDDLTaskStatus>(task_record.task_status_);
|
||||
snapshot_version_ = task_record.snapshot_version_;
|
||||
execution_id_ = task_record.execution_id_;
|
||||
tenant_id_ = task_record.tenant_id_;
|
||||
ret_code_ = task_record.ret_code_;
|
||||
is_inited_ = true;
|
||||
}
|
||||
return ret;
|
||||
@ -139,7 +142,6 @@ int ObColumnRedefinitionTask::send_build_single_replica_request()
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObColumnRedefinitionTask has not been inited", K(ret));
|
||||
} else {
|
||||
redefinition_execution_id_ = ObTimeUtility::fast_current_time();
|
||||
ObDDLSingleReplicaExecutorParam param;
|
||||
param.tenant_id_ = tenant_id_;
|
||||
param.type_ = task_type_;
|
||||
@ -149,7 +151,7 @@ int ObColumnRedefinitionTask::send_build_single_replica_request()
|
||||
param.snapshot_version_ = snapshot_version_;
|
||||
param.task_id_ = task_id_;
|
||||
param.parallelism_ = alter_table_arg_.parallelism_;
|
||||
param.execution_id_ = redefinition_execution_id_;
|
||||
param.execution_id_ = execution_id_;
|
||||
if (OB_FAIL(ObDDLUtil::get_tablets(tenant_id_, object_id_, param.source_tablet_ids_))) {
|
||||
LOG_WARN("fail to get tablets", K(ret), K(tenant_id_), K(object_id_));
|
||||
} else if (OB_FAIL(ObDDLUtil::get_tablets(tenant_id_, target_object_id_, param.dest_tablet_ids_))) {
|
||||
@ -191,6 +193,7 @@ int ObColumnRedefinitionTask::update_complete_sstable_job_status(const common::O
|
||||
const int ret_code)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_latest_execution_id = false;
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObColumnRedefinitionTask has not been inited", K(ret));
|
||||
@ -199,8 +202,10 @@ int ObColumnRedefinitionTask::update_complete_sstable_job_status(const common::O
|
||||
} else if (snapshot_version != snapshot_version_) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("snapshot version not match", K(ret), K(snapshot_version), K(snapshot_version_));
|
||||
} else if (execution_id != redefinition_execution_id_) {
|
||||
LOG_INFO("receive a mismatch execution result, ignore", K(execution_id), K(redefinition_execution_id_));
|
||||
} else if (OB_FAIL(check_is_latest_execution_id(execution_id, is_latest_execution_id))) {
|
||||
LOG_WARN("failed to check latest execution id", K(ret), K(execution_id));
|
||||
} else if (!is_latest_execution_id) {
|
||||
LOG_INFO("receive a mismatch execution result, ignore", K(execution_id), K(execution_id_));
|
||||
} else if (OB_FAIL(replica_builder_.set_partition_task_status(tablet_id, ret_code))) {
|
||||
LOG_WARN("fail to set partition task status", K(ret));
|
||||
}
|
||||
@ -419,6 +424,7 @@ int ObColumnRedefinitionTask::copy_table_dependent_objects(const ObDDLTaskStatus
|
||||
int ret = OB_SUCCESS;
|
||||
ObRootService *root_service = GCTX.root_service_;
|
||||
int64_t finished_task_cnt = 0;
|
||||
bool state_finish = false;
|
||||
ObSchemaGetterGuard schema_guard;
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
@ -436,7 +442,11 @@ int ObColumnRedefinitionTask::copy_table_dependent_objects(const ObDDLTaskStatus
|
||||
} else if (OB_FAIL(copy_table_foreign_keys())) {
|
||||
LOG_WARN("fail to copy table foreign keys", K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
state_finish = true;
|
||||
} else {
|
||||
// wait copy dependent objects to be finished
|
||||
ObAddr unused_addr;
|
||||
for (common::hash::ObHashMap<ObDDLTaskKey, DependTaskStatus>::const_iterator iter = dependent_task_result_map_.begin();
|
||||
@ -471,8 +481,11 @@ int ObColumnRedefinitionTask::copy_table_dependent_objects(const ObDDLTaskStatus
|
||||
}
|
||||
}
|
||||
}
|
||||
if (finished_task_cnt == dependent_task_result_map_.size()) {
|
||||
state_finish = true;
|
||||
}
|
||||
}
|
||||
if (finished_task_cnt == dependent_task_result_map_.size()) {
|
||||
if (state_finish) {
|
||||
if (OB_FAIL(switch_status(next_task_status, ret))) {
|
||||
LOG_WARN("fail to switch status", K(ret));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user