[tx-route] fix session verify tx dynamic state

This commit is contained in:
chinaxing 2024-09-18 05:52:42 +00:00 committed by ob-robot
parent 4cf84fe2bb
commit 37a1c6732a
2 changed files with 11 additions and 4 deletions

View File

@ -446,6 +446,7 @@ int ObTxDesc::switch_to_idle()
commit_task_.reset();
modified_tables_.reset();
state_ = State::IDLE;
op_sn_ = 0;
return OB_SUCCESS;
}

View File

@ -439,6 +439,11 @@ int ObTransService::txn_free_route__update_static_state(const uint32_t session_i
} else { need_add_tx = true; }
}
} else if (!tx->tx_id_.is_valid()) {
if (tx->op_sn_ > 0) {
ObSpinLockGuard guard(tx->lock_);
TRANS_LOG_RET(WARN, OB_ERR_UNEXPECTED, "tx op_sn > 0", K(ret), KPC(tx));
tx->print_trace_();
}
// reuse, overwrite
need_add_tx = true;
audit_record.reuse_tx_ = true;
@ -523,10 +528,11 @@ int ObTransService::update_logic_clock_(const int64_t logic_clock, const ObTxDes
{
// if logic clock drift too much, disconnect required
int ret = OB_SUCCESS;
if (logic_clock - ObClockGenerator::getClock() > 1_day ) {
TRANS_LOG(WARN, "logic clock is fast more than 1 day", K(logic_clock), KPC(tx));
} else if (check_fallback && (ObClockGenerator::getClock() - logic_clock > 1_day)) {
TRANS_LOG(WARN, "logic clock is slow more than 1 day", K(logic_clock), KPC(tx));
const int64_t cur_clock = ObClockGenerator::getClock();
if (logic_clock - cur_clock > 1_day ) {
TRANS_LOG(WARN, "logic clock is fast more than 1 day", K(logic_clock), K(cur_clock), KPC(tx));
} else if (check_fallback && (cur_clock - logic_clock > 1_day)) {
TRANS_LOG(WARN, "logic clock is slow more than 1 day", K(logic_clock), K(cur_clock), KPC(tx));
if (OB_NOT_NULL(tx)) { tx->print_trace_(); }
}
if (OB_SUCC(ret)) {