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;
|
int ret = OB_SUCCESS;
|
||||||
ObRootService *root_service = GCTX.root_service_;
|
ObRootService *root_service = GCTX.root_service_;
|
||||||
int64_t finished_task_cnt = 0;
|
int64_t finished_task_cnt = 0;
|
||||||
|
bool state_finish = false;
|
||||||
ObSchemaGetterGuard schema_guard;
|
ObSchemaGetterGuard schema_guard;
|
||||||
if (OB_UNLIKELY(!is_inited_)) {
|
if (OB_UNLIKELY(!is_inited_)) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
@ -436,7 +437,11 @@ int ObColumnRedefinitionTask::copy_table_dependent_objects(const ObDDLTaskStatus
|
|||||||
} else if (OB_FAIL(copy_table_foreign_keys())) {
|
} else if (OB_FAIL(copy_table_foreign_keys())) {
|
||||||
LOG_WARN("fail to copy table foreign keys", K(ret));
|
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
|
// wait copy dependent objects to be finished
|
||||||
ObAddr unused_addr;
|
ObAddr unused_addr;
|
||||||
for (common::hash::ObHashMap<ObDDLTaskKey, DependTaskStatus>::const_iterator iter = dependent_task_result_map_.begin();
|
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))) {
|
if (OB_FAIL(switch_status(next_task_status, ret))) {
|
||||||
LOG_WARN("fail to switch status", K(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;
|
int ret = OB_SUCCESS;
|
||||||
ObRootService *root_service = GCTX.root_service_;
|
ObRootService *root_service = GCTX.root_service_;
|
||||||
int64_t finished_task_cnt = 0;
|
int64_t finished_task_cnt = 0;
|
||||||
|
bool state_finish = false;
|
||||||
if (OB_UNLIKELY(!is_inited_)) {
|
if (OB_UNLIKELY(!is_inited_)) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("ObTableRedefinitionTask has not been inited", K(ret));
|
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));
|
LOG_WARN("copy table foreign keys failed", K(ret));
|
||||||
} else {
|
} else {
|
||||||
// copy triggers(at current, not supported, skip it)
|
// copy triggers(at current, not supported, skip it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// wait copy dependent objects to be finished
|
if (OB_FAIL(ret)) {
|
||||||
ObAddr unused_addr;
|
state_finish = true;
|
||||||
for (common::hash::ObHashMap<ObDDLTaskKey, DependTaskStatus>::const_iterator iter = dependent_task_result_map_.begin();
|
} else {
|
||||||
iter != dependent_task_result_map_.end(); ++iter) {
|
// wait copy dependent objects to be finished
|
||||||
const int64_t table_id = iter->first.object_id_;
|
ObAddr unused_addr;
|
||||||
const int64_t schema_version = iter->first.schema_version_;
|
for (common::hash::ObHashMap<ObDDLTaskKey, DependTaskStatus>::const_iterator iter = dependent_task_result_map_.begin();
|
||||||
const int64_t target_object_id = -1;
|
iter != dependent_task_result_map_.end(); ++iter) {
|
||||||
const int64_t child_task_id = iter->second.task_id_;
|
const int64_t table_id = iter->first.object_id_;
|
||||||
if (iter->second.ret_code_ == INT64_MAX) {
|
const int64_t schema_version = iter->first.schema_version_;
|
||||||
// maybe ddl already finish when switching rs
|
const int64_t target_object_id = -1;
|
||||||
HEAP_VAR(ObDDLErrorMessageTableOperator::ObBuildDDLErrorMessage, error_message) {
|
const int64_t child_task_id = iter->second.task_id_;
|
||||||
int64_t unused_user_msg_len = 0;
|
if (iter->second.ret_code_ == INT64_MAX) {
|
||||||
if (OB_FAIL(ObDDLErrorMessageTableOperator::get_ddl_error_message(tenant_id_, child_task_id, target_object_id,
|
// maybe ddl already finish when switching rs
|
||||||
unused_addr, false /* is_ddl_retry_task */, *GCTX.sql_proxy_, error_message, unused_user_msg_len))) {
|
HEAP_VAR(ObDDLErrorMessageTableOperator::ObBuildDDLErrorMessage, error_message) {
|
||||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
int64_t unused_user_msg_len = 0;
|
||||||
ret = OB_SUCCESS;
|
if (OB_FAIL(ObDDLErrorMessageTableOperator::get_ddl_error_message(tenant_id_, child_task_id, target_object_id,
|
||||||
LOG_INFO("ddl task not finish", K(table_id), K(child_task_id), K(schema_version), K(target_object_id));
|
unused_addr, false /* is_ddl_retry_task */, *GCTX.sql_proxy_, error_message, unused_user_msg_len))) {
|
||||||
} else {
|
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||||
LOG_WARN("fail to get ddl error message", K(ret), K(table_id), K(child_task_id), K(schema_version), K(target_object_id));
|
ret = OB_SUCCESS;
|
||||||
}
|
LOG_INFO("ddl task not finish", K(table_id), K(child_task_id), K(schema_version), K(target_object_id));
|
||||||
} else {
|
} else {
|
||||||
finished_task_cnt++;
|
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 (error_message.ret_code_ != OB_SUCCESS) {
|
}
|
||||||
ret = error_message.ret_code_;
|
} else {
|
||||||
}
|
finished_task_cnt++;
|
||||||
|
if (error_message.ret_code_ != OB_SUCCESS) {
|
||||||
|
ret = error_message.ret_code_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
finished_task_cnt++;
|
} else {
|
||||||
if (iter->second.ret_code_ != OB_SUCCESS) {
|
finished_task_cnt++;
|
||||||
ret = iter->second.ret_code_;
|
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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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;
|
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_type(ObVarcharType);
|
||||||
types[PARAM_ENCLOSED].set_calc_collation_type(types[PARAM_ENCLOSED].get_collation_type());
|
types[PARAM_ENCLOSED].set_calc_collation_type(types[PARAM_ENCLOSED].get_collation_type());
|
||||||
// is_optional
|
// is_optional
|
||||||
types[PARAM_OPTIONAL].set_calc_type(ObTinyIntType);
|
types[PARAM_OPTIONAL].set_calc_type(ObTinyIntType);
|
||||||
// escaped_cht
|
// escaped_cht
|
||||||
types[PARAM_ESCAPED].set_calc_type(ObVarcharType);
|
types[PARAM_ESCAPED].set_calc_type(ObVarcharType);
|
||||||
types[PARAM_ESCAPED].set_calc_collation_type(types[PARAM_ESCAPED].get_collation_type());
|
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
|
// print field terminator
|
||||||
if (OB_SUCC(ret) && i != expr.arg_cnt_ - 1) {
|
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->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)) {
|
if (OB_SUCC(ret)) {
|
||||||
char *res_buf = NULL;
|
char *res_buf = NULL;
|
||||||
if (OB_ISNULL(res_buf = expr.get_str_res_mem(ctx, pos))) {
|
if (OB_ISNULL(res_buf = expr.get_str_res_mem(ctx, pos))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user