Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
22482771
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看板
提交
22482771
编写于
6月 20, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-353
上级
8bcefa8d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
10 deletion
+15
-10
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+1
-1
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+14
-9
未找到文件。
src/tsdb/inc/tsdbMain.h
浏览文件 @
22482771
...
...
@@ -53,7 +53,7 @@ typedef struct STable {
STSchema
*
schema
[
TSDB_MAX_TABLE_SCHEMAS
];
STSchema
*
tagSchema
;
SKVRow
tagVal
;
void
*
pIndex
;
// For TSDB_SUPER_TABLE, it is the skiplist index
SSkipList
*
pIndex
;
// For TSDB_SUPER_TABLE, it is the skiplist index
void
*
eventHandler
;
// TODO
void
*
streamHandler
;
// TODO
TSKEY
lastKey
;
// lastkey inserted in this table, initialized as 0, TODO: make a structure
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
22482771
...
...
@@ -31,7 +31,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper);
static
void
tsdbFreeTable
(
STable
*
pTable
);
static
int
tsdbUpdateTableTagSchema
(
STable
*
pTable
,
STSchema
*
newSchema
);
static
int
tsdbAddTableToMeta
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
bool
addIdx
);
static
void
tsdbRemoveTableFromMeta
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
bool
rmFromIdx
);
static
void
tsdbRemoveTableFromMeta
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
bool
rmFromIdx
,
bool
lock
);
static
int
tsdbAddTableIntoIndex
(
STsdbMeta
*
pMeta
,
STable
*
pTable
);
static
int
tsdbRemoveTableFromIndex
(
STsdbMeta
*
pMeta
,
STable
*
pTable
);
static
int
tsdbInitTableCfg
(
STableCfg
*
config
,
ETableType
type
,
uint64_t
uid
,
int32_t
tid
);
...
...
@@ -123,6 +123,8 @@ int tsdbDropTable(TSDB_REPO_T *repo, STableId tableId) {
return
-
1
;
}
tsdbTrace
(
"vgId:%d try to drop table %s type %d"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
),
TABLE_TYPE
(
pTable
));
tid
=
TABLE_TID
(
pTable
);
tbname
=
strdup
(
TABLE_CHAR_NAME
(
pTable
));
if
(
tbname
==
NULL
)
{
...
...
@@ -143,11 +145,11 @@ int tsdbDropTable(TSDB_REPO_T *repo, STableId tableId) {
void
*
buf
=
tsdbAllocBytes
(
pRepo
,
tlen
);
ASSERT
(
buf
!=
NULL
);
tsdbInsertTableAct
(
pRepo
,
TSDB_DROP_META
,
buf
,
tTable
);
tsdbRemoveTableFromMeta
(
pRepo
,
tTable
,
true
);
tsdbRemoveTableFromMeta
(
pRepo
,
tTable
,
false
,
true
);
}
}
tsdbRemoveTableFromMeta
(
pRepo
,
pTable
,
true
);
tsdbRemoveTableFromMeta
(
pRepo
,
pTable
,
true
,
true
);
tsdbTrace
(
"vgId:%d, table %s is dropped! tid:%d, uid:%"
PRId64
,
pRepo
->
config
.
tsdbId
,
tbname
,
tid
,
uid
);
free
(
tbname
);
...
...
@@ -708,6 +710,7 @@ _err:
static
void
tsdbFreeTable
(
STable
*
pTable
)
{
if
(
pTable
)
{
tsdbTrace
(
"table %s is destroyed"
,
TABLE_CHAR_NAME
(
pTable
));
tfree
(
TABLE_NAME
(
pTable
));
if
(
TABLE_TYPE
(
pTable
)
!=
TSDB_CHILD_TABLE
)
{
for
(
int
i
=
0
;
i
<
TSDB_MAX_TABLE_SCHEMAS
;
i
++
)
{
...
...
@@ -723,6 +726,7 @@ static void tsdbFreeTable(STable *pTable) {
tSkipListDestroy
(
pTable
->
pIndex
);
tfree
(
pTable
->
sql
);
free
(
pTable
);
}
}
...
...
@@ -790,12 +794,12 @@ static int tsdbAddTableToMeta(STsdbRepo *pRepo, STable *pTable, bool addIdx) {
return
0
;
_err:
tsdbRemoveTableFromMeta
(
pRepo
,
pTable
,
false
);
tsdbRemoveTableFromMeta
(
pRepo
,
pTable
,
false
,
false
);
if
(
addIdx
)
tsdbUnlockRepoMeta
(
pRepo
);
return
-
1
;
}
static
void
tsdbRemoveTableFromMeta
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
bool
rmFromIdx
)
{
static
void
tsdbRemoveTableFromMeta
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
bool
rmFromIdx
,
bool
lock
)
{
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
SListIter
lIter
=
{
0
};
SListNode
*
pNode
=
NULL
;
...
...
@@ -806,17 +810,17 @@ static void tsdbRemoveTableFromMeta(STsdbRepo *pRepo, STable *pTable, bool rmFro
int
maxCols
=
schemaNCols
(
pSchema
);
int
maxRowBytes
=
schemaTLen
(
pSchema
);
if
(
rmFromIdx
)
tsdbWLockRepoMeta
(
pRepo
);
if
(
lock
)
tsdbWLockRepoMeta
(
pRepo
);
if
(
TABLE_TYPE
(
pTable
)
==
TSDB_SUPER_TABLE
)
{
tdListInitIter
(
pMeta
->
superList
,
&
lIter
,
TD_LIST_BACKWARD
);
while
((
pNode
=
tdListNext
(
&
lIter
))
!=
NULL
)
{
tdListNodeGetData
(
pMeta
->
superList
,
pNode
,
(
void
*
)(
tTable
));
tdListNodeGetData
(
pMeta
->
superList
,
pNode
,
(
void
*
)(
&
tTable
));
if
(
pTable
==
tTable
)
{
break
;
tdListPopNode
(
pMeta
->
superList
,
pNode
);
free
(
pNode
);
break
;
}
}
}
else
{
...
...
@@ -843,7 +847,8 @@ static void tsdbRemoveTableFromMeta(STsdbRepo *pRepo, STable *pTable, bool rmFro
}
}
if
(
rmFromIdx
)
tsdbUnlockRepoMeta
(
pRepo
);
if
(
lock
)
tsdbUnlockRepoMeta
(
pRepo
);
tsdbTrace
(
"vgId:%d table %s is removed from meta"
,
REPO_ID
(
pRepo
),
TABLE_CHAR_NAME
(
pTable
));
tsdbUnRefTable
(
pTable
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录