Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
36d4ef0a
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
36d4ef0a
编写于
3月 14, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor stream worker
上级
00c5307d
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
118 addition
and
17 deletion
+118
-17
include/common/tmsg.h
include/common/tmsg.h
+11
-0
include/dnode/snode/snode.h
include/dnode/snode/snode.h
+4
-0
source/dnode/mgmt/impl/inc/dndEnv.h
source/dnode/mgmt/impl/inc/dndEnv.h
+4
-2
source/dnode/mgmt/impl/inc/dndInt.h
source/dnode/mgmt/impl/inc/dndInt.h
+1
-1
source/dnode/mgmt/impl/src/dndSnode.c
source/dnode/mgmt/impl/src/dndSnode.c
+82
-10
source/dnode/mgmt/impl/src/dndWorker.c
source/dnode/mgmt/impl/src/dndWorker.c
+1
-1
source/dnode/snode/src/snode.c
source/dnode/snode/src/snode.c
+12
-0
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+2
-2
source/util/src/tworker.c
source/util/src/tworker.c
+1
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
36d4ef0a
...
...
@@ -1118,6 +1118,17 @@ int32_t tSerializeSCMCreateStreamReq(void* buf, int32_t bufLen, const SCMCreateS
int32_t
tDeserializeSCMCreateStreamReq
(
void
*
buf
,
int32_t
bufLen
,
SCMCreateStreamReq
*
pReq
);
void
tFreeSCMCreateStreamReq
(
SCMCreateStreamReq
*
pReq
);
typedef
struct
{
char
name
[
TSDB_TOPIC_FNAME_LEN
];
int64_t
streamId
;
char
*
sql
;
char
*
executorMsg
;
}
SMVCreateStreamReq
,
SMSCreateStreamReq
;
typedef
struct
{
int64_t
streamId
;
}
SMVCreateStreamRsp
,
SMSCreateStreamRsp
;
typedef
struct
{
char
name
[
TSDB_TOPIC_FNAME_LEN
];
int8_t
igExists
;
...
...
include/dnode/snode/snode.h
浏览文件 @
36d4ef0a
...
...
@@ -80,6 +80,10 @@ int32_t sndGetLoad(SSnode *pSnode, SSnodeLoad *pLoad);
*/
int32_t
sndProcessMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
);
int32_t
sndProcessUMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
);
int32_t
sndProcessSMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
);
/**
* @brief Drop a snode.
*
...
...
source/dnode/mgmt/impl/inc/dndEnv.h
浏览文件 @
36d4ef0a
...
...
@@ -90,9 +90,11 @@ typedef struct {
int32_t
refCount
;
int8_t
deployed
;
int8_t
dropped
;
int8_t
uniqueWorkerInUse
;
SSnode
*
pSnode
;
SRWLatch
latch
;
SDnodeWorker
writeWorker
;
SArray
*
uniqueWorkers
;
// SArray<SDnodeWorker*>
SDnodeWorker
sharedWorker
;
}
SSnodeMgmt
;
typedef
struct
{
...
...
@@ -153,4 +155,4 @@ int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo);
}
#endif
#endif
/*_TD_DND_ENV_H_*/
\ No newline at end of file
#endif
/*_TD_DND_ENV_H_*/
source/dnode/mgmt/impl/inc/dndInt.h
浏览文件 @
36d4ef0a
...
...
@@ -70,4 +70,4 @@ void dndGetStartup(SDnode *pDnode, SStartupReq *pStartup);
}
#endif
#endif
/*_TD_DND_INT_H_*/
\ No newline at end of file
#endif
/*_TD_DND_INT_H_*/
source/dnode/mgmt/impl/src/dndSnode.c
浏览文件 @
36d4ef0a
...
...
@@ -19,7 +19,20 @@
#include "dndTransport.h"
#include "dndWorker.h"
static
void
dndProcessSnodeQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
typedef
struct
{
int32_t
vgId
;
int32_t
refCount
;
int32_t
snVersion
;
int8_t
dropped
;
char
*
path
;
SSnode
*
pImpl
;
STaosQueue
*
pSharedQ
;
STaosQueue
*
pUniqueQ
;
}
SSnodeObj
;
static
void
dndProcessSnodeSharedQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
static
void
dndProcessSnodeUniqueQueue
(
SDnode
*
pDnode
,
STaosQall
*
qall
,
int32_t
numOfMsgs
);
static
SSnode
*
dndAcquireSnode
(
SDnode
*
pDnode
)
{
SSnodeMgmt
*
pMgmt
=
&
pDnode
->
smgmt
;
...
...
@@ -152,8 +165,18 @@ static int32_t dndWriteSnodeFile(SDnode *pDnode) {
static
int32_t
dndStartSnodeWorker
(
SDnode
*
pDnode
)
{
SSnodeMgmt
*
pMgmt
=
&
pDnode
->
smgmt
;
if
(
dndInitWorker
(
pDnode
,
&
pMgmt
->
writeWorker
,
DND_WORKER_SINGLE
,
"snode-write"
,
0
,
1
,
dndProcessSnodeQueue
)
!=
0
)
{
dError
(
"failed to start snode write worker since %s"
,
terrstr
());
pMgmt
->
uniqueWorkers
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
for
(
int32_t
i
=
0
;
i
<
2
;
i
++
)
{
SDnodeWorker
uniqueWorker
;
if
(
dndInitWorker
(
pDnode
,
&
uniqueWorker
,
DND_WORKER_MULTI
,
"snode-unique"
,
1
,
1
,
dndProcessSnodeSharedQueue
)
!=
0
)
{
dError
(
"failed to start snode unique worker since %s"
,
terrstr
());
return
-
1
;
}
taosArrayPush
(
pMgmt
->
uniqueWorkers
,
&
uniqueWorker
);
}
if
(
dndInitWorker
(
pDnode
,
&
pMgmt
->
sharedWorker
,
DND_WORKER_SINGLE
,
"snode-shared"
,
4
,
4
,
dndProcessSnodeSharedQueue
))
{
dError
(
"failed to start snode shared worker since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -169,9 +192,13 @@ static void dndStopSnodeWorker(SDnode *pDnode) {
while
(
pMgmt
->
refCount
>
0
)
{
taosMsleep
(
10
);
}
}
dndCleanupWorker
(
&
pMgmt
->
writeWorker
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pMgmt
->
uniqueWorkers
);
i
++
)
{
SDnodeWorker
*
worker
=
taosArrayGetP
(
pMgmt
->
uniqueWorkers
,
i
);
dndCleanupWorker
(
worker
);
}
taosArrayDestroy
(
pMgmt
->
uniqueWorkers
);
}
static
void
dndBuildSnodeOption
(
SDnode
*
pDnode
,
SSnodeOpt
*
pOption
)
{
...
...
@@ -292,17 +319,36 @@ int32_t dndProcessDropSnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
}
static
void
dndProcessSnode
Queue
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
static
void
dndProcessSnode
UniqueQueue
(
SDnode
*
pDnode
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SSnodeMgmt
*
pMgmt
=
&
pDnode
->
smgmt
;
SRpcMsg
*
pRsp
=
NULL
;
int32_t
code
=
TSDB_CODE_DND_SNODE_NOT_DEPLOYED
;
SSnode
*
pSnode
=
dndAcquireSnode
(
pDnode
);
if
(
pSnode
!=
NULL
)
{
code
=
sndProcessMsg
(
pSnode
,
pMsg
,
&
pRsp
);
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
SRpcMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
sndProcessUMsg
(
pSnode
,
pMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
}
dndReleaseSnode
(
pDnode
,
pSnode
);
}
static
void
dndProcessSnodeSharedQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
&
pDnode
->
smgmt
;
int32_t
code
=
TSDB_CODE_DND_SNODE_NOT_DEPLOYED
;
SSnode
*
pSnode
=
dndAcquireSnode
(
pDnode
);
if
(
pSnode
!=
NULL
)
{
code
=
sndProcessSMsg
(
pSnode
,
pMsg
);
}
dndReleaseSnode
(
pDnode
,
pSnode
);
#if 0
if (pMsg->msgType & 1u) {
if (pRsp != NULL) {
pRsp->ahandle = pMsg->ahandle;
...
...
@@ -314,11 +360,32 @@ static void dndProcessSnodeQueue(SDnode *pDnode, SRpcMsg *pMsg) {
rpcSendResponse(&rpcRsp);
}
}
#endif
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
static
void
dndWriteSnodeMsgToRandomWorker
(
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
);
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
dndWriteSnodeMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SRpcMsg
*
pMsg
)
{
int32_t
code
=
TSDB_CODE_DND_SNODE_NOT_DEPLOYED
;
...
...
@@ -337,8 +404,13 @@ static void dndWriteSnodeMsgToWorker(SDnode *pDnode, SDnodeWorker *pWorker, SRpc
}
}
void
dndProcessSnodeWriteMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
dndWriteSnodeMsgToWorker
(
pDnode
,
&
pDnode
->
smgmt
.
writeWorker
,
pMsg
);
void
dndProcessSnodeUniqueMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
// judge from msg to write to unique queue
dndWriteSnodeMsgToRandomWorker
(
pDnode
,
pMsg
);
}
void
dndProcessSnodeSharedMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
dndWriteSnodeMsgToWorker
(
pDnode
,
&
pDnode
->
smgmt
.
sharedWorker
,
pMsg
);
}
int32_t
dndInitSnode
(
SDnode
*
pDnode
)
{
...
...
source/dnode/mgmt/impl/src/dndWorker.c
浏览文件 @
36d4ef0a
...
...
@@ -109,4 +109,4 @@ int32_t dndWriteMsgToWorker(SDnodeWorker *pWorker, void *pCont, int32_t contLen)
}
return
0
;
}
\ No newline at end of file
}
source/dnode/snode/src/snode.c
浏览文件 @
36d4ef0a
...
...
@@ -31,3 +31,15 @@ int32_t sndProcessMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
}
void
sndDestroy
(
const
char
*
path
)
{}
int32_t
sndProcessUMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
// stream deployment
// stream stop/resume
// operator exec
return
0
;
}
int32_t
sndProcessSMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
// operator exec
return
0
;
}
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
36d4ef0a
...
...
@@ -83,8 +83,8 @@ bool tqNextDataBlock(STqReadHandle* pHandle) {
}
int
tqRetrieveDataBlockInfo
(
STqReadHandle
*
pHandle
,
SDataBlockInfo
*
pBlockInfo
)
{
/
*int32_t sversion = pHandle->pBlock->sversion;*/
/*SSchemaWrapper* pSchema = metaGetTableSchema(pHandle->pMeta, pHandle->pBlock->uid, sversion, false);*/
/
/ currently only rows are used
pBlockInfo
->
numOfCols
=
taosArrayGetSize
(
pHandle
->
pColIdList
);
pBlockInfo
->
rows
=
pHandle
->
pBlock
->
numOfRows
;
pBlockInfo
->
uid
=
pHandle
->
pBlock
->
uid
;
...
...
source/util/src/tworker.c
浏览文件 @
36d4ef0a
...
...
@@ -188,7 +188,7 @@ void tFWorkerFreeQueue(SFWorkerPool *pool, STaosQueue *queue) { tQWorkerFreeQueu
int32_t
tWWorkerInit
(
SWWorkerPool
*
pool
)
{
pool
->
nextId
=
0
;
pool
->
workers
=
calloc
(
sizeof
(
SWWorker
),
pool
->
max
);
pool
->
workers
=
calloc
(
pool
->
max
,
sizeof
(
SWWorker
)
);
if
(
pool
->
workers
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录