Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
97da2ee9
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
97da2ee9
编写于
12月 20, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify api and compile warning
上级
35f76a3c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
79 addition
and
54 deletion
+79
-54
include/libs/scheduler/scheduler.h
include/libs/scheduler/scheduler.h
+2
-2
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+77
-52
未找到文件。
include/libs/scheduler/scheduler.h
浏览文件 @
97da2ee9
...
...
@@ -58,7 +58,7 @@ typedef struct SQueryProfileSummary {
*/
int32_t
scheduleQueryJob
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
SQueryDag
*
pDag
,
void
**
pJob
);
int32_t
scheduleFetchRows
(
void
*
p
Rpc
,
void
*
p
Job
,
void
**
data
);
int32_t
scheduleFetchRows
(
void
*
pJob
,
void
**
data
);
/**
...
...
@@ -66,7 +66,7 @@ int32_t scheduleFetchRows(void *pRpc, void *pJob, void **data);
* @param pJob
* @return
*/
int32_t
scheduleCancelJob
(
void
*
p
Rpc
,
void
*
p
Job
);
int32_t
scheduleCancelJob
(
void
*
pJob
);
void
scheduleFreeJob
(
void
*
pJob
);
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
97da2ee9
...
...
@@ -127,6 +127,8 @@ int32_t schBuildTaskRalation(SQueryJob *job, SHashObj *planToTask) {
int32_t
schValidateAndBuildJob
(
SQueryDag
*
dag
,
SQueryJob
*
job
)
{
int32_t
code
=
0
;
job
->
queryId
=
dag
->
queryId
;
if
(
dag
->
numOfSubplans
<=
0
)
{
qError
(
"invalid subplan num:%d"
,
dag
->
numOfSubplans
);
SCH_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
...
...
@@ -152,7 +154,6 @@ int32_t schValidateAndBuildJob(SQueryDag *dag, SQueryJob *job) {
job
->
levelNum
=
levelNum
;
job
->
levelIdx
=
levelNum
-
1
;
job
->
status
=
SCH_STATUS_NOT_START
;
job
->
subPlans
=
dag
->
pSubplans
;
...
...
@@ -341,50 +342,6 @@ int32_t schTaskCheckAndSetRetry(SQueryJob *job, SQueryTask *task, int32_t errCod
return
TSDB_CODE_SUCCESS
;
}
int32_t
schHandleRspMsg
(
SQueryJob
*
job
,
SQueryTask
*
task
,
int32_t
msgType
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
switch
(
msgType
)
{
case
TSDB_MSG_TYPE_QUERY
:
if
(
rspCode
!=
TSDB_CODE_SUCCESS
)
{
SCH_ERR_JRET
(
schProcessOnTaskFailure
(
job
,
task
,
rspCode
));
}
else
{
code
=
schAsyncSendMsg
(
job
,
task
,
TSDB_MSG_TYPE_RSP_READY
);
if
(
code
)
{
goto
_task_error
;
}
}
break
;
case
TSDB_MSG_TYPE_RSP_READY
:
if
(
rspCode
!=
TSDB_CODE_SUCCESS
)
{
SCH_ERR_JRET
(
schProcessOnTaskFailure
(
job
,
task
,
rspCode
));
}
else
{
code
=
schProcessOnTaskSuccess
(
job
,
task
);
if
(
code
)
{
goto
_task_error
;
}
}
break
;
case
TSDB_MSG_TYPE_FETCH
:
SCH_ERR_JRET
(
rspCode
);
SCH_ERR_JRET
(
schProcessOnDataFetched
(
job
));
break
;
default:
qError
(
"unknown msg type:%d received"
,
msgType
);
return
TSDB_CODE_QRY_INVALID_INPUT
;
}
return
TSDB_CODE_SUCCESS
;
_task_error:
SCH_ERR_JRET
(
schProcessOnTaskFailure
(
job
,
task
,
code
));
return
TSDB_CODE_SUCCESS
;
_return:
code
=
schProcessOnJobFailure
(
job
);
return
code
;
}
int32_t
schFetchFromRemote
(
SQueryJob
*
job
)
{
int32_t
code
=
0
;
...
...
@@ -500,6 +457,50 @@ int32_t schProcessOnTaskFailure(SQueryJob *job, SQueryTask *task, int32_t errCod
return
TSDB_CODE_SUCCESS
;
}
int32_t
schHandleRspMsg
(
SQueryJob
*
job
,
SQueryTask
*
task
,
int32_t
msgType
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
switch
(
msgType
)
{
case
TSDB_MSG_TYPE_QUERY
:
if
(
rspCode
!=
TSDB_CODE_SUCCESS
)
{
SCH_ERR_JRET
(
schProcessOnTaskFailure
(
job
,
task
,
rspCode
));
}
else
{
code
=
schAsyncSendMsg
(
job
,
task
,
TSDB_MSG_TYPE_RSP_READY
);
if
(
code
)
{
goto
_task_error
;
}
}
break
;
case
TSDB_MSG_TYPE_RSP_READY
:
if
(
rspCode
!=
TSDB_CODE_SUCCESS
)
{
SCH_ERR_JRET
(
schProcessOnTaskFailure
(
job
,
task
,
rspCode
));
}
else
{
code
=
schProcessOnTaskSuccess
(
job
,
task
);
if
(
code
)
{
goto
_task_error
;
}
}
break
;
case
TSDB_MSG_TYPE_FETCH
:
SCH_ERR_JRET
(
rspCode
);
SCH_ERR_JRET
(
schProcessOnDataFetched
(
job
));
break
;
default:
qError
(
"unknown msg type:%d received"
,
msgType
);
return
TSDB_CODE_QRY_INVALID_INPUT
;
}
return
TSDB_CODE_SUCCESS
;
_task_error:
SCH_ERR_JRET
(
schProcessOnTaskFailure
(
job
,
task
,
code
));
return
TSDB_CODE_SUCCESS
;
_return:
code
=
schProcessOnJobFailure
(
job
);
return
code
;
}
...
...
@@ -578,10 +579,17 @@ int32_t scheduleQueryJob(struct SCatalog *pCatalog, void *pRpc, const SEpSet* pM
tsem_init
(
&
job
->
rspSem
,
0
,
0
);
if
(
0
!=
taosHashPut
(
schMgmt
.
Jobs
,
&
job
->
queryId
,
sizeof
(
job
->
queryId
),
&
job
,
POINTER_BYTES
))
{
qError
(
"taosHashPut queryId:%"
PRIx64
" failed"
,
job
->
queryId
);
SCH_ERR_JRET
(
TSDB_CODE_SCH_INTERNAL_ERROR
);
}
job
->
status
=
SCH_STATUS_NOT_START
;
SCH_ERR_JRET
(
schLaunchJob
(
job
));
*
(
SQueryJob
**
)
pJob
=
job
;
return
TSDB_CODE_SUCCESS
;
_return:
...
...
@@ -592,8 +600,8 @@ _return:
SCH_RET
(
code
);
}
int32_t
scheduleFetchRows
(
void
*
p
Rpc
,
void
*
p
Job
,
void
**
data
)
{
if
(
NULL
==
p
Rpc
||
NULL
==
p
Job
||
NULL
==
data
)
{
int32_t
scheduleFetchRows
(
void
*
pJob
,
void
**
data
)
{
if
(
NULL
==
pJob
||
NULL
==
data
)
{
return
TSDB_CODE_QRY_INVALID_INPUT
;
}
...
...
@@ -620,14 +628,31 @@ _return:
return
code
;
}
int32_t
scheduleCancelJob
(
void
*
pRpc
,
void
*
pJob
);
int32_t
scheduleCancelJob
(
void
*
pJob
)
{
//TODO
void
scheduleFreeJob
(
void
*
job
)
{
if
(
NULL
==
job
)
{
return
TSDB_CODE_SUCCESS
;
}
void
scheduleFreeJob
(
void
*
pJob
)
{
if
(
NULL
==
pJob
)
{
return
;
}
//TODO
SQueryJob
*
job
=
pJob
;
if
(
job
->
status
>
0
)
{
if
(
0
!=
taosHashRemove
(
schMgmt
.
Jobs
,
&
job
->
queryId
,
sizeof
(
job
->
queryId
)))
{
qError
(
"remove job:%"
PRIx64
"from mgmt failed"
,
job
->
queryId
);
// maybe already freed
return
;
}
if
(
job
->
status
==
SCH_STATUS_EXECUTING
)
{
scheduleCancelJob
(
pJob
);
}
}
//TODO free job
}
void
schedulerDestroy
(
void
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录