[CP] to issue<58095770>:add return value of set_snapshot interface

This commit is contained in:
hanr881
2024-08-01 12:22:59 +00:00
committed by ob-robot
parent 7287fd8471
commit eaaf4a75f2
7 changed files with 32 additions and 26 deletions

View File

@ -1605,7 +1605,7 @@ int ObTableCtx::init_trans(transaction::ObTxDesc *trans_desc,
sql::ObSQLSessionInfo &session = get_session_info();
sql::ObSQLSessionInfo::LockGuard guard(session.get_thread_data_lock());
session.get_tx_desc() = trans_desc;
exec_ctx_.get_das_ctx().set_snapshot(tx_snapshot);
OZ (exec_ctx_.get_das_ctx().set_snapshot(tx_snapshot));
}
return ret;

View File

@ -2051,8 +2051,8 @@ bool ObObjAccessIdx::is_contain_object_type(const common::ObIArray<ObObjAccessId
int ObPLCursorInfo::set_and_register_snapshot(const transaction::ObTxReadSnapshot &snapshot)
{
int ret = OB_SUCCESS;
set_snapshot(snapshot);
if (snapshot.is_valid()) {
OZ (set_snapshot(snapshot));
if (OB_SUCC(ret) && snapshot.is_valid()) {
set_need_check_snapshot(true);
OZ (MTL(transaction::ObTransService*)->register_tx_snapshot_verify(get_snapshot()));
}

View File

@ -959,7 +959,7 @@ public:
inline void set_last_execute_time(int64_t last_execute_time) { last_execute_time_ = last_execute_time; }
inline int64_t get_last_execute_time() const { return last_execute_time_; }
void set_snapshot(const transaction::ObTxReadSnapshot &snapshot) { snapshot_ = snapshot; }
int set_snapshot(const transaction::ObTxReadSnapshot &snapshot) { return snapshot_.assign(snapshot); }
transaction::ObTxReadSnapshot &get_snapshot() { return snapshot_; }
void set_need_check_snapshot(bool is_need_check_snapshot) { is_need_check_snapshot_ = is_need_check_snapshot; }

View File

@ -126,7 +126,7 @@ public:
const DASTableIDArrayWrap *related_table_ids = nullptr);
int get_all_lsid(share::ObLSArray &ls_ids);
int64_t get_related_tablet_cnt() const;
void set_snapshot(const transaction::ObTxReadSnapshot &snapshot) { snapshot_ = snapshot; }
int set_snapshot(const transaction::ObTxReadSnapshot &snapshot) { return snapshot_.assign(snapshot); }
transaction::ObTxReadSnapshot &get_snapshot() { return snapshot_; }
transaction::ObTxSEQ get_savepoint() const { return savepoint_; }
void set_savepoint(const transaction::ObTxSEQ savepoint) { savepoint_ = savepoint; }

View File

@ -175,7 +175,9 @@ int ObRemoteScheduler::build_remote_task(ObExecContext &ctx,
task_id.set_server(ctx.get_addr());
task_id.set_task_id(0);
remote_task.set_task_id(task_id);
remote_task.set_snapshot(ctx.get_das_ctx().get_snapshot());
if (OB_FAIL(remote_task.set_snapshot(ctx.get_das_ctx().get_snapshot()))) {
LOG_WARN("fail to set snapshot", K(ret));
}
}
return ret;
}

View File

@ -430,28 +430,32 @@ OB_DEF_DESERIALIZE(ObRemoteTask)
dependency_tables_.set_allocator(&(exec_ctx_->get_allocator()));
OB_UNIS_DECODE(dependency_tables_);
OB_UNIS_DECODE(snapshot_);
exec_ctx_->get_das_ctx().set_snapshot(snapshot_);
//DESERIALIZE param_meta_count if 0, (1) params->count() ==0 (2) old version -> new version
//for (2) just set obj.meta as param_meta
OB_UNIS_DECODE(param_meta_count);
if (OB_SUCC(ret)) {
if (param_meta_count > 0) {
for (int64_t i = 0; OB_SUCC(ret) && i < param_meta_count; ++i) {
OB_UNIS_DECODE(tmp_meta);
ps_params->at(i).set_param_meta(tmp_meta);
}
for (int64_t i = 0; OB_SUCC(ret) && i < param_meta_count; ++i) {
OB_UNIS_DECODE(tmp_flag);
ps_params->at(i).set_param_flag(tmp_flag);
}
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < ps_params->count(); ++i) {
ps_params->at(i).set_param_meta();
if (OB_FAIL(ret)) {
} else if (OB_FAIL(exec_ctx_->get_das_ctx().set_snapshot(snapshot_))) {
LOG_WARN("fail to set snapshot", K(ret));
} else {
//DESERIALIZE param_meta_count if 0, (1) params->count() ==0 (2) old version -> new version
//for (2) just set obj.meta as param_meta
OB_UNIS_DECODE(param_meta_count);
if (OB_SUCC(ret)) {
if (param_meta_count > 0) {
for (int64_t i = 0; OB_SUCC(ret) && i < param_meta_count; ++i) {
OB_UNIS_DECODE(tmp_meta);
ps_params->at(i).set_param_meta(tmp_meta);
}
for (int64_t i = 0; OB_SUCC(ret) && i < param_meta_count; ++i) {
OB_UNIS_DECODE(tmp_flag);
ps_params->at(i).set_param_flag(tmp_flag);
}
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < ps_params->count(); ++i) {
ps_params->at(i).set_param_meta();
}
}
}
OB_UNIS_DECODE(remote_sql_info_->is_original_ps_mode_);
OB_UNIS_DECODE(remote_sql_info_->sql_from_pl_);
}
OB_UNIS_DECODE(remote_sql_info_->is_original_ps_mode_);
OB_UNIS_DECODE(remote_sql_info_->sql_from_pl_);
}
return ret;
}

View File

@ -227,7 +227,7 @@ public:
const DependenyTableStore &get_dependency_tables() const {
return dependency_tables_;
}
void set_snapshot(const transaction::ObTxReadSnapshot &snapshot) { snapshot_ = snapshot; }
int set_snapshot(const transaction::ObTxReadSnapshot &snapshot) { return snapshot_.assign(snapshot); }
const transaction::ObTxReadSnapshot &get_snapshot() const { return snapshot_; }
int fill_buffer(char* buf, int64_t size, int64_t &filled_size) const
{