Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
buyaopa
TDengine
提交
53f7a132
T
TDengine
项目概览
buyaopa
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
53f7a132
编写于
7月 12, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix table memory leak temporarily
上级
6d573503
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
35 addition
and
7 deletion
+35
-7
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+34
-7
未找到文件。
src/inc/taoserror.h
浏览文件 @
53f7a132
...
...
@@ -200,6 +200,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_CREATE_TB_MSG, 0, 0x060E, "tsdb inval
TAOS_DEFINE_ERROR
(
TSDB_CODE_TDB_NO_TABLE_DATA_IN_MEM
,
0
,
0x060F
,
"tsdb no table data in memory skiplist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TDB_FILE_ALREADY_EXISTS
,
0
,
0x0610
,
"tsdb file already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TDB_TABLE_RECONFIGURE
,
0
,
0x0611
,
"tsdb need to reconfigure table"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TDB_IVD_CREATE_TABLE_INFO
,
0
,
0x0612
,
"tsdb create table information"
)
// query
TAOS_DEFINE_ERROR
(
TSDB_CODE_QRY_INVALID_QHANDLE
,
0
,
0x0700
,
"query invalid handle"
)
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
53f7a132
...
...
@@ -57,8 +57,30 @@ int tsdbCreateTable(TSDB_REPO_T *repo, STableCfg *pCfg) {
STable
*
super
=
NULL
;
STable
*
table
=
NULL
;
int
newSuper
=
0
;
int
tid
=
pCfg
->
tableId
.
tid
;
STable
*
pTable
=
NULL
;
if
(
tid
<
0
||
tid
>=
pRepo
->
config
.
maxTables
)
{
tsdbError
(
"vgId:%d failed to create table since invalid tid %d"
,
REPO_ID
(
pRepo
),
tid
);
terrno
=
TSDB_CODE_TDB_IVD_CREATE_TABLE_INFO
;
goto
_err
;
}
if
(
pMeta
->
tables
[
tid
]
!=
NULL
)
{
if
(
TABLE_UID
(
pMeta
->
tables
[
tid
])
==
pCfg
->
tableId
.
uid
)
{
tsdbError
(
"vgId:%d table %s already exists, tid %d uid %"
PRId64
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
TABLE_UID
(
pTable
));
return
TSDB_CODE_TDB_TABLE_ALREADY_EXIST
;
}
else
{
tsdbError
(
"vgId:%d table %s at tid %d uid %"
PRIu64
" exists, replace it with new table, this can be not reasonable"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pMeta
->
tables
[
tid
]),
TABLE_TID
(
pMeta
->
tables
[
tid
]),
TABLE_UID
(
pMeta
->
tables
[
tid
]));
tsdbDropTable
(
pRepo
,
pMeta
->
tables
[
tid
]
->
tableId
);
}
}
STable
*
pTable
=
tsdbGetTableByUid
(
pMeta
,
pCfg
->
tableId
.
uid
);
pTable
=
tsdbGetTableByUid
(
pMeta
,
pCfg
->
tableId
.
uid
);
if
(
pTable
!=
NULL
)
{
tsdbError
(
"vgId:%d table %s already exists, tid %d uid %"
PRId64
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
TABLE_UID
(
pTable
));
...
...
@@ -72,10 +94,10 @@ int tsdbCreateTable(TSDB_REPO_T *repo, STableCfg *pCfg) {
super
=
tsdbNewTable
(
pCfg
,
true
);
if
(
super
==
NULL
)
goto
_err
;
}
else
{
// TODO
if
(
super
->
type
!=
TSDB_SUPER_TABLE
)
return
-
1
;
if
(
super
->
tableId
.
uid
!=
pCfg
->
superUid
)
return
-
1
;
// tsdbUpdateTable(pRepo, super, pCfg);
if
(
TABLE_TYPE
(
super
)
!=
TSDB_SUPER_TABLE
||
TABLE_UID
(
super
)
!=
pCfg
->
superUid
)
{
terrno
=
TSDB_CODE_TDB_IVD_CREATE_TABLE_INFO
;
goto
_err
;
}
}
}
...
...
@@ -705,6 +727,9 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) {
T_REF_INC
(
pTable
);
tsdbDebug
(
"table %s tid %d uid %"
PRIu64
" is created"
,
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
TABLE_UID
(
pTable
));
return
pTable
;
_err:
...
...
@@ -714,7 +739,9 @@ _err:
static
void
tsdbFreeTable
(
STable
*
pTable
)
{
if
(
pTable
)
{
if
(
pTable
->
name
!=
NULL
)
tsdbDebug
(
"table %s is destroyed"
,
TABLE_CHAR_NAME
(
pTable
));
if
(
pTable
->
name
!=
NULL
)
tsdbDebug
(
"table %s tid %d uid %"
PRIu64
" is destroyed"
,
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
TABLE_UID
(
pTable
));
tfree
(
TABLE_NAME
(
pTable
));
if
(
TABLE_TYPE
(
pTable
)
!=
TSDB_CHILD_TABLE
)
{
for
(
int
i
=
0
;
i
<
TSDB_MAX_TABLE_SCHEMAS
;
i
++
)
{
...
...
@@ -782,7 +809,7 @@ static int tsdbAddTableToMeta(STsdbRepo *pRepo, STable *pTable, bool addIdx, boo
tsdbGetTableSchemaImpl
(
pTable
,
false
,
false
,
-
1
));
}
tsdb
Trace
(
"vgId:%d table %s tid %d uid %"
PRIu64
" is added to meta"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
tsdb
Debug
(
"vgId:%d table %s tid %d uid %"
PRIu64
" is added to meta"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
TABLE_TID
(
pTable
),
TABLE_UID
(
pTable
));
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录