Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d4d9ce20
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看板
未验证
提交
d4d9ce20
编写于
4月 07, 2022
作者:
L
Liu Jicong
提交者:
GitHub
4月 07, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11291 from taosdata/feature/tq
add multi topic test
上级
7aea48a2
0cbfc79b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
54 addition
and
11 deletion
+54
-11
source/dnode/vnode/src/inc/tqInt.h
source/dnode/vnode/src/inc/tqInt.h
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+51
-8
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-1
tests/test/c/tmqSim.c
tests/test/c/tmqSim.c
+1
-1
未找到文件。
source/dnode/vnode/src/inc/tqInt.h
浏览文件 @
d4d9ce20
...
...
@@ -67,7 +67,7 @@ extern "C" {
} \
}
#define TQ_BUFFER_SIZE
8
#define TQ_BUFFER_SIZE
4
#define TQ_BUCKET_MASK 0xFF
#define TQ_BUCKET_SIZE 256
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
d4d9ce20
...
...
@@ -421,22 +421,62 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
int32_t
tqProcessRebReq
(
STQ
*
pTq
,
char
*
msg
)
{
SMqMVRebReq
req
=
{
0
};
terrno
=
TSDB_CODE_SUCCESS
;
tDecodeSMqMVRebReq
(
msg
,
&
req
);
vDebug
(
"vg %d set from consumer %ld to consumer %ld"
,
req
.
vgId
,
req
.
oldConsumerId
,
req
.
newConsumerId
);
STqConsumer
*
pConsumer
=
tqHandleGet
(
pTq
->
tqMeta
,
req
.
oldConsumerId
);
ASSERT
(
pConsumer
);
pConsumer
->
consumerId
=
req
.
newConsumerId
;
tqHandleMovePut
(
pTq
->
tqMeta
,
req
.
newConsumerId
,
pConsumer
);
tqHandleCommit
(
pTq
->
tqMeta
,
req
.
newConsumerId
);
tqHandlePurge
(
pTq
->
tqMeta
,
req
.
oldConsumerId
);
terrno
=
TSDB_CODE_SUCCESS
;
ASSERT
(
pConsumer
->
consumerId
==
req
.
oldConsumerId
);
int32_t
numOfTopics
=
taosArrayGetSize
(
pConsumer
->
topics
);
if
(
numOfTopics
==
1
)
{
STqTopic
*
pTopic
=
taosArrayGet
(
pConsumer
->
topics
,
0
);
ASSERT
(
strcmp
(
pTopic
->
topicName
,
req
.
topic
)
==
0
);
STqConsumer
*
pNewConsumer
=
tqHandleGet
(
pTq
->
tqMeta
,
req
.
newConsumerId
);
if
(
pNewConsumer
==
NULL
)
{
pConsumer
->
consumerId
=
req
.
newConsumerId
;
tqHandleMovePut
(
pTq
->
tqMeta
,
req
.
newConsumerId
,
pConsumer
);
tqHandleCommit
(
pTq
->
tqMeta
,
req
.
newConsumerId
);
tqHandlePurge
(
pTq
->
tqMeta
,
req
.
oldConsumerId
);
return
0
;
}
else
{
taosArrayPush
(
pNewConsumer
->
topics
,
pTopic
);
}
}
else
{
for
(
int32_t
i
=
0
;
i
<
numOfTopics
;
i
++
)
{
STqTopic
*
pTopic
=
taosArrayGet
(
pConsumer
->
topics
,
i
);
if
(
strcmp
(
pTopic
->
topicName
,
req
.
topic
)
==
0
)
{
STqConsumer
*
pNewConsumer
=
tqHandleGet
(
pTq
->
tqMeta
,
req
.
newConsumerId
);
if
(
pNewConsumer
==
NULL
)
{
pNewConsumer
=
taosMemoryCalloc
(
1
,
sizeof
(
STqConsumer
));
if
(
pNewConsumer
==
NULL
)
{
terrno
=
TSDB_CODE_TQ_OUT_OF_MEMORY
;
return
-
1
;
}
strcpy
(
pNewConsumer
->
cgroup
,
pConsumer
->
cgroup
);
pNewConsumer
->
topics
=
taosArrayInit
(
0
,
sizeof
(
STqTopic
));
pNewConsumer
->
consumerId
=
req
.
newConsumerId
;
pNewConsumer
->
epoch
=
0
;
taosArrayPush
(
pNewConsumer
->
topics
,
pTopic
);
tqHandleMovePut
(
pTq
->
tqMeta
,
req
.
newConsumerId
,
pConsumer
);
tqHandleCommit
(
pTq
->
tqMeta
,
req
.
newConsumerId
);
return
0
;
}
ASSERT
(
pNewConsumer
->
consumerId
==
req
.
newConsumerId
);
taosArrayPush
(
pNewConsumer
->
topics
,
pTopic
);
break
;
}
}
//
}
return
0
;
}
int32_t
tqProcessSetConnReq
(
STQ
*
pTq
,
char
*
msg
)
{
SMqSetCVgReq
req
=
{
0
};
tDecodeSMqSetCVgReq
(
msg
,
&
req
);
bool
create
=
false
;
vDebug
(
"vg %d set to consumer %ld"
,
req
.
vgId
,
req
.
consumerId
);
STqConsumer
*
pConsumer
=
tqHandleGet
(
pTq
->
tqMeta
,
req
.
consumerId
);
...
...
@@ -450,6 +490,7 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg) {
pConsumer
->
topics
=
taosArrayInit
(
0
,
sizeof
(
STqTopic
));
pConsumer
->
consumerId
=
req
.
consumerId
;
pConsumer
->
epoch
=
0
;
create
=
true
;
}
STqTopic
*
pTopic
=
taosMemoryCalloc
(
1
,
sizeof
(
STqTopic
));
...
...
@@ -483,10 +524,12 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg) {
pTopic
->
buffer
.
output
[
i
].
task
=
qCreateStreamExecTaskInfo
(
req
.
qmsg
,
&
handle
);
ASSERT
(
pTopic
->
buffer
.
output
[
i
].
task
);
}
/*printf("set topic %s to consumer %ld on vg %d\n", pTopic->topicName, req.consumerId, pTq->pVnode->vgId);*/
vDebug
(
"set topic %s to consumer %ld on vg %d"
,
pTopic
->
topicName
,
req
.
consumerId
,
pTq
->
pVnode
->
vgId
);
taosArrayPush
(
pConsumer
->
topics
,
pTopic
);
tqHandleMovePut
(
pTq
->
tqMeta
,
req
.
consumerId
,
pConsumer
);
tqHandleCommit
(
pTq
->
tqMeta
,
req
.
consumerId
);
if
(
create
)
{
tqHandleMovePut
(
pTq
->
tqMeta
,
req
.
consumerId
,
pConsumer
);
tqHandleCommit
(
pTq
->
tqMeta
,
req
.
consumerId
);
}
terrno
=
TSDB_CODE_SUCCESS
;
return
0
;
}
...
...
tests/script/jenkins/basic.txt
浏览文件 @
d4d9ce20
...
...
@@ -42,7 +42,7 @@
./test.sh -f tsim/tmq/basic.sim
./test.sh -f tsim/tmq/basic1.sim
./test.sh -f tsim/tmq/oneTopic.sim
#
./test.sh -f tsim/tmq/multiTopic.sim
./test.sh -f tsim/tmq/multiTopic.sim
# --- stable
./test.sh -f tsim/stable/disk.sim
...
...
tests/test/c/tmqSim.c
浏览文件 @
d4d9ce20
...
...
@@ -226,7 +226,7 @@ void loop_consume(tmq_t* tmq) {
int32_t
totalRows
=
0
;
int32_t
skipLogNum
=
0
;
while
(
running
)
{
tmq_message_t
*
tmqMsg
=
tmq_consumer_poll
(
tmq
,
3
000
);
tmq_message_t
*
tmqMsg
=
tmq_consumer_poll
(
tmq
,
4
000
);
if
(
tmqMsg
)
{
totalMsgs
++
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录