Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2bcc1394
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看板
提交
2bcc1394
编写于
3月 15, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add stream msg routing
上级
6044c751
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
18 deletion
+54
-18
include/common/tmsg.h
include/common/tmsg.h
+4
-1
include/dnode/snode/snode.h
include/dnode/snode/snode.h
+3
-0
source/dnode/mgmt/impl/src/dndSnode.c
source/dnode/mgmt/impl/src/dndSnode.c
+37
-8
source/dnode/snode/inc/sndInt.h
source/dnode/snode/inc/sndInt.h
+10
-9
未找到文件。
include/common/tmsg.h
浏览文件 @
2bcc1394
...
...
@@ -187,7 +187,10 @@ typedef struct SEp {
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
union
{
int32_t
vgId
;
int32_t
streamTaskId
;
};
}
SMsgHead
;
// Submit message for one table
...
...
include/dnode/snode/snode.h
浏览文件 @
2bcc1394
...
...
@@ -23,6 +23,9 @@
extern
"C"
{
#endif
#define SND_UNIQUE_THREAD_NUM 2
#define SND_SHARED_THREAD_NUM 2
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef
struct
SDnode
SDnode
;
typedef
struct
SSnode
SSnode
;
...
...
source/dnode/mgmt/impl/src/dndSnode.c
浏览文件 @
2bcc1394
...
...
@@ -166,7 +166,7 @@ static int32_t dndWriteSnodeFile(SDnode *pDnode) {
static
int32_t
dndStartSnodeWorker
(
SDnode
*
pDnode
)
{
SSnodeMgmt
*
pMgmt
=
&
pDnode
->
smgmt
;
pMgmt
->
uniqueWorkers
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
for
(
int32_t
i
=
0
;
i
<
2
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
SND_UNIQUE_THREAD_NUM
;
i
++
)
{
SDnodeWorker
*
pUniqueWorker
=
malloc
(
sizeof
(
SDnodeWorker
));
if
(
pUniqueWorker
==
NULL
)
{
return
-
1
;
...
...
@@ -177,8 +177,8 @@ static int32_t dndStartSnodeWorker(SDnode *pDnode) {
}
taosArrayPush
(
pMgmt
->
uniqueWorkers
,
&
pUniqueWorker
);
}
if
(
dndInitWorker
(
pDnode
,
&
pMgmt
->
sharedWorker
,
DND_WORKER_SINGLE
,
"snode-shared"
,
4
,
4
,
dndProcessSnodeSharedQueue
))
{
if
(
dndInitWorker
(
pDnode
,
&
pMgmt
->
sharedWorker
,
DND_WORKER_SINGLE
,
"snode-shared"
,
SND_SHARED_THREAD_NUM
,
SND_SHARED_THREAD_NUM
,
dndProcessSnodeSharedQueue
))
{
dError
(
"failed to start snode shared worker since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -369,13 +369,39 @@ static void dndProcessSnodeSharedQueue(SDnode *pDnode, SRpcMsg *pMsg) {
taosFreeQitem
(
pMsg
);
}
static
void
dndWriteSnodeMsgToRandomWorker
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
static
FORCE_INLINE
int32_t
dndGetSWIdFromMsg
(
SRpcMsg
*
pMsg
)
{
SMsgHead
*
pHead
=
pMsg
->
pCont
;
pHead
->
streamTaskId
=
htonl
(
pHead
->
streamTaskId
);
return
pHead
->
streamTaskId
%
SND_UNIQUE_THREAD_NUM
;
}
static
void
dndWriteSnodeMsgToWorkerByMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
int32_t
code
=
TSDB_CODE_DND_SNODE_NOT_DEPLOYED
;
SSnode
*
pSnode
=
dndAcquireSnode
(
pDnode
);
if
(
pSnode
!=
NULL
)
{
int32_t
index
=
dndGetSWIdFromMsg
(
pMsg
);
SDnodeWorker
*
pWorker
=
taosArrayGetP
(
pDnode
->
smgmt
.
uniqueWorkers
,
index
);
code
=
dndWriteMsgToWorker
(
pWorker
,
pMsg
,
sizeof
(
SRpcMsg
));
}
dndReleaseSnode
(
pDnode
,
pSnode
);
if
(
code
!=
0
)
{
if
(
pMsg
->
msgType
&
1u
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
handle
,
.
ahandle
=
pMsg
->
ahandle
,
.
code
=
code
};
rpcSendResponse
(
&
rsp
);
}
rpcFreeCont
(
pMsg
->
pCont
);
}
}
static
void
dndWriteSnodeMsgToMgmtWorker
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
int32_t
code
=
TSDB_CODE_DND_SNODE_NOT_DEPLOYED
;
SSnode
*
pSnode
=
dndAcquireSnode
(
pDnode
);
if
(
pSnode
!=
NULL
)
{
int32_t
index
=
(
pDnode
->
smgmt
.
uniqueWorkerInUse
+
1
)
%
taosArrayGetSize
(
pDnode
->
smgmt
.
uniqueWorkers
);
SDnodeWorker
*
pWorker
=
taosArrayGet
(
pDnode
->
smgmt
.
uniqueWorkers
,
index
);
SDnodeWorker
*
pWorker
=
taosArrayGet
(
pDnode
->
smgmt
.
uniqueWorkers
,
0
);
code
=
dndWriteMsgToWorker
(
pWorker
,
pMsg
,
sizeof
(
SRpcMsg
));
}
dndReleaseSnode
(
pDnode
,
pSnode
);
...
...
@@ -407,9 +433,12 @@ static void dndWriteSnodeMsgToWorker(SDnode *pDnode, SDnodeWorker *pWorker, SRpc
}
}
void
dndProcessSnodeMgmtMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
dndWriteSnodeMsgToMgmtWorker
(
pDnode
,
pMsg
);
}
void
dndProcessSnodeUniqueMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
// judge from msg to write to unique queue
dndWriteSnodeMsgToRandomWorker
(
pDnode
,
pMsg
);
dndWriteSnodeMsgToWorkerByMsg
(
pDnode
,
pMsg
);
}
void
dndProcessSnodeSharedMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
...
...
source/dnode/snode/inc/sndInt.h
浏览文件 @
2bcc1394
...
...
@@ -30,21 +30,26 @@ extern "C" {
#endif
enum
{
STREAM_STATUS__R
EADY
=
1
,
STREAM_STATUS__R
UNNING
=
1
,
STREAM_STATUS__STOPPED
,
STREAM_STATUS__CREATING
,
STREAM_STATUS__STOPING
,
STREAM_STATUS__RES
UM
ING
,
STREAM_STATUS__RES
TOR
ING
,
STREAM_STATUS__DELETING
,
};
enum
{
STREAM_
RUNNER
__RUNNING
=
1
,
STREAM_
RUNNER
__STOP
,
STREAM_
TASK_STATUS
__RUNNING
=
1
,
STREAM_
TASK_STATUS
__STOP
,
};
typedef
struct
{
SHashObj
*
pHash
;
// taskId -> streamTask
}
SStreamMeta
;
typedef
struct
SSnode
{
SSnodeOpt
cfg
;
SStreamMeta
*
pMeta
;
SSnodeOpt
cfg
;
}
SSnode
;
typedef
struct
{
...
...
@@ -62,10 +67,6 @@ typedef struct {
// storage handle
}
SStreamRunner
;
typedef
struct
{
SHashObj
*
pHash
;
}
SStreamMeta
;
int32_t
sndCreateStream
();
int32_t
sndDropStream
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录