提交 84ecffbd 编写于 作者: O obdev 提交者: wangzelin.wzl

[CP] Fix the problem that XA transactions are not aware of the need rollback field when committing

上级 a3c05eca
......@@ -3159,6 +3159,9 @@ int ObScheTransCtx::xa_one_phase_end_trans(const bool is_rollback)
ret = OB_TRANS_XA_RETRY;
}
}
} else if (!is_rollback && trans_desc_->need_rollback()) {
ret = OB_TRANS_NEED_ROLLBACK;
TRANS_LOG(WARN, "transaction need rollback", K(ret), K(*this));
} else {
if (OB_FAIL(xa_one_phase_end_trans_(is_rollback))) {
TRANS_LOG(WARN, "xa one phase end trans failed", K(ret), K(is_rollback), K(*this));
......@@ -3377,6 +3380,9 @@ int ObScheTransCtx::xa_sync_status_response(const ObTransDesc& trans_desc, const
tmp_trans_desc_->set_stmt_min_sql_no(trans_desc.get_stmt_min_sql_no());
sql_no_ = trans_desc.get_sql_no();
tmp_trans_desc_->get_trans_param() = trans_desc.get_trans_param();
if (trans_desc.need_rollback()) {
tmp_trans_desc_->set_need_rollback();
}
if (OB_FAIL(tmp_trans_desc_->merge_participants(trans_desc.get_participants()))) {
TRANS_LOG(WARN, "merge participants failed", K(ret));
} else if (OB_FAIL(tmp_trans_desc_->merge_participants_pla(trans_desc.get_participants_pla()))) {
......
......@@ -904,6 +904,9 @@ int ObTransService::local_xa_prepare(const ObXATransID& xid, const int64_t stmt_
if (!trans_desc->is_valid()) {
ret = OB_ERR_UNEXPECTED;
TRANS_LOG(WARN, "invalid trans dessc", K(ret), K(xid), K(trans_desc));
} else if (trans_desc->need_rollback()) {
ret = OB_TRANS_NEED_ROLLBACK;
TRANS_LOG(WARN, "transaction need rollback", K(ret), K(xid), K(trans_desc));
} else if (OB_FAIL(trans_desc->set_sche_ctx(sche_ctx))) {
TRANS_LOG(WARN, "set trans_desc failed", K(ret), K(xid), K(trans_desc));
// TODO, refer to the remote xa prepare to handle the case that ctx does not exist
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册