fix xa_pl_savepoint is not bound to proxy id

This commit is contained in:
obdev 2023-03-07 03:13:35 +00:00 committed by ob-robot
parent aa46ea1fbd
commit 0d7417c231
3 changed files with 12 additions and 5 deletions

View File

@ -425,6 +425,7 @@ int ObSqlTransControl::do_end_trans_(ObSQLSessionInfo *session,
}
if (session->associated_xa() && !is_explicit) {
ret = OB_TRANS_XA_RMFAIL;
LOG_ERROR("executing do end trans in xa", K(ret), K(session->get_xid()), KPC(tx_ptr));
} else {
/*
* normal transaction control
@ -504,7 +505,7 @@ int ObSqlTransControl::start_stmt(ObExecContext &exec_ctx)
OZ (get_tx_service(session, txs), tenant_id);
OZ (acquire_tx_if_need_(txs, *session));
OZ (stmt_sanity_check_(session, plan, plan_ctx));
OZ (txs->sql_stmt_start_hook(session->get_xid(), *session->get_tx_desc(), session->get_sessid()));
OZ (txs->sql_stmt_start_hook(session->get_xid(), *session->get_tx_desc(), session->get_sessid(), get_real_session_id(*session)));
bool start_hook = OB_SUCC(ret) && !session->get_xid().empty() ? true : false;
if (OB_SUCC(ret)
&& txs->get_tx_elr_util().check_and_update_tx_elr_info(*session->get_tx_desc())) {
@ -744,7 +745,7 @@ int ObSqlTransControl::start_hook_if_need_(ObSQLSessionInfo &session,
{
int ret = OB_SUCCESS;
if (!session.get_tx_desc()->is_shadow() && !session.has_start_stmt() &&
OB_SUCC(txs->sql_stmt_start_hook(session.get_xid(), *session.get_tx_desc(), session.get_sessid()))) {
OB_SUCC(txs->sql_stmt_start_hook(session.get_xid(), *session.get_tx_desc(), session.get_sessid(), get_real_session_id(session)))) {
start_hook = true;
}
return ret;

View File

@ -1758,7 +1758,10 @@ int ObTransService::is_tx_active(const ObTransID &tx_id, bool &active)
}
return ret;
}
int ObTransService::sql_stmt_start_hook(const ObXATransID &xid, ObTxDesc &tx, const uint32_t session_id)
int ObTransService::sql_stmt_start_hook(const ObXATransID &xid,
ObTxDesc &tx,
const uint32_t session_id,
const uint32_t real_session_id)
{
int ret = OB_SUCCESS;
if (tx.is_xa_trans()) {
@ -1770,7 +1773,7 @@ int ObTransService::sql_stmt_start_hook(const ObXATransID &xid, ObTxDesc &tx, co
TRANS_LOG(WARN, "register tx fail", K(ret), K_(tx.tx_id), K(xid), KP(&tx));
} else { registed = true; }
}
if (OB_SUCC(ret) && OB_FAIL(MTL(ObXAService*)->start_stmt(xid, session_id, tx))) {
if (OB_SUCC(ret) && OB_FAIL(MTL(ObXAService*)->start_stmt(xid, real_session_id, tx))) {
TRANS_LOG(WARN, "xa trans start stmt failed", K(ret), K_(tx.xid), K(xid));
ObGlobalTxType global_tx_type = tx.get_global_tx_type(xid);
if (ObGlobalTxType::DBLINK_TRANS == global_tx_type && OB_TRANS_XA_BRANCH_FAIL == ret) {

View File

@ -545,5 +545,8 @@ int is_tx_active(const ObTransID &tx_id, bool &active);
* between tighly couple branchs around the SQL stmt
* these hooks place on stmt start and end position to handle these works
*****************************************************************************/
int sql_stmt_start_hook(const ObXATransID &xid, ObTxDesc &tx, const uint32_t session_id);
int sql_stmt_start_hook(const ObXATransID &xid,
ObTxDesc &tx,
const uint32_t session_id,
const uint32_t real_session_id);
int sql_stmt_end_hook(const ObXATransID &xid, ObTxDesc &tx);