Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a9a1ad4c
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看板
提交
a9a1ad4c
编写于
4月 19, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: vnode
上级
973b9383
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
66 addition
and
22 deletion
+66
-22
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+2
-0
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+19
-10
source/dnode/vnode/src/meta/metaIdx.c
source/dnode/vnode/src/meta/metaIdx.c
+13
-3
source/dnode/vnode/src/meta/metaOpen.c
source/dnode/vnode/src/meta/metaOpen.c
+9
-0
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+16
-0
source/dnode/vnode/src/meta/metaTDBImpl.c
source/dnode/vnode/src/meta/metaTDBImpl.c
+4
-0
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+3
-9
未找到文件。
source/dnode/vnode/CMakeLists.txt
浏览文件 @
a9a1ad4c
...
...
@@ -21,6 +21,7 @@ target_sources(
"src/meta/metaIdx.c"
"src/meta/metaTable.c"
"src/meta/metaTDBImpl.c"
"src/meta/metaQuery.c"
# tsdb
"src/tsdb/tsdbTDBImpl.c"
...
...
@@ -69,6 +70,7 @@ target_link_libraries(
PUBLIC transport
PUBLIC stream
)
# target_compile_definitions(vnode PUBLIC -DMETA_REFACT)
if
(
${
BUILD_TEST
}
)
add_subdirectory
(
test
)
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
a9a1ad4c
...
...
@@ -47,6 +47,22 @@ int metaRemoveTableFromIdx(SMeta* pMeta, tb_uid_t uid);
static
FORCE_INLINE
tb_uid_t
metaGenerateUid
(
SMeta
*
pMeta
)
{
return
tGenIdPI64
();
}
struct
SMeta
{
char
*
path
;
SVnode
*
pVnode
;
#ifdef META_REFACT
TENV
*
pEnv
;
TDB
*
pTbDb
;
TDB
*
pSchemaDb
;
TDB
*
pNameIdx
;
TDB
*
pCtbIdx
;
#else
SMetaDB
*
pDB
;
#endif
SMetaIdx
*
pIdx
;
};
#if 1
#define META_SUPER_TABLE TD_SUPER_TABLE
#define META_CHILD_TABLE TD_CHILD_TABLE
#define META_NORMAL_TABLE TD_NORMAL_TABLE
...
...
@@ -71,6 +87,7 @@ SMCtbCursor* metaOpenCtbCursor(SMeta* pMeta, tb_uid_t uid);
void
metaCloseCtbCurosr
(
SMCtbCursor
*
pCtbCur
);
tb_uid_t
metaCtbCursorNext
(
SMCtbCursor
*
pCtbCur
);
#ifndef META_REFACT
// SMetaDB
int
metaOpenDB
(
SMeta
*
pMeta
);
void
metaCloseDB
(
SMeta
*
pMeta
);
...
...
@@ -78,17 +95,9 @@ int metaSaveTableToDB(SMeta* pMeta, STbCfg* pTbCfg);
int
metaRemoveTableFromDb
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
int
metaSaveSmaToDB
(
SMeta
*
pMeta
,
STSma
*
pTbCfg
);
int
metaRemoveSmaFromDb
(
SMeta
*
pMeta
,
int64_t
indexUid
);
#endif
// SMetaIdx
tb_uid_t
metaGenerateUid
(
SMeta
*
pMeta
);
struct
SMeta
{
char
*
path
;
SVnode
*
pVnode
;
SMetaDB
*
pDB
;
SMetaIdx
*
pIdx
;
};
#endif
#ifdef __cplusplus
}
...
...
source/dnode/vnode/src/meta/metaIdx.c
浏览文件 @
a9a1ad4c
...
...
@@ -51,7 +51,9 @@ int metaOpenIdx(SMeta *pMeta) {
#ifdef USE_INVERTED_INDEX
SIndexOpts
opts
;
if
(
indexOpen
(
&
opts
,
pMeta
->
path
,
&
pMeta
->
pIdx
->
pIdx
)
!=
0
)
{
return
-
1
;
}
if
(
indexOpen
(
&
opts
,
pMeta
->
path
,
&
pMeta
->
pIdx
->
pIdx
)
!=
0
)
{
return
-
1
;
}
#endif
return
0
;
...
...
@@ -67,7 +69,9 @@ void metaCloseIdx(SMeta *pMeta) { /* TODO */
#ifdef USE_INVERTED_INDEX
SIndexOpts
opts
;
if
(
indexClose
(
pMeta
->
pIdx
->
pIdx
)
!=
0
)
{
return
-
1
;
}
if
(
indexClose
(
pMeta
->
pIdx
->
pIdx
)
!=
0
)
{
return
-
1
;
}
#endif
}
...
...
@@ -84,7 +88,7 @@ int metaSaveTableToIdx(SMeta *pMeta, const STbCfg *pTbCfg) {
tb_uid_t
suid
=
pTbCfg
->
ctbCfg
.
suid
;
// super id
tb_uid_t
tuid
=
0
;
// child table uid
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
SIndexTerm
*
term
=
SIndexTerm
*
term
=
indexTermCreate
(
suid
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
buf
,
strlen
(
buf
),
pTagVal
,
strlen
(
pTagVal
),
tuid
);
indexMultiTermAdd
(
terms
,
term
);
...
...
@@ -114,10 +118,13 @@ int32_t metaCreateTSma(SMeta *pMeta, SSmaCfg *pCfg) {
// TODO: add atomicity
#ifdef META_REFACT
#else
if
(
metaSaveSmaToDB
(
pMeta
,
&
pCfg
->
tSma
)
<
0
)
{
// TODO: handle error
return
-
1
;
}
#endif
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -125,9 +132,12 @@ int32_t metaDropTSma(SMeta *pMeta, int64_t indexUid) {
// TODO: Validate the cfg
// TODO: add atomicity
#ifdef META_REFACT
#else
if
(
metaRemoveSmaFromDb
(
pMeta
,
indexUid
)
<
0
)
{
// TODO: handle error
return
-
1
;
}
#endif
return
TSDB_CODE_SUCCESS
;
}
\ No newline at end of file
source/dnode/vnode/src/meta/metaOpen.c
浏览文件 @
a9a1ad4c
...
...
@@ -21,6 +21,8 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
*
ppMeta
=
NULL
;
#ifdef META_REFACT
#else
// create handle
slen
=
strlen
(
tfsGetPrimaryPath
(
pVnode
->
pTfs
))
+
strlen
(
pVnode
->
path
)
+
strlen
(
VNODE_META_DIR
)
+
3
;
if
((
pMeta
=
taosMemoryCalloc
(
1
,
sizeof
(
*
pMeta
)
+
slen
))
==
NULL
)
{
...
...
@@ -44,22 +46,29 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
if
(
metaOpenIdx
(
pMeta
)
<
0
)
{
goto
_err
;
}
#endif
*
ppMeta
=
pMeta
;
return
0
;
_err:
#ifdef META_REFACT
#else
if
(
pMeta
->
pIdx
)
metaCloseIdx
(
pMeta
);
if
(
pMeta
->
pDB
)
metaCloseDB
(
pMeta
);
taosMemoryFree
(
pMeta
);
#endif
return
-
1
;
}
int
metaClose
(
SMeta
*
pMeta
)
{
if
(
pMeta
)
{
#ifdef META_REFACT
#else
metaCloseIdx
(
pMeta
);
metaCloseDB
(
pMeta
);
taosMemoryFree
(
pMeta
);
#endif
}
return
0
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
0 → 100644
浏览文件 @
a9a1ad4c
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "vnodeInt.h"
\ No newline at end of file
source/dnode/vnode/src/meta/metaTDBImpl.c
浏览文件 @
a9a1ad4c
...
...
@@ -15,6 +15,8 @@
#include "vnodeInt.h"
#ifndef META_REFACT
typedef
struct
SPoolMem
{
int64_t
size
;
struct
SPoolMem
*
prev
;
...
...
@@ -1134,3 +1136,5 @@ static void poolFree(void *arg, void *ptr) {
tdbOsFree
(
pMem
);
}
#endif
\ No newline at end of file
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
a9a1ad4c
...
...
@@ -16,18 +16,13 @@
#include "vnodeInt.h"
int
metaCreateTable
(
SMeta
*
pMeta
,
STbCfg
*
pTbCfg
)
{
// Validate the tbOptions
// if (metaValidateTbCfg(pMeta, pTbCfg) < 0) {
// // TODO: handle error
// return -1;
// }
// TODO: add atomicity
#ifdef META_REFACT
#else
if
(
metaSaveTableToDB
(
pMeta
,
pTbCfg
)
<
0
)
{
// TODO: handle error
return
-
1
;
}
#endif
if
(
metaSaveTableToIdx
(
pMeta
,
pTbCfg
)
<
0
)
{
// TODO: handle error
...
...
@@ -50,4 +45,3 @@ int metaDropTable(SMeta *pMeta, tb_uid_t uid) {
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录