Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dfb7ed06
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看板
未验证
提交
dfb7ed06
编写于
3月 07, 2022
作者:
L
Liu Jicong
提交者:
GitHub
3月 07, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10586 from taosdata/feature/tq
add scheduler
上级
2f792722
402a5e3b
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
141 addition
and
6 deletion
+141
-6
include/dnode/snode/snode.h
include/dnode/snode/snode.h
+4
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+3
-0
source/dnode/mnode/impl/inc/mndScheduler.h
source/dnode/mnode/impl/inc/mndScheduler.h
+34
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+10
-3
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+73
-0
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+10
-0
source/dnode/snode/src/snode.c
source/dnode/snode/src/snode.c
+2
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+4
-1
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+1
-0
未找到文件。
include/dnode/snode/snode.h
浏览文件 @
dfb7ed06
...
...
@@ -16,6 +16,9 @@
#ifndef _TD_SNODE_H_
#define _TD_SNODE_H_
#include "tmsg.h"
#include "trpc.h"
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
@@ -88,4 +91,4 @@ void sndDestroy(const char *path);
}
#endif
#endif
/*_TD_SNODE_H_*/
\ No newline at end of file
#endif
/*_TD_SNODE_H_*/
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
dfb7ed06
...
...
@@ -661,6 +661,9 @@ static FORCE_INLINE void* tDecodeSMqConsumerObj(void* buf, SMqConsumerObj* pCons
return
buf
;
}
typedef
struct
{
}
SStreamScheduler
;
typedef
struct
SMnodeMsg
{
char
user
[
TSDB_USER_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
...
...
source/dnode/mnode/impl/inc/mndScheduler.h
0 → 100644
浏览文件 @
dfb7ed06
/*
* 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_MND_SCHEDULER_H_
#define _TD_MND_SCHEDULER_H_
#include "mndInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int32_t
mndInitScheduler
(
SMnode
*
pMnode
);
void
mndCleanupScheduler
(
SMnode
*
pMnode
);
int32_t
mndSchedInitSubEp
(
SMnode
*
pMnode
,
const
SMqTopicObj
*
pTopic
,
SMqSubscribeObj
*
pSub
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MND_SCHEDULER_H_ */
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
dfb7ed06
...
...
@@ -340,9 +340,16 @@ static int32_t mndProcessStatusReq(SMnodeMsg *pReq) {
pVgroup
->
compStorage
=
pVload
->
compStorage
;
pVgroup
->
pointsWritten
=
pVload
->
pointsWritten
;
}
bool
roleChanged
=
false
;
for
(
int32_t
vg
=
0
;
vg
<
pVgroup
->
replica
;
++
vg
)
{
if
(
pVgroup
->
vnodeGid
[
vg
].
role
!=
pVload
->
role
)
{
roleChanged
=
true
;
}
pVgroup
->
vnodeGid
[
vg
].
role
=
pVload
->
role
;
}
if
(
roleChanged
)
{
// notify scheduler role has changed
}
}
mndReleaseVgroup
(
pMnode
,
pVgroup
);
...
...
@@ -631,13 +638,13 @@ static int32_t mndGetConfigMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp
pShow
->
bytes
[
cols
]
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_CONIIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"value"
);
strcpy
(
pSchema
[
cols
].
name
,
"value"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
...
...
@@ -823,4 +830,4 @@ static int32_t mndRetrieveDnodes(SMnodeMsg *pReq, SShowObj *pShow, char *data, i
static
void
mndCancelGetNextDnode
(
SMnode
*
pMnode
,
void
*
pIter
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbCancelFetch
(
pSdb
,
pIter
);
}
\ No newline at end of file
}
source/dnode/mnode/impl/src/mndScheduler.c
0 → 100644
浏览文件 @
dfb7ed06
/*
* 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/>.
*/
#include "mndScheduler.h"
#include "mndConsumer.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndMnode.h"
#include "mndOffset.h"
#include "mndShow.h"
#include "mndStb.h"
#include "mndSubscribe.h"
#include "mndTopic.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndVgroup.h"
#include "tcompare.h"
#include "tname.h"
int32_t
mndSchedInitSubEp
(
SMnode
*
pMnode
,
const
SMqTopicObj
*
pTopic
,
SMqSubscribeObj
*
pSub
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SVgObj
*
pVgroup
=
NULL
;
SQueryDag
*
pDag
=
qStringToDag
(
pTopic
->
physicalPlan
);
SArray
*
pAray
=
NULL
;
SArray
*
unassignedVg
=
pSub
->
unassignedVg
;
ASSERT
(
pSub
->
vgNum
==
0
);
int32_t
levelNum
=
taosArrayGetSize
(
pDag
->
pSubplans
);
if
(
levelNum
!=
1
)
{
return
-
1
;
}
SArray
*
inner
=
taosArrayGet
(
pDag
->
pSubplans
,
0
);
SSubplan
*
plan
=
taosArrayGetP
(
inner
,
0
);
void
*
pIter
=
NULL
;
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
if
(
pIter
==
NULL
)
break
;
if
(
pVgroup
->
dbUid
!=
pTopic
->
dbUid
)
{
sdbRelease
(
pSdb
,
pVgroup
);
continue
;
}
pSub
->
vgNum
++
;
plan
->
execNode
.
nodeId
=
pVgroup
->
vgId
;
plan
->
execNode
.
epset
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
SMqConsumerEp
consumerEp
=
{
0
};
consumerEp
.
status
=
0
;
consumerEp
.
consumerId
=
-
1
;
consumerEp
.
epSet
=
plan
->
execNode
.
epset
;
consumerEp
.
vgId
=
plan
->
execNode
.
nodeId
;
int32_t
msgLen
;
int32_t
code
=
qSubPlanToString
(
plan
,
&
consumerEp
.
qmsg
,
&
msgLen
);
taosArrayPush
(
unassignedVg
,
&
consumerEp
);
}
return
0
;
}
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
dfb7ed06
...
...
@@ -20,6 +20,7 @@
#include "mndDnode.h"
#include "mndMnode.h"
#include "mndOffset.h"
#include "mndScheduler.h"
#include "mndShow.h"
#include "mndStb.h"
#include "mndTopic.h"
...
...
@@ -97,12 +98,21 @@ static SMqSubscribeObj *mndCreateSubscription(SMnode *pMnode, const SMqTopicObj
strcpy
(
pSub
->
key
,
key
);
free
(
key
);
if
(
mndSchedInitSubEp
(
pMnode
,
pTopic
,
pSub
)
<
0
)
{
terrno
=
TSDB_CODE_MND_UNSUPPORTED_TOPIC
;
tDeleteSMqSubscribeObj
(
pSub
);
free
(
pSub
);
return
NULL
;
}
#if 0
if (mndInitUnassignedVg(pMnode, pTopic, pSub) < 0) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
tDeleteSMqSubscribeObj(pSub);
free(pSub);
return NULL;
}
#endif
// TODO: disable alter subscribed table
return
pSub
;
}
...
...
source/dnode/snode/src/snode.c
浏览文件 @
dfb7ed06
...
...
@@ -17,6 +17,7 @@
SSnode
*
sndOpen
(
const
char
*
path
,
const
SSnodeOpt
*
pOption
)
{
SSnode
*
pSnode
=
calloc
(
1
,
sizeof
(
SSnode
));
memcpy
(
&
pSnode
->
cfg
,
pOption
,
sizeof
(
SSnodeOpt
));
return
pSnode
;
}
...
...
@@ -29,4 +30,4 @@ int32_t sndProcessMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
return
0
;
}
void
sndDestroy
(
const
char
*
path
)
{}
\ No newline at end of file
void
sndDestroy
(
const
char
*
path
)
{}
source/dnode/vnode/src/tq/tq.c
浏览文件 @
dfb7ed06
...
...
@@ -376,7 +376,10 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg) {
for
(
int
i
=
0
;
i
<
TQ_BUFFER_SIZE
;
i
++
)
{
pTopic
->
buffer
.
output
[
i
].
status
=
0
;
STqReadHandle
*
pReadHandle
=
tqInitSubmitMsgScanner
(
pTq
->
pVnodeMeta
);
SReadHandle
handle
=
{.
reader
=
pReadHandle
,
.
meta
=
pTq
->
pVnodeMeta
};
SReadHandle
handle
=
{
.
reader
=
pReadHandle
,
.
meta
=
pTq
->
pVnodeMeta
,
};
pTopic
->
buffer
.
output
[
i
].
pReadHandle
=
pReadHandle
;
pTopic
->
buffer
.
output
[
i
].
task
=
qCreateStreamExecTaskInfo
(
req
.
qmsg
,
&
handle
);
}
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
dfb7ed06
...
...
@@ -28,6 +28,7 @@ STqReadHandle* tqInitSubmitMsgScanner(SMeta* pMeta) {
pReadHandle
->
sver
=
-
1
;
pReadHandle
->
pSchema
=
NULL
;
pReadHandle
->
pSchemaWrapper
=
NULL
;
pReadHandle
->
tbIdHash
=
NULL
;
return
pReadHandle
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录