Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
876942b4
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
876942b4
编写于
1月 12, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
6677dfba
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
70 addition
and
24 deletion
+70
-24
source/libs/scheduler/inc/schedulerInt.h
source/libs/scheduler/inc/schedulerInt.h
+24
-4
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+25
-20
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+21
-0
未找到文件。
source/libs/scheduler/inc/schedulerInt.h
浏览文件 @
876942b4
...
...
@@ -36,11 +36,31 @@ enum {
SCH_WRITE
,
};
typedef
struct
SSchApiStat
{
}
SSchApiStat
;
typedef
struct
SSchRuntimeStat
{
}
SSchRuntimeStat
;
typedef
struct
SSchJobStat
{
}
SSchJobStat
;
typedef
struct
SSchedulerStat
{
SSchApiStat
api
;
SSchRuntimeStat
runtime
;
SSchJobStat
job
;
}
SSchedulerStat
;
typedef
struct
SSchedulerMgmt
{
uint64_t
taskId
;
// sequential taksId
uint64_t
sId
;
// schedulerId
SSchedulerCfg
cfg
;
SHashObj
*
jobs
;
// key: queryId, value: SQueryJob*
uint64_t
taskId
;
// sequential taksId
uint64_t
sId
;
// schedulerId
SSchedulerCfg
cfg
;
SHashObj
*
jobs
;
// key: queryId, value: SQueryJob*
SSchedulerStat
stat
;
}
SSchedulerMgmt
;
typedef
struct
SSchCallbackParam
{
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
876942b4
...
...
@@ -1462,34 +1462,37 @@ void scheduleFreeJob(void *job) {
}
SSchJob
*
pJob
=
job
;
uint64_t
queryId
=
pJob
->
queryId
;
if
(
0
!=
taosHashRemove
(
schMgmt
.
jobs
,
&
pJob
->
queryId
,
sizeof
(
pJob
->
queryId
)))
{
SCH_JOB_ELOG
(
"taosHashRemove job from list failed, may already freed, pJob:%p"
,
pJob
);
return
;
}
if
(
SCH_GET_JOB_STATUS
(
pJob
)
>
0
)
{
if
(
0
!=
taosHashRemove
(
schMgmt
.
jobs
,
&
pJob
->
queryId
,
sizeof
(
pJob
->
queryId
)))
{
SCH_JOB_ELOG
(
"taosHashRemove job from list failed, may already freed, pJob:%p"
,
pJob
);
return
;
}
schCheckAndUpdateJobStatus
(
pJob
,
JOB_TASK_STATUS_DROPPING
);
schCheckAndUpdateJobStatus
(
pJob
,
JOB_TASK_STATUS_DROPPING
);
SCH_JOB_DLOG
(
"job removed from list, no further ref, ref:%d"
,
atomic_load_32
(
&
pJob
->
ref
));
SCH_JOB_DLOG
(
"job removed from list, no further ref, ref:%d"
,
atomic_load_32
(
&
pJob
->
ref
));
while
(
true
)
{
int32_t
ref
=
atomic_load_32
(
&
pJob
->
ref
);
if
(
0
==
ref
)
{
break
;
}
else
if
(
ref
>
0
)
{
usleep
(
1
);
}
else
{
assert
(
0
);
while
(
true
)
{
int32_t
ref
=
atomic_load_32
(
&
pJob
->
ref
);
if
(
0
==
ref
)
{
break
;
}
else
if
(
ref
>
0
)
{
usleep
(
1
);
}
else
{
assert
(
0
);
}
}
}
SCH_JOB_DLOG
(
"job no ref now, status:%d"
,
SCH_GET_JOB_STATUS
(
pJob
));
SCH_JOB_DLOG
(
"job no ref now, status:%d"
,
SCH_GET_JOB_STATUS
(
pJob
));
if
(
pJob
->
status
==
JOB_TASK_STATUS_EXECUTING
)
{
schCancelJob
(
pJob
);
}
if
(
pJob
->
status
==
JOB_TASK_STATUS_EXECUTING
)
{
schCancelJob
(
pJob
);
}
schDropJobAllTasks
(
pJob
);
schDropJobAllTasks
(
pJob
);
}
pJob
->
subPlans
=
NULL
;
// it is a reference to pDag->pSubplans
...
...
@@ -1515,6 +1518,8 @@ void scheduleFreeJob(void *job) {
tfree
(
pJob
->
res
);
tfree
(
pJob
);
qDebug
(
"QID:%"
PRIx64
" job freed"
,
queryId
);
}
void
schedulerDestroy
(
void
)
{
...
...
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
876942b4
...
...
@@ -79,6 +79,7 @@ void schtBuildQueryDag(SQueryDag *dag) {
scanPlan
->
level
=
1
;
scanPlan
->
pParents
=
taosArrayInit
(
1
,
POINTER_BYTES
);
scanPlan
->
pNode
=
(
SPhyNode
*
)
calloc
(
1
,
sizeof
(
SPhyNode
));
scanPlan
->
msgType
=
TDMT_VND_QUERY
;
mergePlan
->
id
.
queryId
=
qId
;
mergePlan
->
id
.
templateId
=
0x4444444444
;
...
...
@@ -89,6 +90,7 @@ void schtBuildQueryDag(SQueryDag *dag) {
mergePlan
->
pChildren
=
taosArrayInit
(
1
,
POINTER_BYTES
);
mergePlan
->
pParents
=
NULL
;
mergePlan
->
pNode
=
(
SPhyNode
*
)
calloc
(
1
,
sizeof
(
SPhyNode
));
mergePlan
->
msgType
=
TDMT_VND_QUERY
;
SSubplan
*
mergePointer
=
(
SSubplan
*
)
taosArrayPush
(
merge
,
&
mergePlan
);
SSubplan
*
scanPointer
=
(
SSubplan
*
)
taosArrayPush
(
scan
,
&
scanPlan
);
...
...
@@ -163,6 +165,11 @@ void schtExecNode(SSubplan* subplan, uint64_t templateId, SQueryNodeAddr* ep) {
}
void
schtRpcSendRequest
(
void
*
shandle
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
int64_t
*
pRid
)
{
}
void
schtSetPlanToString
()
{
static
Stub
stub
;
...
...
@@ -190,6 +197,20 @@ void schtSetExecNode() {
}
}
void
schtSetRpcSendRequest
()
{
static
Stub
stub
;
stub
.
set
(
rpcSendRequest
,
schtRpcSendRequest
);
{
AddrAny
any
(
"libtransport.so"
);
std
::
map
<
std
::
string
,
void
*>
result
;
any
.
get_global_func_addr_dynsym
(
"^rpcSendRequest$"
,
result
);
for
(
const
auto
&
f
:
result
)
{
stub
.
set
(
f
.
second
,
schtRpcSendRequest
);
}
}
}
void
*
schtSendRsp
(
void
*
param
)
{
SSchJob
*
job
=
NULL
;
int32_t
code
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录