diff --git a/src/storage/tx/ob_trans_deadlock_adapter.cpp b/src/storage/tx/ob_trans_deadlock_adapter.cpp index dfd95392acf86ae02c24c0f0ea16340ea52b7cf0..9b30eb6c0fe05855511cecf955ac36cc09944c69 100644 --- a/src/storage/tx/ob_trans_deadlock_adapter.cpp +++ b/src/storage/tx/ob_trans_deadlock_adapter.cpp @@ -626,7 +626,7 @@ int ObTransDeadlockDetectorAdapter::maintain_deadlock_info_when_end_stmt(sql::Ob } else if (is_rollback) {// statment is failed, maybe will try again, check if need register to deadlock detector if (session->get_query_timeout_ts() < ObClockGenerator::getCurrentTime()) { DETECT_LOG(INFO, "query timeout, no need register to deadlock", KR(ret), K(desc->tid())); - } else if (OB_FAIL(desc->get_conflict_txs(conflict_txs))) { + } else if (OB_FAIL(desc->fetch_conflict_txs(conflict_txs))) { DETECT_LOG(WARN, "fail to get conflict txs from desc", KR(ret), K(desc->tid())); } else if (conflict_txs.empty()) { // no row conflicted, no need register to deadlock diff --git a/src/storage/tx/ob_trans_define_v4.cpp b/src/storage/tx/ob_trans_define_v4.cpp index 805fdcdab5f77e3a1e640de917e244612d4b6678..efc2a45c77d629874fbfc5332f8adb8b533cbd32 100644 --- a/src/storage/tx/ob_trans_define_v4.cpp +++ b/src/storage/tx/ob_trans_define_v4.cpp @@ -567,6 +567,7 @@ int ObTxDesc::get_inc_exec_info(ObTxExecResult &exec_info) exec_info_reap_ts_ += 1; } (void) exec_info.merge_cflict_txs(cflict_txs_); + cflict_txs_.reset(); DETECT_LOG(TRACE, "merge conflict txs to exec result", K(cflict_txs_), K(exec_info)); return ret; } @@ -732,6 +733,17 @@ void ObTxDesc::release_implicit_savepoint(const int64_t savepoint) } } +int ObTxDesc::fetch_conflict_txs(ObIArray &array) +{ + int ret = OB_SUCCESS; + ObSpinLockGuard guard(lock_); + if (OB_FAIL(array.assign(cflict_txs_))) { + DETECT_LOG(WARN, "fail to fetch conflict txs", K(ret), K(cflict_txs_)); + } + cflict_txs_.reset(); + return ret; +} + int ObTxDesc::merge_conflict_txs(const ObIArray &conflict_txs) { ObSpinLockGuard guard(lock_); diff --git a/src/storage/tx/ob_trans_define_v4.h b/src/storage/tx/ob_trans_define_v4.h index b77e6c3308ce4a96614bcd6194ce178661d133a9..19accef0067eca0d496366cd46d565d707c5e873 100644 --- a/src/storage/tx/ob_trans_define_v4.h +++ b/src/storage/tx/ob_trans_define_v4.h @@ -478,8 +478,7 @@ public: K(commit_task_.is_registered()), K_(ref)); - int get_conflict_txs(ObIArray &array) - { ObSpinLockGuard guard(lock_); return array.assign(cflict_txs_); } + int fetch_conflict_txs(ObIArray &array); void reset_conflict_txs() { ObSpinLockGuard guard(lock_); cflict_txs_.reset(); } int merge_conflict_txs(const ObIArray &conflict_ids);