diff --git a/src/storage/access/ob_table_scan_iterator.cpp b/src/storage/access/ob_table_scan_iterator.cpp index fc38dadda2..2391679c0f 100644 --- a/src/storage/access/ob_table_scan_iterator.cpp +++ b/src/storage/access/ob_table_scan_iterator.cpp @@ -595,7 +595,7 @@ int ObTableScanIterator::check_txn_status_if_read_uncommitted_() // The txn has been killed during normal processing. So we return // OB_TRANS_KILLED to prompt this abnormal state. ret = OB_TRANS_KILLED; - STORAGE_LOG(WARN, "txn has terminated", K(ret), "tx_id", acc_ctx.tx_id_); + STORAGE_LOG(WARN, "txn has terminated", K(ret), "tx_id", acc_ctx.snapshot_.tx_id_); } } } diff --git a/src/storage/tx/ob_tx_free_route.cpp b/src/storage/tx/ob_tx_free_route.cpp index 531c9d2f10..b8154636d0 100644 --- a/src/storage/tx/ob_tx_free_route.cpp +++ b/src/storage/tx/ob_tx_free_route.cpp @@ -467,6 +467,7 @@ int ObTransService::txn_free_route__update_static_state(const uint32_t session_i // mark as REPLICA_ for all temporary node } else if (FALSE_IT(tx->flags_.SHADOW_ = tx->is_xa_trans() && tx->addr_ != self_)) { // mark as SHADOW_ for XA's temporary node, exclude XA orig node + } else if (FALSE_IT(ctx.set_start_sessid(tx->sess_id_))) { } int64_t elapsed_us = ObTimeUtility::current_time() - start_ts; ObTransTraceLog &tlog = tx->get_tlog(); @@ -1257,7 +1258,7 @@ int ObTransService::tx_free_route_check_alive(ObTxnFreeRouteCtx &ctx, const ObTx m.sender_ = self_; m.receiver_ = ctx.txn_addr_; m.req_sess_id_ = session_id; - m.tx_sess_id_ = tx.sess_id_; + m.tx_sess_id_ = ctx.get_start_session_id(); ret = rpc_->post_msg(ctx.txn_addr_, m); bool print_log = OB_FAIL(ret); #ifndef NDEBUG diff --git a/src/storage/tx/ob_tx_free_route.h b/src/storage/tx/ob_tx_free_route.h index 42d4e7d824..7e290fbf68 100644 --- a/src/storage/tx/ob_tx_free_route.h +++ b/src/storage/tx/ob_tx_free_route.h @@ -85,6 +85,7 @@ struct ObTxnFreeRouteCtx { ObTxnFreeRouteCtx() { reset(); } ~ObTxnFreeRouteCtx() { reset(); } void reset() { + start_session_id_ = 0; local_version_ = 1; global_version_ = 0; global_version_water_mark_ = 0; @@ -101,6 +102,7 @@ struct ObTxnFreeRouteCtx { audit_record_.reset(); } void set_sessid(const uint32_t sessid) { session_id_ = sessid; } + void set_start_sessid(const uint32_t sessid) { start_session_id_ = sessid; } void init_before_update_state(bool proxy_support); void init_before_handle_request(ObTxDesc *txdesc); bool is_temp(const ObTxDesc &tx) const; @@ -123,6 +125,7 @@ struct ObTxnFreeRouteCtx { const ObTransID &get_tx_id() const { return tx_id_; } const ObTxnFreeRouteFlag &get_flag() const { return flag_; } uint32_t get_session_id() const { return session_id_; } + uint32_t get_start_session_id() const { return start_session_id_; } uint64_t get_audit_record() const { return audit_record_.v_; } int state_update_verify_by_version(const TxnFreeRouteState state, const int64_t version, @@ -146,6 +149,9 @@ private: } // the session this ctx belongs to uint32_t session_id_; + // for normal trx: transaction original session + // for xa trx: xa-start session + uint32_t start_session_id_; // the local_version updated when session handle a request // from proxy which caused txn state synced // it is used as request id for checkAlive request