Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d7d81d82
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d7d81d82
编写于
7月 19, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:add committed & position & commite_offset interface
上级
5cb35f2f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
14 addition
and
8 deletion
+14
-8
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+7
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+7
-7
未找到文件。
source/client/test/clientTests.cpp
浏览文件 @
d7d81d82
...
...
@@ -1127,7 +1127,7 @@ TEST(clientCase, tmq_commit) {
printf
(
"position vgId:%d, position:%lld
\n
"
,
pAssign
[
i
].
vgId
,
position
);
tmq_offset_seek
(
tmq
,
topicName
,
pAssign
[
i
].
vgId
,
1
);
position
=
tmq_position
(
tmq
,
topicName
,
pAssign
[
i
].
vgId
);
printf
(
"after seek 1
00
, position vgId:%d, position:%lld
\n
"
,
pAssign
[
i
].
vgId
,
position
);
printf
(
"after seek 1, position vgId:%d, position:%lld
\n
"
,
pAssign
[
i
].
vgId
,
position
);
}
while
(
1
)
{
...
...
@@ -1143,6 +1143,12 @@ TEST(clientCase, tmq_commit) {
for
(
int
i
=
0
;
i
<
numOfAssign
;
i
++
)
{
int64_t
committed
=
tmq_committed
(
tmq
,
topicName
,
pAssign
[
i
].
vgId
);
printf
(
"committed vgId:%d, committed:%lld
\n
"
,
pAssign
[
i
].
vgId
,
committed
);
if
(
committed
>
0
){
int32_t
code
=
tmq_commit_offset_sync
(
tmq
,
topicName
,
pAssign
[
i
].
vgId
,
4
);
printf
(
"tmq_commit_offset_sync vgId:%d, offset:4, code:%d
\n
"
,
pAssign
[
i
].
vgId
,
code
);
int64_t
committed
=
tmq_committed
(
tmq
,
topicName
,
pAssign
[
i
].
vgId
);
printf
(
"after tmq_commit_offset_sync, committed vgId:%d, committed:%lld
\n
"
,
pAssign
[
i
].
vgId
,
committed
);
}
}
if
(
pRes
!=
NULL
)
{
taos_free_result
(
pRes
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
d7d81d82
...
...
@@ -85,9 +85,9 @@ void tqDestroyTqHandle(void* data) {
}
}
static
bool
tqOffset
LessOr
Equal
(
const
STqOffset
*
pLeft
,
const
STqOffset
*
pRight
)
{
static
bool
tqOffsetEqual
(
const
STqOffset
*
pLeft
,
const
STqOffset
*
pRight
)
{
return
pLeft
->
val
.
type
==
TMQ_OFFSET__LOG
&&
pRight
->
val
.
type
==
TMQ_OFFSET__LOG
&&
pLeft
->
val
.
version
<
=
pRight
->
val
.
version
;
pLeft
->
val
.
version
=
=
pRight
->
val
.
version
;
}
STQ
*
tqOpen
(
const
char
*
path
,
SVnode
*
pVnode
)
{
...
...
@@ -302,10 +302,10 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t sversion, char* msg, int32_t
STqOffset
*
pOffset
=
&
vgOffset
.
offset
;
if
(
pOffset
->
val
.
type
==
TMQ_OFFSET__SNAPSHOT_DATA
||
pOffset
->
val
.
type
==
TMQ_OFFSET__SNAPSHOT_META
)
{
tq
Debug
(
"receive offset commit msg to %s on vgId:%d, offset(type:snapshot) uid:%"
PRId64
", ts:%"
PRId64
,
tq
Info
(
"receive offset commit msg to %s on vgId:%d, offset(type:snapshot) uid:%"
PRId64
", ts:%"
PRId64
,
pOffset
->
subKey
,
vgId
,
pOffset
->
val
.
uid
,
pOffset
->
val
.
ts
);
}
else
if
(
pOffset
->
val
.
type
==
TMQ_OFFSET__LOG
)
{
tq
Debug
(
"receive offset commit msg to %s on vgId:%d, offset(type:log) version:%"
PRId64
,
pOffset
->
subKey
,
vgId
,
tq
Info
(
"receive offset commit msg to %s on vgId:%d, offset(type:log) version:%"
PRId64
,
pOffset
->
subKey
,
vgId
,
pOffset
->
val
.
version
);
if
(
pOffset
->
val
.
version
+
1
==
sversion
)
{
pOffset
->
val
.
version
+=
1
;
...
...
@@ -316,8 +316,8 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t sversion, char* msg, int32_t
}
STqOffset
*
pSavedOffset
=
tqOffsetRead
(
pTq
->
pOffsetStore
,
pOffset
->
subKey
);
if
(
pSavedOffset
!=
NULL
&&
tqOffset
LessOr
Equal
(
pOffset
,
pSavedOffset
))
{
tq
Debug
(
"not update the offset, vgId:%d sub:%s since committed:%"
PRId64
" less than/equal to existed:%"
PRId64
,
if
(
pSavedOffset
!=
NULL
&&
tqOffsetEqual
(
pOffset
,
pSavedOffset
))
{
tq
Info
(
"not update the offset, vgId:%d sub:%s since committed:%"
PRId64
" less than/equal to existed:%"
PRId64
,
vgId
,
pOffset
->
subKey
,
pOffset
->
val
.
version
,
pSavedOffset
->
val
.
version
);
return
0
;
// no need to update the offset value
}
...
...
@@ -605,7 +605,7 @@ int32_t tqProcessVgCommittedInfoReq(STQ* pTq, SRpcMsg* pMsg) {
return
TSDB_CODE_INVALID_PARA
;
}
void
*
buf
=
taosMemoryCalloc
(
1
,
len
);
void
*
buf
=
rpcMallocCont
(
len
);
if
(
buf
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录