[BUGFIX] fix repeat update lob in one stmt wrong
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
#include "storage/tx/ob_trans_define_v4.h"
|
||||
#include "storage/tx/ob_trans_service.h"
|
||||
#include "share/ob_lob_access_utils.h"
|
||||
#include "observer/ob_server.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -38,7 +39,8 @@ ObLobLocatorHelper::ObLobLocatorHelper()
|
||||
locator_allocator_(ObModIds::OB_LOB_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID()),
|
||||
rowkey_str_(),
|
||||
enable_locator_v2_(),
|
||||
is_inited_(false)
|
||||
is_inited_(false),
|
||||
scan_flag_()
|
||||
{
|
||||
}
|
||||
|
||||
@ -96,6 +98,7 @@ int ObLobLocatorHelper::init(const ObTableScanParam &scan_param,
|
||||
ls_id_ = ls_id.id();
|
||||
read_snapshot_ = ctx.mvcc_acc_ctx_.snapshot_;
|
||||
enable_locator_v2_ = table_param.enable_lob_locator_v2();
|
||||
scan_flag_ = scan_param.scan_flag_;
|
||||
if (snapshot_version != read_snapshot_.version_.get_val_for_tx()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
STORAGE_LOG(WARN, "snapshot version mismatch",
|
||||
@ -310,6 +313,7 @@ int ObLobLocatorHelper::fuse_mem_lob_header(ObObj &def_obj, uint64_t col_id, boo
|
||||
// mysql inrow lobs & systable lobs do not have extern fields
|
||||
bool has_extern = (lib::is_oracle_mode() && !is_systable);
|
||||
ObMemLobExternFlags extern_flags(has_extern);
|
||||
extern_flags.has_retry_info_ = 0; // default obj should only be inrow, no need retry info
|
||||
ObLobCommon lob_common;
|
||||
int64_t full_loc_size = ObLobLocatorV2::calc_locator_full_len(extern_flags,
|
||||
rowkey_str_.length(),
|
||||
@ -544,6 +548,11 @@ int ObLobLocatorHelper::build_lob_locatorv2(ObLobLocatorV2 &locator,
|
||||
ObMemLobTxInfo tx_info(read_snapshot_.version_.get_val_for_tx(),
|
||||
read_snapshot_.tx_id_.get_id(),
|
||||
read_snapshot_.scn_.cast_to_int());
|
||||
ObMemLobRetryInfo retry_info;
|
||||
retry_info.addr_ = MYADDR;
|
||||
retry_info.is_select_leader_ = true;
|
||||
retry_info.read_latest_ = scan_flag_.read_latest_;
|
||||
retry_info.timeout_ = access_ctx.timeout_;
|
||||
ObMemLobLocationInfo location_info(tablet_id_, ls_id_, cs_type);
|
||||
if (has_extern && OB_FAIL(locator.set_table_info(table_id_, column_id))) { // should be column idx
|
||||
STORAGE_LOG(WARN, "Lob: set table info failed", K(ret), K(table_id_), K(column_id));
|
||||
@ -551,6 +560,8 @@ int ObLobLocatorHelper::build_lob_locatorv2(ObLobLocatorV2 &locator,
|
||||
STORAGE_LOG(WARN, "Lob: set transaction info failed", K(ret), K(tx_info));
|
||||
} else if (extern_flags.has_location_info_ && OB_FAIL(locator.set_location_info(location_info))) {
|
||||
STORAGE_LOG(WARN, "Lob: set location info failed", K(ret), K(location_info));
|
||||
} else if (extern_flags.has_retry_info_ && OB_FAIL(locator.set_retry_info(retry_info))) {
|
||||
STORAGE_LOG(WARN, "Lob: set location info failed", K(ret), K(retry_info));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -93,6 +93,7 @@ private:
|
||||
ObString rowkey_str_; // for default values
|
||||
bool enable_locator_v2_;
|
||||
bool is_inited_;
|
||||
ObQueryFlag scan_flag_;
|
||||
};
|
||||
|
||||
} // namespace storage
|
||||
|
||||
@ -3554,10 +3554,16 @@ int ObLobManager::build_lob_param(ObLobAccessParam& param,
|
||||
if (OB_SUCC(ret) && lob.is_persist_lob() && !lob.has_inrow_data()) {
|
||||
ObMemLobTxInfo *tx_info = nullptr;
|
||||
ObMemLobLocationInfo *location_info = nullptr;
|
||||
ObMemLobRetryInfo *retry_info = nullptr;
|
||||
ObMemLobExternHeader *extern_header = NULL;
|
||||
if (OB_FAIL(lob.get_tx_info(tx_info))) {
|
||||
LOG_WARN("failed to get tx info", K(ret), K(lob));
|
||||
} else if (OB_FAIL(lob.get_location_info(location_info))) {
|
||||
LOG_WARN("failed to get location info", K(ret), K(lob));
|
||||
} else if (OB_FAIL(lob.get_extern_header(extern_header))) {
|
||||
LOG_WARN("failed to get extern header", K(ret), K(lob));
|
||||
} else if (extern_header->flags_.has_retry_info_ && OB_FAIL(lob.get_retry_info(retry_info))) {
|
||||
LOG_WARN("failed to get retry 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_) ||
|
||||
@ -3569,6 +3575,7 @@ int ObLobManager::build_lob_param(ObLobAccessParam& param,
|
||||
param.snapshot_.valid_ = true;
|
||||
param.snapshot_.source_ = transaction::ObTxReadSnapshot::SRC::LS;
|
||||
param.snapshot_.snapshot_lsid_ = share::ObLSID(location_info->ls_id_);
|
||||
param.read_latest_ = retry_info->read_latest_;
|
||||
} else {
|
||||
// When param for write, param.tx_desc_ should not be null
|
||||
// If tx indfo from lob locator is old, produce new read snapshot directly
|
||||
|
||||
@ -936,7 +936,7 @@ int ObPersistentLobApator::build_common_scan_param(
|
||||
false, // index_back
|
||||
false, // query_stat
|
||||
ObQueryFlag::MysqlMode, // sql_mode
|
||||
false // read_latest
|
||||
param.read_latest_ // read_latest
|
||||
);
|
||||
query_flag.disable_cache();
|
||||
query_flag.scan_order_ = param.scan_backward_ ? ObQueryFlag::Reverse : ObQueryFlag::Forward;
|
||||
@ -961,6 +961,9 @@ int ObPersistentLobApator::build_common_scan_param(
|
||||
scan_param.limit_param_.offset_ = 0;
|
||||
// sessions
|
||||
scan_param.snapshot_ = param.snapshot_;
|
||||
if(param.read_latest_) {
|
||||
scan_param.tx_id_ = param.snapshot_.core_.tx_id_;
|
||||
}
|
||||
scan_param.sql_mode_ = param.sql_mode_;
|
||||
// common set
|
||||
scan_param.allocator_ = param.allocator_;
|
||||
|
||||
@ -44,7 +44,8 @@ struct ObLobStorageParam
|
||||
|
||||
struct ObLobAccessParam {
|
||||
ObLobAccessParam()
|
||||
: tx_desc_(nullptr), snapshot_(), tx_id_(), sql_mode_(SMO_DEFAULT), allocator_(nullptr),
|
||||
: tx_desc_(nullptr), snapshot_(), tx_id_(), read_latest_(0),
|
||||
sql_mode_(SMO_DEFAULT), allocator_(nullptr),
|
||||
dml_base_param_(nullptr), column_ids_(),
|
||||
meta_table_schema_(nullptr), piece_table_schema_(nullptr),
|
||||
main_tablet_param_(nullptr), meta_tablet_param_(nullptr), piece_tablet_param_(nullptr),
|
||||
@ -68,12 +69,13 @@ public:
|
||||
TO_STRING_KV(K_(tenant_id), K_(src_tenant_id), K_(ls_id), K_(tablet_id), KPC_(lob_locator), KPC_(lob_common),
|
||||
KPC_(lob_data), K_(byte_size), K_(handle_size), K_(coll_type), K_(scan_backward), K_(offset), K_(len),
|
||||
K_(parent_seq_no), K_(seq_no_st), K_(used_seq_cnt), K_(total_seq_cnt), K_(checksum),
|
||||
K_(update_len), K_(op_type), K_(is_fill_zero), K_(from_rpc), K_(snapshot), K_(tx_id), K_(inrow_read_nocopy),
|
||||
K_(inrow_threshold), K_(spec_lob_id));
|
||||
K_(update_len), K_(op_type), K_(is_fill_zero), K_(from_rpc), K_(snapshot), K_(tx_id), K_(read_latest),
|
||||
K_(inrow_read_nocopy), K_(inrow_threshold), K_(spec_lob_id));
|
||||
public:
|
||||
transaction::ObTxDesc *tx_desc_; // for write/update/delete
|
||||
transaction::ObTxReadSnapshot snapshot_; // for read
|
||||
transaction::ObTransID tx_id_; // used when read-latest
|
||||
transaction::ObTransID tx_id_; // used when read-latest
|
||||
bool read_latest_;
|
||||
ObSQLMode sql_mode_;
|
||||
bool is_total_quantity_log_;
|
||||
ObIAllocator *allocator_;
|
||||
|
||||
Reference in New Issue
Block a user