[Bugfix]fix batch execute read latest
This commit is contained in:
@ -381,6 +381,7 @@ int ObTableBatchExecuteP::multi_get()
|
|||||||
spec))) {
|
spec))) {
|
||||||
LOG_WARN("fail to get or create spec", K(ret));
|
LOG_WARN("fail to get or create spec", K(ret));
|
||||||
} else {
|
} else {
|
||||||
|
tb_ctx_.set_read_latest(false);
|
||||||
const ObTableSchema *table_schema = tb_ctx_.get_table_schema();
|
const ObTableSchema *table_schema = tb_ctx_.get_table_schema();
|
||||||
for (int64_t i = 0; OB_SUCC(ret) && i < batch_operation.count(); ++i) {
|
for (int64_t i = 0; OB_SUCC(ret) && i < batch_operation.count(); ++i) {
|
||||||
const ObTableOperation &table_operation = batch_operation.at(i);
|
const ObTableOperation &table_operation = batch_operation.at(i);
|
||||||
|
|||||||
@ -84,6 +84,7 @@ public:
|
|||||||
is_index_back_ = false;
|
is_index_back_ = false;
|
||||||
is_weak_read_ = false;
|
is_weak_read_ = false;
|
||||||
is_get_ = false;
|
is_get_ = false;
|
||||||
|
read_latest_ = true;
|
||||||
index_schema_ = nullptr;
|
index_schema_ = nullptr;
|
||||||
limit_ = -1;
|
limit_ = -1;
|
||||||
offset_ = 0;
|
offset_ = 0;
|
||||||
@ -99,32 +100,33 @@ public:
|
|||||||
}
|
}
|
||||||
virtual ~ObTableCtx()
|
virtual ~ObTableCtx()
|
||||||
{}
|
{}
|
||||||
TO_STRING_KV("is_init", is_init_,
|
TO_STRING_KV(K_(is_init),
|
||||||
"tenant_id", tenant_id_,
|
K_(tenant_id),
|
||||||
"database_id", database_id_,
|
K_(database_id),
|
||||||
"table_name", table_name_,
|
K_(table_name),
|
||||||
"ref_table_id", ref_table_id_,
|
K_(ref_table_id),
|
||||||
"index_table_id", index_table_id_,
|
K_(index_table_id),
|
||||||
"tablet_id", tablet_id_,
|
K_(tablet_id),
|
||||||
"index_tablet_id", index_tablet_id_,
|
K_(index_tablet_id),
|
||||||
"ls_id", ls_id_,
|
K_(ls_id),
|
||||||
"tenant_schema_version", tenant_schema_version_,
|
K_(tenant_schema_version),
|
||||||
// scan to string
|
// scan to string
|
||||||
"is_scan", is_scan_,
|
K_(is_scan),
|
||||||
"is_index_scan", is_index_scan_,
|
K_(is_index_scan),
|
||||||
"is_index_back", is_index_back_,
|
K_(is_index_back),
|
||||||
"is_weak_read", is_weak_read_,
|
K_(is_weak_read),
|
||||||
"is_get_", is_get_,
|
K_(is_get),
|
||||||
"limit", limit_,
|
K_(read_latest),
|
||||||
"offset", offset_,
|
K_(limit),
|
||||||
"query_col_names", query_col_names_,
|
K_(offset),
|
||||||
"select_col_ids", select_col_ids_,
|
K_(query_col_names),
|
||||||
|
K_(select_col_ids),
|
||||||
// update to string
|
// update to string
|
||||||
"is_update", is_for_update_,
|
K_(is_for_update),
|
||||||
// insert up to string
|
// insert up to string
|
||||||
"is_for_insertup", is_for_insertup_,
|
K_(is_for_insertup),
|
||||||
"entity_type", entity_type_,
|
K_(entity_type),
|
||||||
"cur_cluster_version", cur_cluster_version_);
|
K_(cur_cluster_version));
|
||||||
public:
|
public:
|
||||||
//////////////////////////////////////// getter ////////////////////////////////////////////////
|
//////////////////////////////////////// getter ////////////////////////////////////////////////
|
||||||
// for common
|
// for common
|
||||||
@ -157,6 +159,7 @@ public:
|
|||||||
OB_INLINE bool is_weak_read() const { return is_weak_read_; }
|
OB_INLINE bool is_weak_read() const { return is_weak_read_; }
|
||||||
OB_INLINE bool is_index_back() const { return is_index_back_; }
|
OB_INLINE bool is_index_back() const { return is_index_back_; }
|
||||||
OB_INLINE bool is_get() const { return is_get_; }
|
OB_INLINE bool is_get() const { return is_get_; }
|
||||||
|
OB_INLINE bool is_read_latest() const { return read_latest_; }
|
||||||
OB_INLINE common::ObQueryFlag::ScanOrder get_scan_order() const { return scan_order_; }
|
OB_INLINE common::ObQueryFlag::ScanOrder get_scan_order() const { return scan_order_; }
|
||||||
OB_INLINE const ObIArray<sql::ObRawExpr *>& get_select_exprs() const { return select_exprs_; }
|
OB_INLINE const ObIArray<sql::ObRawExpr *>& get_select_exprs() const { return select_exprs_; }
|
||||||
OB_INLINE const ObIArray<sql::ObRawExpr *>& get_rowkey_exprs() const { return rowkey_exprs_; }
|
OB_INLINE const ObIArray<sql::ObRawExpr *>& get_rowkey_exprs() const { return rowkey_exprs_; }
|
||||||
@ -210,6 +213,7 @@ public:
|
|||||||
// for scan
|
// for scan
|
||||||
OB_INLINE void set_scan(const bool &is_scan) { is_scan_ = is_scan; }
|
OB_INLINE void set_scan(const bool &is_scan) { is_scan_ = is_scan; }
|
||||||
OB_INLINE void set_limit(const int64_t &limit) { limit_ = limit; }
|
OB_INLINE void set_limit(const int64_t &limit) { limit_ = limit; }
|
||||||
|
OB_INLINE void set_read_latest(bool read_latest) { read_latest_ = read_latest; }
|
||||||
// for dml
|
// for dml
|
||||||
OB_INLINE void set_entity(const ObITableEntity *entity) { entity_ = entity; }
|
OB_INLINE void set_entity(const ObITableEntity *entity) { entity_ = entity; }
|
||||||
OB_INLINE void set_entity_type(const ObTableEntityType &type) { entity_type_ = type; }
|
OB_INLINE void set_entity_type(const ObTableEntityType &type) { entity_type_ = type; }
|
||||||
@ -308,6 +312,7 @@ private:
|
|||||||
bool is_index_back_;
|
bool is_index_back_;
|
||||||
bool is_weak_read_;
|
bool is_weak_read_;
|
||||||
bool is_get_;
|
bool is_get_;
|
||||||
|
bool read_latest_; // default true, false in single get and multi get
|
||||||
common::ObQueryFlag::ScanOrder scan_order_;
|
common::ObQueryFlag::ScanOrder scan_order_;
|
||||||
common::ObArray<sql::ObRawExpr*> select_exprs_;
|
common::ObArray<sql::ObRawExpr*> select_exprs_;
|
||||||
common::ObArray<sql::ObRawExpr*> rowkey_exprs_;
|
common::ObArray<sql::ObRawExpr*> rowkey_exprs_;
|
||||||
|
|||||||
@ -347,6 +347,8 @@ int ObTableApiExecuteP::process_get()
|
|||||||
LOG_WARN("fail to init wead read trans", K(ret), K(tb_ctx_));
|
LOG_WARN("fail to init wead read trans", K(ret), K(tb_ctx_));
|
||||||
} else if (OB_FAIL(tb_ctx_.init_trans(get_trans_desc(), get_tx_snapshot()))) {
|
} else if (OB_FAIL(tb_ctx_.init_trans(get_trans_desc(), get_tx_snapshot()))) {
|
||||||
LOG_WARN("fail to init trans", K(ret), K(tb_ctx_));
|
LOG_WARN("fail to init trans", K(ret), K(tb_ctx_));
|
||||||
|
} else if (FALSE_IT(tb_ctx_.set_read_latest(false))) {
|
||||||
|
// do nothing
|
||||||
} else if (OB_FAIL(ObTableOpWrapper::process_get(tb_ctx_, row))) {
|
} else if (OB_FAIL(ObTableOpWrapper::process_get(tb_ctx_, row))) {
|
||||||
if (ret == OB_ITER_END) {
|
if (ret == OB_ITER_END) {
|
||||||
ret = OB_SUCCESS;
|
ret = OB_SUCCESS;
|
||||||
|
|||||||
@ -33,8 +33,7 @@ int ObTableApiScanExecutor::init_das_scan_rtdef(const ObDASScanCtDef &das_ctdef,
|
|||||||
das_rtdef.timeout_ts_ = tb_ctx.get_timeout_ts();
|
das_rtdef.timeout_ts_ = tb_ctx.get_timeout_ts();
|
||||||
das_rtdef.scan_flag_.scan_order_ = tb_ctx.get_scan_order();
|
das_rtdef.scan_flag_.scan_order_ = tb_ctx.get_scan_order();
|
||||||
das_rtdef.scan_flag_.index_back_ = tb_ctx.is_index_back();
|
das_rtdef.scan_flag_.index_back_ = tb_ctx.is_index_back();
|
||||||
bool is_get_op = tb_ctx.get_opertion_type() == ObTableOperationType::Type::GET;
|
das_rtdef.scan_flag_.read_latest_ = tb_ctx.is_read_latest();
|
||||||
das_rtdef.scan_flag_.read_latest_ = is_get_op ? false : true;
|
|
||||||
das_rtdef.need_check_output_datum_ = false;
|
das_rtdef.need_check_output_datum_ = false;
|
||||||
das_rtdef.sql_mode_ = SMO_DEFAULT;
|
das_rtdef.sql_mode_ = SMO_DEFAULT;
|
||||||
das_rtdef.stmt_allocator_.set_alloc(&das_ref_.get_das_alloc());
|
das_rtdef.stmt_allocator_.set_alloc(&das_ref_.get_das_alloc());
|
||||||
|
|||||||
Reference in New Issue
Block a user