Add is_lookup flag in query_flag to inform the transaction layer that this is a lookup task

This commit is contained in:
yishenglanlingzui
2023-03-22 10:41:42 +00:00
committed by ob-robot
parent 79723299c1
commit e3aa4c5a8f
3 changed files with 18 additions and 9 deletions

View File

@ -49,7 +49,8 @@ struct ObQueryFlag
#define OBSF_BIT_IS_SSTABLE_CUT 1 #define OBSF_BIT_IS_SSTABLE_CUT 1
#define OBSF_BIT_IS_SHOW_SEED 1 #define OBSF_BIT_IS_SHOW_SEED 1
#define OBSF_BIT_SKIP_READ_LOB 1 #define OBSF_BIT_SKIP_READ_LOB 1
#define OBSF_BIT_RESERVED 32 #define OBSF_BIT_IS_LOOKUP 1
#define OBSF_BIT_RESERVED 31
static const uint64_t OBSF_MASK_SCAN_ORDER = (0x1UL << OBSF_BIT_SCAN_ORDER) - 1; static const uint64_t OBSF_MASK_SCAN_ORDER = (0x1UL << OBSF_BIT_SCAN_ORDER) - 1;
static const uint64_t OBSF_MASK_DAILY_MERGE = (0x1UL << OBSF_BIT_DAILY_MERGE) - 1; static const uint64_t OBSF_MASK_DAILY_MERGE = (0x1UL << OBSF_BIT_DAILY_MERGE) - 1;
@ -132,6 +133,7 @@ struct ObQueryFlag
uint64_t is_sstable_cut_ : OBSF_BIT_IS_SSTABLE_CUT; //0:sstable no need cut, 1: sstable need cut uint64_t is_sstable_cut_ : OBSF_BIT_IS_SSTABLE_CUT; //0:sstable no need cut, 1: sstable need cut
uint64_t is_show_seed_ : OBSF_BIT_IS_SHOW_SEED; uint64_t is_show_seed_ : OBSF_BIT_IS_SHOW_SEED;
uint64_t skip_read_lob_ : OBSF_BIT_SKIP_READ_LOB; uint64_t skip_read_lob_ : OBSF_BIT_SKIP_READ_LOB;
uint64_t is_lookup_ : OBSF_BIT_IS_LOOKUP;
uint64_t reserved_ : OBSF_BIT_RESERVED; uint64_t reserved_ : OBSF_BIT_RESERVED;
}; };
}; };
@ -183,6 +185,7 @@ struct ObQueryFlag
inline bool is_query_stat() const { return query_stat_; } inline bool is_query_stat() const { return query_stat_; }
inline bool is_mysql_mode() const { return sql_mode_ == MysqlMode; } inline bool is_mysql_mode() const { return sql_mode_ == MysqlMode; }
inline bool is_read_latest() const { return read_latest_; } inline bool is_read_latest() const { return read_latest_; }
inline bool is_lookup() const { return is_lookup_; }
inline bool is_prewarm() const { return prewarm_; } inline bool is_prewarm() const { return prewarm_; }
inline bool is_index_invalid() const { return index_invalid_; } inline bool is_index_invalid() const { return index_invalid_; }
inline bool is_use_row_cache() const { return !is_whole_macro_scan() && use_row_cache_ == UseCache; } inline bool is_use_row_cache() const { return !is_whole_macro_scan() && use_row_cache_ == UseCache; }
@ -246,6 +249,7 @@ struct ObQueryFlag
"is_large_query", is_large_query_, "is_large_query", is_large_query_,
"is_sstable_cut", is_sstable_cut_, "is_sstable_cut", is_sstable_cut_,
"skip_read_lob", skip_read_lob_, "skip_read_lob", skip_read_lob_,
"is_lookup", is_lookup_,
"reserved", reserved_); "reserved", reserved_);
OB_UNIS_VERSION(1); OB_UNIS_VERSION(1);
}; };

View File

