fix coverity of transaction
This commit is contained in:
parent
3427f970aa
commit
293e2ec49b
@ -140,7 +140,8 @@ public:
|
||||
// For Example: If you change the signature of the function `commit` in
|
||||
// `ObTransCtx`, you should also modify the signature of function `commit` in
|
||||
// `ObPartTransCtx`, `ObSlaveTransCtx`, `ObScheTransCtx` and `ObCoordTransCtx`
|
||||
class ObTransCtx : public TransCtxHashValue {
|
||||
class ObTransCtx : public TransCtxHashValue
|
||||
{
|
||||
friend class CtxLock;
|
||||
|
||||
protected:
|
||||
@ -183,6 +184,7 @@ public:
|
||||
part_trans_action_(ObPartTransAction::UNKNOWN),
|
||||
trans_audit_record_(NULL),
|
||||
pending_callback_param_(common::OB_SUCCESS),
|
||||
elr_prepared_state_(ELRState::ELR_INIT),
|
||||
p_mt_ctx_(NULL),
|
||||
replay_clear_clog_ts_(0),
|
||||
is_dup_table_trans_(false),
|
||||
@ -381,7 +383,7 @@ public:
|
||||
virtual int leader_active(const storage::LeaderActiveArg& arg) = 0;
|
||||
virtual int leader_revoke(const bool first_check, bool& need_release, ObEndTransCallbackArray& cb_array) = 0;
|
||||
virtual bool can_be_freezed() const = 0;
|
||||
virtual int commit(const bool is_rollback, sql::ObIEndTransCallback* cb, bool is_readonly,
|
||||
virtual int commit(const bool is_rollback, sql::ObIEndTransCallback* cb, const bool is_readonly,
|
||||
const MonotonicTs commit_time, const int64_t stmt_expired_time, const ObStmtRollbackInfo& stmt_rollback_info,
|
||||
const common::ObString& app_trace_info, bool& need_convert_to_dist_trans) = 0;
|
||||
virtual void set_exiting_();
|
||||
|
@ -1440,8 +1440,8 @@ int ObPartTransCtx::handle_timeout(const int64_t delay)
|
||||
REC_TRANS_TRACE_EXT(tlog_, handle_timeout, OB_ID(ret), ret, OB_ID(used), timeguard, OB_ID(uref), get_uref());
|
||||
} else {
|
||||
TRANS_LOG(WARN, "failed to acquire lock in specified time", K_(trans_id));
|
||||
unregister_timeout_task_();
|
||||
register_timeout_task_(delay);
|
||||
(void)unregister_timeout_task_();
|
||||
(void)register_timeout_task_(delay);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -30,6 +30,11 @@ void ObTransPartitionStat::reset()
|
||||
active_memstore_version_.reset();
|
||||
total_ctx_count_ = 0;
|
||||
mgr_addr_ = 0;
|
||||
with_dependency_trx_count_ = 0;
|
||||
without_dependency_trx_count_ = 0;
|
||||
end_trans_by_prev_count_ = 0;
|
||||
end_trans_by_checkpoint_count_ = 0;
|
||||
end_trans_by_self_count_ = 0;
|
||||
}
|
||||
|
||||
// don't valid input arguments
|
||||
|
@ -18,7 +18,8 @@
|
||||
|
||||
namespace oceanbase {
|
||||
namespace transaction {
|
||||
class ObTransPartitionStat {
|
||||
class ObTransPartitionStat
|
||||
{
|
||||
public:
|
||||
ObTransPartitionStat()
|
||||
{
|
||||
|
@ -87,6 +87,7 @@ void ObTransResultInfo::reset()
|
||||
state_ = ObTransResultState::INVALID;
|
||||
commit_version_ = 0;
|
||||
min_log_id_ = UINT64_MAX;
|
||||
min_log_ts_ = INT64_MAX;
|
||||
trans_id_.reset();
|
||||
next_ = NULL;
|
||||
prev_ = NULL;
|
||||
|
@ -24,7 +24,8 @@ class ObPartitionService;
|
||||
namespace transaction {
|
||||
class ObTransResultInfoFactory;
|
||||
|
||||
class ObTransResultInfoLinkNode {
|
||||
class ObTransResultInfoLinkNode
|
||||
{
|
||||
public:
|
||||
ObTransResultInfoLinkNode()
|
||||
{
|
||||
@ -56,7 +57,8 @@ protected:
|
||||
ObTransResultInfoLinkNode* prev_;
|
||||
};
|
||||
|
||||
class ObTransResultInfo : public ObTransResultInfoLinkNode {
|
||||
class ObTransResultInfo : public ObTransResultInfoLinkNode
|
||||
{
|
||||
public:
|
||||
ObTransResultInfo()
|
||||
{
|
||||
@ -129,7 +131,8 @@ private:
|
||||
ObTransID trans_id_;
|
||||
};
|
||||
|
||||
class ObGetMinLogIdFunction {
|
||||
class ObGetMinLogIdFunction
|
||||
{
|
||||
public:
|
||||
ObGetMinLogIdFunction() : min_log_id_(UINT64_MAX), min_log_ts_(INT64_MAX)
|
||||
{}
|
||||
@ -157,7 +160,8 @@ private:
|
||||
int64_t min_log_ts_;
|
||||
};
|
||||
|
||||
class ObITransResultInfoMgr {
|
||||
class ObITransResultInfoMgr
|
||||
{
|
||||
public:
|
||||
ObITransResultInfoMgr()
|
||||
{}
|
||||
@ -173,7 +177,8 @@ public:
|
||||
virtual int del(const ObTransID& trans_id) = 0;
|
||||
};
|
||||
|
||||
struct ObTransResultInfoBucketHeader {
|
||||
struct ObTransResultInfoBucketHeader
|
||||
{
|
||||
ObTransResultInfoBucketHeader()
|
||||
{
|
||||
reset();
|
||||
@ -196,7 +201,8 @@ struct ObTransResultInfoBucketHeader {
|
||||
common::SpinRWLock lock_;
|
||||
} CACHE_ALIGNED;
|
||||
|
||||
class ObTransResultInfoMgr : public ObITransResultInfoMgr {
|
||||
class ObTransResultInfoMgr : public ObITransResultInfoMgr
|
||||
{
|
||||
public:
|
||||
ObTransResultInfoMgr()
|
||||
{
|
||||
|
@ -560,8 +560,8 @@ int ObScheTransCtx::handle_timeout(const int64_t delay)
|
||||
REC_TRANS_TRACE_EXT(tlog_, handle_timeout, OB_ID(ret), ret, OB_ID(uref), get_uref());
|
||||
} else {
|
||||
TRANS_LOG(WARN, "failed to acquire lock in specified time", K_(trans_id));
|
||||
unregister_timeout_task_();
|
||||
register_timeout_task_(delay);
|
||||
(void)unregister_timeout_task_();
|
||||
(void)register_timeout_task_(delay);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -707,7 +707,7 @@ int ObScheTransCtx::end_trans(const ObTransDesc& trans_desc, const bool is_rollb
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
set_app_trace_info_(trans_desc.get_trace_info().get_app_trace_info());
|
||||
(void)set_app_trace_info_(trans_desc.get_trace_info().get_app_trace_info());
|
||||
set_stc_(commit_time);
|
||||
//(void)check_inner_table_commit_();
|
||||
if (OB_FAIL(end_trans_(is_rollback, trans_expired_time, stmt_expired_time, need_callback))) {
|
||||
@ -2479,7 +2479,7 @@ int ObScheTransCtx::handle_err_response(const int64_t msg_type, const ObPartitio
|
||||
trans_2pc_timeout_ = ObServerConfig::get_instance().trx_2pc_retry_interval;
|
||||
if (timeout_task_.is_registered()) {
|
||||
(void)unregister_timeout_task_();
|
||||
register_timeout_task_(trans_2pc_timeout_);
|
||||
(void)register_timeout_task_(trans_2pc_timeout_);
|
||||
}
|
||||
}
|
||||
} else if (OB_TRANS_CLEAR_REQUEST == msg_type) {
|
||||
@ -2616,7 +2616,7 @@ int ObScheTransCtx::handle_xa_trans_response_(const int64_t msg_type, int status
|
||||
TRANS_LOG(WARN, "[XA] xa prepare failed", K(ret), K(status), "context", *this);
|
||||
is_rollback_ = true;
|
||||
is_xa_end_trans_ = true;
|
||||
register_timeout_task_(trans_2pc_timeout_);
|
||||
(void)register_timeout_task_(trans_2pc_timeout_);
|
||||
status = OB_TRANS_NEED_ROLLBACK;
|
||||
end_trans_callback_(is_rollback_, status);
|
||||
} else if (ObXATransState::PREPARED == xa_trans_state_) {
|
||||
@ -3084,14 +3084,14 @@ int ObScheTransCtx::xa_rollback_session_terminate()
|
||||
*/
|
||||
else if (has_decided_()) {
|
||||
if (!is_xa_one_phase_) {
|
||||
// 已进入两阶段提交阶段的xa事务不再允许执行一阶段提交
|
||||
// forbit one phase commit in two phase commit
|
||||
ret = OB_TRANS_XA_PROTO;
|
||||
TRANS_LOG(WARN, "xa trans has entered into two phase", "context", *this);
|
||||
} else if (!is_rollback_) {
|
||||
ret = OB_TRANS_XA_PROTO;
|
||||
TRANS_LOG(WARN, "invalid xa trans one phase request", "context", *this);
|
||||
} else {
|
||||
// 断连接转发超时,不需要重试
|
||||
// need not retry when rollback
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
// ret = OB_ERR_UNEXPECTED;
|
||||
|
@ -9321,7 +9321,7 @@ int ObTransService::revert_store_ctx_(const ObStandaloneStmtDesc& desc, const Ob
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
if (OB_UNLIKELY(!desc.is_valid() || !pg_key.is_valid() || OB_ISNULL(part_mgr))) {
|
||||
if (OB_UNLIKELY(!desc.is_valid() || !pg_key.is_valid())) {
|
||||
TRANS_LOG(WARN, "invalid argument", K(desc), K(pg_key));
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
} else {
|
||||
|
@ -510,8 +510,8 @@ int ObSlaveTransCtx::handle_timeout(const int64_t delay)
|
||||
REC_TRANS_TRACE_EXT(tlog_, handle_timeout, OB_ID(ret), ret, OB_ID(used), timeguard, OB_ID(uref), get_uref());
|
||||
} else {
|
||||
TRANS_LOG(WARN, "failed to acquire lock in specified time", K_(trans_id));
|
||||
unregister_timeout_task_();
|
||||
register_timeout_task_(delay);
|
||||
(void)unregister_timeout_task_();
|
||||
(void)register_timeout_task_(delay);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user