Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cb1318a7
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看板
提交
cb1318a7
编写于
4月 21, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix flag init
上级
2dcb0145
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
28 deletion
+17
-28
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+0
-5
source/dnode/mnode/impl/src/mndDef.c
source/dnode/mnode/impl/src/mndDef.c
+0
-18
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+17
-5
未找到文件。
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
cb1318a7
...
...
@@ -490,11 +490,6 @@ void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer
typedef
struct
{
int32_t
vgId
;
int8_t
subType
;
int8_t
withTbName
;
int8_t
withSchema
;
int8_t
withTag
;
int8_t
withTagSchema
;
char
*
qmsg
;
SEpSet
epSet
;
}
SMqVgEp
;
...
...
source/dnode/mnode/impl/src/mndDef.c
浏览文件 @
cb1318a7
...
...
@@ -148,13 +148,7 @@ SMqVgEp *tCloneSMqVgEp(const SMqVgEp *pVgEp) {
SMqVgEp
*
pVgEpNew
=
taosMemoryMalloc
(
sizeof
(
SMqVgEp
));
if
(
pVgEpNew
==
NULL
)
return
NULL
;
pVgEpNew
->
vgId
=
pVgEp
->
vgId
;
pVgEpNew
->
subType
=
pVgEp
->
subType
;
pVgEpNew
->
withTbName
=
pVgEp
->
withTbName
;
pVgEpNew
->
withSchema
=
pVgEp
->
withSchema
;
pVgEpNew
->
withTag
=
pVgEp
->
withTag
;
pVgEpNew
->
withTagSchema
=
pVgEp
->
withTagSchema
;
pVgEpNew
->
qmsg
=
strdup
(
pVgEp
->
qmsg
);
/*memcpy(pVgEpNew->topic, pVgEp->topic, TSDB_TOPIC_FNAME_LEN);*/
pVgEpNew
->
epSet
=
pVgEp
->
epSet
;
return
pVgEpNew
;
}
...
...
@@ -164,26 +158,14 @@ void tDeleteSMqVgEp(SMqVgEp *pVgEp) { taosMemoryFree(pVgEp->qmsg); }
int32_t
tEncodeSMqVgEp
(
void
**
buf
,
const
SMqVgEp
*
pVgEp
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pVgEp
->
vgId
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pVgEp
->
subType
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pVgEp
->
withTbName
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pVgEp
->
withSchema
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pVgEp
->
withTag
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pVgEp
->
withTagSchema
);
tlen
+=
taosEncodeString
(
buf
,
pVgEp
->
qmsg
);
/*tlen += taosEncodeString(buf, pVgEp->topic);*/
tlen
+=
taosEncodeSEpSet
(
buf
,
&
pVgEp
->
epSet
);
return
tlen
;
}
void
*
tDecodeSMqVgEp
(
const
void
*
buf
,
SMqVgEp
*
pVgEp
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pVgEp
->
vgId
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pVgEp
->
subType
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pVgEp
->
withTbName
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pVgEp
->
withSchema
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pVgEp
->
withTag
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pVgEp
->
withTagSchema
);
buf
=
taosDecodeString
(
buf
,
&
pVgEp
->
qmsg
);
/*buf = taosDecodeStringTo(buf, pVgEp->topic);*/
buf
=
taosDecodeSEpSet
(
buf
,
&
pVgEp
->
epSet
);
return
(
void
*
)
buf
;
}
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
cb1318a7
...
...
@@ -85,6 +85,12 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic,
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
pSub
->
subType
=
pTopic
->
subType
;
pSub
->
withTbName
=
pTopic
->
withTbName
;
pSub
->
withSchema
=
pTopic
->
withSchema
;
pSub
->
withTag
=
pTopic
->
withTag
;
pSub
->
withTagSchema
=
pTopic
->
withTagSchema
;
ASSERT
(
taosHashGetSize
(
pSub
->
consumerHash
)
==
1
);
if
(
mndSchedInitSubEp
(
pMnode
,
pTopic
,
pSub
)
<
0
)
{
...
...
@@ -98,13 +104,19 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic,
return
pSub
;
}
static
int32_t
mndBuildSubChangeReq
(
void
**
pBuf
,
int32_t
*
pLen
,
const
char
*
subKey
,
const
SMqRebOutputVg
*
pRebVg
)
{
static
int32_t
mndBuildSubChangeReq
(
void
**
pBuf
,
int32_t
*
pLen
,
const
SMqSubscribeObj
*
pSub
,
const
SMqRebOutputVg
*
pRebVg
)
{
SMqRebVgReq
req
=
{
0
};
req
.
oldConsumerId
=
pRebVg
->
oldConsumerId
;
req
.
newConsumerId
=
pRebVg
->
newConsumerId
;
req
.
vgId
=
pRebVg
->
pVgEp
->
vgId
;
req
.
qmsg
=
pRebVg
->
pVgEp
->
qmsg
;
strncpy
(
req
.
subKey
,
subKey
,
TSDB_SUBSCRIBE_KEY_LEN
);
req
.
subType
=
pSub
->
subType
;
req
.
withTbName
=
pSub
->
withTbName
;
req
.
withSchema
=
pSub
->
withSchema
;
req
.
withTag
=
pSub
->
withTag
;
req
.
withTagSchema
=
pSub
->
withTagSchema
;
strncpy
(
req
.
subKey
,
pSub
->
key
,
TSDB_SUBSCRIBE_KEY_LEN
);
int32_t
tlen
=
sizeof
(
SMsgHead
)
+
tEncodeSMqRebVgReq
(
NULL
,
&
req
);
void
*
buf
=
taosMemoryMalloc
(
tlen
);
...
...
@@ -125,13 +137,13 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, const char *subK
return
0
;
}
static
int32_t
mndPersistSubChangeVgReq
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
const
char
*
subKey
,
static
int32_t
mndPersistSubChangeVgReq
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
const
SMqSubscribeObj
*
pSub
,
const
SMqRebOutputVg
*
pRebVg
)
{
ASSERT
(
pRebVg
->
oldConsumerId
!=
pRebVg
->
newConsumerId
);
void
*
buf
;
int32_t
tlen
;
if
(
mndBuildSubChangeReq
(
&
buf
,
&
tlen
,
subKey
,
pRebVg
)
<
0
)
{
if
(
mndBuildSubChangeReq
(
&
buf
,
&
tlen
,
pSub
,
pRebVg
)
<
0
)
{
return
-
1
;
}
...
...
@@ -395,7 +407,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SNodeMsg *pMsg, const SMqRebO
int32_t
vgNum
=
taosArrayGetSize
(
rebVgs
);
for
(
int32_t
i
=
0
;
i
<
vgNum
;
i
++
)
{
SMqRebOutputVg
*
pRebVg
=
taosArrayGet
(
rebVgs
,
i
);
if
(
mndPersistSubChangeVgReq
(
pMnode
,
pTrans
,
pOutput
->
pSub
->
key
,
pRebVg
)
<
0
)
{
if
(
mndPersistSubChangeVgReq
(
pMnode
,
pTrans
,
pOutput
->
pSub
,
pRebVg
)
<
0
)
{
goto
REB_FAIL
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录