Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
07227d7a
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看板
提交
07227d7a
编写于
3月 07, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code optimization
上级
c1370a94
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
17 deletion
+15
-17
include/common/tmsg.h
include/common/tmsg.h
+4
-10
source/dnode/vnode/src/meta/metaBDBImpl.c
source/dnode/vnode/src/meta/metaBDBImpl.c
+4
-2
source/dnode/vnode/test/tsdbSmaTest.cpp
source/dnode/vnode/test/tsdbSmaTest.cpp
+7
-5
未找到文件。
include/common/tmsg.h
浏览文件 @
07227d7a
...
...
@@ -1924,27 +1924,21 @@ typedef struct {
STSma
*
tSma
;
}
STSmaWrapper
;
static
FORCE_INLINE
void
tdDestroyTSma
(
STSma
*
pSma
,
bool
releaseSelf
)
{
static
FORCE_INLINE
void
tdDestroyTSma
(
STSma
*
pSma
)
{
if
(
pSma
)
{
tfree
(
pSma
->
colIds
);
tfree
(
pSma
->
funcIds
);
if
(
releaseSelf
)
{
free
(
pSma
);
}
}
}
static
FORCE_INLINE
void
tdDestroyTSmaWrapper
(
STSmaWrapper
*
pSW
,
bool
releaseSelf
)
{
static
FORCE_INLINE
void
tdDestroyTSmaWrapper
(
STSmaWrapper
*
pSW
)
{
if
(
pSW
)
{
if
(
pSW
->
tSma
)
{
for
(
uint32_t
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
tdDestroyTSma
(
pSW
->
tSma
+
i
,
false
);
tdDestroyTSma
(
pSW
->
tSma
+
i
);
}
tfree
(
pSW
->
tSma
);
}
if
(
releaseSelf
)
{
free
(
pSW
);
}
}
}
...
...
@@ -2031,7 +2025,7 @@ static FORCE_INLINE void* tDecodeTSmaWrapper(void* buf, STSmaWrapper* pSW) {
for
(
uint32_t
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
if
((
buf
=
tDecodeTSma
(
buf
,
pSW
->
tSma
+
i
))
==
NULL
)
{
for
(
uint32_t
j
=
i
;
j
>=
0
;
--
i
)
{
tdDestroyTSma
(
pSW
->
tSma
+
j
,
false
);
tdDestroyTSma
(
pSW
->
tSma
+
j
);
}
free
(
pSW
->
tSma
);
return
NULL
;
...
...
source/dnode/vnode/src/meta/metaBDBImpl.c
浏览文件 @
07227d7a
...
...
@@ -896,14 +896,16 @@ STSmaWrapper *metaGetSmaInfoByUid(SMeta *pMeta, tb_uid_t uid) {
STSma
*
tptr
=
(
STSma
*
)
realloc
(
pSW
->
tSma
,
pSW
->
number
*
sizeof
(
STSma
));
if
(
tptr
==
NULL
)
{
metaCloseSmaCurosr
(
pCur
);
tdDestroyTSmaWrapper
(
pSW
,
true
);
tdDestroyTSmaWrapper
(
pSW
);
tfree
(
pSW
);
return
NULL
;
}
pSW
->
tSma
=
tptr
;
pBuf
=
pval
.
data
;
if
(
tDecodeTSma
(
pBuf
,
pSW
->
tSma
+
pSW
->
number
-
1
)
==
NULL
)
{
metaCloseSmaCurosr
(
pCur
);
tdDestroyTSmaWrapper
(
pSW
,
true
);
tdDestroyTSmaWrapper
(
pSW
);
tfree
(
pSW
);
return
NULL
;
}
continue
;
...
...
source/dnode/vnode/test/tsdbSmaTest.cpp
浏览文件 @
07227d7a
...
...
@@ -94,8 +94,8 @@ TEST(testCase, tSmaEncodeDecodeTest) {
}
// resource release
tdDestroyTSma
(
&
tSma
,
false
);
tdDestroyTSmaWrapper
(
&
dstTSmaWrapper
,
false
);
tdDestroyTSma
(
&
tSma
);
tdDestroyTSmaWrapper
(
&
dstTSmaWrapper
);
}
TEST
(
testCase
,
tSma_DB_Put_Get_Del_Test
)
{
...
...
@@ -152,14 +152,16 @@ TEST(testCase, tSma_DB_Put_Get_Del_Test) {
printf
(
"name1 = %s
\n
"
,
qSmaCfg
->
indexName
);
EXPECT_STRCASEEQ
(
qSmaCfg
->
indexName
,
smaIndexName1
);
EXPECT_EQ
(
qSmaCfg
->
tableUid
,
tSma
.
tableUid
);
tdDestroyTSma
(
qSmaCfg
,
true
);
tdDestroyTSma
(
qSmaCfg
);
free
(
qSmaCfg
);
qSmaCfg
=
metaGetSmaInfoByName
(
pMeta
,
smaIndexName2
);
assert
(
qSmaCfg
!=
NULL
);
printf
(
"name2 = %s
\n
"
,
qSmaCfg
->
indexName
);
EXPECT_STRCASEEQ
(
qSmaCfg
->
indexName
,
smaIndexName2
);
EXPECT_EQ
(
qSmaCfg
->
interval
,
tSma
.
interval
);
tdDestroyTSma
(
qSmaCfg
,
true
);
tdDestroyTSma
(
qSmaCfg
);
free
(
qSmaCfg
);
// get index name by table uid
SMSmaCursor
*
pSmaCur
=
metaOpenSmaCursor
(
pMeta
,
tbUid
);
...
...
@@ -189,7 +191,7 @@ TEST(testCase, tSma_DB_Put_Get_Del_Test) {
metaRemoveSmaFromDb
(
pMeta
,
smaIndexName1
);
metaRemoveSmaFromDb
(
pMeta
,
smaIndexName2
);
tdDestroyTSma
(
&
tSma
,
false
);
tdDestroyTSma
(
&
tSma
);
metaClose
(
pMeta
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录