Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
90687bae
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
90687bae
编写于
5月 19, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor.
上级
d8525123
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
24 deletion
+19
-24
source/libs/stream/inc/streamInc.h
source/libs/stream/inc/streamInc.h
+1
-1
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+14
-21
source/libs/stream/src/streamData.c
source/libs/stream/src/streamData.c
+2
-1
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+1
-1
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+1
-0
未找到文件。
source/libs/stream/inc/streamInc.h
浏览文件 @
90687bae
...
...
@@ -34,7 +34,7 @@ typedef struct {
static
SStreamGlobalEnv
streamEnv
;
int32_t
streamDispatch
(
SStreamTask
*
pTask
);
int32_t
stream
DispatchReq
ToData
(
const
SStreamDispatchReq
*
pReq
,
SStreamDataBlock
*
pData
);
int32_t
stream
ConvertDispatchMsg
ToData
(
const
SStreamDispatchReq
*
pReq
,
SStreamDataBlock
*
pData
);
int32_t
streamRetrieveReqToData
(
const
SStreamRetrieveReq
*
pReq
,
SStreamDataBlock
*
pData
);
int32_t
streamDispatchAllBlocks
(
SStreamTask
*
pTask
,
const
SStreamDataBlock
*
data
);
...
...
source/libs/stream/src/stream.c
浏览文件 @
90687bae
...
...
@@ -121,24 +121,22 @@ int32_t streamSchedExec(SStreamTask* pTask) {
int32_t
streamTaskEnqueueBlocks
(
SStreamTask
*
pTask
,
const
SStreamDispatchReq
*
pReq
,
SRpcMsg
*
pRsp
)
{
SStreamDataBlock
*
pData
=
taosAllocateQitem
(
sizeof
(
SStreamDataBlock
),
DEF_QITEM
,
0
);
int8_t
status
;
// enqueue data block
if
(
pData
!=
NULL
)
{
int8_t
status
=
0
;
if
(
pData
==
NULL
)
{
streamTaskInputFail
(
pTask
);
status
=
TASK_INPUT_STATUS__FAILED
;
qDebug
(
"vgId:%d, s-task:%s failed to received dispatch msg, reason: out of memory"
,
pTask
->
pMeta
->
vgId
,
pTask
->
id
.
idStr
);
}
else
{
pData
->
type
=
STREAM_INPUT__DATA_BLOCK
;
pData
->
srcVgId
=
pReq
->
dataSrcVgId
;
// decode
/*pData->blocks = pReq->data;*/
/*pBlock->sourceVer = pReq->sourceVer;*/
streamDispatchReqToData
(
pReq
,
pData
);
streamConvertDispatchMsgToData
(
pReq
,
pData
);
if
(
tAppendDataToInputQueue
(
pTask
,
(
SStreamQueueItem
*
)
pData
)
==
0
)
{
status
=
TASK_INPUT_STATUS__NORMAL
;
}
else
{
// input queue is full, upstream is blocked now
status
=
TASK_INPUT_STATUS__BLOCKED
;
}
}
else
{
streamTaskInputFail
(
pTask
);
status
=
TASK_INPUT_STATUS__FAILED
;
}
// rsp by input status
...
...
@@ -219,7 +217,7 @@ int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBlock* pBlock) {
}
int32_t
streamProcessDispatchReq
(
SStreamTask
*
pTask
,
SStreamDispatchReq
*
pReq
,
SRpcMsg
*
pRsp
,
bool
exec
)
{
qDebug
(
"s-task:%s receive dispatch msg from taskId:
%d
(vgId:%d)"
,
pTask
->
id
.
idStr
,
pReq
->
upstreamTaskId
,
qDebug
(
"s-task:%s receive dispatch msg from taskId:
0x%x
(vgId:%d)"
,
pTask
->
id
.
idStr
,
pReq
->
upstreamTaskId
,
pReq
->
upstreamNodeId
);
// todo add the input queue buffer limitation
...
...
@@ -294,16 +292,13 @@ int32_t tAppendDataToInputQueue(SStreamTask* pTask, SStreamQueueItem* pItem) {
double
size
=
QUEUE_MEM_SIZE_IN_MB
(
pTask
->
inputQueue
->
queue
);
if
(
type
==
STREAM_INPUT__DATA_SUBMIT
)
{
int32_t
numOfBlocks
=
taosQueueItemSize
(
pTask
->
inputQueue
->
queue
)
+
1
;
double
size
=
QUEUE_MEM_SIZE_IN_MB
(
pTask
->
inputQueue
->
queue
);
SStreamDataSubmit
*
px
=
(
SStreamDataSubmit
*
)
pItem
;
qDebug
(
"s-task:%s submit enqueue msgLen:%d ver:%"
PRId64
", total in queue:%d, size:%.2fMiB"
,
pTask
->
id
.
idStr
,
px
->
submit
.
msgLen
,
px
->
submit
.
ver
,
numOfBlocks
,
size
);
px
->
submit
.
msgLen
,
px
->
submit
.
ver
,
total
,
size
);
if
((
pTask
->
taskLevel
==
TASK_LEVEL__SOURCE
)
&&
tInputQueueIsFull
(
pTask
))
{
qError
(
"s-task:%s input queue is full, capacity(size:%d num:%dMiB), current(blocks:%d, size:%.2fMiB) abort"
,
pTask
->
id
.
idStr
,
STREAM_TASK_INPUT_QUEUEU_CAPACITY
,
STREAM_TASK_INPUT_QUEUEU_CAPACITY_IN_SIZE
,
numOfBlocks
,
pTask
->
id
.
idStr
,
STREAM_TASK_INPUT_QUEUEU_CAPACITY
,
STREAM_TASK_INPUT_QUEUEU_CAPACITY_IN_SIZE
,
total
,
size
);
streamDataSubmitDestroy
(
px
);
taosFreeQitem
(
pItem
);
...
...
@@ -312,22 +307,20 @@ int32_t tAppendDataToInputQueue(SStreamTask* pTask, SStreamQueueItem* pItem) {
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
}
else
if
(
type
==
STREAM_INPUT__DATA_BLOCK
||
type
==
STREAM_INPUT__DATA_RETRIEVE
||
type
==
STREAM_INPUT__REF_DATA_BLOCK
)
{
int32_t
numOfBlocks
=
taosQueueItemSize
(
pTask
->
inputQueue
->
queue
)
+
1
;
double
size
=
QUEUE_MEM_SIZE_IN_MB
(
pTask
->
inputQueue
->
queue
);
if
((
pTask
->
taskLevel
==
TASK_LEVEL__SOURCE
)
&&
(
tInputQueueIsFull
(
pTask
)))
{
qError
(
"s-task:%s input queue is full, capacity:%d size:%d MiB, current(blocks:%d, size:%.2fMiB) abort"
,
pTask
->
id
.
idStr
,
STREAM_TASK_INPUT_QUEUEU_CAPACITY
,
STREAM_TASK_INPUT_QUEUEU_CAPACITY_IN_SIZE
,
numOfBlocks
,
pTask
->
id
.
idStr
,
STREAM_TASK_INPUT_QUEUEU_CAPACITY
,
STREAM_TASK_INPUT_QUEUEU_CAPACITY_IN_SIZE
,
total
,
size
);
return
-
1
;
}
qDebug
(
"s-task:%s data block enqueue, total in queue:%d"
,
pTask
->
id
.
idStr
,
numOfBlocks
);
qDebug
(
"s-task:%s data block enqueue, total in queue:%d"
,
pTask
->
id
.
idStr
,
total
);
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
}
else
if
(
type
==
STREAM_INPUT__CHECKPOINT
)
{
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
}
else
if
(
type
==
STREAM_INPUT__GET_RES
)
{
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
qDebug
(
"s-task:%s data block enqueue, current(blocks:%d, size:%.2fMiB)"
,
pTask
->
id
.
idStr
,
total
,
size
);
}
if
(
type
!=
STREAM_INPUT__GET_RES
&&
type
!=
STREAM_INPUT__CHECKPOINT
&&
pTask
->
triggerParam
!=
0
)
{
...
...
source/libs/stream/src/streamData.c
浏览文件 @
90687bae
...
...
@@ -15,7 +15,7 @@
#include "streamInc.h"
int32_t
stream
DispatchReq
ToData
(
const
SStreamDispatchReq
*
pReq
,
SStreamDataBlock
*
pData
)
{
int32_t
stream
ConvertDispatchMsg
ToData
(
const
SStreamDispatchReq
*
pReq
,
SStreamDataBlock
*
pData
)
{
int32_t
blockNum
=
pReq
->
blockNum
;
SArray
*
pArray
=
taosArrayInit_s
(
sizeof
(
SSDataBlock
),
blockNum
);
if
(
pArray
==
NULL
)
{
...
...
@@ -39,6 +39,7 @@ int32_t streamDispatchReqToData(const SStreamDispatchReq* pReq, SStreamDataBlock
pDataBlock
->
info
.
type
=
pRetrieve
->
streamBlockType
;
pDataBlock
->
info
.
childId
=
pReq
->
upstreamChildId
;
}
pData
->
blocks
=
pArray
;
return
0
;
}
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
90687bae
...
...
@@ -320,7 +320,7 @@ int32_t streamDispatchOneDataReq(SStreamTask* pTask, const SStreamDispatchReq* p
msg
.
pCont
=
buf
;
msg
.
msgType
=
pTask
->
dispatchMsgType
;
qDebug
(
"dispatch from s-task:%s to taskId:
%d
vgId:%d data msg"
,
pTask
->
id
.
idStr
,
pReq
->
taskId
,
vgId
);
qDebug
(
"dispatch from s-task:%s to taskId:
0x%x
vgId:%d data msg"
,
pTask
->
id
.
idStr
,
pReq
->
taskId
,
vgId
);
tmsgSendReq
(
pEpSet
,
&
msg
);
code
=
0
;
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
90687bae
...
...
@@ -272,6 +272,7 @@ int32_t streamExecForAll(SStreamTask* pTask) {
if
(
streamTaskShouldPause
(
&
pTask
->
status
))
{
return
0
;
}
SStreamQueueItem
*
qItem
=
streamQueueNextItem
(
pTask
->
inputQueue
);
if
(
qItem
==
NULL
)
{
if
(
pTask
->
taskLevel
==
TASK_LEVEL__SOURCE
&&
batchSize
<
MIN_STREAM_EXEC_BATCH_NUM
&&
times
<
5
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录