@ -1032,7 +1032,9 @@ int ObLocalIndexLookupOp::check_lookup_row_cnt()
"scan_range", scan_param_.key_ranges_, "scan_range", scan_param_.key_ranges_,
"index_table_id", index_ctdef_->ref_table_id_ , "index_table_id", index_ctdef_->ref_table_id_ ,
"data_table_tablet_id", tablet_id_ , "data_table_tablet_id", tablet_id_ ,
KPC_(lookup_ctdef), KPC_(lookup_rtdef)); KPC_(tx_desc));
LOG_ERROR("Fatal Error!!! Catch a defensive error!",
K(ret), KPC_(lookup_ctdef), KPC_(lookup_rtdef));
} }
} }
return ret; return ret;

View File

@ -880,6 +880,7 @@ OB_INLINE int ObTableScanOp::init_das_scan_rtdef(const ObDASScanCtDef &das_ctdef
if (MY_SPEC.batch_scan_flag_ || is_lookup) { if (MY_SPEC.batch_scan_flag_ || is_lookup) {
das_rtdef.scan_flag_.scan_order_ = ObQueryFlag::KeepOrder; das_rtdef.scan_flag_.scan_order_ = ObQueryFlag::KeepOrder;
} }
das_rtdef.scan_flag_.is_lookup_ = is_lookup;
das_rtdef.need_check_output_datum_ = MY_SPEC.need_check_output_datum_; das_rtdef.need_check_output_datum_ = MY_SPEC.need_check_output_datum_;
das_rtdef.sql_mode_ = my_session->get_sql_mode(); das_rtdef.sql_mode_ = my_session->get_sql_mode();
das_rtdef.stmt_allocator_.set_alloc(&das_ref_.get_das_alloc()); das_rtdef.stmt_allocator_.set_alloc(&das_ref_.get_das_alloc());
@ -3249,6 +3250,7 @@ bool ObGlobalIndexLookupOpImpl::need_next_index_batch() const
int ObGlobalIndexLookupOpImpl::check_lookup_row_cnt() int ObGlobalIndexLookupOpImpl::check_lookup_row_cnt()
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
ObSQLSessionInfo *my_session = GET_MY_SESSION(table_scan_op_->get_exec_ctx());
if (GCONF.enable_defensive_check() if (GCONF.enable_defensive_check()
&& get_lookup_ctdef()->pd_expr_spec_.pushdown_filters_.empty()) { && get_lookup_ctdef()->pd_expr_spec_.pushdown_filters_.empty()) {
if (OB_UNLIKELY(lookup_rowkey_cnt_ != lookup_row_cnt_) if (OB_UNLIKELY(lookup_rowkey_cnt_ != lookup_row_cnt_)
@ -3260,7 +3262,8 @@ int ObGlobalIndexLookupOpImpl::check_lookup_row_cnt()
K(ret), K_(lookup_rowkey_cnt), K_(lookup_row_cnt), K(ret), K_(lookup_rowkey_cnt), K_(lookup_row_cnt),
"index_group_cnt", get_index_group_cnt(), "index_group_cnt", get_index_group_cnt(),
"lookup_group_cnt", get_lookup_group_cnt(), "lookup_group_cnt", get_lookup_group_cnt(),
"index_table_id", table_scan_op_->get_tsc_spec().get_ref_table_id()); "index_table_id", table_scan_op_->get_tsc_spec().get_ref_table_id(),
KPC(my_session->get_tx_desc()));
//now to dump lookup das task info //now to dump lookup das task info
for (DASTaskIter task_iter = das_ref_.begin_task_iter(); !task_iter.is_end(); ++task_iter) { for (DASTaskIter task_iter = das_ref_.begin_task_iter(); !task_iter.is_end(); ++task_iter) {
ObDASScanOp *das_op = static_cast<ObDASScanOp*>(*task_iter); ObDASScanOp *das_op = static_cast<ObDASScanOp*>(*task_iter);