[master] change seq_no to ObTxSEQ

This commit is contained in:
chinaxing
2023-08-10 06:12:31 +00:00
committed by ob-robot
parent 116871fc10
commit ea61a471d1
134 changed files with 793 additions and 648 deletions

View File

@ -1054,19 +1054,19 @@ int ObLobManager::init_out_row_ctx(
{
int ret = OB_SUCCESS;
ObLobDataOutRowCtx *out_row_ctx = reinterpret_cast<ObLobDataOutRowCtx*>(param.lob_data_->buffer_);
if (param.seq_no_st_ == -1) {
if (!param.seq_no_st_.is_valid()) {
// pre-calc seq_no_cnt and init seq_no_st
// for insert, most oper len/128K + 2
// for erase, most oper len/128K + 2
// for append, most oper len/256K + 1
// for sql update, calc erase+insert
int64_t N = ((len + param.update_len_) / (ObLobMetaUtil::LOB_OPER_PIECE_DATA_SIZE / 2) + 2) * 2;
param.seq_no_st_ = ObSequence::get_and_inc_max_seq_no(N);
param.seq_no_st_ = param.tx_desc_->get_and_inc_tx_seq(param.parent_seq_no_.get_branch(), N);
param.used_seq_cnt_ = 0;
param.total_seq_cnt_ = N;
}
if (OB_SUCC(ret)) {
out_row_ctx->seq_no_st_ = param.seq_no_st_;
out_row_ctx->seq_no_st_ = param.seq_no_st_.cast_to_int();
out_row_ctx->is_full_ = 1;
out_row_ctx->offset_ = param.offset_;
out_row_ctx->check_sum_ = param.checksum_;
@ -3263,12 +3263,13 @@ int ObLobManager::build_lob_param(ObLobAccessParam& param,
} else if (OB_FAIL(lob.get_location_info(location_info))) {
LOG_WARN("failed to get location info", K(ret), K(lob));
} else {
auto snapshot_tx_seq = transaction::ObTxSEQ::cast_from_int(tx_info->snapshot_seq_);
if (OB_ISNULL(param.tx_desc_) ||
param.tx_desc_->get_tx_id().get_id() == tx_info->tx_id_ || // read in same tx
(tx_info->tx_id_ == 0 && tx_info->scn_ == -1 && tx_info->version_ > 0)) { // read not in tx
param.snapshot_.core_.version_.convert_for_tx(tx_info->version_);
param.snapshot_.core_.tx_id_ = tx_info->tx_id_;
param.snapshot_.core_.scn_ = tx_info->scn_;
param.tx_desc_->get_tx_id().get_id() == tx_info->snapshot_tx_id_ || // read in same tx
(tx_info->snapshot_tx_id_ == 0 && !snapshot_tx_seq.is_valid() && tx_info->snapshot_version_ > 0)) { // read not in tx
param.snapshot_.core_.version_.convert_for_tx(tx_info->snapshot_version_);
param.snapshot_.core_.tx_id_ = tx_info->snapshot_tx_id_;
param.snapshot_.core_.scn_ = snapshot_tx_seq;
param.snapshot_.valid_ = true;
param.snapshot_.source_ = transaction::ObTxReadSnapshot::SRC::LS;
param.snapshot_.snapshot_lsid_ = share::ObLSID(location_info->ls_id_);