Limit prefetch depth in scan/multi-scan
This commit is contained in:
@ -674,6 +674,7 @@ void ObIndexTreeMultiPassPrefetcher::reset()
|
|||||||
can_blockscan_ = false;
|
can_blockscan_ = false;
|
||||||
is_prefetch_end_ = false;
|
is_prefetch_end_ = false;
|
||||||
is_row_lock_checked_ = false;
|
is_row_lock_checked_ = false;
|
||||||
|
need_check_prefetch_depth_ = false;
|
||||||
cur_range_fetch_idx_ = 0;
|
cur_range_fetch_idx_ = 0;
|
||||||
cur_range_prefetch_idx_ = 0;
|
cur_range_prefetch_idx_ = 0;
|
||||||
max_range_prefetching_cnt_ = 0;
|
max_range_prefetching_cnt_ = 0;
|
||||||
@ -699,6 +700,7 @@ void ObIndexTreeMultiPassPrefetcher::reuse()
|
|||||||
clean_blockscan_check_info();
|
clean_blockscan_check_info();
|
||||||
is_prefetch_end_ = false;
|
is_prefetch_end_ = false;
|
||||||
is_row_lock_checked_ = false;
|
is_row_lock_checked_ = false;
|
||||||
|
need_check_prefetch_depth_ = false;
|
||||||
cur_range_fetch_idx_ = 0;
|
cur_range_fetch_idx_ = 0;
|
||||||
cur_range_prefetch_idx_ = 0;
|
cur_range_prefetch_idx_ = 0;
|
||||||
cur_micro_data_fetch_idx_ = -1;
|
cur_micro_data_fetch_idx_ = -1;
|
||||||
@ -816,6 +818,12 @@ int ObIndexTreeMultiPassPrefetcher::init_basic_info(
|
|||||||
cur_level_ = 0;
|
cur_level_ = 0;
|
||||||
iter_type_ = iter_type;
|
iter_type_ = iter_type;
|
||||||
index_tree_height_ = sstable_->get_meta().get_index_tree_height();
|
index_tree_height_ = sstable_->get_meta().get_index_tree_height();
|
||||||
|
need_check_prefetch_depth_ =
|
||||||
|
(ObStoreRowIterator::IteratorScan == iter_type || ObStoreRowIterator::IteratorMultiScan == iter_type) &&
|
||||||
|
iter_param_->limit_prefetch_ &&
|
||||||
|
nullptr != access_ctx_->limit_param_ &&
|
||||||
|
access_ctx_->limit_param_->limit_ >= 0 &&
|
||||||
|
access_ctx_->limit_param_->limit_ < 4096;
|
||||||
switch (iter_type) {
|
switch (iter_type) {
|
||||||
case ObStoreRowIterator::IteratorMultiGet: {
|
case ObStoreRowIterator::IteratorMultiGet: {
|
||||||
rowkeys_ = static_cast<const common::ObIArray<blocksstable::ObDatumRowkey> *> (query_range);
|
rowkeys_ = static_cast<const common::ObIArray<blocksstable::ObDatumRowkey> *> (query_range);
|
||||||
@ -982,6 +990,7 @@ int ObIndexTreeMultiPassPrefetcher::try_add_query_range(ObIndexTreeLevelHandle &
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t OB_SSTABLE_MICRO_AVG_COUNT = 100;
|
||||||
int ObIndexTreeMultiPassPrefetcher::prefetch_micro_data()
|
int ObIndexTreeMultiPassPrefetcher::prefetch_micro_data()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
@ -995,7 +1004,13 @@ int ObIndexTreeMultiPassPrefetcher::prefetch_micro_data()
|
|||||||
} else {
|
} else {
|
||||||
int64_t prefetched_cnt = 0;
|
int64_t prefetched_cnt = 0;
|
||||||
int64_t prefetch_micro_idx = 0;
|
int64_t prefetch_micro_idx = 0;
|
||||||
prefetch_depth_ = min(max_micro_handle_cnt_, 2 * prefetch_depth_);
|
prefetch_depth_ = MIN(max_micro_handle_cnt_, 2 * prefetch_depth_);
|
||||||
|
if (need_check_prefetch_depth_) {
|
||||||
|
int64_t prefetch_micro_cnt = MAX(1,
|
||||||
|
(access_ctx_->limit_param_->offset_ + access_ctx_->limit_param_->limit_ - access_ctx_->out_cnt_ + \
|
||||||
|
OB_SSTABLE_MICRO_AVG_COUNT - 1) / OB_SSTABLE_MICRO_AVG_COUNT);
|
||||||
|
prefetch_depth_ = MIN(prefetch_depth_, prefetch_micro_cnt);
|
||||||
|
}
|
||||||
int64_t prefetch_depth = min(static_cast<int64_t>(prefetch_depth_),
|
int64_t prefetch_depth = min(static_cast<int64_t>(prefetch_depth_),
|
||||||
max_micro_handle_cnt_ - (micro_data_prefetch_idx_ - cur_micro_data_fetch_idx_));
|
max_micro_handle_cnt_ - (micro_data_prefetch_idx_ - cur_micro_data_fetch_idx_));
|
||||||
while (OB_SUCC(ret) && prefetched_cnt < prefetch_depth) {
|
while (OB_SUCC(ret) && prefetched_cnt < prefetch_depth) {
|
||||||
|
|||||||
@ -317,6 +317,7 @@ public:
|
|||||||
row_lock_check_version_(transaction::ObTransVersion::INVALID_TRANS_VERSION),
|
row_lock_check_version_(transaction::ObTransVersion::INVALID_TRANS_VERSION),
|
||||||
agg_row_store_(nullptr),
|
agg_row_store_(nullptr),
|
||||||
can_blockscan_(false),
|
can_blockscan_(false),
|
||||||
|
need_check_prefetch_depth_(false),
|
||||||
iter_type_(0),
|
iter_type_(0),
|
||||||
cur_level_(0),
|
cur_level_(0),
|
||||||
index_tree_height_(0),
|
index_tree_height_(0),
|
||||||
@ -376,7 +377,8 @@ public:
|
|||||||
K_(is_prefetch_end), K_(cur_range_fetch_idx), K_(cur_range_prefetch_idx), K_(max_range_prefetching_cnt),
|
K_(is_prefetch_end), K_(cur_range_fetch_idx), K_(cur_range_prefetch_idx), K_(max_range_prefetching_cnt),
|
||||||
K_(cur_micro_data_fetch_idx), K_(micro_data_prefetch_idx), K_(max_micro_handle_cnt),
|
K_(cur_micro_data_fetch_idx), K_(micro_data_prefetch_idx), K_(max_micro_handle_cnt),
|
||||||
K_(iter_type), K_(cur_level), K_(index_tree_height), K_(prefetch_depth),
|
K_(iter_type), K_(cur_level), K_(index_tree_height), K_(prefetch_depth),
|
||||||
K_(total_micro_data_cnt), KP_(query_range), K_(tree_handles), K_(border_rowkey));
|
K_(total_micro_data_cnt), KP_(query_range), K_(tree_handles), K_(border_rowkey),
|
||||||
|
K_(can_blockscan), K_(need_check_prefetch_depth));
|
||||||
private:
|
private:
|
||||||
int init_basic_info(
|
int init_basic_info(
|
||||||
const int iter_type,
|
const int iter_type,
|
||||||
@ -566,6 +568,7 @@ public:
|
|||||||
ObAggregatedStore *agg_row_store_;
|
ObAggregatedStore *agg_row_store_;
|
||||||
private:
|
private:
|
||||||
bool can_blockscan_;
|
bool can_blockscan_;
|
||||||
|
bool need_check_prefetch_depth_;
|
||||||
int16_t iter_type_;
|
int16_t iter_type_;
|
||||||
int16_t cur_level_;
|
int16_t cur_level_;
|
||||||
int16_t index_tree_height_;
|
int16_t index_tree_height_;
|
||||||
|
|||||||
@ -41,6 +41,7 @@ ObTableIterParam::ObTableIterParam()
|
|||||||
has_virtual_columns_(false),
|
has_virtual_columns_(false),
|
||||||
has_lob_column_out_(false),
|
has_lob_column_out_(false),
|
||||||
is_for_foreign_check_(false),
|
is_for_foreign_check_(false),
|
||||||
|
limit_prefetch_(false),
|
||||||
ss_rowkey_prefix_cnt_(0),
|
ss_rowkey_prefix_cnt_(0),
|
||||||
pd_storage_flag_(0)
|
pd_storage_flag_(0)
|
||||||
{
|
{
|
||||||
@ -70,6 +71,7 @@ void ObTableIterParam::reset()
|
|||||||
has_virtual_columns_ = false;
|
has_virtual_columns_ = false;
|
||||||
has_lob_column_out_ = false;
|
has_lob_column_out_ = false;
|
||||||
is_for_foreign_check_ = false;
|
is_for_foreign_check_ = false;
|
||||||
|
limit_prefetch_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObTableIterParam::is_valid() const
|
bool ObTableIterParam::is_valid() const
|
||||||
@ -136,7 +138,10 @@ DEF_TO_STRING(ObTableIterParam)
|
|||||||
K_(pd_storage_flag),
|
K_(pd_storage_flag),
|
||||||
K_(vectorized_enabled),
|
K_(vectorized_enabled),
|
||||||
K_(has_virtual_columns),
|
K_(has_virtual_columns),
|
||||||
K_(has_lob_column_out));
|
K_(has_lob_column_out),
|
||||||
|
K_(is_for_foreign_check),
|
||||||
|
K_(limit_prefetch),
|
||||||
|
K_(ss_rowkey_prefix_cnt));
|
||||||
J_OBJ_END();
|
J_OBJ_END();
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
@ -222,6 +227,7 @@ int ObTableAccessParam::init(
|
|||||||
iter_param_.has_virtual_columns_ = table_param.has_virtual_column();
|
iter_param_.has_virtual_columns_ = table_param.has_virtual_column();
|
||||||
// vectorize requires blockscan is enabled(_pushdown_storage_level > 0)
|
// vectorize requires blockscan is enabled(_pushdown_storage_level > 0)
|
||||||
iter_param_.vectorized_enabled_ = nullptr != op_ && op_->is_vectorized();
|
iter_param_.vectorized_enabled_ = nullptr != op_ && op_->is_vectorized();
|
||||||
|
iter_param_.limit_prefetch_ = (nullptr == op_filters_ || op_filters_->empty());
|
||||||
|
|
||||||
if (OB_FAIL(iter_param_.check_read_info_valid())) {
|
if (OB_FAIL(iter_param_.check_read_info_valid())) {
|
||||||
STORAGE_LOG(WARN, "Failed to check read info valdie", K(ret), K(iter_param_));
|
STORAGE_LOG(WARN, "Failed to check read info valdie", K(ret), K(iter_param_));
|
||||||
|
|||||||
@ -165,6 +165,7 @@ public:
|
|||||||
// so we can generate from the request cols in readinfo without considering fuse row cache
|
// so we can generate from the request cols in readinfo without considering fuse row cache
|
||||||
bool has_lob_column_out_;
|
bool has_lob_column_out_;
|
||||||
bool is_for_foreign_check_;
|
bool is_for_foreign_check_;
|
||||||
|
bool limit_prefetch_;
|
||||||
int64_t ss_rowkey_prefix_cnt_;
|
int64_t ss_rowkey_prefix_cnt_;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user