Fix bugs of ddl reap old replica build task
This commit is contained in:
@ -720,7 +720,7 @@ int ObIndexBuildTask::release_snapshot(const int64_t snapshot)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObIndexBuildTask::try_reap_old_replica_build_task()
|
||||
int ObIndexBuildTask::reap_old_replica_build_task(bool &need_exec_new_inner_sql)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSchemaGetterGuard schema_guard;
|
||||
@ -743,17 +743,19 @@ int ObIndexBuildTask::try_reap_old_replica_build_task()
|
||||
const ObTabletID unused_tablet_id;
|
||||
const ObDDLTaskInfo unused_addition_info;
|
||||
const int old_ret_code = OB_SUCCESS;
|
||||
bool need_exec_new_inner_sql = true;
|
||||
ObAddr invalid_addr;
|
||||
(void)ObCheckTabletDataComplementOp::check_and_wait_old_complement_task(tenant_id_, dest_table_id,
|
||||
if (old_execution_id < 0) {
|
||||
need_exec_new_inner_sql = true;
|
||||
} else if (OB_FAIL(ObCheckTabletDataComplementOp::check_and_wait_old_complement_task(tenant_id_, dest_table_id,
|
||||
task_id_, old_execution_id, invalid_addr, trace_id_,
|
||||
table_schema->get_schema_version(), snapshot_version_, need_exec_new_inner_sql);
|
||||
if (!need_exec_new_inner_sql) {
|
||||
table_schema->get_schema_version(), snapshot_version_, need_exec_new_inner_sql))) {
|
||||
if (OB_EAGAIN != ret) {
|
||||
LOG_WARN("failed to check and wait old complement task", K(ret));
|
||||
}
|
||||
} else if (!need_exec_new_inner_sql) {
|
||||
if (OB_FAIL(update_complete_sstable_job_status(unused_tablet_id, snapshot_version_, old_execution_id, old_ret_code, unused_addition_info))) {
|
||||
LOG_INFO("succ to wait and complete old task finished!", K(ret));
|
||||
}
|
||||
} else {
|
||||
ret = OB_ENTRY_NOT_EXIST;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -855,7 +857,14 @@ int ObIndexBuildTask::wait_data_complement()
|
||||
|
||||
// submit a job to complete sstable for the index table on snapshot_version
|
||||
if (OB_SUCC(ret) && !state_finished && !is_sstable_complete_task_submitted_) {
|
||||
if (OB_SUCCESS == try_reap_old_replica_build_task()) {
|
||||
bool need_exec_new_inner_sql = false;
|
||||
if (OB_FAIL(reap_old_replica_build_task(need_exec_new_inner_sql))) {
|
||||
if (OB_EAGAIN == ret) {
|
||||
ret = OB_SUCCESS; // retry
|
||||
} else {
|
||||
LOG_WARN("failed to reap old task", K(ret));
|
||||
}
|
||||
} else if (!need_exec_new_inner_sql) {
|
||||
state_finished = true;
|
||||
} else if (OB_FAIL(send_build_single_replica_request())) {
|
||||
LOG_WARN("fail to send build single replica request", K(ret));
|
||||
|
||||
Reference in New Issue
Block a user