bug fix for free-route keep-alive with xa trx
This commit is contained in:
@ -595,7 +595,7 @@ int ObTableScanIterator::check_txn_status_if_read_uncommitted_()
|
|||||||
// The txn has been killed during normal processing. So we return
|
// The txn has been killed during normal processing. So we return
|
||||||
// OB_TRANS_KILLED to prompt this abnormal state.
|
// OB_TRANS_KILLED to prompt this abnormal state.
|
||||||
ret = OB_TRANS_KILLED;
|
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_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -467,6 +467,7 @@ int ObTransService::txn_free_route__update_static_state(const uint32_t session_i
|
|||||||
// mark as REPLICA_ for all temporary node
|
// mark as REPLICA_ for all temporary node
|
||||||
} else if (FALSE_IT(tx->flags_.SHADOW_ = tx->is_xa_trans() && tx->addr_ != self_)) {
|
} 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
|
// 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;
|
int64_t elapsed_us = ObTimeUtility::current_time() - start_ts;
|
||||||
ObTransTraceLog &tlog = tx->get_tlog();
|
ObTransTraceLog &tlog = tx->get_tlog();
|
||||||
@ -1257,7 +1258,7 @@ int ObTransService::tx_free_route_check_alive(ObTxnFreeRouteCtx &ctx, const ObTx
|
|||||||
m.sender_ = self_;
|
m.sender_ = self_;
|
||||||
m.receiver_ = ctx.txn_addr_;
|
m.receiver_ = ctx.txn_addr_;
|
||||||
m.req_sess_id_ = session_id;
|
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);
|
ret = rpc_->post_msg(ctx.txn_addr_, m);
|
||||||
bool print_log = OB_FAIL(ret);
|
bool print_log = OB_FAIL(ret);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
|||||||
@ -85,6 +85,7 @@ struct ObTxnFreeRouteCtx {
|
|||||||
ObTxnFreeRouteCtx() { reset(); }
|
ObTxnFreeRouteCtx() { reset(); }
|
||||||
~ObTxnFreeRouteCtx() { reset(); }
|
~ObTxnFreeRouteCtx() { reset(); }
|
||||||
void reset() {
|
void reset() {
|
||||||
|
start_session_id_ = 0;
|
||||||
local_version_ = 1;
|
local_version_ = 1;
|
||||||
global_version_ = 0;
|
global_version_ = 0;
|
||||||
global_version_water_mark_ = 0;
|
global_version_water_mark_ = 0;
|
||||||
@ -101,6 +102,7 @@ struct ObTxnFreeRouteCtx {
|
|||||||
audit_record_.reset();
|
audit_record_.reset();
|
||||||
}
|
}
|
||||||
void set_sessid(const uint32_t sessid) { session_id_ = sessid; }
|
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_update_state(bool proxy_support);
|
||||||
void init_before_handle_request(ObTxDesc *txdesc);
|
void init_before_handle_request(ObTxDesc *txdesc);
|
||||||
bool is_temp(const ObTxDesc &tx) const;
|
bool is_temp(const ObTxDesc &tx) const;
|
||||||
@ -123,6 +125,7 @@ struct ObTxnFreeRouteCtx {
|
|||||||
const ObTransID &get_tx_id() const { return tx_id_; }
|
const ObTransID &get_tx_id() const { return tx_id_; }
|
||||||
const ObTxnFreeRouteFlag &get_flag() const { return flag_; }
|
const ObTxnFreeRouteFlag &get_flag() const { return flag_; }
|
||||||
uint32_t get_session_id() const { return session_id_; }
|
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_; }
|
uint64_t get_audit_record() const { return audit_record_.v_; }
|
||||||
int state_update_verify_by_version(const TxnFreeRouteState state,
|
int state_update_verify_by_version(const TxnFreeRouteState state,
|
||||||
const int64_t version,
|
const int64_t version,
|
||||||
@ -146,6 +149,9 @@ private:
|
|||||||
}
|
}
|
||||||
// the session this ctx belongs to
|
// the session this ctx belongs to
|
||||||
uint32_t session_id_;
|
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
|
// the local_version updated when session handle a request
|
||||||
// from proxy which caused txn state synced
|
// from proxy which caused txn state synced
|
||||||
// it is used as request id for checkAlive request
|
// it is used as request id for checkAlive request
|
||||||
|
|||||||
Reference in New Issue
Block a user