提交 3c2464ff 编写于 作者: C chinaxing 提交者: ob-robot

[master] release tx won't failed if tx is active

上级 01a4cbb0
...@@ -72,7 +72,7 @@ static int get_tx_service(ObBasicSessionInfo *session, ...@@ -72,7 +72,7 @@ static int get_tx_service(ObBasicSessionInfo *session,
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
auto effective_tenant_id = session->get_effective_tenant_id(); auto effective_tenant_id = session->get_effective_tenant_id();
if (session->get_tx_desc() != NULL) { if (OB_NOT_NULL(session->get_tx_desc())) {
auto tx_tenant_id = session->get_tx_desc()->get_tenant_id(); auto tx_tenant_id = session->get_tx_desc()->get_tenant_id();
if (effective_tenant_id != tx_tenant_id) { if (effective_tenant_id != tx_tenant_id) {
ret = OB_TENANT_ID_NOT_MATCH; ret = OB_TENANT_ID_NOT_MATCH;
...@@ -348,9 +348,9 @@ int ObSqlTransControl::kill_tx(ObSQLSessionInfo *session, int cause) ...@@ -348,9 +348,9 @@ int ObSqlTransControl::kill_tx(ObSQLSessionInfo *session, int cause)
// and disassocate with session // and disassocate with session
if (tx_desc->is_xa_trans() && tx_desc->get_addr() == GCONF.self_addr_) { if (tx_desc->is_xa_trans() && tx_desc->get_addr() == GCONF.self_addr_) {
auto txs = MTL(transaction::ObTransService*); auto txs = MTL(transaction::ObTransService*);
CK (OB_NOT_NULL(txs)); CK (OB_NOT_NULL(txs), session_id, tx_id);
OZ (txs->release_tx_ref(*tx_desc)); OZ (txs->release_tx_ref(*tx_desc), session_id, tx_id);
OX (session->get_tx_desc() = NULL); session->get_tx_desc() = NULL;
} }
} else if (tx_desc->is_xa_trans()) { } else if (tx_desc->is_xa_trans()) {
const transaction::ObXATransID xid = session->get_xid(); const transaction::ObXATransID xid = session->get_xid();
...@@ -1001,6 +1001,7 @@ int ObSqlTransControl::reset_session_tx_state(ObBasicSessionInfo *session, bool ...@@ -1001,6 +1001,7 @@ int ObSqlTransControl::reset_session_tx_state(ObBasicSessionInfo *session, bool
LOG_DEBUG("reset session tx state", KPC(session->get_tx_desc()), K(lbt())); LOG_DEBUG("reset session tx state", KPC(session->get_tx_desc()), K(lbt()));
if (OB_NOT_NULL(session->get_tx_desc())) { if (OB_NOT_NULL(session->get_tx_desc())) {
auto &tx_desc = *session->get_tx_desc(); auto &tx_desc = *session->get_tx_desc();
auto tx_id = tx_desc.get_tx_id();
auto effect_tid = session->get_effective_tenant_id(); auto effect_tid = session->get_effective_tenant_id();
MTL_SWITCH(effect_tid) { MTL_SWITCH(effect_tid) {
transaction::ObTransService *txs = NULL; transaction::ObTransService *txs = NULL;
...@@ -1008,12 +1009,12 @@ int ObSqlTransControl::reset_session_tx_state(ObBasicSessionInfo *session, bool ...@@ -1008,12 +1009,12 @@ int ObSqlTransControl::reset_session_tx_state(ObBasicSessionInfo *session, bool
if (reuse_tx_desc) { if (reuse_tx_desc) {
if (OB_FAIL(txs->reuse_tx(tx_desc))) { if (OB_FAIL(txs->reuse_tx(tx_desc))) {
LOG_ERROR("reuse txn descriptor fail, will release it", K(ret), KPC(session), K(tx_desc)); LOG_ERROR("reuse txn descriptor fail, will release it", K(ret), KPC(session), K(tx_desc));
OZ (txs->release_tx(tx_desc)); OZ (txs->release_tx(tx_desc), tx_id);
OX (session->get_tx_desc() = NULL); session->get_tx_desc() = NULL;
} }
} else { } else {
OZ (txs->release_tx(tx_desc), *session, tx_desc); OZ (txs->release_tx(tx_desc), *session, tx_id, tx_desc);
OX (session->get_tx_desc() = NULL); session->get_tx_desc() = NULL;
} }
} }
} }
......
...@@ -385,9 +385,6 @@ void ObTxDesc::reset() ...@@ -385,9 +385,6 @@ void ObTxDesc::reset()
xa_ctx_ = NULL; xa_ctx_ = NULL;
tlog_.reset(); tlog_.reset();
xa_ctx_ = NULL; xa_ctx_ = NULL;
#ifndef NDEBUG
alloc_link_.reset();
#endif
} }
const ObString &ObTxDesc::get_tx_state_str() const { const ObString &ObTxDesc::get_tx_state_str() const {
......
...@@ -150,7 +150,7 @@ int ObTransService::release_tx(ObTxDesc &tx) ...@@ -150,7 +150,7 @@ int ObTransService::release_tx(ObTxDesc &tx)
#endif #endif
tx_desc_mgr_.revert(tx); tx_desc_mgr_.revert(tx);
} else { } else {
ret = finalize_tx_(tx); finalize_tx_(tx);
tx_desc_mgr_.revert(tx); tx_desc_mgr_.revert(tx);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册