[cp] fix bug remote_exec cover the err_code
This commit is contained in:
committed by
LINxiansheng
parent
db982ff170
commit
2b43f09ce1
@ -408,7 +408,17 @@ int ObRemoteBaseExecuteP<T>::auto_end_phy_trans(bool is_rollback, const ObPartit
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
int end_ret = OB_SUCCESS;
|
int end_ret = OB_SUCCESS;
|
||||||
|
bool ac = false;
|
||||||
|
ObEndTransSyncCallback callback;
|
||||||
|
ObSQLSessionInfo *my_session = GET_MY_SESSION(exec_ctx_);
|
||||||
|
if (OB_ISNULL(my_session)) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
LOG_ERROR("ret is OB_SUCCESS, but session is NULL", K(ret));
|
||||||
|
} else if (OB_FAIL(my_session->get_autocommit(ac))) {
|
||||||
|
LOG_WARN("fail to get autocommit", K(ret));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OB_SUCC(ret)) {
|
||||||
if (trans_state_.is_start_participant_executed() && trans_state_.is_start_participant_success()) {
|
if (trans_state_.is_start_participant_executed() && trans_state_.is_start_participant_success()) {
|
||||||
if (OB_SUCCESS != (end_ret = ObSqlTransControl::end_participant(exec_ctx_, is_rollback, participants))) {
|
if (OB_SUCCESS != (end_ret = ObSqlTransControl::end_participant(exec_ctx_, is_rollback, participants))) {
|
||||||
ret = (OB_SUCCESS == ret) ? end_ret : ret;
|
ret = (OB_SUCCESS == ret) ? end_ret : ret;
|
||||||
@ -425,26 +435,14 @@ int ObRemoteBaseExecuteP<T>::auto_end_phy_trans(bool is_rollback, const ObPartit
|
|||||||
trans_state_.clear_start_stmt_executed();
|
trans_state_.clear_start_stmt_executed();
|
||||||
}
|
}
|
||||||
if (trans_state_.is_start_trans_executed() && trans_state_.is_start_trans_success()) {
|
if (trans_state_.is_start_trans_executed() && trans_state_.is_start_trans_success()) {
|
||||||
ObSQLSessionInfo* my_session = GET_MY_SESSION(exec_ctx_);
|
|
||||||
if (OB_ISNULL(my_session)) {
|
|
||||||
if (OB_SUCC(ret)) {
|
|
||||||
ret = OB_ERR_UNEXPECTED;
|
|
||||||
LOG_ERROR("ret is OB_SUCCESS, but session is NULL", K(ret));
|
|
||||||
} else {
|
|
||||||
LOG_ERROR("ret is not OB_SUCCESS, and session is NULL", K(ret));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bool in_trans = my_session->get_in_transaction();
|
bool in_trans = my_session->get_in_transaction();
|
||||||
bool ac = false;
|
if (ObSqlTransUtil::plan_can_end_trans(ac, in_trans)) {
|
||||||
if (OB_FAIL(my_session->get_autocommit(ac))) {
|
|
||||||
LOG_WARN("fail to get autocommit", K(ret));
|
|
||||||
} else if (ObSqlTransUtil::plan_can_end_trans(ac, in_trans)) {
|
|
||||||
if (!my_session->is_standalone_stmt()) {
|
if (!my_session->is_standalone_stmt()) {
|
||||||
ObEndTransSyncCallback callback;
|
if (OB_SUCCESS != (end_ret = callback.init(&(my_session->get_trans_desc()), my_session))) {
|
||||||
is_rollback = (is_rollback || OB_SUCCESS != ret);
|
ret = (OB_SUCCESS == ret) ? end_ret : ret;
|
||||||
if (OB_FAIL(callback.init(&(my_session->get_trans_desc()), my_session))) {
|
|
||||||
LOG_WARN("fail init callback", K(ret));
|
LOG_WARN("fail init callback", K(ret));
|
||||||
} else {
|
}
|
||||||
|
is_rollback = (is_rollback || OB_SUCCESS != ret);
|
||||||
int wait_ret = OB_SUCCESS;
|
int wait_ret = OB_SUCCESS;
|
||||||
if (OB_SUCCESS != (end_ret = ObSqlTransControl::implicit_end_trans(
|
if (OB_SUCCESS != (end_ret = ObSqlTransControl::implicit_end_trans(
|
||||||
exec_ctx_, is_rollback, callback))) { // implicit commit, no rollback
|
exec_ctx_, is_rollback, callback))) { // implicit commit, no rollback
|
||||||
@ -458,8 +456,7 @@ int ObRemoteBaseExecuteP<T>::auto_end_phy_trans(bool is_rollback, const ObPartit
|
|||||||
K(is_rollback),
|
K(is_rollback),
|
||||||
K(my_session->get_trans_desc()));
|
K(my_session->get_trans_desc()));
|
||||||
}
|
}
|
||||||
ret = OB_SUCCESS != ret ? ret : wait_ret;
|
ret = OB_SUCCESS != ret? ret : wait_ret;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
trans_state_.clear_start_trans_executed();
|
trans_state_.clear_start_trans_executed();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user