Fix tx read snapshot compatible bug

This commit is contained in:
Naynahs
2024-02-26 11:17:18 +00:00
committed by ob-robot
parent cb524c1a6f
commit e24f98638b
3 changed files with 11 additions and 3 deletions

View File

@ -193,7 +193,8 @@ OB_SERIALIZE_MEMBER(ObTxReadSnapshot,
snapshot_lsid_,
parts_,
snapshot_ls_role_,
committed_);
committed_,
snapshot_acquire_addr_);
OB_SERIALIZE_MEMBER(ObTxPart, id_, addr_, epoch_, first_scn_, last_scn_);
DEFINE_SERIALIZE(ObTxDesc::FLAG::FOR_FIXED_SER_VAL)
@ -1166,6 +1167,7 @@ ObTxReadSnapshot::ObTxReadSnapshot()
source_(SRC::INVL),
snapshot_lsid_(),
snapshot_ls_role_(common::ObRole::INVALID_ROLE),
snapshot_acquire_addr_(),
uncertain_bound_(0),
parts_()
{}
@ -1176,6 +1178,7 @@ ObTxReadSnapshot::~ObTxReadSnapshot()
committed_ = false;
source_ = SRC::INVL;
snapshot_ls_role_ = common::INVALID_ROLE;
snapshot_acquire_addr_.reset();
uncertain_bound_ = 0;
}
@ -1187,6 +1190,7 @@ void ObTxReadSnapshot::reset()
source_ = SRC::INVL;
snapshot_lsid_.reset();
snapshot_ls_role_ = common::INVALID_ROLE;
snapshot_acquire_addr_.reset();
uncertain_bound_ = 0;
parts_.reset();
}
@ -1200,6 +1204,7 @@ int ObTxReadSnapshot::assign(const ObTxReadSnapshot &from)
source_ = from.source_;
snapshot_lsid_ = from.snapshot_lsid_;
snapshot_ls_role_ = from.snapshot_ls_role_;
snapshot_acquire_addr_ = from.snapshot_acquire_addr_;
uncertain_bound_ = from.uncertain_bound_;
if (OB_FAIL(parts_.assign(from.parts_))) {
TRANS_LOG(WARN, "assign snapshot fail", K(ret), K(from));

View File

@ -262,6 +262,7 @@ struct ObTxReadSnapshot
share::ObLSID snapshot_lsid_; // for source_ = LOCAL //
common::ObRole snapshot_ls_role_; // for source_ = LS, only can be used for dup_table with a
// max_commit_ts from the follower
ObAddr snapshot_acquire_addr_; // snapshot version acquired from which server
int64_t uncertain_bound_; // for source_ GLOBAL
ObSEArray<ObTxLSEpochPair, 1> parts_;
@ -279,6 +280,7 @@ struct ObTxReadSnapshot
bool is_valid() const { return valid_; }
bool is_committed() const { return committed_; }
int format_source_for_display(char *buf, const int64_t buf_len) const;
const ObAddr get_snapshot_acquire_addr() const { return snapshot_acquire_addr_; }
void reset();
int assign(const ObTxReadSnapshot &);
ObTxReadSnapshot();
@ -290,6 +292,7 @@ struct ObTxReadSnapshot
K_(uncertain_bound),
K_(snapshot_lsid),
K_(snapshot_ls_role),
K_(snapshot_acquire_addr),
K_(parts),
K_(committed));
OB_UNIS_VERSION(1);