[4.x] get data lock before set tx desc to null

This commit is contained in:
jw-guo
2023-06-29 09:42:17 +00:00
committed by ob-robot
parent e25a482ffa
commit 3facd57ead

View File

@ -212,7 +212,7 @@ int ObRemoteBaseExecuteP<T>::auto_start_phy_trans()
LOG_ERROR("plan_ctx or my_session is NULL", K(ret), K(plan_ctx), K(my_session));
} else {
// 远程单partition并且是autocommit的情况下才运行start_trans和start_stmt
bool in_trans = my_session->is_in_transaction();
// bool in_trans = my_session->is_in_transaction();
bool ac = true;
my_session->set_early_lock_release(plan_ctx->get_phy_plan()->stat_.enable_early_lock_release_);
if (OB_FAIL(my_session->get_autocommit(ac))) {
@ -223,6 +223,7 @@ int ObRemoteBaseExecuteP<T>::auto_start_phy_trans()
// NOTE: autocommit modfied by PL cannot sync to remote,
// use has_start_stmt to test transaction prepared on original node
if (false == my_session->has_start_stmt()) {
ObSQLSessionInfo::LockGuard data_lock_guard(my_session->get_thread_data_lock());
//start Tx on remote node, we need release txDesc deserilized by session
if (OB_NOT_NULL(my_session->get_tx_desc())) {
MTL(transaction::ObTransService*)->release_tx(*my_session->get_tx_desc());