Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ad4c5916
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
ad4c5916
编写于
8月 01, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(stream): update the stream task.
上级
164bfd54
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
55 addition
and
10 deletion
+55
-10
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+1
-0
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+52
-10
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+2
-0
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
ad4c5916
...
@@ -532,6 +532,7 @@ int32_t tDecodeStreamCheckpointReadyMsg(SDecoder* pDecoder, SStreamCheckpointRea
...
@@ -532,6 +532,7 @@ int32_t tDecodeStreamCheckpointReadyMsg(SDecoder* pDecoder, SStreamCheckpointRea
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
SEpSet
epset
;
int32_t
numOfTasks
;
int32_t
numOfTasks
;
}
SStreamHbMsg
;
}
SStreamHbMsg
;
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
ad4c5916
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "mndVgroup.h"
#include "mndVgroup.h"
#include "parser.h"
#include "parser.h"
#include "tname.h"
#include "tname.h"
#include "tmisce.h"
#define MND_STREAM_VER_NUMBER 3
#define MND_STREAM_VER_NUMBER 3
#define MND_STREAM_RESERVE_SIZE 64
#define MND_STREAM_RESERVE_SIZE 64
...
@@ -1783,12 +1784,13 @@ static int32_t createStreamUpdateTrans(SMnode* pMnode, SStreamObj* pStream, int3
...
@@ -1783,12 +1784,13 @@ static int32_t createStreamUpdateTrans(SMnode* pMnode, SStreamObj* pStream, int3
return
-
1
;
return
-
1
;
}
}
mDebug
(
"start to build stream:0x%"
PRIx64
" task DAG update"
,
pStream
->
uid
);
mDebug
(
"start to build stream:0x%"
PRIx64
" task DAG update"
,
pStream
->
uid
);
ASSERT
(
0
);
ASSERT
(
0
);
// mndTransSetDbName(pTrans, "stream-task-update", "checkpoint");
// mndTransSetDbName(pTrans, "stream-task-update", "checkpoint");
if
(
mndTransCheckConflict
(
pMnode
,
pTrans
)
!=
0
)
{
if
(
mndTransCheckConflict
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"failed to build stream:0x%"
PRIx64
" task DAG update, code:%s"
,
pStream
->
uid
,
tstrerror
(
TSDB_CODE_MND_TRANS_CONFLICT
));
mError
(
"failed to build stream:0x%"
PRIx64
" task DAG update, code:%s"
,
pStream
->
uid
,
tstrerror
(
TSDB_CODE_MND_TRANS_CONFLICT
));
mndTransDrop
(
pTrans
);
mndTransDrop
(
pTrans
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1818,7 +1820,6 @@ static int32_t createStreamUpdateTrans(SMnode* pMnode, SStreamObj* pStream, int3
...
@@ -1818,7 +1820,6 @@ static int32_t createStreamUpdateTrans(SMnode* pMnode, SStreamObj* pStream, int3
taosWUnLockLatch
(
&
pStream
->
lock
);
taosWUnLockLatch
(
&
pStream
->
lock
);
return
-
1
;
return
-
1
;
}
}
}
}
}
}
...
@@ -1843,6 +1844,35 @@ static int32_t createStreamUpdateTrans(SMnode* pMnode, SStreamObj* pStream, int3
...
@@ -1843,6 +1844,35 @@ static int32_t createStreamUpdateTrans(SMnode* pMnode, SStreamObj* pStream, int3
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
updateTaskEpInfo
(
SStreamObj
*
pStream
,
int32_t
nodeId
,
SEpSet
*
pEpSet
)
{
int32_t
numOfLevels
=
0
;
for
(
int32_t
j
=
0
;
j
<
numOfLevels
;
++
j
)
{
SArray
*
pLevel
=
taosArrayGetP
(
pStream
->
tasks
,
j
);
int32_t
numOfTasks
=
taosArrayGetSize
(
pLevel
);
for
(
int32_t
k
=
0
;
k
<
numOfTasks
;
++
k
)
{
SStreamTask
*
pTask
=
taosArrayGetP
(
pLevel
,
k
);
if
(
pTask
->
info
.
nodeId
==
nodeId
)
{
pTask
->
info
.
epSet
=
*
pEpSet
;
continue
;
}
// check for the dispath info and the upstream task info
int32_t
level
=
pTask
->
info
.
taskLevel
;
if
(
level
==
TASK_LEVEL__SOURCE
)
{
streamTaskUpdateDownstreamInfo
(
pTask
,
nodeId
,
pEpSet
);
}
else
if
(
level
==
TASK_LEVEL__AGG
)
{
streamTaskUpdateUpstreamInfo
(
pTask
,
nodeId
,
pEpSet
);
streamTaskUpdateDownstreamInfo
(
pTask
,
nodeId
,
pEpSet
);
}
else
{
// TASK_LEVEL__SINK
streamTaskUpdateUpstreamInfo
(
pTask
,
nodeId
,
pEpSet
);
}
}
}
return
0
;
}
// todo: handle the database drop/stream drop case
// todo: handle the database drop/stream drop case
int32_t
mndProcessStreamHb
(
SRpcMsg
*
pReq
)
{
int32_t
mndProcessStreamHb
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
...
@@ -1862,7 +1892,8 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
...
@@ -1862,7 +1892,8 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
int64_t
now
=
taosGetTimestampSec
();
int64_t
now
=
taosGetTimestampSec
();
// only handle the vnode transfer case.
// timeout list
bool
nodeChanged
=
false
;
SArray
*
pList
=
taosArrayInit
(
4
,
sizeof
(
int32_t
));
SArray
*
pList
=
taosArrayInit
(
4
,
sizeof
(
int32_t
));
// record the timeout node
// record the timeout node
...
@@ -1876,13 +1907,25 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
...
@@ -1876,13 +1907,25 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
continue
;
continue
;
}
}
pEntry
->
hbTimestamp
=
now
;
// check epset to identify whether the node has been transferred to other dnodes.
// check epset to identify whether the node has been transferred to other dnodes.
// 1. if the epset is changed
// 1. node the epset is changed, which means the node transfer has occurred for this node.
taosArrayPush
(
pList
,
&
pEntry
);
if
(
!
isEpsetEqual
(
&
pEntry
->
epset
,
&
req
.
epset
))
{
nodeChanged
=
true
;
break
;
}
}
// todo handle the node timeout case.
// handle the node changed case
if
(
!
nodeChanged
)
{
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
nodeId
=
0
;
int32_t
nodeId
=
req
.
vgId
;
SEpSet
newEpSet
=
{
0
}
;
SEpSet
newEpSet
=
req
.
epset
;
{
// check all streams that involved this vnode should update the epset info
{
// check all streams that involved this vnode should update the epset info
SStreamObj
*
pStream
=
NULL
;
SStreamObj
*
pStream
=
NULL
;
...
@@ -1936,7 +1979,6 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
...
@@ -1936,7 +1979,6 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
// }
// }
// }
// }
// mndTransDrop(pTrans);
// mndTransDrop(pTrans);
return
code
;
mTrace
(
"receive stream-meta hb from vgId:%d, active numOfTasks:%d"
,
req
.
vgId
,
req
.
numOfTasks
);
mTrace
(
"receive stream-meta hb from vgId:%d, active numOfTasks:%d"
,
req
.
vgId
,
req
.
numOfTasks
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
ad4c5916
...
@@ -553,6 +553,7 @@ int32_t tEncodeStreamHbMsg(SEncoder* pEncoder, const SStreamHbMsg* pReq) {
...
@@ -553,6 +553,7 @@ int32_t tEncodeStreamHbMsg(SEncoder* pEncoder, const SStreamHbMsg* pReq) {
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
numOfTasks
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
numOfTasks
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
pEncoder
,
&
pReq
->
epset
)
<
0
)
return
-
1
;
tEndEncode
(
pEncoder
);
tEndEncode
(
pEncoder
);
return
pEncoder
->
pos
;
return
pEncoder
->
pos
;
}
}
...
@@ -561,6 +562,7 @@ int32_t tDecodeStreamHbMsg(SDecoder* pDecoder, SStreamHbMsg* pReq) {
...
@@ -561,6 +562,7 @@ int32_t tDecodeStreamHbMsg(SDecoder* pDecoder, SStreamHbMsg* pReq) {
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
numOfTasks
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
numOfTasks
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pReq
->
epset
)
<
0
)
return
-
1
;
tEndDecode
(
pDecoder
);
tEndDecode
(
pDecoder
);
return
0
;
return
0
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录