diff --git a/src/storage/tx/ob_trans_part_ctx.cpp b/src/storage/tx/ob_trans_part_ctx.cpp index 80c451726f..e4ae0e8477 100644 --- a/src/storage/tx/ob_trans_part_ctx.cpp +++ b/src/storage/tx/ob_trans_part_ctx.cpp @@ -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)); diff --git a/src/storage/tx/ob_trans_service_v4.cpp b/src/storage/tx/ob_trans_service_v4.cpp index cbadac298c..1ee9f1b61e 100644 --- a/src/storage/tx/ob_trans_service_v4.cpp +++ b/src/storage/tx/ob_trans_service_v4.cpp @@ -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();