Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b0f9674e
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b0f9674e
编写于
8月 07, 2023
作者:
H
Haojun Liao
提交者:
GitHub
8月 07, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #22343 from taosdata/mark/ref
fix:set terrno = 0 to avoid affect next fetch msg
上级
7924d7e0
5daf38c0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
184 addition
and
5 deletion
+184
-5
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+174
-0
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+2
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+8
-4
未找到文件。
source/client/test/clientTests.cpp
浏览文件 @
b0f9674e
...
...
@@ -1442,4 +1442,178 @@ TEST(clientCase, sub_tb_mt_test) {
}
}
TEST
(
clientCase
,
ts_3756
)
{
// taos_options(TSDB_OPTION_CONFIGDIR, "~/first/cfg");
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
ASSERT_NE
(
pConn
,
nullptr
);
tmq_conf_t
*
conf
=
tmq_conf_new
();
tmq_conf_set
(
conf
,
"enable.auto.commit"
,
"false"
);
tmq_conf_set
(
conf
,
"auto.commit.interval.ms"
,
"2000"
);
tmq_conf_set
(
conf
,
"group.id"
,
"group_id_2"
);
tmq_conf_set
(
conf
,
"td.connect.user"
,
"root"
);
tmq_conf_set
(
conf
,
"td.connect.pass"
,
"taosdata"
);
tmq_conf_set
(
conf
,
"auto.offset.reset"
,
"latest"
);
tmq_conf_set
(
conf
,
"msg.with.table.name"
,
"false"
);
tmq_t
*
tmq
=
tmq_consumer_new
(
conf
,
NULL
,
0
);
tmq_conf_destroy
(
conf
);
// 创建订阅 topics 列表
tmq_list_t
*
topicList
=
tmq_list_new
();
tmq_list_append
(
topicList
,
"tp"
);
// 启动订阅
tmq_subscribe
(
tmq
,
topicList
);
tmq_list_destroy
(
topicList
);
TAOS_FIELD
*
fields
=
NULL
;
int32_t
numOfFields
=
0
;
int32_t
precision
=
0
;
int32_t
totalRows
=
0
;
int32_t
msgCnt
=
0
;
int32_t
timeout
=
200
;
int32_t
count
=
0
;
tmq_topic_assignment
*
pAssign
=
NULL
;
int32_t
numOfAssign
=
0
;
int32_t
code
=
tmq_get_topic_assignment
(
tmq
,
"tp"
,
&
pAssign
,
&
numOfAssign
);
if
(
code
!=
0
)
{
printf
(
"error occurs:%s
\n
"
,
tmq_err2str
(
code
));
tmq_free_assignment
(
pAssign
);
tmq_consumer_close
(
tmq
);
taos_close
(
pConn
);
fprintf
(
stderr
,
"%d msg consumed, include %d rows
\n
"
,
msgCnt
,
totalRows
);
return
;
}
for
(
int
i
=
0
;
i
<
numOfAssign
;
i
++
){
printf
(
"assign i:%d, vgId:%d, offset:%lld, start:%lld, end:%lld
\n
"
,
i
,
pAssign
[
i
].
vgId
,
pAssign
[
i
].
currentOffset
,
pAssign
[
i
].
begin
,
pAssign
[
i
].
end
);
}
// tmq_offset_seek(tmq, "tp", pAssign[0].vgId, 4);
tmq_free_assignment
(
pAssign
);
code
=
tmq_get_topic_assignment
(
tmq
,
"tp"
,
&
pAssign
,
&
numOfAssign
);
if
(
code
!=
0
)
{
printf
(
"error occurs:%s
\n
"
,
tmq_err2str
(
code
));
tmq_free_assignment
(
pAssign
);
tmq_consumer_close
(
tmq
);
taos_close
(
pConn
);
fprintf
(
stderr
,
"%d msg consumed, include %d rows
\n
"
,
msgCnt
,
totalRows
);
return
;
}
for
(
int
i
=
0
;
i
<
numOfAssign
;
i
++
){
printf
(
"assign i:%d, vgId:%d, offset:%lld, start:%lld, end:%lld
\n
"
,
i
,
pAssign
[
i
].
vgId
,
pAssign
[
i
].
currentOffset
,
pAssign
[
i
].
begin
,
pAssign
[
i
].
end
);
}
tmq_free_assignment
(
pAssign
);
code
=
tmq_get_topic_assignment
(
tmq
,
"tp"
,
&
pAssign
,
&
numOfAssign
);
if
(
code
!=
0
)
{
printf
(
"error occurs:%s
\n
"
,
tmq_err2str
(
code
));
tmq_free_assignment
(
pAssign
);
tmq_consumer_close
(
tmq
);
taos_close
(
pConn
);
fprintf
(
stderr
,
"%d msg consumed, include %d rows
\n
"
,
msgCnt
,
totalRows
);
return
;
}
for
(
int
i
=
0
;
i
<
numOfAssign
;
i
++
){
printf
(
"assign i:%d, vgId:%d, offset:%lld, start:%lld, end:%lld
\n
"
,
i
,
pAssign
[
i
].
vgId
,
pAssign
[
i
].
currentOffset
,
pAssign
[
i
].
begin
,
pAssign
[
i
].
end
);
}
while
(
1
)
{
printf
(
"start to poll
\n
"
);
TAOS_RES
*
pRes
=
tmq_consumer_poll
(
tmq
,
timeout
);
if
(
pRes
)
{
char
buf
[
128
];
const
char
*
topicName
=
tmq_get_topic_name
(
pRes
);
// const char* dbName = tmq_get_db_name(pRes);
// int32_t vgroupId = tmq_get_vgroup_id(pRes);
//
// printf("topic: %s\n", topicName);
// printf("db: %s\n", dbName);
// printf("vgroup id: %d\n", vgroupId);
printSubResults
(
pRes
,
&
totalRows
);
tmq_topic_assignment
*
pAssignTmp
=
NULL
;
int32_t
numOfAssignTmp
=
0
;
code
=
tmq_get_topic_assignment
(
tmq
,
"tp"
,
&
pAssignTmp
,
&
numOfAssignTmp
);
if
(
code
!=
0
)
{
printf
(
"error occurs:%s
\n
"
,
tmq_err2str
(
code
));
tmq_free_assignment
(
pAssign
);
tmq_consumer_close
(
tmq
);
taos_close
(
pConn
);
fprintf
(
stderr
,
"%d msg consumed, include %d rows
\n
"
,
msgCnt
,
totalRows
);
return
;
}
for
(
int
i
=
0
;
i
<
numOfAssign
;
i
++
){
printf
(
"assign i:%d, vgId:%d, offset:%lld, start:%lld, end:%lld
\n
"
,
i
,
pAssignTmp
[
i
].
vgId
,
pAssignTmp
[
i
].
currentOffset
,
pAssignTmp
[
i
].
begin
,
pAssignTmp
[
i
].
end
);
}
if
(
numOfAssign
!=
0
){
int
i
=
0
;
for
(;
i
<
numOfAssign
;
i
++
){
if
(
pAssign
[
i
].
currentOffset
!=
pAssignTmp
[
i
].
currentOffset
){
break
;
}
}
if
(
i
==
numOfAssign
){
printf
(
"all position is same
\n
"
);
break
;
}
tmq_free_assignment
(
pAssign
);
}
numOfAssign
=
numOfAssignTmp
;
pAssign
=
pAssignTmp
;
}
else
{
// tmq_offset_seek(tmq, "tp", pAssign[0].vgId, pAssign[0].currentOffset);
// tmq_offset_seek(tmq, "tp", pAssign[1].vgId, pAssign[1].currentOffset);
// tmq_commit_sync(tmq, pRes);
continue
;
}
// tmq_commit_sync(tmq, pRes);
if
(
pRes
!=
NULL
)
{
taos_free_result
(
pRes
);
// if ((++count) > 1) {
// break;
// }
}
else
{
// break;
}
// tmq_offset_seek(tmq, "tp", pAssign[0].vgId, pAssign[0].begin);
}
tmq_free_assignment
(
pAssign
);
code
=
tmq_get_topic_assignment
(
tmq
,
"tp"
,
&
pAssign
,
&
numOfAssign
);
if
(
code
!=
0
)
{
printf
(
"error occurs:%s
\n
"
,
tmq_err2str
(
code
));
tmq_free_assignment
(
pAssign
);
tmq_consumer_close
(
tmq
);
taos_close
(
pConn
);
fprintf
(
stderr
,
"%d msg consumed, include %d rows
\n
"
,
msgCnt
,
totalRows
);
return
;
}
for
(
int
i
=
0
;
i
<
numOfAssign
;
i
++
){
printf
(
"assign i:%d, vgId:%d, offset:%lld, start:%lld, end:%lld
\n
"
,
i
,
pAssign
[
i
].
vgId
,
pAssign
[
i
].
currentOffset
,
pAssign
[
i
].
begin
,
pAssign
[
i
].
end
);
}
tmq_consumer_close
(
tmq
);
taos_close
(
pConn
);
fprintf
(
stderr
,
"%d msg consumed, include %d rows
\n
"
,
msgCnt
,
totalRows
);
}
#pragma GCC diagnostic pop
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
b0f9674e
...
...
@@ -114,9 +114,10 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
dGTrace
(
"vgId:%d, msg:%p get from vnode-fetch queue"
,
pVnode
->
vgId
,
pMsg
);
terrno
=
0
;
int32_t
code
=
vnodeProcessFetchMsg
(
pVnode
->
pImpl
,
pMsg
,
pInfo
);
if
(
code
!=
0
)
{
if
(
terrno
!=
0
)
{
if
(
code
==
-
1
&&
terrno
!=
0
)
{
code
=
terrno
;
}
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
b0f9674e
...
...
@@ -646,7 +646,8 @@ int32_t tqProcessVgCommittedInfoReq(STQ* pTq, SRpcMsg* pMsg) {
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
data
,
len
);
if
(
tDecodeMqVgOffset
(
&
decoder
,
&
vgOffset
)
<
0
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
terrno
;
}
tDecoderClear
(
&
decoder
);
...
...
@@ -654,19 +655,22 @@ int32_t tqProcessVgCommittedInfoReq(STQ* pTq, SRpcMsg* pMsg) {
STqOffset
*
pOffset
=
&
vgOffset
.
offset
;
STqOffset
*
pSavedOffset
=
tqOffsetRead
(
pTq
->
pOffsetStore
,
pOffset
->
subKey
);
if
(
pSavedOffset
==
NULL
)
{
return
TSDB_CODE_TMQ_NO_COMMITTED
;
terrno
=
TSDB_CODE_TMQ_NO_COMMITTED
;
return
terrno
;
}
vgOffset
.
offset
=
*
pSavedOffset
;
int32_t
code
=
0
;
tEncodeSize
(
tEncodeMqVgOffset
,
&
vgOffset
,
len
,
code
);
if
(
code
<
0
)
{
return
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
void
*
buf
=
rpcMallocCont
(
len
);
if
(
buf
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
terrno
;
}
SEncoder
encoder
;
tEncoderInit
(
&
encoder
,
buf
,
len
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录