提交 9ca3f5de 编写于 作者: O obdev 提交者: ob-robot

[CP] [DeadLock] clear conflict tx info in desc when fetch finished

上级 1e7414d5
...@@ -626,7 +626,7 @@ int ObTransDeadlockDetectorAdapter::maintain_deadlock_info_when_end_stmt(sql::Ob ...@@ -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 } 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()) { if (session->get_query_timeout_ts() < ObClockGenerator::getCurrentTime()) {
DETECT_LOG(INFO, "query timeout, no need register to deadlock", KR(ret), K(desc->tid())); 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())); DETECT_LOG(WARN, "fail to get conflict txs from desc", KR(ret), K(desc->tid()));
} else if (conflict_txs.empty()) { } else if (conflict_txs.empty()) {
// no row conflicted, no need register to deadlock // no row conflicted, no need register to deadlock
......
...@@ -567,6 +567,7 @@ int ObTxDesc::get_inc_exec_info(ObTxExecResult &exec_info) ...@@ -567,6 +567,7 @@ int ObTxDesc::get_inc_exec_info(ObTxExecResult &exec_info)
exec_info_reap_ts_ += 1; exec_info_reap_ts_ += 1;
} }
(void) exec_info.merge_cflict_txs(cflict_txs_); (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)); DETECT_LOG(TRACE, "merge conflict txs to exec result", K(cflict_txs_), K(exec_info));
return ret; return ret;
} }
...@@ -732,6 +733,17 @@ void ObTxDesc::release_implicit_savepoint(const int64_t savepoint) ...@@ -732,6 +733,17 @@ void ObTxDesc::release_implicit_savepoint(const int64_t savepoint)
} }
} }
int ObTxDesc::fetch_conflict_txs(ObIArray<ObTransIDAndAddr> &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<ObTransIDAndAddr> &conflict_txs) int ObTxDesc::merge_conflict_txs(const ObIArray<ObTransIDAndAddr> &conflict_txs)
{ {
ObSpinLockGuard guard(lock_); ObSpinLockGuard guard(lock_);
......
...@@ -478,8 +478,7 @@ public: ...@@ -478,8 +478,7 @@ public:
K(commit_task_.is_registered()), K(commit_task_.is_registered()),
K_(ref)); K_(ref));
int get_conflict_txs(ObIArray<ObTransIDAndAddr> &array) int fetch_conflict_txs(ObIArray<ObTransIDAndAddr> &array);
{ ObSpinLockGuard guard(lock_); return array.assign(cflict_txs_); }
void reset_conflict_txs() void reset_conflict_txs()
{ ObSpinLockGuard guard(lock_); cflict_txs_.reset(); } { ObSpinLockGuard guard(lock_); cflict_txs_.reset(); }
int merge_conflict_txs(const ObIArray<ObTransIDAndAddr> &conflict_ids); int merge_conflict_txs(const ObIArray<ObTransIDAndAddr> &conflict_ids);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册