Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
563fca5c
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看板
提交
563fca5c
编写于
5月 01, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(tmq): remove unnecessary error log.
上级
465c595c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
56 deletion
+54
-56
source/dnode/vnode/src/tq/tqOffset.c
source/dnode/vnode/src/tq/tqOffset.c
+54
-41
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+0
-15
未找到文件。
source/dnode/vnode/src/tq/tqOffset.c
浏览文件 @
563fca5c
...
...
@@ -31,57 +31,67 @@ char* tqOffsetBuildFName(const char* path, int32_t fVer) {
int32_t
tqOffsetRestoreFromFile
(
STqOffsetStore
*
pStore
,
const
char
*
fname
)
{
TdFilePtr
pFile
=
taosOpenFile
(
fname
,
TD_FILE_READ
);
if
(
pFile
!=
NULL
)
{
STqOffsetHead
head
=
{
0
};
int64_t
code
;
while
(
1
)
{
if
((
code
=
taosReadFile
(
pFile
,
&
head
,
sizeof
(
STqOffsetHead
)))
!=
sizeof
(
STqOffsetHead
))
{
if
(
code
==
0
)
{
break
;
}
else
{
return
-
1
;
}
}
int32_t
size
=
htonl
(
head
.
size
);
void
*
memBuf
=
taosMemoryCalloc
(
1
,
size
);
if
(
memBuf
==
NULL
)
{
return
-
1
;
}
if
((
code
=
taosReadFile
(
pFile
,
memBuf
,
size
))
!=
size
)
{
taosMemoryFree
(
memBuf
);
return
-
1
;
}
STqOffset
offset
;
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
memBuf
,
size
);
if
(
tDecodeSTqOffset
(
&
decoder
,
&
offset
)
<
0
)
{
taosMemoryFree
(
memBuf
);
tDecoderClear
(
&
decoder
);
if
(
pFile
==
NULL
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
vgId
=
TD_VID
(
pStore
->
pTq
->
pVnode
);
int64_t
code
=
0
;
STqOffsetHead
head
=
{
0
};
while
(
1
)
{
if
((
code
=
taosReadFile
(
pFile
,
&
head
,
sizeof
(
STqOffsetHead
)))
!=
sizeof
(
STqOffsetHead
))
{
if
(
code
==
0
)
{
break
;
}
else
{
return
-
1
;
}
}
int32_t
size
=
htonl
(
head
.
size
);
void
*
pMemBuf
=
taosMemoryCalloc
(
1
,
size
);
if
(
pMemBuf
==
NULL
)
{
tqError
(
"vgId:%d failed to restore offset from file, since out of memory, malloc size:%d"
,
vgId
,
size
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
if
((
code
=
taosReadFile
(
pFile
,
pMemBuf
,
size
))
!=
size
)
{
taosMemoryFree
(
pMemBuf
);
return
-
1
;
}
STqOffset
offset
;
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
pMemBuf
,
size
);
if
(
tDecodeSTqOffset
(
&
decoder
,
&
offset
)
<
0
)
{
taosMemoryFree
(
pMemBuf
);
tDecoderClear
(
&
decoder
);
if
(
taosHashPut
(
pStore
->
pHash
,
offset
.
subKey
,
strlen
(
offset
.
subKey
),
&
offset
,
sizeof
(
STqOffset
))
<
0
)
{
return
-
1
;
}
return
code
;
}
tDecoderClear
(
&
decoder
);
if
(
taosHashPut
(
pStore
->
pHash
,
offset
.
subKey
,
strlen
(
offset
.
subKey
),
&
offset
,
sizeof
(
STqOffset
))
<
0
)
{
return
-
1
;
}
if
(
offset
.
val
.
type
==
TMQ_OFFSET__LOG
)
{
STqHandle
*
pHandle
=
taosHashGet
(
pStore
->
pTq
->
pHandle
,
offset
.
subKey
,
strlen
(
offset
.
subKey
));
if
(
pHandle
)
{
if
(
walRefVer
(
pHandle
->
pRef
,
offset
.
val
.
version
)
<
0
)
{
tqError
(
"vgId: %d, tq handle %s ref ver %"
PRId64
"error"
,
pStore
->
pTq
->
pVnode
->
config
.
vgId
,
pHandle
->
subKey
,
offset
.
val
.
version
);
}
// todo remove this
if
(
offset
.
val
.
type
==
TMQ_OFFSET__LOG
)
{
STqHandle
*
pHandle
=
taosHashGet
(
pStore
->
pTq
->
pHandle
,
offset
.
subKey
,
strlen
(
offset
.
subKey
));
if
(
pHandle
)
{
if
(
walRefVer
(
pHandle
->
pRef
,
offset
.
val
.
version
)
<
0
)
{
// tqError("vgId: %d, tq handle %s ref ver %" PRId64 "error", pStore->pTq->pVnode->config.vgId, pHandle->subKey,
// offset.val.version);
}
}
taosMemoryFree
(
memBuf
);
}
taos
CloseFile
(
&
pFile
);
taos
MemoryFree
(
pMemBuf
);
}
return
0
;
taosCloseFile
(
&
pFile
);
return
TSDB_CODE_SUCCESS
;
}
STqOffsetStore
*
tqOffsetOpen
(
STQ
*
pTq
)
{
...
...
@@ -89,6 +99,7 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) {
if
(
pStore
==
NULL
)
{
return
NULL
;
}
pStore
->
pTq
=
pTq
;
pStore
->
needCommit
=
0
;
pTq
->
pOffsetStore
=
pStore
;
...
...
@@ -98,12 +109,14 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) {
taosMemoryFree
(
pStore
);
return
NULL
;
}
char
*
fname
=
tqOffsetBuildFName
(
pStore
->
pTq
->
path
,
0
);
if
(
tqOffsetRestoreFromFile
(
pStore
,
fname
)
<
0
)
{
taosMemoryFree
(
fname
);
taosMemoryFree
(
pStore
);
return
NULL
;
}
taosMemoryFree
(
fname
);
return
pStore
;
}
...
...
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
563fca5c
...
...
@@ -335,21 +335,6 @@ int32_t tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t v
}
if
(
msgType
==
TDMT_VND_SUBMIT
)
{
#if 0
void* data = taosMemoryMalloc(len);
if (data == NULL) {
// todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then retry
terrno = TSDB_CODE_OUT_OF_MEMORY;
tqError("vgId:%d, failed to copy submit data for stream processing, since out of memory", vgId);
return -1;
}
memcpy(data, pReq, len);
SPackedData submit = {.msgStr = data, .msgLen = len, .ver = ver};
tqDebug("vgId:%d tq copy submit msg:%p len:%d ver:%" PRId64 " from %p for stream", vgId, data, len, ver, pReq);
tqProcessSubmitReq(pTq, submit);
#endif
SPackedData
submit
=
{
0
};
tqProcessSubmitReq
(
pTq
,
submit
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录