Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ea0b090c
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ea0b090c
编写于
11月 15, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
11月 15, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18147 from taosdata/feature/stream
fix: memory leak
上级
6c91e46b
efde22f0
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
30 addition
and
16 deletion
+30
-16
include/common/tmsg.h
include/common/tmsg.h
+1
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+1
-0
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+1
-0
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+1
-2
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+5
-3
source/dnode/vnode/src/tq/tqMeta.c
source/dnode/vnode/src/tq/tqMeta.c
+2
-2
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+10
-8
source/libs/wal/src/walMgmt.c
source/libs/wal/src/walMgmt.c
+8
-0
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+1
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
ea0b090c
...
@@ -2627,6 +2627,7 @@ typedef struct {
...
@@ -2627,6 +2627,7 @@ typedef struct {
int32_t
tEncodeSTqCheckInfo
(
SEncoder
*
pEncoder
,
const
STqCheckInfo
*
pInfo
);
int32_t
tEncodeSTqCheckInfo
(
SEncoder
*
pEncoder
,
const
STqCheckInfo
*
pInfo
);
int32_t
tDecodeSTqCheckInfo
(
SDecoder
*
pDecoder
,
STqCheckInfo
*
pInfo
);
int32_t
tDecodeSTqCheckInfo
(
SDecoder
*
pDecoder
,
STqCheckInfo
*
pInfo
);
void
tDeleteSTqCheckInfo
(
STqCheckInfo
*
pInfo
);
typedef
struct
{
typedef
struct
{
char
topic
[
TSDB_TOPIC_FNAME_LEN
];
char
topic
[
TSDB_TOPIC_FNAME_LEN
];
...
...
source/common/src/tmsg.c
浏览文件 @
ea0b090c
...
@@ -5903,6 +5903,7 @@ int32_t tDecodeSTqCheckInfo(SDecoder *pDecoder, STqCheckInfo *pInfo) {
...
@@ -5903,6 +5903,7 @@ int32_t tDecodeSTqCheckInfo(SDecoder *pDecoder, STqCheckInfo *pInfo) {
}
}
return
0
;
return
0
;
}
}
void
tDeleteSTqCheckInfo
(
STqCheckInfo
*
pInfo
)
{
taosArrayDestroy
(
pInfo
->
colIdList
);
}
int32_t
tEncodeDeleteRes
(
SEncoder
*
pCoder
,
const
SDeleteRes
*
pRes
)
{
int32_t
tEncodeDeleteRes
(
SEncoder
*
pCoder
,
const
SDeleteRes
*
pRes
)
{
int32_t
nUid
=
taosArrayGetSize
(
pRes
->
uidList
);
int32_t
nUid
=
taosArrayGetSize
(
pRes
->
uidList
);
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
ea0b090c
...
@@ -235,6 +235,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -235,6 +235,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
taosHashPut
(
pHash
,
&
pVgEp
->
vgId
,
sizeof
(
int32_t
),
&
outputVg
,
sizeof
(
SMqRebOutputVg
));
taosHashPut
(
pHash
,
&
pVgEp
->
vgId
,
sizeof
(
int32_t
),
&
outputVg
,
sizeof
(
SMqRebOutputVg
));
mInfo
(
"mq rebalance: remove vgId:%d from consumer:%"
PRId64
,
pVgEp
->
vgId
,
consumerId
);
mInfo
(
"mq rebalance: remove vgId:%d from consumer:%"
PRId64
,
pVgEp
->
vgId
,
consumerId
);
}
}
taosArrayDestroy
(
pConsumerEp
->
vgs
);
taosHashRemove
(
pOutput
->
pSub
->
consumerHash
,
&
consumerId
,
sizeof
(
int64_t
));
taosHashRemove
(
pOutput
->
pSub
->
consumerHash
,
&
consumerId
,
sizeof
(
int64_t
));
// put into removed
// put into removed
taosArrayPush
(
pOutput
->
removedConsumers
,
&
consumerId
);
taosArrayPush
(
pOutput
->
removedConsumers
,
&
consumerId
);
...
...
source/dnode/vnode/src/inc/tq.h
浏览文件 @
ea0b090c
...
@@ -89,7 +89,6 @@ typedef struct {
...
@@ -89,7 +89,6 @@ typedef struct {
STqExecDb
execDb
;
STqExecDb
execDb
;
};
};
int32_t
numOfCols
;
// number of out pout column, temporarily used
int32_t
numOfCols
;
// number of out pout column, temporarily used
SSchemaWrapper
*
pSchemaWrapper
;
// columns that are involved in query
}
STqExecHandle
;
}
STqExecHandle
;
typedef
struct
{
typedef
struct
{
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
ea0b090c
...
@@ -55,6 +55,7 @@ static void destroySTqHandle(void* data) {
...
@@ -55,6 +55,7 @@ static void destroySTqHandle(void* data) {
STqHandle
*
pData
=
(
STqHandle
*
)
data
;
STqHandle
*
pData
=
(
STqHandle
*
)
data
;
qDestroyTask
(
pData
->
execHandle
.
task
);
qDestroyTask
(
pData
->
execHandle
.
task
);
if
(
pData
->
execHandle
.
subType
==
TOPIC_SUB_TYPE__COLUMN
)
{
if
(
pData
->
execHandle
.
subType
==
TOPIC_SUB_TYPE__COLUMN
)
{
taosMemoryFreeClear
(
pData
->
execHandle
.
execCol
.
qmsg
);
}
else
if
(
pData
->
execHandle
.
subType
==
TOPIC_SUB_TYPE__DB
)
{
}
else
if
(
pData
->
execHandle
.
subType
==
TOPIC_SUB_TYPE__DB
)
{
tqCloseReader
(
pData
->
execHandle
.
pExecReader
);
tqCloseReader
(
pData
->
execHandle
.
pExecReader
);
walCloseReader
(
pData
->
pWalReader
);
walCloseReader
(
pData
->
pWalReader
);
...
@@ -80,7 +81,6 @@ STQ* tqOpen(const char* path, SVnode* pVnode) {
...
@@ -80,7 +81,6 @@ STQ* tqOpen(const char* path, SVnode* pVnode) {
pTq
->
pVnode
=
pVnode
;
pTq
->
pVnode
=
pVnode
;
pTq
->
pHandle
=
taosHashInit
(
64
,
MurmurHash3_32
,
true
,
HASH_ENTRY_LOCK
);
pTq
->
pHandle
=
taosHashInit
(
64
,
MurmurHash3_32
,
true
,
HASH_ENTRY_LOCK
);
taosHashSetFreeFp
(
pTq
->
pHandle
,
destroySTqHandle
);
taosHashSetFreeFp
(
pTq
->
pHandle
,
destroySTqHandle
);
taosInitRWLatch
(
&
pTq
->
pushLock
);
taosInitRWLatch
(
&
pTq
->
pushLock
);
...
@@ -88,6 +88,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode) {
...
@@ -88,6 +88,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode) {
taosHashSetFreeFp
(
pTq
->
pPushMgr
,
tqPushEntryFree
);
taosHashSetFreeFp
(
pTq
->
pPushMgr
,
tqPushEntryFree
);
pTq
->
pCheckInfo
=
taosHashInit
(
64
,
MurmurHash3_32
,
true
,
HASH_ENTRY_LOCK
);
pTq
->
pCheckInfo
=
taosHashInit
(
64
,
MurmurHash3_32
,
true
,
HASH_ENTRY_LOCK
);
taosHashSetFreeFp
(
pTq
->
pCheckInfo
,
(
FDelete
)
tDeleteSTqCheckInfo
);
if
(
tqMetaOpen
(
pTq
)
<
0
)
{
if
(
tqMetaOpen
(
pTq
)
<
0
)
{
ASSERT
(
0
);
ASSERT
(
0
);
...
@@ -779,6 +780,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
...
@@ -779,6 +780,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
}
}
if
(
req
.
newConsumerId
==
-
1
)
{
if
(
req
.
newConsumerId
==
-
1
)
{
tqError
(
"vgId:%d, tq invalid rebalance request, new consumerId %"
PRId64
""
,
req
.
vgId
,
req
.
newConsumerId
);
tqError
(
"vgId:%d, tq invalid rebalance request, new consumerId %"
PRId64
""
,
req
.
vgId
,
req
.
newConsumerId
);
taosMemoryFree
(
req
.
qmsg
);
return
0
;
return
0
;
}
}
STqHandle
tqHandle
=
{
0
};
STqHandle
tqHandle
=
{
0
};
...
@@ -815,8 +817,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
...
@@ -815,8 +817,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
req
.
qmsg
=
NULL
;
req
.
qmsg
=
NULL
;
pHandle
->
execHandle
.
task
=
pHandle
->
execHandle
.
task
=
qCreateQueueExecTaskInfo
(
pHandle
->
execHandle
.
execCol
.
qmsg
,
&
handle
,
&
pHandle
->
execHandle
.
numOfCols
,
qCreateQueueExecTaskInfo
(
pHandle
->
execHandle
.
execCol
.
qmsg
,
&
handle
,
&
pHandle
->
execHandle
.
numOfCols
,
NULL
);
&
pHandle
->
execHandle
.
pSchemaWrapper
);
ASSERT
(
pHandle
->
execHandle
.
task
);
ASSERT
(
pHandle
->
execHandle
.
task
);
void
*
scanner
=
NULL
;
void
*
scanner
=
NULL
;
qExtractStreamScanner
(
pHandle
->
execHandle
.
task
,
&
scanner
);
qExtractStreamScanner
(
pHandle
->
execHandle
.
task
,
&
scanner
);
...
@@ -864,6 +865,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
...
@@ -864,6 +865,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
atomic_store_32
(
&
pHandle
->
epoch
,
-
1
);
atomic_store_32
(
&
pHandle
->
epoch
,
-
1
);
atomic_store_64
(
&
pHandle
->
consumerId
,
req
.
newConsumerId
);
atomic_store_64
(
&
pHandle
->
consumerId
,
req
.
newConsumerId
);
atomic_add_fetch_32
(
&
pHandle
->
epoch
,
1
);
atomic_add_fetch_32
(
&
pHandle
->
epoch
,
1
);
taosMemoryFree
(
req
.
qmsg
);
if
(
tqMetaSaveHandle
(
pTq
,
req
.
subKey
,
pHandle
)
<
0
)
{
if
(
tqMetaSaveHandle
(
pTq
,
req
.
subKey
,
pHandle
)
<
0
)
{
// TODO
// TODO
ASSERT
(
0
);
ASSERT
(
0
);
...
...
source/dnode/vnode/src/tq/tqMeta.c
浏览文件 @
ea0b090c
...
@@ -305,8 +305,8 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
...
@@ -305,8 +305,8 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
};
};
if
(
handle
.
execHandle
.
subType
==
TOPIC_SUB_TYPE__COLUMN
)
{
if
(
handle
.
execHandle
.
subType
==
TOPIC_SUB_TYPE__COLUMN
)
{
handle
.
execHandle
.
task
=
qCreateQueueExecTaskInfo
(
handle
.
execHandle
.
task
=
handle
.
execHandle
.
execCol
.
qmsg
,
&
reader
,
&
handle
.
execHandle
.
numOfCols
,
&
handle
.
execHandle
.
pSchemaWrapper
);
qCreateQueueExecTaskInfo
(
handle
.
execHandle
.
execCol
.
qmsg
,
&
reader
,
&
handle
.
execHandle
.
numOfCols
,
NULL
);
ASSERT
(
handle
.
execHandle
.
task
);
ASSERT
(
handle
.
execHandle
.
task
);
void
*
scanner
=
NULL
;
void
*
scanner
=
NULL
;
qExtractStreamScanner
(
handle
.
execHandle
.
task
,
&
scanner
);
qExtractStreamScanner
(
handle
.
execHandle
.
task
,
&
scanner
);
...
...
source/libs/executor/src/executor.c
浏览文件 @
ea0b090c
...
@@ -246,7 +246,9 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
...
@@ -246,7 +246,9 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
}
}
}
}
if
(
pSchema
)
{
*
pSchema
=
tCloneSSchemaWrapper
(((
SExecTaskInfo
*
)
pTaskInfo
)
->
schemaInfo
.
qsw
);
*
pSchema
=
tCloneSSchemaWrapper
(((
SExecTaskInfo
*
)
pTaskInfo
)
->
schemaInfo
.
qsw
);
}
return
pTaskInfo
;
return
pTaskInfo
;
}
}
...
@@ -659,7 +661,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
...
@@ -659,7 +661,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
return
pTaskInfo
->
code
;
return
pTaskInfo
->
code
;
}
}
int32_t
qAppendTaskStopInfo
(
SExecTaskInfo
*
pTaskInfo
,
SExchangeOpStopInfo
*
pInfo
)
{
int32_t
qAppendTaskStopInfo
(
SExecTaskInfo
*
pTaskInfo
,
SExchangeOpStopInfo
*
pInfo
)
{
taosWLockLatch
(
&
pTaskInfo
->
stopInfo
.
lock
);
taosWLockLatch
(
&
pTaskInfo
->
stopInfo
.
lock
);
taosArrayPush
(
pTaskInfo
->
stopInfo
.
pStopInfo
,
pInfo
);
taosArrayPush
(
pTaskInfo
->
stopInfo
.
pStopInfo
,
pInfo
);
taosWUnLockLatch
(
&
pTaskInfo
->
stopInfo
.
lock
);
taosWUnLockLatch
(
&
pTaskInfo
->
stopInfo
.
lock
);
...
@@ -680,7 +682,7 @@ int32_t stopInfoComp(void const* lp, void const* rp) {
...
@@ -680,7 +682,7 @@ int32_t stopInfoComp(void const* lp, void const* rp) {
return
0
;
return
0
;
}
}
void
qRemoveTaskStopInfo
(
SExecTaskInfo
*
pTaskInfo
,
SExchangeOpStopInfo
*
pInfo
)
{
void
qRemoveTaskStopInfo
(
SExecTaskInfo
*
pTaskInfo
,
SExchangeOpStopInfo
*
pInfo
)
{
taosWLockLatch
(
&
pTaskInfo
->
stopInfo
.
lock
);
taosWLockLatch
(
&
pTaskInfo
->
stopInfo
.
lock
);
int32_t
idx
=
taosArraySearchIdx
(
pTaskInfo
->
stopInfo
.
pStopInfo
,
pInfo
,
stopInfoComp
,
TD_EQ
);
int32_t
idx
=
taosArraySearchIdx
(
pTaskInfo
->
stopInfo
.
pStopInfo
,
pInfo
,
stopInfoComp
,
TD_EQ
);
if
(
idx
>=
0
)
{
if
(
idx
>=
0
)
{
...
@@ -696,7 +698,7 @@ void qStopTaskOperators(SExecTaskInfo* pTaskInfo) {
...
@@ -696,7 +698,7 @@ void qStopTaskOperators(SExecTaskInfo* pTaskInfo) {
int32_t
num
=
taosArrayGetSize
(
pTaskInfo
->
stopInfo
.
pStopInfo
);
int32_t
num
=
taosArrayGetSize
(
pTaskInfo
->
stopInfo
.
pStopInfo
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SExchangeOpStopInfo
*
pStop
=
taosArrayGet
(
pTaskInfo
->
stopInfo
.
pStopInfo
,
i
);
SExchangeOpStopInfo
*
pStop
=
taosArrayGet
(
pTaskInfo
->
stopInfo
.
pStopInfo
,
i
);
SExchangeInfo
*
pExchangeInfo
=
taosAcquireRef
(
exchangeObjRefPool
,
pStop
->
refId
);
SExchangeInfo
*
pExchangeInfo
=
taosAcquireRef
(
exchangeObjRefPool
,
pStop
->
refId
);
if
(
pExchangeInfo
)
{
if
(
pExchangeInfo
)
{
tsem_post
(
&
pExchangeInfo
->
ready
);
tsem_post
(
&
pExchangeInfo
->
ready
);
...
...
source/libs/wal/src/walMgmt.c
浏览文件 @
ea0b090c
...
@@ -203,6 +203,14 @@ void walClose(SWal *pWal) {
...
@@ -203,6 +203,14 @@ void walClose(SWal *pWal) {
pWal
->
pIdxFile
=
NULL
;
pWal
->
pIdxFile
=
NULL
;
taosArrayDestroy
(
pWal
->
fileInfoSet
);
taosArrayDestroy
(
pWal
->
fileInfoSet
);
pWal
->
fileInfoSet
=
NULL
;
pWal
->
fileInfoSet
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
pIter
=
taosHashIterate
(
pWal
->
pRefHash
,
pIter
);
if
(
pIter
==
NULL
)
break
;
SWalRef
*
pRef
=
*
(
SWalRef
**
)
pIter
;
taosMemoryFree
(
pRef
);
}
taosHashCleanup
(
pWal
->
pRefHash
);
taosHashCleanup
(
pWal
->
pRefHash
);
taosThreadMutexUnlock
(
&
pWal
->
mutex
);
taosThreadMutexUnlock
(
&
pWal
->
mutex
);
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
ea0b090c
...
@@ -26,7 +26,7 @@ int32_t walRestoreFromSnapshot(SWal *pWal, int64_t ver) {
...
@@ -26,7 +26,7 @@ int32_t walRestoreFromSnapshot(SWal *pWal, int64_t ver) {
while
(
1
)
{
while
(
1
)
{
pIter
=
taosHashIterate
(
pWal
->
pRefHash
,
pIter
);
pIter
=
taosHashIterate
(
pWal
->
pRefHash
,
pIter
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
SWalRef
*
pRef
=
(
SWalRef
*
)
pIter
;
SWalRef
*
pRef
=
*
(
SWalRef
*
*
)
pIter
;
if
(
pRef
->
refVer
!=
-
1
&&
pRef
->
refVer
<=
ver
)
{
if
(
pRef
->
refVer
!=
-
1
&&
pRef
->
refVer
<=
ver
)
{
taosHashCancelIterate
(
pWal
->
pRefHash
,
pIter
);
taosHashCancelIterate
(
pWal
->
pRefHash
,
pIter
);
taosThreadMutexUnlock
(
&
pWal
->
mutex
);
taosThreadMutexUnlock
(
&
pWal
->
mutex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录