[master] release tx won't failed if tx is active
This commit is contained in:
parent
01a4cbb0ee
commit
3c2464ff06
@ -72,7 +72,7 @@ static int get_tx_service(ObBasicSessionInfo *session,
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
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();
|
||||
if (effective_tenant_id != tx_tenant_id) {
|
||||
ret = OB_TENANT_ID_NOT_MATCH;
|
||||
@ -348,9 +348,9 @@ int ObSqlTransControl::kill_tx(ObSQLSessionInfo *session, int cause)
|
||||
// and disassocate with session
|
||||
if (tx_desc->is_xa_trans() && tx_desc->get_addr() == GCONF.self_addr_) {
|
||||
auto txs = MTL(transaction::ObTransService*);
|
||||
CK (OB_NOT_NULL(txs));
|
||||
OZ (txs->release_tx_ref(*tx_desc));
|
||||
OX (session->get_tx_desc() = NULL);
|
||||
CK (OB_NOT_NULL(txs), session_id, tx_id);
|
||||
OZ (txs->release_tx_ref(*tx_desc), session_id, tx_id);
|
||||
session->get_tx_desc() = NULL;
|
||||
}
|
||||
} else if (tx_desc->is_xa_trans()) {
|
||||
const transaction::ObXATransID xid = session->get_xid();
|
||||
@ -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()));
|
||||
if (OB_NOT_NULL(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();
|
||||
MTL_SWITCH(effect_tid) {
|
||||
transaction::ObTransService *txs = NULL;
|
||||
@ -1008,12 +1009,12 @@ int ObSqlTransControl::reset_session_tx_state(ObBasicSessionInfo *session, bool
|
||||
if (reuse_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));
|
||||
OZ (txs->release_tx(tx_desc));
|
||||
OX (session->get_tx_desc() = NULL);
|
||||
OZ (txs->release_tx(tx_desc), tx_id);
|
||||
session->get_tx_desc() = NULL;
|
||||
}
|
||||
} else {
|
||||
OZ (txs->release_tx(tx_desc), *session, tx_desc);
|
||||
OX (session->get_tx_desc() = NULL);
|
||||
OZ (txs->release_tx(tx_desc), *session, tx_id, tx_desc);
|
||||
session->get_tx_desc() = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -385,9 +385,6 @@ void ObTxDesc::reset()
|
||||
xa_ctx_ = NULL;
|
||||
tlog_.reset();
|
||||
xa_ctx_ = NULL;
|
||||
#ifndef NDEBUG
|
||||
alloc_link_.reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
const ObString &ObTxDesc::get_tx_state_str() const {
|
||||
|
@ -150,7 +150,7 @@ int ObTransService::release_tx(ObTxDesc &tx)
|
||||
#endif
|
||||
tx_desc_mgr_.revert(tx);
|
||||
} else {
|
||||
ret = finalize_tx_(tx);
|
||||
finalize_tx_(tx);
|
||||
tx_desc_mgr_.revert(tx);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user