Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c2aebfa3
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看板
提交
c2aebfa3
编写于
7月 13, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: add stream queue to vnode
上级
8e7b494b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
51 addition
and
2 deletion
+51
-2
include/common/tglobal.h
include/common/tglobal.h
+1
-0
include/common/tmsgcb.h
include/common/tmsgcb.h
+1
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+6
-0
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
+3
-0
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+1
-0
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+38
-1
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+1
-1
未找到文件。
include/common/tglobal.h
浏览文件 @
c2aebfa3
...
...
@@ -64,6 +64,7 @@ extern int32_t tsNumOfMnodeQueryThreads;
extern
int32_t
tsNumOfMnodeFetchThreads
;
extern
int32_t
tsNumOfMnodeReadThreads
;
extern
int32_t
tsNumOfVnodeQueryThreads
;
extern
int32_t
tsNumOfVnodeStreamThreads
;
extern
int32_t
tsNumOfVnodeFetchThreads
;
extern
int32_t
tsNumOfVnodeWriteThreads
;
extern
int32_t
tsNumOfVnodeSyncThreads
;
...
...
include/common/tmsgcb.h
浏览文件 @
c2aebfa3
...
...
@@ -34,6 +34,7 @@ typedef enum {
WRITE_QUEUE
,
APPLY_QUEUE
,
SYNC_QUEUE
,
STREAM_QUEUE
,
QUEUE_MAX
,
}
EQueueType
;
...
...
source/common/src/tglobal.c
浏览文件 @
c2aebfa3
...
...
@@ -55,6 +55,7 @@ int32_t tsNumOfMnodeQueryThreads = 2;
int32_t
tsNumOfMnodeFetchThreads
=
1
;
int32_t
tsNumOfMnodeReadThreads
=
1
;
int32_t
tsNumOfVnodeQueryThreads
=
2
;
int32_t
tsNumOfVnodeStreamThreads
=
2
;
int32_t
tsNumOfVnodeFetchThreads
=
4
;
int32_t
tsNumOfVnodeWriteThreads
=
2
;
int32_t
tsNumOfVnodeSyncThreads
=
2
;
...
...
@@ -412,6 +413,10 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
tsNumOfVnodeQueryThreads
=
TMAX
(
tsNumOfVnodeQueryThreads
,
2
);
if
(
cfgAddInt32
(
pCfg
,
"numOfVnodeQueryThreads"
,
tsNumOfVnodeQueryThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfVnodeStreamThreads
=
tsNumOfCores
/
4
;
tsNumOfVnodeStreamThreads
=
TMAX
(
tsNumOfVnodeStreamThreads
,
4
);
if
(
cfgAddInt32
(
pCfg
,
"numOfVnodeStreamThreads"
,
tsNumOfVnodeStreamThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfVnodeFetchThreads
=
tsNumOfCores
/
4
;
tsNumOfVnodeFetchThreads
=
TMAX
(
tsNumOfVnodeFetchThreads
,
4
);
if
(
cfgAddInt32
(
pCfg
,
"numOfVnodeFetchThreads"
,
tsNumOfVnodeFetchThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
...
...
@@ -587,6 +592,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsNumOfMnodeQueryThreads
=
cfgGetItem
(
pCfg
,
"numOfMnodeQueryThreads"
)
->
i32
;
tsNumOfMnodeReadThreads
=
cfgGetItem
(
pCfg
,
"numOfMnodeReadThreads"
)
->
i32
;
tsNumOfVnodeQueryThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeQueryThreads"
)
->
i32
;
tsNumOfVnodeStreamThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeStreamThreads"
)
->
i32
;
tsNumOfVnodeFetchThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeFetchThreads"
)
->
i32
;
tsNumOfVnodeWriteThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeWriteThreads"
)
->
i32
;
tsNumOfVnodeSyncThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeSyncThreads"
)
->
i32
;
...
...
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
浏览文件 @
c2aebfa3
...
...
@@ -31,6 +31,7 @@ typedef struct SVnodeMgmt {
const
char
*
path
;
const
char
*
name
;
SQWorkerPool
queryPool
;
SQWorkerPool
streamPool
;
SWWorkerPool
fetchPool
;
SWWorkerPool
syncPool
;
SWWorkerPool
writePool
;
...
...
@@ -61,6 +62,7 @@ typedef struct {
STaosQueue
*
pSyncQ
;
STaosQueue
*
pApplyQ
;
STaosQueue
*
pQueryQ
;
STaosQueue
*
pStreamQ
;
STaosQueue
*
pFetchQ
;
}
SVnodeObj
;
...
...
@@ -105,6 +107,7 @@ int32_t vmPutMsgToWriteQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t
vmPutMsgToSyncQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToQueryQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToFetchQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToStreamQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToMergeQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToMgmtQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToMonitorQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
浏览文件 @
c2aebfa3
...
...
@@ -92,6 +92,7 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
while
(
!
taosQueueEmpty
(
pVnode
->
pApplyQ
))
taosMsleep
(
10
);
while
(
!
taosQueueEmpty
(
pVnode
->
pQueryQ
))
taosMsleep
(
10
);
while
(
!
taosQueueEmpty
(
pVnode
->
pFetchQ
))
taosMsleep
(
10
);
while
(
!
taosQueueEmpty
(
pVnode
->
pStreamQ
))
taosMsleep
(
10
);
dTrace
(
"vgId:%d, vnode queue is empty"
,
pVnode
->
vgId
);
vmFreeQueue
(
pMgmt
,
pVnode
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
c2aebfa3
...
...
@@ -81,6 +81,23 @@ static void vmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
taosFreeQitem
(
pMsg
);
}
static
void
vmProcessStreamQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
dGTrace
(
"vgId:%d, msg:%p get from vnode-stream queue"
,
pVnode
->
vgId
,
pMsg
);
int32_t
code
=
vnodeProcessFetchMsg
(
pVnode
->
pImpl
,
pMsg
,
pInfo
);
if
(
code
!=
0
)
{
if
(
terrno
!=
0
)
code
=
terrno
;
dGError
(
"vgId:%d, msg:%p failed to stream since %s"
,
pVnode
->
vgId
,
pMsg
,
terrstr
());
vmSendRsp
(
pMsg
,
code
);
}
dGTrace
(
"vgId:%d, msg:%p is freed, code:0x%x"
,
pVnode
->
vgId
,
pMsg
,
code
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
static
void
vmProcessFetchQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SRpcMsg
*
pMsg
=
NULL
;
...
...
@@ -140,6 +157,10 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
dGTrace
(
"vgId:%d, msg:%p put into vnode-query queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pQueryQ
,
pMsg
);
break
;
case
STREAM_QUEUE
:
dGTrace
(
"vgId:%d, msg:%p put into vnode-stream queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pStreamQ
,
pMsg
);
break
;
case
FETCH_QUEUE
:
dGTrace
(
"vgId:%d, msg:%p put into vnode-fetch queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pFetchQ
,
pMsg
);
...
...
@@ -174,6 +195,8 @@ int32_t vmPutMsgToQueryQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return vmPutMsg
int32_t
vmPutMsgToFetchQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
vmPutMsgToQueue
(
pMgmt
,
pMsg
,
FETCH_QUEUE
);
}
int32_t
vmPutMsgToStreamQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
vmPutMsgToQueue
(
pMgmt
,
pMsg
,
STREAM_QUEUE
);
}
int32_t
vmPutMsgToMgmtQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
dGTrace
(
"msg:%p, put into vnode-mgmt queue"
,
pMsg
);
...
...
@@ -234,6 +257,9 @@ int32_t vmGetQueueSize(SVnodeMgmt *pMgmt, int32_t vgId, EQueueType qtype) {
case
FETCH_QUEUE
:
size
=
taosQueueItemSize
(
pVnode
->
pFetchQ
);
break
;
case
STREAM_QUEUE
:
size
=
taosQueueItemSize
(
pVnode
->
pStreamQ
);
break
;
default:
break
;
}
...
...
@@ -247,10 +273,11 @@ int32_t vmAllocQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
pVnode
->
pSyncQ
=
tWWorkerAllocQueue
(
&
pMgmt
->
syncPool
,
pVnode
,
(
FItems
)
vmProcessSyncQueue
);
pVnode
->
pApplyQ
=
tWWorkerAllocQueue
(
&
pMgmt
->
applyPool
,
pVnode
->
pImpl
,
(
FItems
)
vnodeApplyWriteMsg
);
pVnode
->
pQueryQ
=
tQWorkerAllocQueue
(
&
pMgmt
->
queryPool
,
pVnode
,
(
FItem
)
vmProcessQueryQueue
);
pVnode
->
pStreamQ
=
tQWorkerAllocQueue
(
&
pMgmt
->
streamPool
,
pVnode
,
(
FItem
)
vmProcessStreamQueue
);
pVnode
->
pFetchQ
=
tWWorkerAllocQueue
(
&
pMgmt
->
fetchPool
,
pVnode
,
(
FItems
)
vmProcessFetchQueue
);
if
(
pVnode
->
pWriteQ
==
NULL
||
pVnode
->
pSyncQ
==
NULL
||
pVnode
->
pApplyQ
==
NULL
||
pVnode
->
pQueryQ
==
NULL
||
pVnode
->
pFetchQ
==
NULL
)
{
pVnode
->
p
StreamQ
==
NULL
||
pVnode
->
p
FetchQ
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
...
...
@@ -259,6 +286,7 @@ int32_t vmAllocQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
dDebug
(
"vgId:%d, sync-queue:%p is alloced"
,
pVnode
->
vgId
,
pVnode
->
pSyncQ
);
dDebug
(
"vgId:%d, apply-queue:%p is alloced"
,
pVnode
->
vgId
,
pVnode
->
pApplyQ
);
dDebug
(
"vgId:%d, query-queue:%p is alloced"
,
pVnode
->
vgId
,
pVnode
->
pQueryQ
);
dDebug
(
"vgId:%d, stream-queue:%p is alloced"
,
pVnode
->
vgId
,
pVnode
->
pStreamQ
);
dDebug
(
"vgId:%d, fetch-queue:%p is alloced"
,
pVnode
->
vgId
,
pVnode
->
pFetchQ
);
return
0
;
}
...
...
@@ -268,11 +296,13 @@ void vmFreeQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
tWWorkerFreeQueue
(
&
pMgmt
->
applyPool
,
pVnode
->
pApplyQ
);
tWWorkerFreeQueue
(
&
pMgmt
->
syncPool
,
pVnode
->
pSyncQ
);
tQWorkerFreeQueue
(
&
pMgmt
->
queryPool
,
pVnode
->
pQueryQ
);
tQWorkerFreeQueue
(
&
pMgmt
->
streamPool
,
pVnode
->
pStreamQ
);
tWWorkerFreeQueue
(
&
pMgmt
->
fetchPool
,
pVnode
->
pFetchQ
);
pVnode
->
pWriteQ
=
NULL
;
pVnode
->
pSyncQ
=
NULL
;
pVnode
->
pApplyQ
=
NULL
;
pVnode
->
pQueryQ
=
NULL
;
pVnode
->
pStreamQ
=
NULL
;
pVnode
->
pFetchQ
=
NULL
;
dDebug
(
"vgId:%d, queue is freed"
,
pVnode
->
vgId
);
}
...
...
@@ -284,6 +314,12 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) {
pQPool
->
max
=
tsNumOfVnodeQueryThreads
;
if
(
tQWorkerInit
(
pQPool
)
!=
0
)
return
-
1
;
SQWorkerPool
*
pStreamPool
=
&
pMgmt
->
streamPool
;
pStreamPool
->
name
=
"vnode-stream"
;
pStreamPool
->
min
=
tsNumOfVnodeStreamThreads
;
pStreamPool
->
max
=
tsNumOfVnodeStreamThreads
;
if
(
tQWorkerInit
(
pStreamPool
)
!=
0
)
return
-
1
;
SWWorkerPool
*
pFPool
=
&
pMgmt
->
fetchPool
;
pFPool
->
name
=
"vnode-fetch"
;
pFPool
->
max
=
tsNumOfVnodeFetchThreads
;
...
...
@@ -333,6 +369,7 @@ void vmStopWorker(SVnodeMgmt *pMgmt) {
tWWorkerCleanup
(
&
pMgmt
->
applyPool
);
tWWorkerCleanup
(
&
pMgmt
->
syncPool
);
tQWorkerCleanup
(
&
pMgmt
->
queryPool
);
tQWorkerCleanup
(
&
pMgmt
->
streamPool
);
tWWorkerCleanup
(
&
pMgmt
->
fetchPool
);
dDebug
(
"vnode workers are closed"
);
}
source/libs/stream/src/stream.c
浏览文件 @
c2aebfa3
...
...
@@ -97,7 +97,7 @@ int32_t streamLaunchByWrite(SStreamTask* pTask, int32_t vgId) {
.
pCont
=
pRunReq
,
.
contLen
=
sizeof
(
SStreamTaskRunReq
),
};
tmsgPutToQueue
(
pTask
->
pMsgCb
,
FETCH
_QUEUE
,
&
msg
);
tmsgPutToQueue
(
pTask
->
pMsgCb
,
STREAM
_QUEUE
,
&
msg
);
}
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录