Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a2a7dffb
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看板
提交
a2a7dffb
编写于
2月 18, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor and add some logs.
上级
abe37a16
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
13 deletion
+14
-13
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+13
-12
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+1
-1
未找到文件。
source/client/src/clientTmq.c
浏览文件 @
a2a7dffb
...
@@ -641,17 +641,14 @@ static int32_t tmqCommitConsumerImpl(tmq_t* tmq, int8_t automatic, int8_t async,
...
@@ -641,17 +641,14 @@ static int32_t tmqCommitConsumerImpl(tmq_t* tmq, int8_t automatic, int8_t async,
SMqClientTopic
*
pTopic
=
taosArrayGet
(
tmq
->
clientTopics
,
i
);
SMqClientTopic
*
pTopic
=
taosArrayGet
(
tmq
->
clientTopics
,
i
);
int32_t
numOfVgroups
=
taosArrayGetSize
(
pTopic
->
vgs
);
int32_t
numOfVgroups
=
taosArrayGetSize
(
pTopic
->
vgs
);
tscDebug
(
"consumer:0x%"
PRIx64
", begin commit for topic %s, vgNum %d"
,
tmq
->
consumerId
,
pTopic
->
topicName
,
numOfVgroups
);
for
(
int32_t
j
=
0
;
j
<
numOfVgroups
;
j
++
)
{
for
(
int32_t
j
=
0
;
j
<
numOfVgroups
;
j
++
)
{
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
j
);
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
j
);
tscDebug
(
"consumer:0x%"
PRIx64
"
, begin commit for topic %s, vgId:
%d"
,
tmq
->
consumerId
,
pTopic
->
topicName
,
tscDebug
(
"consumer:0x%"
PRIx64
"
begin commit for topic %s, vgId:%d, ordinal:%d/
%d"
,
tmq
->
consumerId
,
pTopic
->
topicName
,
pVg
->
vgId
);
pVg
->
vgId
,
j
+
1
,
numOfVgroups
);
if
(
pVg
->
currentOffset
.
type
>
0
&&
!
tOffsetEqual
(
&
pVg
->
currentOffset
,
&
pVg
->
committedOffset
))
{
if
(
pVg
->
currentOffset
.
type
>
0
&&
!
tOffsetEqual
(
&
pVg
->
currentOffset
,
&
pVg
->
committedOffset
))
{
tscDebug
(
"consumer:
%"
PRId64
",
vg:%d, current %"
PRId64
", committed %"
PRId64
""
,
tmq
->
consumerId
,
pVg
->
vgId
,
tscDebug
(
"consumer:
0x%"
PRId64
"
vg:%d, current %"
PRId64
", committed %"
PRId64
""
,
tmq
->
consumerId
,
pVg
->
vgId
,
pVg
->
currentOffset
.
version
,
pVg
->
committedOffset
.
version
);
pVg
->
currentOffset
.
version
,
pVg
->
committedOffset
.
version
);
if
(
tmqSendCommitReq
(
tmq
,
pVg
,
pTopic
,
pParamSet
)
<
0
)
{
if
(
tmqSendCommitReq
(
tmq
,
pVg
,
pTopic
,
pParamSet
)
<
0
)
{
continue
;
continue
;
...
@@ -811,7 +808,7 @@ int32_t tmqHandleAllDelayedTask(tmq_t* pTmq) {
...
@@ -811,7 +808,7 @@ int32_t tmqHandleAllDelayedTask(tmq_t* pTmq) {
int64_t
*
pRefId
=
taosMemoryMalloc
(
sizeof
(
int64_t
));
int64_t
*
pRefId
=
taosMemoryMalloc
(
sizeof
(
int64_t
));
*
pRefId
=
pTmq
->
refId
;
*
pRefId
=
pTmq
->
refId
;
tscDebug
(
"consumer:0x%"
PRIx64
" retrieve ep from mnode in 1s"
,
pTmq
->
consumerId
);
tscDebug
(
"consumer:0x%"
PRIx64
"
will
retrieve ep from mnode in 1s"
,
pTmq
->
consumerId
);
taosTmrReset
(
tmqAssignAskEpTask
,
1000
,
pRefId
,
tmqMgmt
.
timer
,
&
pTmq
->
epTimer
);
taosTmrReset
(
tmqAssignAskEpTask
,
1000
,
pRefId
,
tmqMgmt
.
timer
,
&
pTmq
->
epTimer
);
}
else
if
(
*
pTaskType
==
TMQ_DELAYED_TASK__COMMIT
)
{
}
else
if
(
*
pTaskType
==
TMQ_DELAYED_TASK__COMMIT
)
{
tmqCommitInner
(
pTmq
,
NULL
,
1
,
1
,
pTmq
->
commitCb
,
pTmq
->
commitCbUserParam
);
tmqCommitInner
(
pTmq
,
NULL
,
1
,
1
,
pTmq
->
commitCb
,
pTmq
->
commitCbUserParam
);
...
@@ -819,7 +816,7 @@ int32_t tmqHandleAllDelayedTask(tmq_t* pTmq) {
...
@@ -819,7 +816,7 @@ int32_t tmqHandleAllDelayedTask(tmq_t* pTmq) {
int64_t
*
pRefId
=
taosMemoryMalloc
(
sizeof
(
int64_t
));
int64_t
*
pRefId
=
taosMemoryMalloc
(
sizeof
(
int64_t
));
*
pRefId
=
pTmq
->
refId
;
*
pRefId
=
pTmq
->
refId
;
tscDebug
(
"consumer:0x%"
PRIx64
"
commit to mnode in %.2f
s"
,
pTmq
->
consumerId
,
pTmq
->
autoCommitInterval
/
1000
.
0
);
tscDebug
(
"consumer:0x%"
PRIx64
"
will commit to mnode in %.2f
s"
,
pTmq
->
consumerId
,
pTmq
->
autoCommitInterval
/
1000
.
0
);
taosTmrReset
(
tmqAssignDelayedCommitTask
,
pTmq
->
autoCommitInterval
,
pRefId
,
tmqMgmt
.
timer
,
&
pTmq
->
commitTimer
);
taosTmrReset
(
tmqAssignDelayedCommitTask
,
pTmq
->
autoCommitInterval
,
pRefId
,
tmqMgmt
.
timer
,
&
pTmq
->
commitTimer
);
}
else
if
(
*
pTaskType
==
TMQ_DELAYED_TASK__REPORT
)
{
}
else
if
(
*
pTaskType
==
TMQ_DELAYED_TASK__REPORT
)
{
// do nothing
// do nothing
...
@@ -1066,7 +1063,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
...
@@ -1066,7 +1063,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
SCMSubscribeReq
req
=
{
0
};
SCMSubscribeReq
req
=
{
0
};
int32_t
code
=
0
;
int32_t
code
=
0
;
tscDebug
(
"consumer:0x%"
PRIx64
"
,
tmq subscribe start, numOfTopic %d"
,
tmq
->
consumerId
,
sz
);
tscDebug
(
"consumer:0x%"
PRIx64
" tmq subscribe start, numOfTopic %d"
,
tmq
->
consumerId
,
sz
);
req
.
consumerId
=
tmq
->
consumerId
;
req
.
consumerId
=
tmq
->
consumerId
;
tstrncpy
(
req
.
clientId
,
tmq
->
clientId
,
256
);
tstrncpy
(
req
.
clientId
,
tmq
->
clientId
,
256
);
...
@@ -1156,7 +1153,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
...
@@ -1156,7 +1153,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
goto
FAIL
;
goto
FAIL
;
}
}
tscDebug
(
"consumer:0x%"
PRIx64
", mnd not ready for subscribe, retry
count
:%d in 500ms"
,
tmq
->
consumerId
,
retryCnt
);
tscDebug
(
"consumer:0x%"
PRIx64
", mnd not ready for subscribe, retry:%d in 500ms"
,
tmq
->
consumerId
,
retryCnt
);
taosMsleep
(
500
);
taosMsleep
(
500
);
}
}
...
@@ -1435,11 +1432,15 @@ int32_t tmqAskEpCb(void* param, SDataBuf* pMsg, int32_t code) {
...
@@ -1435,11 +1432,15 @@ int32_t tmqAskEpCb(void* param, SDataBuf* pMsg, int32_t code) {
// Epoch will only increase when received newer epoch ep msg
// Epoch will only increase when received newer epoch ep msg
SMqRspHead
*
head
=
pMsg
->
pData
;
SMqRspHead
*
head
=
pMsg
->
pData
;
int32_t
epoch
=
atomic_load_32
(
&
tmq
->
epoch
);
int32_t
epoch
=
atomic_load_32
(
&
tmq
->
epoch
);
tscDebug
(
"consumer:0x%"
PRIx64
", recv ep, msg epoch %d, current epoch %d"
,
tmq
->
consumerId
,
head
->
epoch
,
epoch
);
if
(
head
->
epoch
<=
epoch
)
{
if
(
head
->
epoch
<=
epoch
)
{
tscDebug
(
"consumer:0x%"
PRIx64
", recv ep, msg epoch %d, current epoch %d, no need to update local ep"
,
tmq
->
consumerId
,
head
->
epoch
,
epoch
);
goto
END
;
goto
END
;
}
}
tscDebug
(
"consumer:0x%"
PRIx64
", recv ep, msg epoch %d, current epoch %d, update local ep"
,
tmq
->
consumerId
,
head
->
epoch
,
epoch
);
if
(
!
async
)
{
if
(
!
async
)
{
SMqAskEpRsp
rsp
;
SMqAskEpRsp
rsp
;
tDecodeSMqAskEpRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
rsp
);
tDecodeSMqAskEpRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
rsp
);
...
@@ -1548,7 +1549,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) {
...
@@ -1548,7 +1549,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) {
sendInfo
->
msgType
=
TDMT_MND_TMQ_ASK_EP
;
sendInfo
->
msgType
=
TDMT_MND_TMQ_ASK_EP
;
SEpSet
epSet
=
getEpSet_s
(
&
tmq
->
pTscObj
->
pAppInfo
->
mgmtEp
);
SEpSet
epSet
=
getEpSet_s
(
&
tmq
->
pTscObj
->
pAppInfo
->
mgmtEp
);
tscDebug
(
"consumer:0x%"
PRIx64
"
, ask ep from mnode"
,
tmq
->
consumerId
);
tscDebug
(
"consumer:0x%"
PRIx64
"
ask ep from mnode, async:%d"
,
tmq
->
consumerId
,
async
);
int64_t
transporterId
=
0
;
int64_t
transporterId
=
0
;
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
sendInfo
);
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
sendInfo
);
...
...
source/client/test/clientTests.cpp
浏览文件 @
a2a7dffb
...
@@ -671,7 +671,7 @@ TEST(clientCase, generated_request_id_test) {
...
@@ -671,7 +671,7 @@ TEST(clientCase, generated_request_id_test) {
uint64_t
v
=
generateRequestId
();
uint64_t
v
=
generateRequestId
();
void
*
result
=
taosHashGet
(
phash
,
&
v
,
sizeof
(
v
));
void
*
result
=
taosHashGet
(
phash
,
&
v
,
sizeof
(
v
));
if
(
result
!=
nullptr
)
{
if
(
result
!=
nullptr
)
{
printf
(
"0x%
lx, index:%d
\n
"
,
v
,
i
);
// printf("0x%l
lx, index:%d\n", v, i);
}
}
assert
(
result
==
nullptr
);
assert
(
result
==
nullptr
);
taosHashPut
(
phash
,
&
v
,
sizeof
(
v
),
NULL
,
0
);
taosHashPut
(
phash
,
&
v
,
sizeof
(
v
),
NULL
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录