Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
379cdc05
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
You need to sign in or sign up before continuing.
未验证
提交
379cdc05
编写于
8月 09, 2022
作者:
L
Liu Jicong
提交者:
GitHub
8月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15889 from taosdata/feature/stream
fix(stream): memory error
上级
0a5329d5
d9a4ea30
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
63 addition
and
36 deletion
+63
-36
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+20
-12
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+17
-11
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+4
-4
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+2
-0
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+5
-2
source/libs/stream/src/streamRecover.c
source/libs/stream/src/streamRecover.c
+14
-6
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
379cdc05
...
...
@@ -42,8 +42,8 @@ enum {
TASK_STATUS__DROPPING
,
TASK_STATUS__FAIL
,
TASK_STATUS__STOP
,
TASK_STATUS__
PREPARE_RECOVER
,
TASK_STATUS__RECOVER
ING
,
TASK_STATUS__
RECOVER_DOWNSTREAM
,
TASK_STATUS__RECOVER
_SELF
,
};
enum
{
...
...
@@ -232,8 +232,8 @@ typedef struct {
}
SStreamChildEpInfo
;
typedef
struct
{
int32_t
n
odeId
;
int32_t
c
hildId
;
int32_t
srcN
odeId
;
int32_t
srcC
hildId
;
int64_t
stateSaveVer
;
int64_t
stateProcessedVer
;
}
SStreamCheckpointInfo
;
...
...
@@ -394,9 +394,6 @@ typedef struct {
int32_t
upstreamTaskId
;
int32_t
upstreamChildId
;
int32_t
upstreamNodeId
;
#if 0
int64_t sourceVer;
#endif
int32_t
blockNum
;
SArray
*
dataLen
;
// SArray<int32_t>
SArray
*
data
;
// SArray<SRetrieveTableRsp*>
...
...
@@ -426,6 +423,7 @@ typedef struct {
int32_t
rspToTaskId
;
}
SStreamRetrieveRsp
;
#if 0
typedef struct {
int64_t streamId;
int32_t taskId;
...
...
@@ -462,13 +460,25 @@ int32_t tDecodeSMStreamTaskRecoverReq(SDecoder* pDecoder, SMStreamTaskRecoverReq
int32_t tEncodeSMStreamTaskRecoverRsp(SEncoder* pEncoder, const SMStreamTaskRecoverRsp* pRsp);
int32_t tDecodeSMStreamTaskRecoverRsp(SDecoder* pDecoder, SMStreamTaskRecoverRsp* pRsp);
int32_t streamProcessRecoverReq(SStreamTask* pTask, SStreamTaskRecoverReq* pReq, SRpcMsg* pMsg);
int32_t streamProcessRecoverRsp(SStreamTask* pTask, SStreamTaskRecoverRsp* pRsp);
#endif
typedef
struct
{
int64_t
streamId
;
}
SPStreamTaskRecoverReq
;
int32_t
downstreamTaskId
;
int32_t
taskId
;
}
SStreamRecoverDownstreamReq
;
typedef
struct
{
int8_t
reserved
;
}
SPStreamTaskRecoverRsp
;
int64_t
streamId
;
int32_t
downstreamTaskId
;
int32_t
taskId
;
SArray
*
checkpointVer
;
// SArray<SStreamCheckpointInfo>
}
SStreamRecoverDownstreamRsp
;
int32_t
tEncodeSStreamTaskRecoverReq
(
SEncoder
*
pEncoder
,
const
SStreamRecoverDownstreamReq
*
pReq
);
int32_t
tDecodeSStreamTaskRecoverRsp
(
SDecoder
*
pDecoder
,
const
SStreamRecoverDownstreamRsp
*
pRsp
);
int32_t
tDecodeStreamDispatchReq
(
SDecoder
*
pDecoder
,
SStreamDispatchReq
*
pReq
);
int32_t
tDecodeStreamRetrieveReq
(
SDecoder
*
pDecoder
,
SStreamRetrieveReq
*
pReq
);
...
...
@@ -479,8 +489,6 @@ int32_t streamSetupTrigger(SStreamTask* pTask);
int32_t
streamProcessRunReq
(
SStreamTask
*
pTask
);
int32_t
streamProcessDispatchReq
(
SStreamTask
*
pTask
,
SStreamDispatchReq
*
pReq
,
SRpcMsg
*
pMsg
,
bool
exec
);
int32_t
streamProcessDispatchRsp
(
SStreamTask
*
pTask
,
SStreamDispatchRsp
*
pRsp
);
int32_t
streamProcessRecoverReq
(
SStreamTask
*
pTask
,
SStreamTaskRecoverReq
*
pReq
,
SRpcMsg
*
pMsg
);
int32_t
streamProcessRecoverRsp
(
SStreamTask
*
pTask
,
SStreamTaskRecoverRsp
*
pRsp
);
int32_t
streamProcessRetrieveReq
(
SStreamTask
*
pTask
,
SStreamRetrieveReq
*
pReq
,
SRpcMsg
*
pMsg
);
int32_t
streamProcessRetrieveRsp
(
SStreamTask
*
pTask
,
SStreamRetrieveRsp
*
pRsp
);
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
379cdc05
...
...
@@ -504,6 +504,7 @@ static int32_t mndPersistTaskDropReq(STrans *pTrans, SStreamTask *pTask) {
return
0
;
}
#if 0
static int32_t mndPersistTaskRecoverReq(STrans *pTrans, SStreamTask *pTask) {
SMStreamTaskRecoverReq *pReq = taosMemoryCalloc(1, sizeof(SMStreamTaskRecoverReq));
if (pReq == NULL) {
...
...
@@ -540,7 +541,6 @@ static int32_t mndPersistTaskRecoverReq(STrans *pTrans, SStreamTask *pTask) {
return 0;
}
#if 0
int32_t mndRecoverStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
if (pStream->isDistributed) {
int32_t lv = taosArrayGetSize(pStream->tasks);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
379cdc05
...
...
@@ -777,6 +777,7 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg, bool exec) {
}
}
#if 0
int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg) {
SStreamTaskRecoverReq* pReq = pMsg->pCont;
int32_t taskId = pReq->taskId;
...
...
@@ -789,25 +790,26 @@ int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg) {
}
}
int32_t
tqProcessTaskDispatchRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
SStreamDispatchRsp
*
pRsp
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
int32_t
taskId
=
pRsp
->
taskId
;
int32_t tqProcessTaskRecoverRsp(STQ* pTq, SRpcMsg* pMsg) {
SStreamTaskRecoverRsp* pRsp = pMsg->pCont;
int32_t taskId = pRsp->rspTaskId;
SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId);
if (pTask) {
streamProcess
Dispatch
Rsp
(
pTask
,
pRsp
);
streamProcess
Recover
Rsp(pTask, pRsp);
return 0;
} else {
return -1;
}
}
#endif
int32_t
tqProcessTaskRecoverRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
SStreamTaskRecoverRsp
*
pRsp
=
pMsg
->
pCont
;
int32_t
taskId
=
pRsp
->
rspTaskId
;
int32_t
tqProcessTaskDispatchRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
SStreamDispatchRsp
*
pRsp
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
int32_t
taskId
=
pRsp
->
taskId
;
SStreamTask
*
pTask
=
streamMetaGetTask
(
pTq
->
pStreamMeta
,
taskId
);
if
(
pTask
)
{
streamProcess
Recover
Rsp
(
pTask
,
pRsp
);
streamProcess
Dispatch
Rsp
(
pTask
,
pRsp
);
return
0
;
}
else
{
return
-
1
;
...
...
@@ -873,6 +875,8 @@ void vnodeEnqueueStreamMsg(SVnode* pVnode, SRpcMsg* pMsg) {
.
code
=
0
,
};
streamProcessDispatchReq
(
pTask
,
&
req
,
&
rsp
,
false
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
return
;
}
...
...
@@ -883,4 +887,6 @@ FAIL:
.
info
=
pMsg
->
info
,
};
tmsgSendRsp
(
&
rsp
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
379cdc05
...
...
@@ -334,14 +334,14 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
case
TDMT_STREAM_TASK_DISPATCH
:
// return tqProcessTaskDispatchReq(pVnode->pTq, pMsg, pInfo->workerId != 0);
return
tqProcessTaskDispatchReq
(
pVnode
->
pTq
,
pMsg
,
true
);
case
TDMT_STREAM_TASK_RECOVER
:
return
tqProcessTaskRecoverReq
(
pVnode
->
pTq
,
pMsg
);
/*case TDMT_STREAM_TASK_RECOVER:*/
/*return tqProcessTaskRecoverReq(pVnode->pTq, pMsg);*/
case
TDMT_STREAM_RETRIEVE
:
return
tqProcessTaskRetrieveReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_TASK_DISPATCH_RSP
:
return
tqProcessTaskDispatchRsp
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_TASK_RECOVER_RSP
:
return
tqProcessTaskRecoverRsp
(
pVnode
->
pTq
,
pMsg
);
/*case TDMT_STREAM_TASK_RECOVER_RSP:*/
/*return tqProcessTaskRecoverRsp(pVnode->pTq, pMsg);*/
case
TDMT_STREAM_RETRIEVE_RSP
:
return
tqProcessTaskRetrieveRsp
(
pVnode
->
pTq
,
pMsg
);
default:
...
...
source/libs/stream/src/stream.c
浏览文件 @
379cdc05
...
...
@@ -229,6 +229,7 @@ int32_t streamProcessRunReq(SStreamTask* pTask) {
return
0
;
}
#if 0
int32_t streamProcessRecoverReq(SStreamTask* pTask, SStreamTaskRecoverReq* pReq, SRpcMsg* pRsp) {
void* buf = rpcMallocCont(sizeof(SMsgHead) + sizeof(SStreamTaskRecoverRsp));
((SMsgHead*)buf)->vgId = htonl(pReq->upstreamNodeId);
...
...
@@ -267,6 +268,7 @@ int32_t streamProcessRecoverRsp(SStreamTask* pTask, SStreamTaskRecoverRsp* pRsp)
return 0;
}
#endif
int32_t
streamProcessRetrieveReq
(
SStreamTask
*
pTask
,
SStreamRetrieveReq
*
pReq
,
SRpcMsg
*
pRsp
)
{
qDebug
(
"task %d receive retrieve req from node %d task %d"
,
pTask
->
taskId
,
pReq
->
srcNodeId
,
pReq
->
srcTaskId
);
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
379cdc05
...
...
@@ -200,14 +200,13 @@ int32_t streamExecForAll(SStreamTask* pTask) {
streamTaskExecImpl
(
pTask
,
data
,
pRes
);
qDebug
(
"stream task %d exec end"
,
pTask
->
taskId
);
streamFreeQitem
(
data
);
if
(
taosArrayGetSize
(
pRes
)
!=
0
)
{
SStreamDataBlock
*
qRes
=
taosAllocateQitem
(
sizeof
(
SStreamDataBlock
),
DEF_QITEM
);
if
(
qRes
==
NULL
)
{
// TODO log failed ver
streamQueueProcessFail
(
pTask
->
inputQueue
);
taosArrayDestroy
(
pRes
);
streamFreeQitem
(
data
);
return
-
1
;
}
qRes
->
type
=
STREAM_INPUT__DATA_BLOCK
;
...
...
@@ -224,10 +223,14 @@ int32_t streamExecForAll(SStreamTask* pTask) {
/*streamQueueProcessFail(pTask->inputQueue);*/
taosArrayDestroyEx
(
pRes
,
(
FDelete
)
blockDataFreeRes
);
taosFreeQitem
(
qRes
);
streamFreeQitem
(
data
);
return
-
1
;
}
/*streamQueueProcessSuccess(pTask->inputQueue);*/
}
else
{
taosArrayDestroy
(
pRes
);
}
streamFreeQitem
(
data
);
}
return
0
;
}
...
...
source/libs/stream/src/streamRecover.c
浏览文件 @
379cdc05
...
...
@@ -15,6 +15,7 @@
#include "streamInc.h"
#if 0
int32_t tEncodeStreamTaskRecoverReq(SEncoder* pEncoder, const SStreamTaskRecoverReq* pReq) {
if (tStartEncode(pEncoder) < 0) return -1;
if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
...
...
@@ -86,17 +87,18 @@ int32_t tDecodeSMStreamTaskRecoverRsp(SDecoder* pDecoder, SMStreamTaskRecoverRsp
tEndDecode(pDecoder);
return 0;
}
#endif
int32_t
tEncodeSStreamCheckpointInfo
(
SEncoder
*
pEncoder
,
const
SStreamCheckpointInfo
*
pCheckpoint
)
{
if
(
tEncodeI32
(
pEncoder
,
pCheckpoint
->
n
odeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pCheckpoint
->
c
hildId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pCheckpoint
->
srcN
odeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pCheckpoint
->
srcC
hildId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pCheckpoint
->
stateProcessedVer
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
tDecodeSStreamCheckpointInfo
(
SDecoder
*
pDecoder
,
SStreamCheckpointInfo
*
pCheckpoint
)
{
if
(
tDecodeI32
(
pDecoder
,
&
pCheckpoint
->
n
odeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pCheckpoint
->
c
hildId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pCheckpoint
->
srcN
odeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pCheckpoint
->
srcC
hildId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pCheckpoint
->
stateProcessedVer
)
<
0
)
return
-
1
;
return
0
;
}
...
...
@@ -221,11 +223,17 @@ int32_t streamSaveAggLevel(SStreamMeta* pMeta, SStreamTask* pTask) {
return
0
;
}
int32_t
streamFetchSinkStatus
(
SStreamTask
*
pTask
)
{
ASSERT
(
pTask
->
taskLevel
!=
TASK_LEVEL__SINK
);
int32_t
streamFetchDownstreamStatus
(
SStreamTask
*
pTask
)
{
// set self status to recover_phase1
// build fetch status msg
// send fetch msg
atomic_store_8
(
&
pTask
->
taskStatus
,
TASK_STATUS__RECOVER_DOWNSTREAM
);
if
(
pTask
->
outputType
==
TASK_OUTPUT__FIXED_DISPATCH
)
{
}
else
if
(
pTask
->
outputType
==
TASK_OUTPUT__SHUFFLE_DISPATCH
)
{
}
else
{
ASSERT
(
0
);
}
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录