fix elr and defensive mgr bug

This commit is contained in:
obdev
2023-01-03 15:26:51 +00:00
committed by ob-robot
parent 6b71492704
commit 2b5e273dd0
3 changed files with 10 additions and 10 deletions

View File

@ -324,7 +324,7 @@ int ObSingleMerge::inner_get_next_row(ObDatumRow &row)
access_ctx_->defensive_check_record_.query_flag_ = access_ctx_->query_flag_;
transaction::ObTransService *trx = MTL(transaction::ObTransService *);
bool trx_id_valid = (NULL != access_ctx_->store_ctx_
&& access_ctx_->store_ctx_->mvcc_acc_ctx_.tx_id_.is_valid());
&& access_ctx_->store_ctx_->mvcc_acc_ctx_.snapshot_.is_valid());
if (OB_NOT_NULL(trx)
&& trx_id_valid
&& NULL != trx->get_defensive_check_mgr()) {

View File

@ -559,18 +559,18 @@ int ObTransService::get_read_snapshot(ObTxDesc &tx,
if (OB_SUCC(ret)) {
snapshot.source_ = ObTxReadSnapshot::SRC::GLOBAL;
snapshot.parts_.reset();
if (tx.state_ != ObTxDesc::State::IDLE) {
// If tx id is valid , record tx_id and scn
if (tx.tx_id_.is_valid()) {
snapshot.core_.tx_id_ = tx.tx_id_;
snapshot.core_.scn_ = ObSequence::get_max_seq_no();
}
if (tx.state_ != ObTxDesc::State::IDLE) {
ARRAY_FOREACH(tx.parts_, i) {
if (!tx.parts_[i].is_clean() &&
OB_FAIL(snapshot.parts_.push_back(ObTxLSEpochPair(tx.parts_[i].id_, tx.parts_[i].epoch_)))) {
TRANS_LOG(WARN, "push snapshot parts fail", K(ret), K(tx), K(snapshot));
}
}
} else {
snapshot.core_.tx_id_.reset();
snapshot.core_.scn_ = 0;
}
snapshot.valid_ = true;
}
@ -611,9 +611,12 @@ int ObTransService::get_ls_read_snapshot(ObTxDesc &tx,
snapshot.snapshot_lsid_ = lsid;
snapshot.uncertain_bound_ = 0;
snapshot.parts_.reset();
if (tx.state_ != ObTxDesc::State::IDLE) {
// If tx id is valid , record tx_id and scn
if (tx.tx_id_.is_valid()) {
snapshot.core_.tx_id_ = tx.tx_id_;
snapshot.core_.scn_ = ObSequence::get_max_seq_no();
}
if (tx.state_ != ObTxDesc::State::IDLE) {
ARRAY_FOREACH(tx.parts_, i) {
if (tx.parts_[i].id_ == lsid && !tx.parts_[i].is_clean()) {
if (OB_FAIL(snapshot.parts_.push_back(ObTxLSEpochPair(lsid, tx.parts_[i].epoch_)))) {
@ -621,9 +624,6 @@ int ObTransService::get_ls_read_snapshot(ObTxDesc &tx,
}
}
}
} else {
snapshot.core_.tx_id_.reset();
snapshot.core_.scn_ = 0;
}
snapshot.valid_ = true;
} else {

View File

@ -264,7 +264,7 @@ int LockForReadFunctor::inner_lock_for_read(const ObTxData &tx_data, ObTxCCCtx *
} else {
// Only dml statement can read elr data
if (ObTxData::ELR_COMMIT == state
&& lock_for_read_arg_.mvcc_acc_ctx_.get_tx_id().is_valid()) {
&& lock_for_read_arg_.mvcc_acc_ctx_.snapshot_.tx_id_.is_valid()) {
can_read_ = !tx_data.undo_status_list_.is_contain(data_sql_sequence);
trans_version_ = commit_version;
} else {