[master] fix sampling sql caused txn free route defensive check false positve

This commit is contained in:
chinaxing 2023-05-17 15:16:45 +00:00 committed by ob-robot
parent ffb515a326
commit 8f6b152ac8
2 changed files with 14 additions and 3 deletions

View File

@ -1070,6 +1070,17 @@ int ObDynamicSampling::restore_session(ObSQLSessionInfo *session,
session->set_sql_mode(session->get_sql_mode() | SMO_NO_BACKSLASH_ESCAPES);
}
if (tx_desc != NULL) {//reset origin tx desc.
// release curr
if (OB_NOT_NULL(session->get_tx_desc())) {
auto txs = MTL(transaction::ObTransService*);
if (OB_ISNULL(txs)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("can not acquire MTL TransService", KR(ret));
session->get_tx_desc()->dump_and_print_trace();
} else {
txs->release_tx(*session->get_tx_desc());
}
}
session->get_tx_desc() = tx_desc;
}
}
@ -1909,4 +1920,4 @@ bool ObDynamicSamplingUtils::is_ds_virtual_table(const int64_t table_id)
// }
} // end of namespace common
} // end of namespace oceanbase
} // end of namespace oceanbase

View File

@ -36,8 +36,8 @@ int64_t MAX_STATE_SIZE = 4 * 1024; // 4KB
bool ObTxnFreeRouteCtx::is_temp(const ObTxDesc &tx) const
{
UNUSED(tx);
return txn_addr_.is_valid() && txn_addr_ != GCONF.self_addr_;
// match against tx_id to allow other txn commit or rollback on temp node
return tx_id_ == tx.tx_id_ && txn_addr_.is_valid() && txn_addr_ != GCONF.self_addr_;
}
void ObTxnFreeRouteCtx::init_before_update_state(bool proxy_support)
{