[CP] only root participant need to request gts

This commit is contained in:
obdev 2022-12-28 04:08:13 +00:00 committed by ob-robot
parent b4561e6ecd
commit 80ea36d9ab
3 changed files with 6 additions and 20 deletions

View File

@ -2138,11 +2138,10 @@ int ObPartTransCtx::generate_prepare_version_()
SCN gts = SCN::min_scn();
SCN local_max_read_version = SCN::min_scn();
bool is_gts_ok = false;
bool need_gts = need_request_gts_();
// Only the root participant require to request gts
const bool need_gts = is_root();
// Only the first participant in the participants list of the root require
// to request gts
if (is_root() && need_gts) {
if (need_gts) {
if (OB_FAIL(get_gts_(gts))) {
if (OB_EAGAIN == ret) {
is_gts_ok = false;
@ -2169,6 +2168,9 @@ int ObPartTransCtx::generate_prepare_version_()
TRANS_LOG(WARN, "get local max read version failed", KR(ret), K(*this));
} else {
exec_info_.prepare_version_ = std::max(gts, local_max_read_version);
if (exec_info_.prepare_version_ > gts) {
mt_ctx_.before_prepare(exec_info_.prepare_version_);
}
}
}
}

View File

@ -632,7 +632,6 @@ protected:
private:
// int tx_end_(const bool commit, const int64_t commit_version);
bool need_request_gts_();
void register_gts_callback_();
int restart_2pc_trans_timer_();
// ============================ TX COMMITTER END ============================

View File

@ -345,21 +345,6 @@ int ObPartTransCtx::on_clear()
return ret;
}
bool ObPartTransCtx::need_request_gts_()
{
bool bret = false;
if (!is_leaf()) {
if (0 != exec_info_.participants_.count()
&& ls_id_ == exec_info_.participants_[0]) {
bret = true;
} else {
bret = false;
}
}
return bret;
}
int ObPartTransCtx::reply_to_scheduler_for_sub2pc(int64_t msg_type)
{
int ret = OB_SUCCESS;