Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b0f36f57
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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,发现更多精彩内容 >>
未验证
提交
b0f36f57
编写于
11月 12, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
11月 12, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18077 from taosdata/fix/TD-20347
fix: fix tablemeta leak
上级
9307af8b
df950055
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
13 deletion
+20
-13
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+2
-1
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+18
-12
未找到文件。
source/libs/catalog/src/ctgAsync.c
浏览文件 @
b0f36f57
...
@@ -1204,11 +1204,12 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
...
@@ -1204,11 +1204,12 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
stbCtx
.
flag
=
flag
;
stbCtx
.
flag
=
flag
;
stbCtx
.
pName
=
&
stbName
;
stbCtx
.
pName
=
&
stbName
;
STableMeta
*
stbMeta
=
NULL
;
STableMeta
*
stbMeta
=
NULL
;
ctgReadTbMetaFromCache
(
pCtg
,
&
stbCtx
,
&
stbMeta
);
ctgReadTbMetaFromCache
(
pCtg
,
&
stbCtx
,
&
stbMeta
);
if
(
stbMeta
&&
stbMeta
->
sversion
>=
pOut
->
tbMeta
->
sversion
)
{
if
(
stbMeta
&&
stbMeta
->
sversion
>=
pOut
->
tbMeta
->
sversion
)
{
ctgDebug
(
"use cached stb meta, tbName:%s"
,
tNameGetTableName
(
pName
));
ctgDebug
(
"use cached stb meta, tbName:%s"
,
tNameGetTableName
(
pName
));
exist
=
1
;
exist
=
1
;
taosMemoryFreeClear
(
stbMeta
);
}
else
{
}
else
{
ctgDebug
(
"need to get/update stb meta, tbName:%s"
,
tNameGetTableName
(
pName
));
ctgDebug
(
"need to get/update stb meta, tbName:%s"
,
tNameGetTableName
(
pName
));
taosMemoryFreeClear
(
pOut
->
tbMeta
);
taosMemoryFreeClear
(
pOut
->
tbMeta
);
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
b0f36f57
...
@@ -72,8 +72,8 @@ void ctgRUnlockVgInfo(SCtgDBCache *dbCache) { CTG_UNLOCK(CTG_READ, &dbCache->vgC
...
@@ -72,8 +72,8 @@ void ctgRUnlockVgInfo(SCtgDBCache *dbCache) { CTG_UNLOCK(CTG_READ, &dbCache->vgC
void
ctgWUnlockVgInfo
(
SCtgDBCache
*
dbCache
)
{
CTG_UNLOCK
(
CTG_WRITE
,
&
dbCache
->
vgCache
.
vgLock
);
}
void
ctgWUnlockVgInfo
(
SCtgDBCache
*
dbCache
)
{
CTG_UNLOCK
(
CTG_WRITE
,
&
dbCache
->
vgCache
.
vgLock
);
}
void
ctgReleaseDBCache
(
SCatalog
*
pCtg
,
SCtgDBCache
*
dbCache
)
{
void
ctgReleaseDBCache
(
SCatalog
*
pCtg
,
SCtgDBCache
*
dbCache
)
{
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
dbLock
);
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
dbLock
);
taosHashRelease
(
pCtg
->
dbCache
,
dbCache
);
taosHashRelease
(
pCtg
->
dbCache
,
dbCache
);
}
}
...
@@ -90,7 +90,7 @@ int32_t ctgAcquireDBCacheImpl(SCatalog *pCtg, const char *dbFName, SCtgDBCache *
...
@@ -90,7 +90,7 @@ int32_t ctgAcquireDBCacheImpl(SCatalog *pCtg, const char *dbFName, SCtgDBCache *
}
else
{
}
else
{
dbCache
=
(
SCtgDBCache
*
)
taosHashGet
(
pCtg
->
dbCache
,
dbFName
,
strlen
(
dbFName
));
dbCache
=
(
SCtgDBCache
*
)
taosHashGet
(
pCtg
->
dbCache
,
dbFName
,
strlen
(
dbFName
));
}
}
if
(
NULL
==
dbCache
)
{
if
(
NULL
==
dbCache
)
{
*
pCache
=
NULL
;
*
pCache
=
NULL
;
ctgDebug
(
"db not in cache, dbFName:%s"
,
dbFName
);
ctgDebug
(
"db not in cache, dbFName:%s"
,
dbFName
);
...
@@ -422,6 +422,7 @@ _return:
...
@@ -422,6 +422,7 @@ _return:
ctgReleaseTbMetaToCache
(
pCtg
,
dbCache
,
tbCache
);
ctgReleaseTbMetaToCache
(
pCtg
,
dbCache
,
tbCache
);
taosMemoryFreeClear
(
*
pTableMeta
);
taosMemoryFreeClear
(
*
pTableMeta
);
*
pTableMeta
=
NULL
;
CTG_RET
(
code
);
CTG_RET
(
code
);
}
}
...
@@ -1436,7 +1437,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
...
@@ -1436,7 +1437,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
if
(
pCache
)
{
if
(
pCache
)
{
CTG_ERR_RET
(
ctgUpdateRentStbVersion
(
pCtg
,
dbFName
,
tbName
,
dbId
,
meta
->
suid
,
pCache
));
CTG_ERR_RET
(
ctgUpdateRentStbVersion
(
pCtg
,
dbFName
,
tbName
,
dbId
,
meta
->
suid
,
pCache
));
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1565,7 +1566,8 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
...
@@ -1565,7 +1566,8 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
}
}
bool
newAdded
=
false
;
bool
newAdded
=
false
;
SDbVgVersion
vgVersion
=
{.
dbId
=
msg
->
dbId
,
.
vgVersion
=
dbInfo
->
vgVersion
,
.
numOfTable
=
dbInfo
->
numOfTable
,
.
stateTs
=
dbInfo
->
stateTs
};
SDbVgVersion
vgVersion
=
{
.
dbId
=
msg
->
dbId
,
.
vgVersion
=
dbInfo
->
vgVersion
,
.
numOfTable
=
dbInfo
->
numOfTable
,
.
stateTs
=
dbInfo
->
stateTs
};
SCtgDBCache
*
dbCache
=
NULL
;
SCtgDBCache
*
dbCache
=
NULL
;
CTG_ERR_JRET
(
ctgGetAddDBCache
(
msg
->
pCtg
,
dbFName
,
msg
->
dbId
,
&
dbCache
));
CTG_ERR_JRET
(
ctgGetAddDBCache
(
msg
->
pCtg
,
dbFName
,
msg
->
dbId
,
&
dbCache
));
...
@@ -1581,15 +1583,17 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
...
@@ -1581,15 +1583,17 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
SDBVgInfo
*
vgInfo
=
vgCache
->
vgInfo
;
SDBVgInfo
*
vgInfo
=
vgCache
->
vgInfo
;
if
(
dbInfo
->
vgVersion
<
vgInfo
->
vgVersion
)
{
if
(
dbInfo
->
vgVersion
<
vgInfo
->
vgVersion
)
{
ctgDebug
(
"db updateVgroup is ignored, dbFName:%s, vgVer:%d, curVer:%d"
,
dbFName
,
dbInfo
->
vgVersion
,
vgInfo
->
vgVersion
);
ctgDebug
(
"db updateVgroup is ignored, dbFName:%s, vgVer:%d, curVer:%d"
,
dbFName
,
dbInfo
->
vgVersion
,
vgInfo
->
vgVersion
);
ctgWUnlockVgInfo
(
dbCache
);
ctgWUnlockVgInfo
(
dbCache
);
goto
_return
;
goto
_return
;
}
}
if
(
dbInfo
->
vgVersion
==
vgInfo
->
vgVersion
&&
dbInfo
->
numOfTable
==
vgInfo
->
numOfTable
&&
dbInfo
->
stateTs
==
vgInfo
->
stateTs
)
{
if
(
dbInfo
->
vgVersion
==
vgInfo
->
vgVersion
&&
dbInfo
->
numOfTable
==
vgInfo
->
numOfTable
&&
ctgDebug
(
"no new db vgroup update info, dbFName:%s, vgVer:%d, numOfTable:%d, stateTs:%"
PRId64
,
dbFName
,
dbInfo
->
vgVersion
,
dbInfo
->
stateTs
==
vgInfo
->
stateTs
)
{
dbInfo
->
numOfTable
,
dbInfo
->
stateTs
);
ctgDebug
(
"no new db vgroup update info, dbFName:%s, vgVer:%d, numOfTable:%d, stateTs:%"
PRId64
,
dbFName
,
dbInfo
->
vgVersion
,
dbInfo
->
numOfTable
,
dbInfo
->
stateTs
);
ctgWUnlockVgInfo
(
dbCache
);
ctgWUnlockVgInfo
(
dbCache
);
goto
_return
;
goto
_return
;
...
@@ -1601,7 +1605,8 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
...
@@ -1601,7 +1605,8 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
vgCache
->
vgInfo
=
dbInfo
;
vgCache
->
vgInfo
=
dbInfo
;
msg
->
dbInfo
=
NULL
;
msg
->
dbInfo
=
NULL
;
ctgDebug
(
"db vgInfo updated, dbFName:%s, vgVer:%d, stateTs:%"
PRId64
", dbId:0x%"
PRIx64
,
dbFName
,
vgVersion
.
vgVersion
,
vgVersion
.
stateTs
,
vgVersion
.
dbId
);
ctgDebug
(
"db vgInfo updated, dbFName:%s, vgVer:%d, stateTs:%"
PRId64
", dbId:0x%"
PRIx64
,
dbFName
,
vgVersion
.
vgVersion
,
vgVersion
.
stateTs
,
vgVersion
.
dbId
);
ctgWUnlockVgInfo
(
dbCache
);
ctgWUnlockVgInfo
(
dbCache
);
...
@@ -1692,7 +1697,7 @@ int32_t ctgOpUpdateTbMeta(SCtgCacheOperation *operation) {
...
@@ -1692,7 +1697,7 @@ int32_t ctgOpUpdateTbMeta(SCtgCacheOperation *operation) {
if
(
pCtg
->
stopUpdate
)
{
if
(
pCtg
->
stopUpdate
)
{
goto
_return
;
goto
_return
;
}
}
if
((
!
CTG_IS_META_CTABLE
(
pMeta
->
metaType
))
&&
NULL
==
pMeta
->
tbMeta
)
{
if
((
!
CTG_IS_META_CTABLE
(
pMeta
->
metaType
))
&&
NULL
==
pMeta
->
tbMeta
)
{
ctgError
(
"no valid tbmeta got from meta rsp, dbFName:%s, tbName:%s"
,
pMeta
->
dbFName
,
pMeta
->
tbName
);
ctgError
(
"no valid tbmeta got from meta rsp, dbFName:%s, tbName:%s"
,
pMeta
->
dbFName
,
pMeta
->
tbName
);
CTG_ERR_JRET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
CTG_ERR_JRET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
...
@@ -1902,7 +1907,7 @@ int32_t ctgOpUpdateEpset(SCtgCacheOperation *operation) {
...
@@ -1902,7 +1907,7 @@ int32_t ctgOpUpdateEpset(SCtgCacheOperation *operation) {
int32_t
code
=
0
;
int32_t
code
=
0
;
SCtgUpdateEpsetMsg
*
msg
=
operation
->
data
;
SCtgUpdateEpsetMsg
*
msg
=
operation
->
data
;
SCatalog
*
pCtg
=
msg
->
pCtg
;
SCatalog
*
pCtg
=
msg
->
pCtg
;
SCtgDBCache
*
dbCache
=
NULL
;
SCtgDBCache
*
dbCache
=
NULL
;
if
(
pCtg
->
stopUpdate
)
{
if
(
pCtg
->
stopUpdate
)
{
goto
_return
;
goto
_return
;
...
@@ -2209,6 +2214,7 @@ int32_t ctgGetTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta **p
...
@@ -2209,6 +2214,7 @@ int32_t ctgGetTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta **p
}
}
taosMemoryFreeClear
(
*
pTableMeta
);
taosMemoryFreeClear
(
*
pTableMeta
);
*
pTableMeta
=
NULL
;
}
}
if
(
CTG_FLAG_IS_UNKNOWN_STB
(
ctx
->
flag
))
{
if
(
CTG_FLAG_IS_UNKNOWN_STB
(
ctx
->
flag
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录