Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
76738ad2
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看板
提交
76738ad2
编写于
12月 18, 2021
作者:
D
dapan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature scheduler
上级
8dd9cc74
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
51 addition
and
8 deletion
+51
-8
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+1
-1
include/libs/scheduler/scheduler.h
include/libs/scheduler/scheduler.h
+2
-2
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+12
-0
source/libs/scheduler/inc/schedulerInt.h
source/libs/scheduler/inc/schedulerInt.h
+8
-1
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+28
-4
未找到文件。
include/libs/catalog/catalog.h
浏览文件 @
76738ad2
...
...
@@ -137,7 +137,7 @@ int32_t catalogGetTableHashVgroup(struct SCatalog* pCatalog, void *pRpc, const S
int32_t
catalogGetAllMeta
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
SCatalogReq
*
pReq
,
SMetaData
*
pRsp
);
int32_t
catalogGetQnodeList
(
struct
SCatalog
*
pCatalog
,
const
SEpSet
*
pMgmtEps
,
SEpSet
*
pQnodeEpSet
);
int32_t
catalogGetQnodeList
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
SEpSet
*
pQnodeEpSet
);
...
...
include/libs/scheduler/scheduler.h
浏览文件 @
76738ad2
...
...
@@ -23,7 +23,7 @@ extern "C" {
#include "planner.h"
typedef
struct
SSchedulerCfg
{
int32_t
clusterType
;
}
SSchedulerCfg
;
typedef
struct
SQueryProfileSummary
{
...
...
@@ -55,7 +55,7 @@ typedef struct SQueryProfileSummary {
* @param pJob
* @return
*/
int32_t
scheduleQueryJob
(
void
*
pRpc
,
SQueryDag
*
pDag
,
void
**
pJob
);
int32_t
scheduleQueryJob
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
SQueryDag
*
pDag
,
void
**
pJob
);
int32_t
scheduleFetchRows
(
void
*
pRpc
,
void
*
pJob
,
void
*
data
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
76738ad2
...
...
@@ -634,6 +634,18 @@ _return:
CTG_RET
(
code
);
}
int32_t
catalogGetQnodeList
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
SEpSet
*
pQnodeEpSet
)
{
if
(
NULL
==
pCatalog
||
NULL
==
pRpc
||
NULL
==
pMgmtEps
||
NULL
==
pQnodeEpSet
)
{
CTG_ERR_RET
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
pQnodeEpSet
->
inUse
=
0
;
pQnodeEpSet
->
numOfEps
=
0
;
return
TSDB_CODE_SUCCESS
;
}
void
catalogDestroy
(
void
)
{
if
(
ctgMgmt
.
pCluster
)
{
taosHashCleanup
(
ctgMgmt
.
pCluster
);
//TBD
...
...
source/libs/scheduler/inc/schedulerInt.h
浏览文件 @
76738ad2
...
...
@@ -29,6 +29,8 @@ extern "C" {
#define SCHEDULE_DEFAULT_JOB_NUMBER 1000
#define SCHEDULE_DEFAULT_TASK_NUMBER 1000
#define SCHEDULE_MAX_CONDIDATE_EP_NUM 3
enum
{
SCH_STATUS_NOT_START
=
1
,
SCH_STATUS_EXECUTING
,
...
...
@@ -40,6 +42,7 @@ enum {
typedef
struct
SSchedulerMgmt
{
uint64_t
taskId
;
SSchedulerCfg
cfg
;
SHashObj
*
Jobs
;
// key: queryId, value: SQueryJob*
}
SSchedulerMgmt
;
...
...
@@ -69,6 +72,10 @@ typedef struct SQueryJob {
int32_t
levelIdx
;
int8_t
status
;
SQueryProfileSummary
summary
;
SEpSet
dataSrcEps
;
struct
SCatalog
*
catalog
;
void
*
rpc
;
SEpSet
*
mgmtEpSet
;
SHashObj
*
execTasks
;
// executing tasks, key:taskid, value:SQueryTask*
SHashObj
*
succTasks
;
// succeed tasks, key:taskid, value:SQueryTask*
...
...
@@ -78,7 +85,7 @@ typedef struct SQueryJob {
}
SQueryJob
;
#define SCH_TASK_READY_TO_LUNCH(task) ((task)->childReady >= taosArrayGetSize((task)->children)) // MAY NEED TO ENHANCE
#define SCH_IS_DATA_SRC_TASK(task) (task->plan->type == QUERY_TYPE_SCAN)
#define SCH_JOB_ERR_LOG(param, ...) qError("QID:%"PRIx64 param, job->queryId, __VA_ARGS__)
#define SCH_TASK_ERR_LOG(param, ...) qError("QID:%"PRIx64",TID:%"PRIx64 param, job->queryId, task->taskId, __VA_ARGS__)
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
76738ad2
...
...
@@ -16,6 +16,7 @@
#include "schedulerInt.h"
#include "taosmsg.h"
#include "query.h"
#include "catalog.h"
SSchedulerMgmt
schMgmt
=
{
0
};
...
...
@@ -223,8 +224,16 @@ _return:
SCH_RET
(
code
);
}
int32_t
schAvailableEpSet
(
SEpSet
*
epSet
)
{
int32_t
schAvailableEpSet
(
SQueryJob
*
job
,
SEpSet
*
epSet
)
{
SCH_ERR_RET
(
catalogGetQnodeList
(
job
->
catalog
,
job
->
rpc
,
job
->
mgmtEpSet
,
epSet
));
if
(
epSet
->
numOfEps
>
SCHEDULE_MAX_CONDIDATE_EP_NUM
)
{
return
TSDB_CODE_SUCCESS
;
}
//TODO COPY dataSrcEps TO epSet
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -267,6 +276,13 @@ int32_t schProcessOnTaskSuccess(SQueryJob *job, SQueryTask *task) {
return
TSDB_CODE_SUCCESS
;
}
if
(
SCH_IS_DATA_SRC_TASK
(
task
)
&&
job
->
dataSrcEps
.
numOfEps
<
SCHEDULE_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
)
{
SQueryTask
*
par
=
taosArrayGet
(
task
->
parents
,
i
);
...
...
@@ -335,7 +351,7 @@ int32_t schTaskRun(SQueryJob *job, SQueryTask *task) {
SCH_ERR_RET
(
qSubPlanToString
(
plan
,
&
task
->
msg
));
if
(
plan
->
execEpSet
.
numOfEps
<=
0
)
{
SCH_ERR_RET
(
schAvailableEpSet
(
&
plan
->
execEpSet
));
SCH_ERR_RET
(
schAvailableEpSet
(
job
,
&
plan
->
execEpSet
));
}
SCH_ERR_RET
(
schAsyncLaunchTask
(
job
,
task
));
...
...
@@ -362,12 +378,16 @@ int32_t schedulerInit(SSchedulerCfg *cfg) {
SCH_ERR_LRET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
,
"init %d schduler jobs failed"
,
SCHEDULE_DEFAULT_JOB_NUMBER
);
}
if
(
cfg
)
{
schMgmt
.
cfg
=
*
cfg
;
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
scheduleQueryJob
(
void
*
pRpc
,
SQueryDag
*
pDag
,
void
**
pJob
)
{
if
(
NULL
==
pDag
||
NULL
==
pDag
->
pSubplans
||
NULL
==
pJob
)
{
int32_t
scheduleQueryJob
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
SQueryDag
*
pDag
,
void
**
pJob
)
{
if
(
NULL
==
p
Catalog
||
NULL
==
pRpc
||
NULL
==
pMgmtEps
||
NULL
==
p
Dag
||
NULL
==
pDag
->
pSubplans
||
NULL
==
pJob
)
{
SCH_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
...
...
@@ -377,6 +397,10 @@ int32_t scheduleQueryJob(void *pRpc, SQueryDag* pDag, void** pJob) {
SCH_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
job
->
catalog
=
pCatalog
;
job
->
rpc
=
pRpc
;
job
->
mgmtEpSet
=
pMgmtEps
;
SCH_ERR_JRET
(
schValidateAndBuildJob
(
pDag
,
job
));
job
->
execTasks
=
taosHashInit
(
pDag
->
numOfSubplans
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_ENTRY_LOCK
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录