[fix](scan) use serial scan thread token only for scan node (#12058)

Only the scan node's limit is less than 1024, we can use serial thread token to submit scanners.
Or it will slow down the query.
This commit is contained in:
Mingyu Chen
2022-08-25 14:54:02 +08:00
committed by GitHub
parent 9d165797c5
commit 003fdf2b36
2 changed files with 15 additions and 0 deletions

View File

@ -654,6 +654,10 @@ Status FragmentMgr::exec_plan_fragment(const TExecPlanFragmentParams& params, Fi
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.limit > 0 && node.limit < 1024) {
concurrency = 1;
is_serial = true;
@ -717,6 +721,15 @@ Status FragmentMgr::exec_plan_fragment(const TExecPlanFragmentParams& params, Fi
return Status::OK();
}
bool FragmentMgr::_is_scan_node(const TPlanNodeType::type& type) {
return type == TPlanNodeType::OLAP_SCAN_NODE || type == TPlanNodeType::MYSQL_SCAN_NODE ||
type == TPlanNodeType::SCHEMA_SCAN_NODE || type == TPlanNodeType::META_SCAN_NODE ||
type == TPlanNodeType::BROKER_SCAN_NODE || type == TPlanNodeType::ES_SCAN_NODE ||
type == TPlanNodeType::ES_HTTP_SCAN_NODE || type == TPlanNodeType::ODBC_SCAN_NODE ||
type == TPlanNodeType::TABLE_VALUED_FUNCTION_SCAN_NODE ||
type == TPlanNodeType::FILE_SCAN_NODE;
}
Status FragmentMgr::cancel(const TUniqueId& fragment_id, const PPlanFragmentCancelReason& reason,
const std::string& msg) {
std::shared_ptr<FragmentExecState> exec_state;

View File

@ -96,6 +96,8 @@ public:
private:
void _exec_actual(std::shared_ptr<FragmentExecState> exec_state, FinishCallback cb);
bool _is_scan_node(const TPlanNodeType::type& type);
// This is input params
ExecEnv* _exec_env;