提交 5e39047f 编写于 作者: C chinaxing 提交者: ob-robot

[master][tx-route] fix tx-route part-ctx gc

上级 61df07f5
......@@ -6316,7 +6316,7 @@ int ObPartTransCtx::tx_keepalive_response_(const int64_t status)
int ret = OB_SUCCESS;
CtxLockGuard guard(lock_);
if (OB_TRANS_CTX_NOT_EXIST == status && can_be_recycled_()) {
if ((OB_TRANS_CTX_NOT_EXIST == status || OB_TRANS_ROLLBACKED == status) && can_be_recycled_()) {
if (REACH_TIME_INTERVAL(5 * 1000 * 1000)) {
TRANS_LOG(WARN, "[TRANS GC] tx has quit, local tx will be aborted",
K(status), KPC(this));
......@@ -6324,6 +6324,9 @@ int ObPartTransCtx::tx_keepalive_response_(const int64_t status)
if (OB_FAIL(gc_ctx_())) {
TRANS_LOG(WARN, "force kill part_ctx error", KR(ret), KPC(this));
}
} else if (OB_TRANS_COMMITED == status && can_be_recycled_() && first_scn_ >= last_scn_ /*all changes were rollbacked*/) {
TRANS_LOG(WARN, "txn has comitted on scheduler, but this particiapnt can be recycled", KPC(this));
FORCE_PRINT_TRACE(tlog_, "[participant leaky] ");
} else if (OB_SUCCESS != status) {
if (REACH_TIME_INTERVAL(5 * 1000 * 1000)) {
TRANS_LOG(WARN, "[TRANS GC] tx keepalive fail", K(status), KPC(this));
......
......@@ -851,11 +851,12 @@ int ObTransService::handle_trans_keepalive(const ObTxKeepaliveMsg &msg, ObTransR
TRANS_LOG(WARN, "get tx fail", K(ret), K(tx_id), K(msg));
} else if (OB_ISNULL(tx)) {
ret = OB_TRANS_CTX_NOT_EXIST;
} else if (tx->is_committed() && tx_id == tx->tx_id_) {
ret = OB_TRANS_COMMITED;
} else if (tx->is_rollbacked() && tx_id == tx->tx_id_) {
ret = OB_TRANS_ROLLBACKED;
} else if (OB_SUCCESS != msg.status_) {
TRANS_LOG(WARN, "tx participant in failed, abort tx", KPC(tx), K(msg));
if (OB_FAIL(abort_tx(*tx, msg.status_))) {
TRANS_LOG(WARN, "do abort tx fail", K(ret), KPC(tx));
}
TRANS_LOG(WARN, "tx participant in failed status", K(msg));
}
ObTxKeepaliveRespMsg resp;
resp.cluster_version_ = GET_MIN_CLUSTER_VERSION();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册