[CP]not allow begin/start transaction statement in xa trans for bug 46947616

This commit is contained in:
obdev
2022-12-30 04:11:58 +00:00
committed by ob-robot
parent 0c1f02747b
commit 230d34ce9b

View File

@ -238,9 +238,17 @@ int ObResultSet::on_cmd_execute()
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_ERROR("invalid inner state", K(cmd_)); LOG_ERROR("invalid inner state", K(cmd_));
} else if (cmd_->cause_implicit_commit()) { } else if (cmd_->cause_implicit_commit()) {
// commit current open transaction, synchronously // not allow implicit commit in xa trans
if (OB_FAIL(ObSqlTransControl::implicit_end_trans(get_exec_context(), false))) { if (my_session_.associated_xa()) {
SQL_ENG_LOG(WARN, "fail end implicit trans on cmd execute", K(ret)); ret = OB_TRANS_XA_ERR_COMMIT;
get_exec_context().set_need_disconnect(false);
const transaction::ObTxDesc *tx_desc = my_session_.get_tx_desc();
LOG_WARN("COMMIT is not allowed in a xa trans", K(ret), KPC(tx_desc));
} else {
// commit current open transaction, synchronously
if (OB_FAIL(ObSqlTransControl::implicit_end_trans(get_exec_context(), false))) {
SQL_ENG_LOG(WARN, "fail end implicit trans on cmd execute", K(ret));
}
} }
} }
return ret; return ret;