Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d74b91af
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看板
提交
d74b91af
编写于
12月 31, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
9462b153
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
73 addition
and
25 deletion
+73
-25
include/common/tmsg.h
include/common/tmsg.h
+3
-0
source/libs/scheduler/inc/schedulerInt.h
source/libs/scheduler/inc/schedulerInt.h
+13
-11
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+57
-14
未找到文件。
include/common/tmsg.h
浏览文件 @
d74b91af
...
...
@@ -1090,6 +1090,7 @@ typedef struct SResFetchMsg {
}
SResFetchMsg
;
typedef
struct
SSchTasksStatusMsg
{
SMsgHead
header
;
uint64_t
sId
;
}
SSchTasksStatusMsg
;
...
...
@@ -1105,6 +1106,7 @@ typedef struct SSchedulerStatusRsp {
}
SSchedulerStatusRsp
;
typedef
struct
STaskCancelMsg
{
SMsgHead
header
;
uint64_t
sId
;
uint64_t
queryId
;
uint64_t
taskId
;
...
...
@@ -1115,6 +1117,7 @@ typedef struct STaskCancelRsp {
}
STaskCancelRsp
;
typedef
struct
STaskDropMsg
{
SMsgHead
header
;
uint64_t
sId
;
uint64_t
queryId
;
uint64_t
taskId
;
...
...
source/libs/scheduler/inc/schedulerInt.h
浏览文件 @
d74b91af
...
...
@@ -60,17 +60,19 @@ typedef struct SSchLevel {
typedef
struct
SSchTask
{
uint64_t
taskId
;
// task id
SSchLevel
*
level
;
// level
SSubplan
*
plan
;
// subplan
char
*
msg
;
// operator tree
int32_t
msgLen
;
// msg length
int8_t
status
;
// task status
SEpAddr
execAddr
;
// task actual executed node address
SQueryProfileSummary
summary
;
// task execution summary
int32_t
childReady
;
// child task ready number
SArray
*
children
;
// the datasource tasks,from which to fetch the result, element is SQueryTask*
SArray
*
parents
;
// the data destination tasks, get data from current task, element is SQueryTask*
uint64_t
taskId
;
// task id
SSchLevel
*
level
;
// level
SSubplan
*
plan
;
// subplan
char
*
msg
;
// operator tree
int32_t
msgLen
;
// msg length
int8_t
status
;
// task status
SQueryNodeAddr
execAddr
;
// task actual executed node address
int8_t
condidateIdx
;
// current try condidation index
SArray
*
condidateAddrs
;
// condidate node addresses, element is SQueryNodeAddr
SQueryProfileSummary
summary
;
// task execution summary
int32_t
childReady
;
// child task ready number
SArray
*
children
;
// the datasource tasks,from which to fetch the result, element is SQueryTask*
SArray
*
parents
;
// the data destination tasks, get data from current task, element is SQueryTask*
}
SSchTask
;
typedef
struct
SSchJobAttr
{
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
d74b91af
...
...
@@ -215,28 +215,49 @@ _return:
SCH_RET
(
code
);
}
int32_t
schSetTask
ExecEpSet
(
SSchJob
*
job
,
SEpSet
*
epSet
)
{
if
(
epSet
->
numOfEps
>=
SCH_MAX_CONDIDATE_EP_NUM
)
{
int32_t
schSetTask
CondidateAddrs
(
SSchJob
*
job
,
SSchTask
*
task
)
{
if
(
task
->
condidateAddrs
)
{
return
TSDB_CODE_SUCCESS
;
}
task
->
condidateIdx
=
0
;
task
->
condidateAddrs
=
taosArrayInit
(
SCH_MAX_CONDIDATE_EP_NUM
,
sizeof
(
SQueryNodeAddr
));
if
(
NULL
==
task
->
condidateAddrs
)
{
qError
(
"taosArrayInit failed"
);
SCH_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
if
(
task
->
plan
->
execNode
.
numOfEps
>
0
)
{
if
(
NULL
==
taosArrayPush
(
task
->
condidateAddrs
,
&
task
->
plan
->
execNode
))
{
qError
(
"taosArrayPush failed"
);
SCH_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
addNum
=
0
;
int32_t
nodeNum
=
taosArrayGetSize
(
job
->
nodeList
);
for
(
int32_t
i
=
0
;
i
<
nodeNum
&&
epSet
->
numOfEps
<
tListLen
(
epSet
->
port
)
;
++
i
)
{
S
EpAddr
*
addr
=
taosArrayGet
(
job
->
nodeList
,
i
);
for
(
int32_t
i
=
0
;
i
<
nodeNum
&&
addNum
<
SCH_MAX_CONDIDATE_EP_NUM
;
++
i
)
{
S
QueryNodeAddr
*
n
addr
=
taosArrayGet
(
job
->
nodeList
,
i
);
strncpy
(
epSet
->
fqdn
[
epSet
->
numOfEps
],
addr
->
fqdn
,
sizeof
(
addr
->
fqdn
));
epSet
->
port
[
epSet
->
numOfEps
]
=
addr
->
port
;
if
(
NULL
==
taosArrayPush
(
task
->
condidateAddrs
,
&
task
->
plan
->
execNode
))
{
qError
(
"taosArrayPush failed"
);
SCH_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
++
epSet
->
numOfEps
;
++
addNum
;
}
for
(
int32_t
i
=
0
;
i
<
job
->
dataSrcEps
.
numOfEps
&&
epSet
->
numOfEps
<
tListLen
(
epSet
->
port
);
++
i
)
{
/*
for (int32_t i = 0; i < job->dataSrcEps.numOfEps && addNum < SCH_MAX_CONDIDATE_EP_NUM; ++i) {
strncpy(epSet->fqdn[epSet->numOfEps], job->dataSrcEps.fqdn[i], sizeof(job->dataSrcEps.fqdn[i]));
epSet->port[epSet->numOfEps] = job->dataSrcEps.port[i];
++epSet->numOfEps;
}
*/
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -394,12 +415,14 @@ int32_t schProcessOnTaskSuccess(SSchJob *job, SSchTask *task) {
return
TSDB_CODE_SUCCESS
;
}
/*
if (SCH_IS_DATA_SRC_TASK(task) && job->dataSrcEps.numOfEps < SCH_MAX_CONDIDATE_EP_NUM) {
strncpy(job->dataSrcEps.fqdn[job->dataSrcEps.numOfEps], task->execAddr.fqdn, sizeof(task->execAddr.fqdn));
job->dataSrcEps.port[job->dataSrcEps.numOfEps] = task->execAddr.port;
++job->dataSrcEps.numOfEps;
}
*/
for
(
int32_t
i
=
0
;
i
<
parentNum
;
++
i
)
{
SSchTask
*
par
=
*
(
SSchTask
**
)
taosArrayGet
(
task
->
parents
,
i
);
...
...
@@ -633,6 +656,16 @@ _return:
SCH_RET
(
code
);
}
void
schConvertAddrToEpSet
(
SQueryNodeAddr
*
addr
,
SEpSet
*
epSet
)
{
epSet
->
inUse
=
addr
->
inUse
;
epSet
->
numOfEps
=
addr
->
numOfEps
;
for
(
int8_t
i
=
0
;
i
<
epSet
->
numOfEps
;
++
i
)
{
strncpy
(
epSet
->
fqdn
[
i
],
addr
->
epAddr
[
i
].
fqdn
,
sizeof
(
addr
->
epAddr
[
i
].
fqdn
));
epSet
->
port
[
i
]
=
addr
->
epAddr
[
i
].
port
;
}
}
int32_t
schBuildAndSendMsg
(
SSchJob
*
job
,
SSchTask
*
task
,
int32_t
msgType
)
{
uint32_t
msgSize
=
0
;
...
...
@@ -665,6 +698,7 @@ int32_t schBuildAndSendMsg(SSchJob *job, SSchTask *task, int32_t msgType) {
SSubQueryMsg
*
pMsg
=
msg
;
pMsg
->
header
.
vgId
=
htonl
(
task
->
plan
->
execNode
.
nodeId
);
pMsg
->
sId
=
htobe64
(
schMgmt
.
sId
);
pMsg
->
queryId
=
htobe64
(
job
->
queryId
);
pMsg
->
taskId
=
htobe64
(
task
->
taskId
);
...
...
@@ -681,6 +715,8 @@ int32_t schBuildAndSendMsg(SSchJob *job, SSchTask *task, int32_t msgType) {
}
SResReadyMsg
*
pMsg
=
msg
;
pMsg
->
header
.
vgId
=
htonl
(
task
->
plan
->
execNode
.
nodeId
);
pMsg
->
sId
=
htobe64
(
schMgmt
.
sId
);
pMsg
->
queryId
=
htobe64
(
job
->
queryId
);
pMsg
->
taskId
=
htobe64
(
task
->
taskId
);
...
...
@@ -698,6 +734,8 @@ int32_t schBuildAndSendMsg(SSchJob *job, SSchTask *task, int32_t msgType) {
}
SResFetchMsg
*
pMsg
=
msg
;
pMsg
->
header
.
vgId
=
htonl
(
task
->
plan
->
execNode
.
nodeId
);
pMsg
->
sId
=
htobe64
(
schMgmt
.
sId
);
pMsg
->
queryId
=
htobe64
(
job
->
queryId
);
pMsg
->
taskId
=
htobe64
(
task
->
taskId
);
...
...
@@ -712,6 +750,8 @@ int32_t schBuildAndSendMsg(SSchJob *job, SSchTask *task, int32_t msgType) {
}
STaskDropMsg
*
pMsg
=
msg
;
pMsg
->
header
.
vgId
=
htonl
(
task
->
plan
->
execNode
.
nodeId
);
pMsg
->
sId
=
htobe64
(
schMgmt
.
sId
);
pMsg
->
queryId
=
htobe64
(
job
->
queryId
);
pMsg
->
taskId
=
htobe64
(
task
->
taskId
);
...
...
@@ -723,7 +763,12 @@ int32_t schBuildAndSendMsg(SSchJob *job, SSchTask *task, int32_t msgType) {
break
;
}
SCH_ERR_JRET
(
schAsyncSendMsg
(
job
->
transport
,
&
task
->
plan
->
execEpSet
,
job
->
queryId
,
task
->
taskId
,
msgType
,
msg
,
msgSize
));
SEpSet
epSet
;
SQueryNodeAddr
*
addr
=
taosArrayGet
(
task
->
condidateAddrs
,
task
->
condidateIdx
);
schConvertAddrToEpSet
(
addr
,
&
epSet
);
SCH_ERR_JRET
(
schAsyncSendMsg
(
job
->
transport
,
&
epSet
,
job
->
queryId
,
task
->
taskId
,
msgType
,
msg
,
msgSize
));
return
TSDB_CODE_SUCCESS
;
...
...
@@ -737,12 +782,10 @@ _return:
int32_t
schLaunchTask
(
SSchJob
*
job
,
SSchTask
*
task
)
{
SSubplan
*
plan
=
task
->
plan
;
SCH_ERR_RET
(
qSubPlanToString
(
plan
,
&
task
->
msg
,
&
task
->
msgLen
));
if
(
plan
->
execEpSet
.
numOfEps
<=
0
)
{
SCH_ERR_RET
(
schSetTaskExecEpSet
(
job
,
&
plan
->
execEpSet
));
}
SCH_ERR_RET
(
schSetTaskCondidateAddrs
(
job
,
task
));
if
(
plan
->
execEpSet
.
numOfEps
<=
0
)
{
SCH_TASK_ERR_LOG
(
"
invalid execEpSet num:%d"
,
plan
->
execEpSet
.
numOfEps
);
if
(
NULL
==
task
->
condidateAddrs
||
taosArrayGetSize
(
task
->
condidateAddrs
)
<=
0
)
{
SCH_TASK_ERR_LOG
(
"
no valid condidate node for task:%"
PRIx64
,
task
->
taskId
);
SCH_ERR_RET
(
TSDB_CODE_SCH_INTERNAL_ERROR
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录