Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9d8e3e0c
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,发现更多精彩内容 >>
提交
9d8e3e0c
编写于
2月 10, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix mem leak
上级
cf129cac
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
17 deletion
+50
-17
source/dnode/mnode/impl/src/mndIndex.c
source/dnode/mnode/impl/src/mndIndex.c
+4
-3
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+46
-14
未找到文件。
source/dnode/mnode/impl/src/mndIndex.c
浏览文件 @
9d8e3e0c
...
...
@@ -62,6 +62,7 @@ int32_t mndInitIdx(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_INDEX
,
mndProcessCreateIdxReq
);
// mndSetMsgHandle(pMnode, TDMT_MND_DROP_INDEX, mndProcessDropIdxReq);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_CREATE_INDEX_RSP
,
mndTransProcessRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_DROP_INDEX_RSP
,
mndTransProcessRsp
);
...
...
@@ -421,7 +422,7 @@ static int32_t mndProcessCreateIdxReq(SRpcMsg *pReq) {
pIdx
=
idx
.
pIdx
;
}
if
(
pIdx
!=
NULL
)
{
terrno
=
TSDB_CODE_MND_
SMA
_ALREADY_EXIST
;
terrno
=
TSDB_CODE_MND_
TAG_INDEX
_ALREADY_EXIST
;
goto
_OVER
;
}
...
...
@@ -800,7 +801,7 @@ static int32_t mndAddIndex(SMnode *pMnode, SRpcMsg *pReq, SCreateTagIndexReq *re
memcpy
(
idxObj
.
colName
,
req
->
colName
,
TSDB_COL_NAME_LEN
);
idxObj
.
createdTime
=
taosGetTimestampMs
();
idxObj
.
uid
=
mndGenerateUid
(
req
->
idxName
,
TSDB_TABLE_FNAME_LEN
);
idxObj
.
uid
=
mndGenerateUid
(
req
->
idxName
,
strlen
(
req
->
idxName
)
);
idxObj
.
stbUid
=
pStb
->
uid
;
idxObj
.
dbUid
=
pStb
->
dbUid
;
...
...
@@ -899,7 +900,7 @@ int32_t mndProcessDropTagIdxReq(SRpcMsg *pReq) {
code
=
0
;
goto
_OVER
;
}
else
{
terrno
=
TSDB_CODE_MND_
SMA
_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_
TAG_INDEX
_NOT_EXIST
;
goto
_OVER
;
}
}
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
9d8e3e0c
...
...
@@ -478,7 +478,13 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
void
*
pKey
=
NULL
,
*
pVal
=
NULL
;
int
nKey
=
0
,
nVal
=
0
;
rc
=
tdbTbcNext
(
pCtbIdxc
,
&
pKey
,
&
nKey
,
&
pVal
,
&
nVal
);
if
(
rc
<
0
)
break
;
if
(
rc
<
0
)
{
tdbFree
(
pKey
);
tdbFree
(
pVal
);
tdbTbcClose
(
pCtbIdxc
);
pCtbIdxc
=
NULL
;
break
;
}
if
(((
SCtbIdxKey
*
)
pKey
)
->
suid
!=
suid
)
{
tdbFree
(
pKey
);
tdbFree
(
pVal
);
...
...
@@ -500,10 +506,12 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
pTagData
=
&
(
tagVal
.
i64
);
nTagData
=
tDataTypes
[
pCol
->
type
].
bytes
;
}
if
(
metaCreateTagIdxKey
(
suid
,
pCol
->
colId
,
pTagData
,
nTagData
,
pCol
->
type
,
table
->
uid
,
&
pTagIdxKey
,
&
nTagIdxKey
)
<
0
)
{
rc
=
metaCreateTagIdxKey
(
suid
,
pCol
->
colId
,
pTagData
,
nTagData
,
pCol
->
type
,
table
->
uid
,
&
pTagIdxKey
,
&
nTagIdxKey
);
tdbFree
(
pKey
);
tdbFree
(
pVal
);
if
(
rc
<
0
)
{
metaDestroyTagIdxKey
(
pTagIdxKey
);
tdbTbcClose
(
pCtbIdxc
);
goto
_err
;
}
...
...
@@ -529,8 +537,15 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
if
(
oStbEntry
.
pBuf
)
taosMemoryFree
(
oStbEntry
.
pBuf
);
tDecoderClear
(
&
dc
);
tdbFree
(
pData
);
tdbTbcClose
(
pCtbIdxc
);
return
TSDB_CODE_SUCCESS
;
_err:
if
(
oStbEntry
.
pBuf
)
taosMemoryFree
(
oStbEntry
.
pBuf
);
tDecoderClear
(
&
dc
);
tdbFree
(
pData
);
return
TSDB_CODE_VND_COL_ALREADY_EXISTS
;
}
int
metaDropIndexFromSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SDropIndexReq
*
pReq
)
{
...
...
@@ -557,7 +572,6 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
tbDbKey
.
uid
=
suid
;
tbDbKey
.
version
=
((
SUidIdxVal
*
)
pData
)[
0
].
version
;
tdbTbGet
(
pMeta
->
pTbDb
,
&
tbDbKey
,
sizeof
(
tbDbKey
),
&
pData
,
&
nData
);
tDecoderInit
(
&
dc
,
pData
,
nData
);
ret
=
metaDecodeEntry
(
&
dc
,
&
oStbEntry
);
if
(
ret
<
0
)
{
...
...
@@ -594,7 +608,13 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
void
*
pKey
=
NULL
,
*
pVal
=
NULL
;
int
nKey
=
0
,
nVal
=
0
;
rc
=
tdbTbcNext
(
pCtbIdxc
,
&
pKey
,
&
nKey
,
&
pVal
,
&
nVal
);
if
(
rc
<
0
)
break
;
if
(
rc
<
0
)
{
tdbFree
(
pKey
);
tdbFree
(
pVal
);
tdbTbcClose
(
pCtbIdxc
);
pCtbIdxc
=
NULL
;
break
;
}
if
(((
SCtbIdxKey
*
)
pKey
)
->
suid
!=
suid
)
{
tdbFree
(
pKey
);
tdbFree
(
pVal
);
...
...
@@ -616,13 +636,18 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
pTagData
=
&
(
tagVal
.
i64
);
nTagData
=
tDataTypes
[
pCol
->
type
].
bytes
;
}
if
(
metaCreateTagIdxKey
(
suid
,
pCol
->
colId
,
pTagData
,
nTagData
,
pCol
->
type
,
table
->
uid
,
&
pTagIdxKey
,
&
nTagIdxKey
)
<
0
)
{
rc
=
metaCreateTagIdxKey
(
suid
,
pCol
->
colId
,
pTagData
,
nTagData
,
pCol
->
type
,
table
->
uid
,
&
pTagIdxKey
,
&
nTagIdxKey
);
tdbFree
(
pKey
);
tdbFree
(
pVal
);
if
(
rc
<
0
)
{
metaDestroyTagIdxKey
(
pTagIdxKey
);
tdbTbcClose
(
pCtbIdxc
);
goto
_err
;
}
metaWLock
(
pMeta
);
tdbTbDelete
(
pMeta
->
pTagIdx
,
pTagIdxKey
,
nTagIdxKey
,
pMeta
->
txn
);
metaULock
(
pMeta
);
metaDestroyTagIdxKey
(
pTagIdxKey
);
}
...
...
@@ -641,9 +666,6 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
nStbEntry
.
stbEntry
.
schemaTag
=
*
tag
;
nStbEntry
.
stbEntry
.
rsmaParam
=
oStbEntry
.
stbEntry
.
rsmaParam
;
taosMemoryFree
(
row
);
taosMemoryFree
(
tag
);
metaWLock
(
pMeta
);
// update table.db
metaSaveToTbDb
(
pMeta
,
&
nStbEntry
);
...
...
@@ -651,12 +673,20 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
metaUpdateUidIdx
(
pMeta
,
&
nStbEntry
);
metaULock
(
pMeta
);
tDeleteSSchemaWrapper
(
tag
);
tDeleteSSchemaWrapper
(
row
);
if
(
oStbEntry
.
pBuf
)
taosMemoryFree
(
oStbEntry
.
pBuf
);
tDecoderClear
(
&
dc
);
return
TSDB_CODE_SUCCESS
;
// impl later
tdbFree
(
pData
);
tdbTbcClose
(
pCtbIdxc
);
return
TSDB_CODE_SUCCESS
;
_err:
if
(
oStbEntry
.
pBuf
)
taosMemoryFree
(
oStbEntry
.
pBuf
);
tDecoderClear
(
&
dc
);
tdbFree
(
pData
);
return
-
1
;
}
...
...
@@ -1746,10 +1776,12 @@ static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterT
}
tdbTbcClose
(
pTagIdxc
);
metaWLock
(
pMeta
);
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tagIdxList
);
i
++
)
{
SMetaPair
*
pair
=
taosArrayGet
(
tagIdxList
,
i
);
tdbTbDelete
(
pMeta
->
pTagIdx
,
pair
->
key
,
pair
->
nkey
,
pMeta
->
txn
);
}
metaULock
(
pMeta
);
taosArrayDestroy
(
tagIdxList
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录