Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e3179689
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看板
提交
e3179689
编写于
3月 20, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(tmq): diable commit when close conumer if auto commit is disabled.
上级
2517f9bb
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
29 addition
and
21 deletion
+29
-21
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+29
-21
未找到文件。
source/client/src/clientTmq.c
浏览文件 @
e3179689
...
@@ -2017,24 +2017,16 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
...
@@ -2017,24 +2017,16 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
}
}
}
}
int32_t
tmq_consumer_close
(
tmq_t
*
tmq
)
{
static
void
displayConsumeStatistics
(
const
tmq_t
*
pTmq
)
{
tscDebug
(
"consumer:0x%"
PRIx64
" start to close consumer, status:%d"
,
tmq
->
consumerId
,
tmq
->
status
);
int32_t
numOfTopics
=
taosArrayGetSize
(
pTmq
->
clientTopics
);
if
(
tmq
->
status
==
TMQ_CONSUMER_STATUS__READY
)
{
int32_t
rsp
=
tmq_commit_sync
(
tmq
,
NULL
);
if
(
rsp
!=
0
)
{
return
rsp
;
}
int32_t
numOfTopics
=
taosArrayGetSize
(
tmq
->
clientTopics
);
tscDebug
(
"consumer:0x%"
PRIx64
" closing poll:%"
PRId64
" rows:%"
PRId64
" topics:%d, final epoch:%d"
,
tscDebug
(
"consumer:0x%"
PRIx64
" closing poll:%"
PRId64
" rows:%"
PRId64
" topics:%d, final epoch:%d"
,
tmq
->
consumerId
,
tmq
->
pollCnt
,
tmq
->
totalRows
,
numOfTopics
,
t
mq
->
epoch
);
pTmq
->
consumerId
,
pTmq
->
pollCnt
,
pTmq
->
totalRows
,
numOfTopics
,
pT
mq
->
epoch
);
tscDebug
(
"consumer:0x%"
PRIx64
" rows dist begin: "
,
t
mq
->
consumerId
);
tscDebug
(
"consumer:0x%"
PRIx64
" rows dist begin: "
,
pT
mq
->
consumerId
);
for
(
int32_t
i
=
0
;
i
<
numOfTopics
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTopics
;
++
i
)
{
SMqClientTopic
*
pTopics
=
taosArrayGet
(
t
mq
->
clientTopics
,
i
);
SMqClientTopic
*
pTopics
=
taosArrayGet
(
pT
mq
->
clientTopics
,
i
);
tscDebug
(
"consumer:0x%"
PRIx64
" topic:%d"
,
t
mq
->
consumerId
,
i
);
tscDebug
(
"consumer:0x%"
PRIx64
" topic:%d"
,
pT
mq
->
consumerId
,
i
);
int32_t
numOfVgs
=
taosArrayGetSize
(
pTopics
->
vgs
);
int32_t
numOfVgs
=
taosArrayGetSize
(
pTopics
->
vgs
);
for
(
int32_t
j
=
0
;
j
<
numOfVgs
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
numOfVgs
;
++
j
)
{
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopics
->
vgs
,
j
);
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopics
->
vgs
,
j
);
...
@@ -2042,12 +2034,26 @@ int32_t tmq_consumer_close(tmq_t* tmq) {
...
@@ -2042,12 +2034,26 @@ int32_t tmq_consumer_close(tmq_t* tmq) {
}
}
}
}
tscDebug
(
"consumer:0x%"
PRIx64
" rows dist end"
,
tmq
->
consumerId
);
tscDebug
(
"consumer:0x%"
PRIx64
" rows dist end"
,
pTmq
->
consumerId
);
}
int32_t
tmq_consumer_close
(
tmq_t
*
tmq
)
{
tscDebug
(
"consumer:0x%"
PRIx64
" start to close consumer, status:%d"
,
tmq
->
consumerId
,
tmq
->
status
);
displayConsumeStatistics
(
tmq
);
if
(
tmq
->
status
==
TMQ_CONSUMER_STATUS__READY
)
{
// if auto commit is set, commit before close consumer. Otherwise, do nothing.
if
(
tmq
->
autoCommit
)
{
int32_t
rsp
=
tmq_commit_sync
(
tmq
,
NULL
);
if
(
rsp
!=
0
)
{
return
rsp
;
}
}
int32_t
retryCnt
=
0
;
int32_t
retryCnt
=
0
;
tmq_list_t
*
lst
=
tmq_list_new
();
tmq_list_t
*
lst
=
tmq_list_new
();
while
(
1
)
{
while
(
1
)
{
rsp
=
tmq_subscribe
(
tmq
,
lst
);
int32_t
rsp
=
tmq_subscribe
(
tmq
,
lst
);
if
(
rsp
!=
TSDB_CODE_MND_CONSUMER_NOT_READY
||
retryCnt
>
5
)
{
if
(
rsp
!=
TSDB_CODE_MND_CONSUMER_NOT_READY
||
retryCnt
>
5
)
{
break
;
break
;
}
else
{
}
else
{
...
@@ -2057,6 +2063,8 @@ int32_t tmq_consumer_close(tmq_t* tmq) {
...
@@ -2057,6 +2063,8 @@ int32_t tmq_consumer_close(tmq_t* tmq) {
}
}
tmq_list_destroy
(
lst
);
tmq_list_destroy
(
lst
);
}
else
{
tscWarn
(
"consumer:0x%"
PRIx64
" not in ready state, close it directly"
,
tmq
->
consumerId
);
}
}
taosRemoveRef
(
tmqMgmt
.
rsetId
,
tmq
->
refId
);
taosRemoveRef
(
tmqMgmt
.
rsetId
,
tmq
->
refId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录