Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
caec1313
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
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看板
未验证
提交
caec1313
编写于
3月 24, 2023
作者:
H
Haojun Liao
提交者:
GitHub
3月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20628 from taosdata/fix/liaohj
fix(tmq): wait for 2mins when subscribe topics.
上级
e0d1a405
b22cc822
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
187 addition
and
215 deletion
+187
-215
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+3
-3
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+12
-17
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+169
-192
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+3
-3
未找到文件。
source/client/src/clientTmq.c
浏览文件 @
caec1313
...
...
@@ -1116,6 +1116,7 @@ _failed:
}
int32_t
tmq_subscribe
(
tmq_t
*
tmq
,
const
tmq_list_t
*
topic_list
)
{
const
int32_t
MAX_RETRY_COUNT
=
120
*
2
;
// let's wait for 2 mins at most
const
SArray
*
container
=
&
topic_list
->
container
;
int32_t
sz
=
taosArrayGetSize
(
container
);
void
*
buf
=
NULL
;
...
...
@@ -1209,7 +1210,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
int32_t
retryCnt
=
0
;
while
(
TSDB_CODE_MND_CONSUMER_NOT_READY
==
tmqAskEp
(
tmq
,
false
))
{
if
(
retryCnt
++
>
40
)
{
if
(
retryCnt
++
>
MAX_RETRY_COUNT
)
{
goto
FAIL
;
}
...
...
@@ -1811,7 +1812,6 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
if
(
pRspWrapper
==
NULL
)
{
taosReadAllQitems
(
tmq
->
mqueue
,
tmq
->
qall
);
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
pRspWrapper
);
if
(
pRspWrapper
==
NULL
)
{
return
NULL
;
}
...
...
@@ -1831,7 +1831,6 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
SMqDataRsp
*
pDataRsp
=
&
pollRspWrapper
->
dataRsp
;
if
(
pDataRsp
->
head
.
epoch
==
consumerEpoch
)
{
// todo fix it: race condition
SMqClientVg
*
pVg
=
pollRspWrapper
->
vgHandle
;
// update the epset
...
...
@@ -1843,6 +1842,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
pVg
->
epSet
=
*
pollRspWrapper
->
pEpset
;
}
// update the local offset value only for the returned values.
pVg
->
currentOffset
=
pDataRsp
->
rspOffset
;
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
...
...
source/dnode/vnode/src/inc/tq.h
浏览文件 @
caec1313
...
...
@@ -109,23 +109,18 @@ typedef struct {
}
STqPushEntry
;
struct
STQ
{
SVnode
*
pVnode
;
char
*
path
;
int64_t
walLogLastVer
;
SRWLatch
pushLock
;
SHashObj
*
pPushMgr
;
// consumerId -> STqPushEntry
SHashObj
*
pHandle
;
// subKey -> STqHandle
SHashObj
*
pCheckInfo
;
// topic -> SAlterCheckInfo
SVnode
*
pVnode
;
char
*
path
;
int64_t
walLogLastVer
;
SRWLatch
lock
;
SHashObj
*
pPushMgr
;
// consumerId -> STqPushEntry
SHashObj
*
pHandle
;
// subKey -> STqHandle
SHashObj
*
pCheckInfo
;
// topic -> SAlterCheckInfo
STqOffsetStore
*
pOffsetStore
;
TDB
*
pMetaDB
;
TTB
*
pExecStore
;
TTB
*
pCheckStore
;
SStreamMeta
*
pStreamMeta
;
TDB
*
pMetaDB
;
TTB
*
pExecStore
;
TTB
*
pCheckStore
;
SStreamMeta
*
pStreamMeta
;
};
typedef
struct
{
...
...
@@ -164,7 +159,7 @@ typedef struct {
int32_t
size
;
}
STqOffsetHead
;
STqOffsetStore
*
tqOffsetOpen
();
STqOffsetStore
*
tqOffsetOpen
(
STQ
*
pTq
);
void
tqOffsetClose
(
STqOffsetStore
*
);
STqOffset
*
tqOffsetRead
(
STqOffsetStore
*
pStore
,
const
char
*
subscribeKey
);
int32_t
tqOffsetWrite
(
STqOffsetStore
*
pStore
,
const
STqOffset
*
pOffset
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
caec1313
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
caec1313
...
...
@@ -213,7 +213,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
if
(
msgType
==
TDMT_VND_SUBMIT
)
{
// lock push mgr to avoid potential msg lost
taosWLockLatch
(
&
pTq
->
pushL
ock
);
taosWLockLatch
(
&
pTq
->
l
ock
);
int32_t
numOfRegisteredPush
=
taosHashGetSize
(
pTq
->
pPushMgr
);
if
(
numOfRegisteredPush
>
0
)
{
...
...
@@ -231,7 +231,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
taosArrayDestroy
(
cachedKeyLens
);
// unlock
taosWUnLockLatch
(
&
pTq
->
pushL
ock
);
taosWUnLockLatch
(
&
pTq
->
l
ock
);
return
-
1
;
}
...
...
@@ -320,7 +320,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
taosMemoryFree
(
data
);
}
// unlock
taosWUnLockLatch
(
&
pTq
->
pushL
ock
);
taosWUnLockLatch
(
&
pTq
->
l
ock
);
}
if
(
!
tsDisableStream
&&
vnodeIsRoleLeader
(
pTq
->
pVnode
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录