[dblink] refine print xid in tm rm start

This commit is contained in:
jw-guo
2023-08-24 11:44:13 +00:00
committed by ob-robot
parent 7ca812ff62
commit f436b6e223
3 changed files with 10 additions and 7 deletions

View File

@ -129,17 +129,18 @@ int ObTMService::tm_rm_start(ObExecContext &exec_ctx,
}
// step 3, xa start for dblink connection
ObXATransID remote_xid;
if (OB_SUCCESS != ret) {
} else if (OB_FAIL(xa_service->xa_start_for_dblink_client(dblink_type,
dblink_conn, tx_desc))) {
LOG_WARN("fail to execute xa start for dblink client", K(ret), K(xid));
dblink_conn, tx_desc, remote_xid))) {
LOG_WARN("fail to execute xa start for dblink client", K(ret), K(xid), K(remote_xid));
} else {
tx_id = tx_desc->tid();
}
my_session->get_raw_audit_record().trans_id_ = my_session->get_tx_id();
LOG_INFO("tm rm start", K(ret), K(tx_id), K(xid), K(need_start), K(need_promote));
LOG_INFO("tm rm start", K(ret), K(tx_id), K(remote_xid), K(need_start), K(need_promote));
// TODO, if fail, the trans needs rollback
// if fail, the trans should be rolled back by client
return ret;
}

View File

@ -429,7 +429,8 @@ int ObXAService::xa_start_for_tm_(const int64_t flags,
int ObXAService::xa_start_for_dblink_client(const DblinkDriverProto dblink_type,
ObISQLConnection *dblink_conn,
ObTxDesc *&tx_desc)
ObTxDesc *&tx_desc,
ObXATransID &remote_xid)
{
int ret = OB_SUCCESS;
if (NULL == tx_desc || !tx_desc->is_valid()) {
@ -453,9 +454,9 @@ int ObXAService::xa_start_for_dblink_client(const DblinkDriverProto dblink_type,
ret = OB_ERR_UNEXPECTED;
TRANS_LOG(WARN, "unexpected dblink client", K(ret), K(xid), K(tx_id));
} else {
ObXATransID remote_xid;
if (client->is_started(xid)) {
// return success
remote_xid = client->get_xid();
} else if (OB_FAIL(ObXAService::generate_xid_with_new_bqual(xid,
client->get_index(), remote_xid))) {
TRANS_LOG(WARN, "fail to generate xid", K(ret), K(xid), K(tx_id), K(remote_xid));

View File

@ -103,7 +103,8 @@ public:
ObXATransID &xid);
int xa_start_for_dblink_client(const common::sqlclient::DblinkDriverProto dblink_type,
common::sqlclient::ObISQLConnection *dblink_conn,
ObTxDesc *&tx_desc);
ObTxDesc *&tx_desc,
ObXATransID &remote_xid);
int commit_for_dblink_trans(ObTxDesc *&tx_desc);
int rollback_for_dblink_trans(ObTxDesc *&tx_desc);
static int generate_xid(const ObTransID &tx_id, ObXATransID &new_xid);