Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
48cc2702
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看板
提交
48cc2702
编写于
12月 20, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
6377bab3
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
145 addition
and
49 deletion
+145
-49
include/common/taosmsg.h
include/common/taosmsg.h
+5
-0
include/dnode/qnode/qnode.h
include/dnode/qnode/qnode.h
+1
-43
include/libs/qcom/queryWorker.h
include/libs/qcom/queryWorker.h
+50
-0
include/libs/scheduler/scheduler.h
include/libs/scheduler/scheduler.h
+1
-0
source/libs/qcom/inc/qWorkerInt.h
source/libs/qcom/inc/qWorkerInt.h
+37
-0
source/libs/qcom/src/queryWorker.c
source/libs/qcom/src/queryWorker.c
+38
-0
source/libs/scheduler/inc/schedulerInt.h
source/libs/scheduler/inc/schedulerInt.h
+2
-1
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+11
-5
未找到文件。
include/common/taosmsg.h
浏览文件 @
48cc2702
...
...
@@ -1082,6 +1082,7 @@ typedef struct {
}
SUpdateTagValRsp
;
typedef
struct
SSchedulerQueryMsg
{
uint64_t
schedulerId
;
uint64_t
queryId
;
uint64_t
taskId
;
uint32_t
contentLen
;
...
...
@@ -1098,6 +1099,10 @@ typedef struct SSchedulerFetchMsg {
uint64_t
taskId
;
}
SSchedulerFetchMsg
;
typedef
struct
SSchedulerStatusMsg
{
uint64_t
schedulerId
;
}
SSchedulerStatusMsg
;
#pragma pack(pop)
...
...
include/dnode/qnode/qnode.h
浏览文件 @
48cc2702
...
...
@@ -19,7 +19,7 @@
#ifdef __cplusplus
extern
"C"
{
#endif
#include "trpc.h"
typedef
struct
{
uint64_t
numOfStartTask
;
...
...
@@ -32,48 +32,6 @@ typedef struct {
uint64_t
numOfErrors
;
}
SQnodeStat
;
/* start Task msg */
typedef
struct
{
uint32_t
schedulerIp
;
uint16_t
schedulerPort
;
int64_t
taskId
;
int64_t
queryId
;
uint32_t
srcIp
;
uint16_t
srcPort
;
}
SQnodeStartTaskMsg
;
/* stop Task msg */
typedef
struct
{
int64_t
taskId
;
}
SQnodeStopTaskMsg
;
/* start/stop Task msg response */
typedef
struct
{
int64_t
taskId
;
int32_t
code
;
}
SQnodeTaskRespMsg
;
/* Task status msg */
typedef
struct
{
int64_t
taskId
;
int32_t
status
;
int64_t
queryId
;
}
SQnodeTaskStatusMsg
;
/* Qnode/Scheduler heartbeat msg */
typedef
struct
{
int32_t
status
;
int32_t
load
;
}
SQnodeHeartbeatMsg
;
/* Qnode sent/received msg */
typedef
struct
{
int8_t
msgType
;
int32_t
msgLen
;
char
msg
[];
}
SQnodeMsg
;
/**
* Start one Qnode in Dnode.
...
...
include/libs/qcom/queryWorker.h
0 → 100644
浏览文件 @
48cc2702
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_QUERY_WORKER_H_
#define _TD_QUERY_WORKER_H_
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
SQWorkerCfg
{
uint32_t
maxSchedulerNum
;
uint32_t
maxResCacheNum
;
}
SQWorkerCfg
;
typedef
struct
{
uint64_t
numOfStartTask
;
uint64_t
numOfStopTask
;
uint64_t
numOfRecvedFetch
;
uint64_t
numOfSentHb
;
uint64_t
numOfSentFetch
;
uint64_t
numOfTaskInQueue
;
uint64_t
numOfFetchInQueue
;
uint64_t
numOfErrors
;
}
SQWorkerStat
;
int32_t
qWorkerInit
(
SQWorkerCfg
*
cfg
);
int32_t
qWorkerProcessQueryMsg
(
char
*
msg
,
int32_t
msgLen
,
int32_t
*
code
,
char
**
rspMsg
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_QUERY_WORKER_H_*/
include/libs/scheduler/scheduler.h
浏览文件 @
48cc2702
...
...
@@ -25,6 +25,7 @@ extern "C" {
typedef
struct
SSchedulerCfg
{
int32_t
clusterType
;
int32_t
maxJobNum
;
}
SSchedulerCfg
;
typedef
struct
SQueryProfileSummary
{
...
...
source/libs/qcom/inc/qWorkerInt.h
0 → 100644
浏览文件 @
48cc2702
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_QWORKER_INT_H_
#define _TD_QWORKER_INT_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#define QWORKER_DEFAULT_SCHEDULER_NUMBER 10000
#define QWORKER_DEFAULT_RES_CACHE_NUMBER 10000
typedef
struct
SQWorkerMgmt
{
SQWorkerCfg
cfg
;
SHashObj
*
scheduleHash
;
//key: schedulerId, value:
SHashObj
*
resHash
;
//key: queryId+taskId, value:
}
SQWorkerMgmt
;
#ifdef __cplusplus
}
#endif
#endif
/*_TD_QWORKER_INT_H_*/
source/libs/qcom/src/queryWorker.c
0 → 100644
浏览文件 @
48cc2702
#include "queryInt.h"
#include "query.h"
#include "taosmsg.h"
#include "queryWorker.h"
#include "qWorkerInt.h"
SQWorkerMgmt
qWorkerMgmt
=
{
0
};
int32_t
qWorkerInit
(
SQWorkerCfg
*
cfg
)
{
if
(
cfg
)
{
qWorkerMgmt
.
cfg
=
*
cfg
;
}
else
{
qWorkerMgmt
.
cfg
.
maxSchedulerNum
=
QWORKER_DEFAULT_SCHEDULER_NUMBER
;
qWorkerMgmt
.
cfg
.
maxResCacheNum
=
QWORKER_DEFAULT_RES_CACHE_NUMBER
;
}
qWorkerMgmt
.
scheduleHash
=
taosHashInit
(
qWorkerMgmt
.
cfg
.
maxSchedulerNum
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_ENTRY_LOCK
);
if
(
NULL
==
qWorkerMgmt
.
scheduleHash
)
{
SCH_ERR_LRET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
,
"init %d schduler hash failed"
,
qWorkerMgmt
.
cfg
.
maxSchedulerNum
);
}
qWorkerMgmt
.
resHash
=
taosHashInit
(
qWorkerMgmt
.
cfg
.
maxResCacheNum
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_ENTRY_LOCK
);
if
(
NULL
==
qWorkerMgmt
.
resHash
)
{
taosHashCleanup
(
qWorkerMgmt
.
scheduleHash
);
qWorkerMgmt
.
scheduleHash
=
NULL
;
SCH_ERR_LRET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
,
"init %d res cache hash failed"
,
qWorkerMgmt
.
cfg
.
maxResCacheNum
);
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
qWorkerProcessQueryMsg
(
SSchedulerQueryMsg
*
msg
,
int32_t
msgLen
,
int32_t
*
code
,
char
**
rspMsg
)
{
// TODO
return
0
;
}
source/libs/scheduler/inc/schedulerInt.h
浏览文件 @
48cc2702
...
...
@@ -41,7 +41,8 @@ enum {
};
typedef
struct
SSchedulerMgmt
{
uint64_t
taskId
;
uint64_t
taskId
;
uint64_t
schedulerId
;
SSchedulerCfg
cfg
;
SHashObj
*
Jobs
;
// key: queryId, value: SQueryJob*
}
SSchedulerMgmt
;
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
48cc2702
...
...
@@ -291,6 +291,8 @@ int32_t schAsyncSendMsg(SQueryJob *job, SQueryTask *task, int32_t msgType) {
}
SSchedulerQueryMsg
*
pMsg
=
msg
;
pMsg
->
schedulerId
=
schMgmt
.
schedulerId
;
pMsg
->
queryId
=
job
->
queryId
;
pMsg
->
taskId
=
task
->
taskId
;
pMsg
->
contentLen
=
len
;
...
...
@@ -535,15 +537,19 @@ int32_t schLaunchJob(SQueryJob *job) {
int32_t
schedulerInit
(
SSchedulerCfg
*
cfg
)
{
schMgmt
.
Jobs
=
taosHashInit
(
SCHEDULE_DEFAULT_JOB_NUMBER
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_ENTRY_LOCK
);
if
(
NULL
==
schMgmt
.
Jobs
)
{
SCH_ERR_LRET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
,
"init %d schduler jobs failed"
,
SCHEDULE_DEFAULT_JOB_NUMBER
);
}
if
(
cfg
)
{
schMgmt
.
cfg
=
*
cfg
;
}
else
{
schMgmt
.
cfg
.
maxJobNum
=
SCHEDULE_DEFAULT_JOB_NUMBER
;
}
schMgmt
.
Jobs
=
taosHashInit
(
schMgmt
.
cfg
.
maxJobNum
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_ENTRY_LOCK
);
if
(
NULL
==
schMgmt
.
Jobs
)
{
SCH_ERR_LRET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
,
"init %d schduler jobs failed"
,
schMgmt
.
cfg
.
maxJobNum
);
}
schMgmt
.
schedulerId
=
1
;
//TODO GENERATE A UUID
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录