fix invalid session id for bug, url:https://aone.alibaba-inc.com/v2/project/81079/bug/46417091
This commit is contained in:
@ -461,7 +461,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()));
|
||||
OZ (txs->sql_stmt_start_hook(session->get_xid(), *session->get_tx_desc(), session->get_sessid()));
|
||||
if (OB_SUCC(ret)
|
||||
&& txs->get_tx_elr_util().check_and_update_tx_elr_info(
|
||||
*session->get_tx_desc(),
|
||||
|
||||
@ -532,6 +532,7 @@ public:
|
||||
void set_xa_ctx(ObXACtx *xa_ctx) { xa_ctx_ = xa_ctx; }
|
||||
ObXACtx *get_xa_ctx() { return xa_ctx_; }
|
||||
void set_xid(const ObXATransID &xid) { xid_ = xid; }
|
||||
void set_sessid(const uint32_t session_id) { sess_id_ = session_id; }
|
||||
const ObXATransID &get_xid() const { return xid_; }
|
||||
bool is_xa_trans() const { return !xid_.empty(); }
|
||||
void reset_for_xa() { xid_.reset(); xa_ctx_ = NULL; }
|
||||
|
||||
@ -1705,14 +1705,16 @@ int ObTransService::is_tx_active(const ObTransID &tx_id, bool &active)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int ObTransService::sql_stmt_start_hook(const ObXATransID &xid, ObTxDesc &tx)
|
||||
int ObTransService::sql_stmt_start_hook(const ObXATransID &xid, ObTxDesc &tx, const uint32_t session_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (tx.is_xa_trans()) {
|
||||
if (OB_FAIL(MTL(ObXAService*)->start_stmt(xid, tx))) {
|
||||
TRANS_LOG(WARN, "xa trans start stmt failed", K(ret), K_(tx.xid), K(xid));
|
||||
} else {
|
||||
tx.set_sessid(session_id);
|
||||
}
|
||||
TRANS_LOG(INFO, "xa trans start stmt", K_(tx.xid), K(xid));
|
||||
TRANS_LOG(INFO, "xa trans start stmt", K_(tx.xid), K(xid), K_(tx.sess_id), K(session_id));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -539,5 +539,5 @@ 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);
|
||||
int sql_stmt_start_hook(const ObXATransID &xid, ObTxDesc &tx, const uint32_t session_id);
|
||||
int sql_stmt_end_hook(const ObXATransID &xid, ObTxDesc &tx);
|
||||
|
||||
@ -1387,7 +1387,7 @@ int ObXAService::end_stmt(const ObXATransID &xid, ObTxDesc &tx_desc)
|
||||
if (NULL == xa_ctx) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
TRANS_LOG(WARN, "unexpected trans descriptor", K(ret), K(tx_id), K(xid));
|
||||
} else if (xa_ctx->end_stmt(xid)) {
|
||||
} else if (OB_FAIL(xa_ctx->end_stmt(xid))) {
|
||||
TRANS_LOG(WARN, "xa trans end stmt failed", K(ret), K(tx_id), K(xid));
|
||||
} else {
|
||||
TRANS_LOG(INFO, "xa trans end stmt", K(ret), K(tx_id), K(xid));
|
||||
|
||||
Reference in New Issue
Block a user