fix the condition of returning resp when tx data does not exist

This commit is contained in:
obdev 2023-04-13 06:43:00 +00:00 committed by ob-robot
parent 532b8ce27b
commit fdc59d1d46
4 changed files with 17 additions and 3 deletions

View File

@ -610,6 +610,19 @@ int ObCoreLocalPartitionAuditInfo::init(int64_t array_len)
return ret;
}
bool ObStateInfo::need_update(const ObStateInfo &state_info)
{
bool need_update = true;
if (ObTxState::PRE_COMMIT <= state_ && state_ <= ObTxState::CLEAR) {
need_update = false;
} else if (snapshot_version_ > state_info.snapshot_version_) {
need_update = false;
} else if (state_info.state_ < state_) {
need_update = false;
}
return need_update;
}
void ObAddrLogId::reset()
{
addr_.reset();

View File

@ -1468,6 +1468,7 @@ public:
version_ = state_info.version_;
snapshot_version_ = state_info.snapshot_version_;
}
bool need_update(const ObStateInfo &state_info);
TO_STRING_KV(K_(ls_id), K_(state), K_(version), K_(snapshot_version))
OB_UNIS_VERSION(1);
public:

View File

@ -7026,7 +7026,7 @@ int ObPartTransCtx::handle_trans_ask_state_resp(const ObAskStateRespMsg &msg)
if (OB_FAIL(state_info_array_.push_back(msg.state_info_array_.at(i)))) {
TRANS_LOG(WARN, "push back state info array fail", K(ret));
}
} else if (state_info_array_.at(j-1).snapshot_version_ < msg.state_info_array_.at(i).snapshot_version_) {
} else if (state_info_array_.at(j-1).need_update(msg.state_info_array_.at(i))) {
state_info_array_.at(j-1) = msg.state_info_array_.at(i);
}
}
@ -7128,7 +7128,7 @@ int ObPartTransCtx::handle_trans_collect_state_resp(const ObCollectStateRespMsg
if (!is_contain) {
ret = OB_ERR_UNEXPECTED;
TRANS_LOG(WARN, "state info array has wrong participiants", K(ret), K(msg), KPC(this));
} else if (state_info_array_.at(i-1).snapshot_version_ < msg.state_info_.snapshot_version_) {
} else if (state_info_array_.at(i-1).need_update(msg.state_info_)) {
state_info_array_.at(i-1) = msg.state_info_;
}
if (OB_SUCC(ret)) {

View File

@ -3188,7 +3188,7 @@ int ObTransService::check_and_fill_state_info(const ObTransID &tx_id, ObStateInf
ret = OB_TRANS_CTX_NOT_EXIST;
} else if (OB_FAIL(ls->get_ls_replica_readable_scn(version))) {
TRANS_LOG(WARN, "get ls replica readable scn fail", K(ret), K(ls_id));
} else if (version <= state_info.snapshot_version_) {
} else if (version >= state_info.snapshot_version_) {
state_info.state_ = ObTxState::UNKNOWN;
state_info.version_ = version;
} else {