[bugfix](scannode) 1. make rows_read correct 2. use single scanner if has limit clause (#16473)
make rows_read correct so that the scheduler could using this correctly. use single scanner if has limit clause. Move it from fragment context to scannode. --------- Co-authored-by: yiguolei <yiguolei@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -773,43 +773,11 @@ Status FragmentMgr::exec_plan_fragment(const TExecPlanFragmentParams& params, Fi
|
||||
void FragmentMgr::_set_scan_concurrency(const TExecPlanFragmentParams& params,
|
||||
QueryFragmentsCtx* fragments_ctx) {
|
||||
#ifndef BE_TEST
|
||||
// set thread token
|
||||
// the thread token will be set if
|
||||
// 1. the cpu_limit is set, or
|
||||
// 2. the limit is very small ( < 1024)
|
||||
// If the token is set, the scan task will use limited_scan_pool in scanner scheduler.
|
||||
// Otherwise, the scan task will use local/remote scan pool in scanner scheduler
|
||||
int concurrency = 1;
|
||||
bool is_serial = false;
|
||||
bool need_token = false;
|
||||
if (params.query_options.__isset.resource_limit &&
|
||||
params.query_options.resource_limit.__isset.cpu_limit) {
|
||||
concurrency = params.query_options.resource_limit.cpu_limit;
|
||||
need_token = true;
|
||||
} else {
|
||||
concurrency = config::doris_scanner_thread_pool_thread_num;
|
||||
}
|
||||
if (params.__isset.fragment && params.fragment.__isset.plan &&
|
||||
params.fragment.plan.nodes.size() > 0) {
|
||||
for (auto& node : params.fragment.plan.nodes) {
|
||||
// Only for SCAN NODE
|
||||
if (!_is_scan_node(node.node_type)) {
|
||||
continue;
|
||||
}
|
||||
if (node.__isset.conjuncts && !node.conjuncts.empty()) {
|
||||
// If the scan node has where predicate, do not set concurrency
|
||||
continue;
|
||||
}
|
||||
if (node.limit > 0 && node.limit < 1024) {
|
||||
concurrency = 1;
|
||||
is_serial = true;
|
||||
need_token = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (need_token) {
|
||||
fragments_ctx->set_thread_token(concurrency, is_serial);
|
||||
fragments_ctx->set_thread_token(params.query_options.resource_limit.cpu_limit, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user