Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fab0adde
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
fab0adde
编写于
9月 28, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix memory error
上级
057edd92
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
9 deletion
+24
-9
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+9
-2
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+14
-6
未找到文件。
source/dnode/vnode/src/inc/tq.h
浏览文件 @
fab0adde
...
...
@@ -116,7 +116,7 @@ typedef struct {
typedef
struct
{
SMqDataRsp
dataRsp
;
SMqRspHead
rspHead
;
STqHandle
*
pHandle
;
char
subKey
[
TSDB_SUBSCRIBE_KEY_LEN
]
;
SRpcHandleInfo
pInfo
;
}
STqPushEntry
;
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
fab0adde
...
...
@@ -554,8 +554,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
if
(
dataRsp
.
blockNum
==
0
)
{
STqPushEntry
*
pPushEntry
=
taosMemoryCalloc
(
1
,
sizeof
(
STqPushEntry
));
if
(
pPushEntry
!=
NULL
)
{
pPushEntry
->
pHandle
=
pHandle
;
pPushEntry
->
pInfo
=
pMsg
->
info
;
memcpy
(
pPushEntry
->
subKey
,
pHandle
->
subKey
,
TSDB_SUBSCRIBE_KEY_LEN
);
dataRsp
.
withTbName
=
0
;
memcpy
(
&
pPushEntry
->
dataRsp
,
&
dataRsp
,
sizeof
(
SMqDataRsp
));
pPushEntry
->
rspHead
.
consumerId
=
consumerId
;
...
...
@@ -704,7 +704,14 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
int32_t
tqProcessVgDeleteReq
(
STQ
*
pTq
,
int64_t
version
,
char
*
msg
,
int32_t
msgLen
)
{
SMqVDeleteReq
*
pReq
=
(
SMqVDeleteReq
*
)
msg
;
int32_t
code
=
taosHashRemove
(
pTq
->
pHandle
,
pReq
->
subKey
,
strlen
(
pReq
->
subKey
));
taosWLockLatch
(
&
pTq
->
pushLock
);
int32_t
code
=
taosHashRemove
(
pTq
->
pPushMgr
,
pReq
->
subKey
,
strlen
(
pReq
->
subKey
));
if
(
code
!=
0
)
{
tqDebug
(
"vgId:%d, tq remove push handle %s"
,
pTq
->
pVnode
->
config
.
vgId
,
pReq
->
subKey
);
}
taosWUnLockLatch
(
&
pTq
->
pushLock
);
code
=
taosHashRemove
(
pTq
->
pHandle
,
pReq
->
subKey
,
strlen
(
pReq
->
subKey
));
if
(
code
!=
0
)
{
tqError
(
"cannot process tq delete req %s, since no such handle"
,
pReq
->
subKey
);
}
...
...
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
fab0adde
...
...
@@ -213,11 +213,12 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_
#endif
int
tqPushMsg
(
STQ
*
pTq
,
void
*
msg
,
int32_t
msgLen
,
tmsg_t
msgType
,
int64_t
ver
)
{
tqDebug
(
"vgId:%d tq push msg ver %ld
"
,
pTq
->
pVnode
->
config
.
vgId
,
ver
);
tqDebug
(
"vgId:%d tq push msg ver %ld
, type: %s"
,
pTq
->
pVnode
->
config
.
vgId
,
ver
,
TMSG_INFO
(
msgType
)
);
if
(
msgType
==
TDMT_VND_SUBMIT
)
{
// lock push mgr to avoid potential msg lost
taosWLockLatch
(
&
pTq
->
pushLock
);
tqDebug
(
"vgId:%d push handle num %d"
,
pTq
->
pVnode
->
config
.
vgId
,
taosHashGetSize
(
pTq
->
pPushMgr
));
if
(
taosHashGetSize
(
pTq
->
pPushMgr
)
!=
0
)
{
SArray
*
cachedKeys
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
SArray
*
cachedKeyLens
=
taosArrayInit
(
0
,
sizeof
(
size_t
));
...
...
@@ -235,10 +236,17 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
while
(
1
)
{
pIter
=
taosHashIterate
(
pTq
->
pPushMgr
,
pIter
);
if
(
pIter
==
NULL
)
break
;
STqPushEntry
*
pPushEntry
=
*
(
STqPushEntry
**
)
pIter
;
STqExecHandle
*
pExec
=
&
pPushEntry
->
pHandle
->
execHandle
;
STqPushEntry
*
pPushEntry
=
*
(
STqPushEntry
**
)
pIter
;
STqHandle
*
pHandle
=
taosHashGet
(
pTq
->
pHandle
,
pPushEntry
->
subKey
,
strlen
(
pPushEntry
->
subKey
));
if
(
pHandle
==
NULL
)
{
tqDebug
(
"vgId:%d cannot find handle %s"
,
pTq
->
pVnode
->
config
.
vgId
,
pPushEntry
->
subKey
);
continue
;
}
STqExecHandle
*
pExec
=
&
pHandle
->
execHandle
;
qTaskInfo_t
task
=
pExec
->
task
;
SMqDataRsp
*
pRsp
=
&
pPushEntry
->
dataRsp
;
SMqDataRsp
*
pRsp
=
&
pPushEntry
->
dataRsp
;
// prepare scan mem data
qStreamScanMemData
(
task
,
pReq
);
...
...
@@ -259,8 +267,8 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
pRsp
->
blockNum
++
;
}
tqDebug
(
"vgId:%d tq handle push, subkey: %s, block num: %d"
,
pTq
->
pVnode
->
config
.
vgId
,
p
PushEntry
->
pHandle
->
subKey
,
p
Rsp
->
blockNum
);
tqDebug
(
"vgId:%d tq handle push, subkey: %s, block num: %d"
,
pTq
->
pVnode
->
config
.
vgId
,
pPushEntry
->
subKey
,
pRsp
->
blockNum
);
if
(
pRsp
->
blockNum
>
0
)
{
// set offset
tqOffsetResetToLog
(
&
pRsp
->
rspOffset
,
ver
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录