Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e4ab8f98
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e4ab8f98
编写于
1月 03, 2023
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove assert
上级
9a10242f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
50 deletion
+7
-50
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+7
-50
未找到文件。
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
e4ab8f98
...
@@ -96,26 +96,12 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic,
...
@@ -96,26 +96,12 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic,
pSub
->
subType
=
pTopic
->
subType
;
pSub
->
subType
=
pTopic
->
subType
;
pSub
->
withMeta
=
pTopic
->
withMeta
;
pSub
->
withMeta
=
pTopic
->
withMeta
;
if
(
pSub
->
unassignedVgs
->
size
!=
0
||
taosHashGetSize
(
pSub
->
consumerHash
)
!=
0
)
{
tDeleteSubscribeObj
(
pSub
);
taosMemoryFree
(
pSub
);
terrno
=
TSDB_CODE_MND_INVALID_SUB_OPTION
;
return
NULL
;
}
if
(
mndSchedInitSubEp
(
pMnode
,
pTopic
,
pSub
)
<
0
)
{
if
(
mndSchedInitSubEp
(
pMnode
,
pTopic
,
pSub
)
<
0
)
{
tDeleteSubscribeObj
(
pSub
);
tDeleteSubscribeObj
(
pSub
);
taosMemoryFree
(
pSub
);
taosMemoryFree
(
pSub
);
return
NULL
;
return
NULL
;
}
}
if
(
pSub
->
unassignedVgs
->
size
<=
0
||
taosHashGetSize
(
pSub
->
consumerHash
)
!=
0
)
{
tDeleteSubscribeObj
(
pSub
);
taosMemoryFree
(
pSub
);
terrno
=
TSDB_CODE_MND_INVALID_SUB_OPTION
;
return
NULL
;
}
return
pSub
;
return
pSub
;
}
}
...
@@ -229,24 +215,10 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -229,24 +215,10 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
int32_t
actualRemoved
=
0
;
int32_t
actualRemoved
=
0
;
for
(
int32_t
i
=
0
;
i
<
removedNum
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
removedNum
;
i
++
)
{
int64_t
consumerId
=
*
(
int64_t
*
)
taosArrayGet
(
pInput
->
pRebInfo
->
removedConsumers
,
i
);
int64_t
consumerId
=
*
(
int64_t
*
)
taosArrayGet
(
pInput
->
pRebInfo
->
removedConsumers
,
i
);
if
(
consumerId
<=
0
)
{
mError
(
"sub:%s, mq rebalance cunsumerId:%"
PRId64
" <= 0"
,
sub
,
consumerId
);
continue
;
}
SMqConsumerEp
*
pConsumerEp
=
taosHashGet
(
pOutput
->
pSub
->
consumerHash
,
&
consumerId
,
sizeof
(
int64_t
));
SMqConsumerEp
*
pConsumerEp
=
taosHashGet
(
pOutput
->
pSub
->
consumerHash
,
&
consumerId
,
sizeof
(
int64_t
));
if
(
pConsumerEp
==
NULL
)
{
mError
(
"sub:%s, mq rebalance ep is null, cunsumberId:%"
PRId64
,
sub
,
consumerId
);
continue
;
}
if
(
pConsumerEp
)
{
if
(
pConsumerEp
)
{
if
(
consumerId
!=
pConsumerEp
->
consumerId
)
{
mError
(
"sub:%s, mq rebalance cunsumberId:%"
PRId64
" not matched saved:%"
PRId64
,
sub
,
consumerId
,
pConsumerEp
->
consumerId
);
continue
;
}
actualRemoved
++
;
actualRemoved
++
;
int32_t
consumerVgNum
=
taosArrayGetSize
(
pConsumerEp
->
vgs
);
int32_t
consumerVgNum
=
taosArrayGetSize
(
pConsumerEp
->
vgs
);
for
(
int32_t
j
=
0
;
j
<
consumerVgNum
;
j
++
)
{
for
(
int32_t
j
=
0
;
j
<
consumerVgNum
;
j
++
)
{
...
@@ -305,10 +277,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -305,10 +277,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
pIter
=
taosHashIterate
(
pOutput
->
pSub
->
consumerHash
,
pIter
);
pIter
=
taosHashIterate
(
pOutput
->
pSub
->
consumerHash
,
pIter
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
SMqConsumerEp
*
pConsumerEp
=
(
SMqConsumerEp
*
)
pIter
;
SMqConsumerEp
*
pConsumerEp
=
(
SMqConsumerEp
*
)
pIter
;
if
(
pConsumerEp
->
consumerId
<=
0
)
{
mError
(
"sub:%s, mq rebalance cunsumberId:%"
PRId64
" <= 0"
,
sub
,
pConsumerEp
->
consumerId
);
continue
;
}
int32_t
consumerVgNum
=
taosArrayGetSize
(
pConsumerEp
->
vgs
);
int32_t
consumerVgNum
=
taosArrayGetSize
(
pConsumerEp
->
vgs
);
// all old consumers still existing are touched
// all old consumers still existing are touched
...
@@ -356,10 +324,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -356,10 +324,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
int32_t
consumerNum
=
taosArrayGetSize
(
pInput
->
pRebInfo
->
newConsumers
);
int32_t
consumerNum
=
taosArrayGetSize
(
pInput
->
pRebInfo
->
newConsumers
);
for
(
int32_t
i
=
0
;
i
<
consumerNum
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
consumerNum
;
i
++
)
{
int64_t
consumerId
=
*
(
int64_t
*
)
taosArrayGet
(
pInput
->
pRebInfo
->
newConsumers
,
i
);
int64_t
consumerId
=
*
(
int64_t
*
)
taosArrayGet
(
pInput
->
pRebInfo
->
newConsumers
,
i
);
if
(
consumerId
<=
0
)
{
mError
(
"sub:%s, mq rebalance cunsumberId:%"
PRId64
" <= 0"
,
sub
,
consumerId
);
continue
;
}
SMqConsumerEp
newConsumerEp
;
SMqConsumerEp
newConsumerEp
;
newConsumerEp
.
consumerId
=
consumerId
;
newConsumerEp
.
consumerId
=
consumerId
;
...
@@ -379,10 +343,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -379,10 +343,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
pIter
=
taosHashIterate
(
pOutput
->
pSub
->
consumerHash
,
pIter
);
pIter
=
taosHashIterate
(
pOutput
->
pSub
->
consumerHash
,
pIter
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
SMqConsumerEp
*
pConsumerEp
=
(
SMqConsumerEp
*
)
pIter
;
SMqConsumerEp
*
pConsumerEp
=
(
SMqConsumerEp
*
)
pIter
;
if
(
pConsumerEp
->
consumerId
<=
0
)
{
mError
(
"sub:%s, mq rebalance cunsumberId:%"
PRId64
" <= 0"
,
sub
,
pConsumerEp
->
consumerId
);
continue
;
}
// push until equal minVg
// push until equal minVg
while
(
taosArrayGetSize
(
pConsumerEp
->
vgs
)
<
minVgCnt
)
{
while
(
taosArrayGetSize
(
pConsumerEp
->
vgs
)
<
minVgCnt
)
{
...
@@ -417,10 +377,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -417,10 +377,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
while
(
1
)
{
while
(
1
)
{
pIter
=
taosHashIterate
(
pOutput
->
pSub
->
consumerHash
,
pIter
);
pIter
=
taosHashIterate
(
pOutput
->
pSub
->
consumerHash
,
pIter
);
pConsumerEp
=
(
SMqConsumerEp
*
)
pIter
;
pConsumerEp
=
(
SMqConsumerEp
*
)
pIter
;
if
(
pConsumerEp
==
NULL
||
pConsumerEp
->
consumerId
<=
0
)
{
mError
(
"sub:%s, mq rebalance cunsumberId invalid"
,
sub
);
continue
;
}
if
(
taosArrayGetSize
(
pConsumerEp
->
vgs
)
==
minVgCnt
)
{
if
(
taosArrayGetSize
(
pConsumerEp
->
vgs
)
==
minVgCnt
)
{
break
;
break
;
...
@@ -446,10 +402,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -446,10 +402,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
pIter
=
taosHashIterate
(
pHash
,
pIter
);
pIter
=
taosHashIterate
(
pHash
,
pIter
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
pRebOutput
=
(
SMqRebOutputVg
*
)
pIter
;
pRebOutput
=
(
SMqRebOutputVg
*
)
pIter
;
if
(
pRebOutput
->
newConsumerId
!=
1
)
{
mError
(
"sub:%s, mq rebalance output consumerId:%"
PRId64
" not -1"
,
sub
,
pRebOutput
->
newConsumerId
);
continue
;
}
taosArrayPush
(
pOutput
->
pSub
->
unassignedVgs
,
&
pRebOutput
->
pVgEp
);
taosArrayPush
(
pOutput
->
pSub
->
unassignedVgs
,
&
pRebOutput
->
pVgEp
);
taosArrayPush
(
pOutput
->
rebVgs
,
pRebOutput
);
taosArrayPush
(
pOutput
->
rebVgs
,
pRebOutput
);
...
@@ -534,7 +486,6 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu
...
@@ -534,7 +486,6 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu
consumerNum
=
taosArrayGetSize
(
pOutput
->
newConsumers
);
consumerNum
=
taosArrayGetSize
(
pOutput
->
newConsumers
);
for
(
int32_t
i
=
0
;
i
<
consumerNum
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
consumerNum
;
i
++
)
{
int64_t
consumerId
=
*
(
int64_t
*
)
taosArrayGet
(
pOutput
->
newConsumers
,
i
);
int64_t
consumerId
=
*
(
int64_t
*
)
taosArrayGet
(
pOutput
->
newConsumers
,
i
);
if
(
consumerId
<=
0
)
continue
;
SMqConsumerObj
*
pConsumerOld
=
mndAcquireConsumer
(
pMnode
,
consumerId
);
SMqConsumerObj
*
pConsumerOld
=
mndAcquireConsumer
(
pMnode
,
consumerId
);
SMqConsumerObj
*
pConsumerNew
=
tNewSMqConsumerObj
(
pConsumerOld
->
consumerId
,
pConsumerOld
->
cgroup
);
SMqConsumerObj
*
pConsumerNew
=
tNewSMqConsumerObj
(
pConsumerOld
->
consumerId
,
pConsumerOld
->
cgroup
);
...
@@ -557,7 +508,6 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu
...
@@ -557,7 +508,6 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu
consumerNum
=
taosArrayGetSize
(
pOutput
->
removedConsumers
);
consumerNum
=
taosArrayGetSize
(
pOutput
->
removedConsumers
);
for
(
int32_t
i
=
0
;
i
<
consumerNum
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
consumerNum
;
i
++
)
{
int64_t
consumerId
=
*
(
int64_t
*
)
taosArrayGet
(
pOutput
->
removedConsumers
,
i
);
int64_t
consumerId
=
*
(
int64_t
*
)
taosArrayGet
(
pOutput
->
removedConsumers
,
i
);
if
(
consumerId
<=
0
)
continue
;
SMqConsumerObj
*
pConsumerOld
=
mndAcquireConsumer
(
pMnode
,
consumerId
);
SMqConsumerObj
*
pConsumerOld
=
mndAcquireConsumer
(
pMnode
,
consumerId
);
SMqConsumerObj
*
pConsumerNew
=
tNewSMqConsumerObj
(
pConsumerOld
->
consumerId
,
pConsumerOld
->
cgroup
);
SMqConsumerObj
*
pConsumerNew
=
tNewSMqConsumerObj
(
pConsumerOld
->
consumerId
,
pConsumerOld
->
cgroup
);
...
@@ -631,6 +581,13 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) {
...
@@ -631,6 +581,13 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) {
taosRLockLatch
(
&
pTopic
->
lock
);
taosRLockLatch
(
&
pTopic
->
lock
);
rebOutput
.
pSub
=
mndCreateSub
(
pMnode
,
pTopic
,
pRebInfo
->
key
);
rebOutput
.
pSub
=
mndCreateSub
(
pMnode
,
pTopic
,
pRebInfo
->
key
);
if
(
rebOutput
.
pSub
==
NULL
)
{
mError
(
"mq rebalance %s failed create sub since %s, abort"
,
pRebInfo
->
key
,
terrstr
());
taosRUnLockLatch
(
&
pTopic
->
lock
);
mndReleaseTopic
(
pMnode
,
pTopic
);
continue
;
}
memcpy
(
rebOutput
.
pSub
->
dbName
,
pTopic
->
db
,
TSDB_DB_FNAME_LEN
);
memcpy
(
rebOutput
.
pSub
->
dbName
,
pTopic
->
db
,
TSDB_DB_FNAME_LEN
);
taosRUnLockLatch
(
&
pTopic
->
lock
);
taosRUnLockLatch
(
&
pTopic
->
lock
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录