Fix forgot to switch status and errcode overwrite
This commit is contained in:
committed by
wangzelin.wzl
parent
8aa5f18458
commit
9875d0330c
@ -419,6 +419,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 +437,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 +476,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));
|
||||
}
|
||||
|
||||
@ -524,6 +524,7 @@ int ObTableRedefinitionTask::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;
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObTableRedefinitionTask has not been inited", K(ret));
|
||||
@ -541,47 +542,54 @@ int ObTableRedefinitionTask::copy_table_dependent_objects(const ObDDLTaskStatus
|
||||
LOG_WARN("copy table foreign keys failed", K(ret));
|
||||
} else {
|
||||
// copy triggers(at current, not supported, skip it)
|
||||
}
|
||||
}
|
||||
|
||||
// wait copy dependent objects to be finished
|
||||
ObAddr unused_addr;
|
||||
for (common::hash::ObHashMap<ObDDLTaskKey, DependTaskStatus>::const_iterator iter = dependent_task_result_map_.begin();
|
||||
iter != dependent_task_result_map_.end(); ++iter) {
|
||||
const int64_t table_id = iter->first.object_id_;
|
||||
const int64_t schema_version = iter->first.schema_version_;
|
||||
const int64_t target_object_id = -1;
|
||||
const int64_t child_task_id = iter->second.task_id_;
|
||||
if (iter->second.ret_code_ == INT64_MAX) {
|
||||
// maybe ddl already finish when switching rs
|
||||
HEAP_VAR(ObDDLErrorMessageTableOperator::ObBuildDDLErrorMessage, error_message) {
|
||||
int64_t unused_user_msg_len = 0;
|
||||
if (OB_FAIL(ObDDLErrorMessageTableOperator::get_ddl_error_message(tenant_id_, child_task_id, target_object_id,
|
||||
unused_addr, false /* is_ddl_retry_task */, *GCTX.sql_proxy_, error_message, unused_user_msg_len))) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
LOG_INFO("ddl task not finish", K(table_id), K(child_task_id), K(schema_version), K(target_object_id));
|
||||
} else {
|
||||
LOG_WARN("fail to get ddl error message", K(ret), K(table_id), K(child_task_id), K(schema_version), K(target_object_id));
|
||||
}
|
||||
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();
|
||||
iter != dependent_task_result_map_.end(); ++iter) {
|
||||
const int64_t table_id = iter->first.object_id_;
|
||||
const int64_t schema_version = iter->first.schema_version_;
|
||||
const int64_t target_object_id = -1;
|
||||
const int64_t child_task_id = iter->second.task_id_;
|
||||
if (iter->second.ret_code_ == INT64_MAX) {
|
||||
// maybe ddl already finish when switching rs
|
||||
HEAP_VAR(ObDDLErrorMessageTableOperator::ObBuildDDLErrorMessage, error_message) {
|
||||
int64_t unused_user_msg_len = 0;
|
||||
if (OB_FAIL(ObDDLErrorMessageTableOperator::get_ddl_error_message(tenant_id_, child_task_id, target_object_id,
|
||||
unused_addr, false /* is_ddl_retry_task */, *GCTX.sql_proxy_, error_message, unused_user_msg_len))) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
LOG_INFO("ddl task not finish", K(table_id), K(child_task_id), K(schema_version), K(target_object_id));
|
||||
} else {
|
||||
finished_task_cnt++;
|
||||
if (error_message.ret_code_ != OB_SUCCESS) {
|
||||
ret = error_message.ret_code_;
|
||||
}
|
||||
LOG_WARN("fail to get ddl error message", K(ret), K(table_id), K(child_task_id), K(schema_version), K(target_object_id));
|
||||
}
|
||||
} else {
|
||||
finished_task_cnt++;
|
||||
if (error_message.ret_code_ != OB_SUCCESS) {
|
||||
ret = error_message.ret_code_;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
finished_task_cnt++;
|
||||
if (iter->second.ret_code_ != OB_SUCCESS) {
|
||||
ret = iter->second.ret_code_;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (finished_task_cnt == dependent_task_result_map_.size()) {
|
||||
if (OB_FAIL(switch_status(next_task_status, ret))) {
|
||||
LOG_WARN("fail to switch status", K(ret));
|
||||
}
|
||||
} else {
|
||||
finished_task_cnt++;
|
||||
if (iter->second.ret_code_ != OB_SUCCESS) {
|
||||
ret = iter->second.ret_code_;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (finished_task_cnt == dependent_task_result_map_.size()) {
|
||||
state_finish = true;
|
||||
}
|
||||
}
|
||||
if (state_finish) {
|
||||
if (OB_FAIL(switch_status(next_task_status, ret))) {
|
||||
LOG_WARN("fail to switch status", K(ret));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -67,8 +67,8 @@ int ObExprToOutfileRow::calc_result_typeN(ObExprResType &type,
|
||||
types[PARAM_ENCLOSED].set_calc_type(ObVarcharType);
|
||||
types[PARAM_ENCLOSED].set_calc_collation_type(types[PARAM_ENCLOSED].get_collation_type());
|
||||
// is_optional
|
||||
types[PARAM_OPTIONAL].set_calc_type(ObTinyIntType);
|
||||
// escaped_cht
|
||||
types[PARAM_OPTIONAL].set_calc_type(ObTinyIntType);
|
||||
// escaped_cht
|
||||
types[PARAM_ESCAPED].set_calc_type(ObVarcharType);
|
||||
types[PARAM_ESCAPED].set_calc_collation_type(types[PARAM_ESCAPED].get_collation_type());
|
||||
}
|
||||
@ -184,9 +184,9 @@ int ObExprToOutfileRow::to_outfile_str(const ObExpr &expr, ObEvalCtx &ctx, ObDat
|
||||
// print field terminator
|
||||
if (OB_SUCC(ret) && i != expr.arg_cnt_ - 1) {
|
||||
OZ(out_info->field_.print_plain_str_literal(buf, buf_len, pos, out_info->print_params_));
|
||||
}
|
||||
}
|
||||
OZ(out_info->line_.print_plain_str_literal(buf, buf_len, pos, out_info->print_params_));
|
||||
}
|
||||
}
|
||||
OZ(out_info->line_.print_plain_str_literal(buf, buf_len, pos, out_info->print_params_));
|
||||
if (OB_SUCC(ret)) {
|
||||
char *res_buf = NULL;
|
||||
if (OB_ISNULL(res_buf = expr.get_str_res_mem(ctx, pos))) {
|
||||
|
||||
Reference in New Issue
Block a user