Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
75b1520b
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看板
提交
75b1520b
编写于
8月 01, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(stream): create task update info
上级
e61aa835
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
59 addition
and
2 deletion
+59
-2
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+8
-0
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+35
-2
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+16
-0
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
75b1520b
...
@@ -549,6 +549,14 @@ typedef struct {
...
@@ -549,6 +549,14 @@ typedef struct {
int32_t
tEncodeCompleteHistoryDataMsg
(
SEncoder
*
pEncoder
,
const
SStreamCompleteHistoryMsg
*
pReq
);
int32_t
tEncodeCompleteHistoryDataMsg
(
SEncoder
*
pEncoder
,
const
SStreamCompleteHistoryMsg
*
pReq
);
int32_t
tDecodeCompleteHistoryDataMsg
(
SDecoder
*
pDecoder
,
SStreamCompleteHistoryMsg
*
pReq
);
int32_t
tDecodeCompleteHistoryDataMsg
(
SDecoder
*
pDecoder
,
SStreamCompleteHistoryMsg
*
pReq
);
typedef
struct
{
int32_t
nodeId
;
SEpSet
epset
;
}
SStreamTaskUpdateInfo
;
int32_t
tEncodeTaskUpdateMsg
(
SEncoder
*
pEncoder
,
const
SStreamTaskUpdateInfo
*
pMsg
);
int32_t
tDecodeTaskUpdateMsg
(
SDecoder
*
pDecoder
,
SStreamTaskUpdateInfo
*
pMsg
);
typedef
struct
{
typedef
struct
{
int64_t
streamId
;
int64_t
streamId
;
int32_t
downstreamTaskId
;
int32_t
downstreamTaskId
;
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
75b1520b
...
@@ -1776,7 +1776,7 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
...
@@ -1776,7 +1776,7 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
int32_t
nodeId
=
0
;
int32_t
nodeId
=
0
;
SEpSet
newEpSet
=
{
0
};
SEpSet
newEpSet
=
{
0
};
{
// check all streams that involved this vnode
{
// check all streams that involved this vnode
should update the epset info
SStreamObj
*
pStream
=
NULL
;
SStreamObj
*
pStream
=
NULL
;
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
while
(
1
)
{
...
@@ -1796,7 +1796,7 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
...
@@ -1796,7 +1796,7 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
for
(
int32_t
k
=
0
;
k
<
numOfTasks
;
++
k
)
{
for
(
int32_t
k
=
0
;
k
<
numOfTasks
;
++
k
)
{
SStreamTask
*
pTask
=
taosArrayGetP
(
pLevel
,
k
);
SStreamTask
*
pTask
=
taosArrayGetP
(
pLevel
,
k
);
if
(
pTask
->
info
.
nodeId
==
nodeId
)
{
if
(
pTask
->
info
.
nodeId
==
nodeId
)
{
//pTask->info.epSet = 0; set the new epset
pTask
->
info
.
epSet
=
newEpSet
;
continue
;
continue
;
}
}
...
@@ -1813,6 +1813,39 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
...
@@ -1813,6 +1813,39 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
}
}
}
}
{
// build trans to update the epset
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB_INSIDE
,
NULL
,
"stream-checkpoint"
);
if
(
pTrans
==
NULL
)
{
mError
(
"failed to trigger checkpoint, reason: %s"
,
tstrerror
(
TSDB_CODE_OUT_OF_MEMORY
));
return
-
1
;
}
// mDebug("start to trigger checkpoint, checkpointId: %" PRId64 "", checkpointId);
mndTransSetDbName
(
pTrans
,
"checkpoint"
,
"checkpoint"
);
if
(
mndTransCheckConflict
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"failed to trigger checkpoint, checkpointId: %"
PRId64
", reason:%s"
,
checkpointId
,
tstrerror
(
TSDB_CODE_MND_TRANS_CONFLICT
));
mndTransDrop
(
pTrans
);
return
-
1
;
}
void
*
pBuf
=
NULL
;
int32_t
len
=
0
;
// doBuildStreamTaskUpdateMsg(&pBuf, &len, nodeId, newEpSet);
STransAction
action
=
{
0
};
action
.
epSet
=
/*mndGetVgroupEpset(pMnode, pVgObj)*/
;
action
.
pCont
=
pBuf
;
action
.
contLen
=
len
;
action
.
msgType
=
TDMT_VND_STREAM_CHECK_POINT_SOURCE
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pBuf
);
taosWUnLockLatch
(
&
pStream
->
lock
);
return
-
1
;
}
}
taosWUnLockLatch
(
&
pStream
->
lock
);
taosWUnLockLatch
(
&
pStream
->
lock
);
}
}
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
75b1520b
...
@@ -958,3 +958,19 @@ int32_t streamNotifyUpstreamContinue(SStreamTask* pTask) {
...
@@ -958,3 +958,19 @@ int32_t streamNotifyUpstreamContinue(SStreamTask* pTask) {
num
);
num
);
return
0
;
return
0
;
}
}
int32_t
tEncodeTaskUpdateMsg
(
SEncoder
*
pEncoder
,
const
SStreamTaskUpdateInfo
*
pMsg
)
{
if
(
tStartEncode
(
pEncoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pMsg
->
nodeId
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
pEncoder
,
&
pMsg
->
epset
)
<
0
)
return
-
1
;
tEndEncode
(
pEncoder
);
return
pEncoder
->
pos
;
}
int32_t
tDecodeTaskUpdateMsg
(
SDecoder
*
pDecoder
,
SStreamTaskUpdateInfo
*
pMsg
)
{
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pMsg
->
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pMsg
->
epset
)
<
0
)
return
-
1
;
tEndDecode
(
pDecoder
);
return
0
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录