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

This commit is contained in:
chinaxing
2023-03-14 18:16:27 +00:00
committed by ob-robot
parent 61df07f5ce
commit 5e39047f54
2 changed files with 9 additions and 5 deletions

View File

@ -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));

View File

@ -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();