Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
15dd2721
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
15dd2721
编写于
5月 11, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(tmq): do not show closed consumer
上级
3b56457f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
18 deletion
+29
-18
include/common/tmsg.h
include/common/tmsg.h
+1
-1
source/client/src/tmq.c
source/client/src/tmq.c
+12
-8
source/dnode/mnode/impl/inc/mndConsumer.h
source/dnode/mnode/impl/inc/mndConsumer.h
+1
-0
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+8
-3
tests/test/c/tmqSim.c
tests/test/c/tmqSim.c
+7
-6
未找到文件。
include/common/tmsg.h
浏览文件 @
15dd2721
...
...
@@ -1493,7 +1493,7 @@ typedef struct {
}
SMVSubscribeRsp
;
typedef
struct
{
char
name
[
TSDB_T
ABLE
_FNAME_LEN
];
char
name
[
TSDB_T
OPIC
_FNAME_LEN
];
int8_t
igNotExists
;
}
SMDropTopicReq
;
...
...
source/client/src/tmq.c
浏览文件 @
15dd2721
...
...
@@ -1307,15 +1307,19 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t wait_time) {
}
tmq_resp_err_t
tmq_consumer_close
(
tmq_t
*
tmq
)
{
tmq_list_t
*
lst
=
tmq_list_new
();
tmq_resp_err_t
rsp
=
tmq_subscribe
(
tmq
,
lst
);
tmq_list_destroy
(
lst
);
if
(
rsp
==
TMQ_RESP_ERR__SUCCESS
)
{
// TODO: free resources
return
TMQ_RESP_ERR__SUCCESS
;
}
else
{
return
TMQ_RESP_ERR__FAIL
;
if
(
tmq
->
status
==
TMQ_CONSUMER_STATUS__READY
)
{
tmq_list_t
*
lst
=
tmq_list_new
();
tmq_resp_err_t
rsp
=
tmq_subscribe
(
tmq
,
lst
);
tmq_list_destroy
(
lst
);
if
(
rsp
==
TMQ_RESP_ERR__SUCCESS
)
{
// TODO: free resources
return
TMQ_RESP_ERR__SUCCESS
;
}
else
{
return
TMQ_RESP_ERR__FAIL
;
}
}
// TODO: free resources
return
TMQ_RESP_ERR__SUCCESS
;
}
const
char
*
tmq_err2str
(
tmq_resp_err_t
err
)
{
...
...
source/dnode/mnode/impl/inc/mndConsumer.h
浏览文件 @
15dd2721
...
...
@@ -29,6 +29,7 @@ enum {
MQ_CONSUMER_STATUS__LOST
,
MQ_CONSUMER_STATUS__LOST_IN_REB
,
MQ_CONSUMER_STATUS__LOST_REBD
,
MQ_CONSUMER_STATUS__REMOVED
,
};
int32_t
mndInitConsumer
(
SMnode
*
pMnode
);
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
15dd2721
...
...
@@ -486,6 +486,14 @@ static int32_t mndProcessSubscribeReq(SNodeMsg *pMsg) {
}
}
if
(
pConsumerOld
&&
taosArrayGetSize
(
pConsumerNew
->
rebNewTopics
)
==
0
&&
taosArrayGetSize
(
pConsumerNew
->
rebRemovedTopics
)
==
0
)
{
/*if (taosArrayGetSize(pConsumerNew->assignedTopics) == 0) {*/
/*pConsumerNew->updateType = */
/*}*/
goto
SUBSCRIBE_OVER
;
}
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_SUBSCRIBE
,
&
pMsg
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
SUBSCRIBE_OVER
;
if
(
mndSetConsumerCommitLogs
(
pMnode
,
pTrans
,
pConsumerNew
)
!=
0
)
goto
SUBSCRIBE_OVER
;
...
...
@@ -684,9 +692,6 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
if
(
pOldConsumer
->
status
==
MQ_CONSUMER_STATUS__MODIFY
||
pOldConsumer
->
status
==
MQ_CONSUMER_STATUS__MODIFY_IN_REB
)
{
pOldConsumer
->
status
=
MQ_CONSUMER_STATUS__READY
;
// TODO: remove
/*if (taosArrayGetSize(pOldConsumer->assignedTopics) == 0) {*/
/*}*/
}
else
if
(
pOldConsumer
->
status
==
MQ_CONSUMER_STATUS__LOST_IN_REB
||
pOldConsumer
->
status
==
MQ_CONSUMER_STATUS__LOST
)
{
pOldConsumer
->
status
=
MQ_CONSUMER_STATUS__LOST_REBD
;
...
...
tests/test/c/tmqSim.c
浏览文件 @
15dd2721
...
...
@@ -331,12 +331,6 @@ void loop_consume(SThreadInfo* pInfo) {
}
}
err
=
tmq_consumer_close
(
pInfo
->
tmq
);
if
(
err
)
{
printf
(
"tmq_consumer_close() fail, reason: %s
\n
"
,
tmq_err2str
(
err
));
exit
(
-
1
);
}
pInfo
->
consumeMsgCnt
=
totalMsgs
;
pInfo
->
consumeRowCnt
=
totalRows
;
...
...
@@ -372,6 +366,13 @@ void* consumeThreadFunc(void* param) {
return
NULL
;
}
err
=
tmq_consumer_close
(
pInfo
->
tmq
);
if
(
err
)
{
printf
(
"tmq_consumer_close() fail, reason: %s
\n
"
,
tmq_err2str
(
err
));
exit
(
-
1
);
}
pInfo
->
tmq
=
NULL
;
// save consume result into consumeresult table
saveConsumeResult
(
pInfo
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录