Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b50676b6
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看板
提交
b50676b6
编写于
10月 11, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact
上级
6dc0ce0b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
109 addition
and
4 deletion
+109
-4
CMakeLists.txt
CMakeLists.txt
+1
-1
deps/CMakeLists.txt
deps/CMakeLists.txt
+1
-0
include/common/trow.h
include/common/trow.h
+7
-0
source/server/vnode/CMakeLists.txt
source/server/vnode/CMakeLists.txt
+1
-1
source/server/vnode/meta/CMakeLists.txt
source/server/vnode/meta/CMakeLists.txt
+7
-2
source/server/vnode/meta/src/meta.c
source/server/vnode/meta/src/meta.c
+66
-0
source/server/vnode/meta/test/CMakeLists.txt
source/server/vnode/meta/test/CMakeLists.txt
+18
-0
source/server/vnode/meta/test/metaTests.cpp
source/server/vnode/meta/test/metaTests.cpp
+8
-0
未找到文件。
CMakeLists.txt
浏览文件 @
b50676b6
...
...
@@ -42,7 +42,7 @@ if(${BUILD_WITH_LEVELDB})
endif
(
${
BUILD_WITH_LEVELDB
}
)
## rocksdb
option
(
BUILD_WITH_ROCKSDB
"If build with rocksdb"
O
FF
)
option
(
BUILD_WITH_ROCKSDB
"If build with rocksdb"
O
N
)
if
(
${
BUILD_WITH_ROCKSDB
}
)
cat
(
"
${
CMAKE_SUPPORT_DIR
}
/rocksdb_CMakeLists.txt.in"
${
DEPS_TMP_FILE
}
)
endif
(
${
BUILD_WITH_ROCKSDB
}
)
...
...
deps/CMakeLists.txt
浏览文件 @
b50676b6
...
...
@@ -48,6 +48,7 @@ endif(${BUILD_WITH_LEVELDB})
if
(
${
BUILD_WITH_ROCKSDB
}
)
option
(
WITH_TESTS
""
OFF
)
option
(
WITH_BENCHMARK_TOOLS
""
OFF
)
option
(
ROCKSDB_BUILD_SHARED
"Build shared versions of the RocksDB libraries"
OFF
)
add_subdirectory
(
rocksdb
)
target_include_directories
(
rocksdb
...
...
include/common/trow.h
浏览文件 @
b50676b6
...
...
@@ -20,6 +20,13 @@
extern
"C"
{
#endif
typedef
struct
SRow
SRow
;
#define rowType(r)
#define rowLen(r)
#define rowVersion(r)
#define rowNCols(r)
#ifdef __cplusplus
}
#endif
...
...
source/server/vnode/CMakeLists.txt
浏览文件 @
b50676b6
...
...
@@ -3,7 +3,7 @@ add_subdirectory(tq)
add_subdirectory
(
tsdb
)
aux_source_directory
(
src VNODE_SRC
)
add_library
(
vnode
${
VNODE_SRC
}
)
add_library
(
vnode
STATIC
${
VNODE_SRC
}
)
target_include_directories
(
vnode
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/vnode"
...
...
source/server/vnode/meta/CMakeLists.txt
浏览文件 @
b50676b6
aux_source_directory
(
src META_SRC
)
add_library
(
meta
${
META_SRC
}
)
add_library
(
meta
STATIC
${
META_SRC
}
)
target_include_directories
(
meta
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/vnode/meta"
...
...
@@ -8,4 +8,9 @@ target_include_directories(
target_link_libraries
(
meta
PUBLIC common
)
\ No newline at end of file
)
target_link_libraries
(
meta PUBLIC rocksdb
)
# if(${BUILD_TEST})
# add_subdirectory(test)
# endif(${BUILD_TEST})
source/server/vnode/meta/src/meta.c
浏览文件 @
b50676b6
...
...
@@ -13,6 +13,72 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <rocksdb/c.h>
#include "thash.h"
#include "tlist.h"
#include "tlockfree.h"
#include "ttypes.h"
#include "meta.h"
typedef
struct
STable
{
uint64_t
uid
;
tstr
*
name
;
uint64_t
suid
;
SArray
*
schema
;
}
STable
;
typedef
struct
STableObj
{
bool
pin
;
uint64_t
ref
;
SRWLatch
latch
;
uint64_t
offset
;
SList
*
ctbList
;
// child table list
STable
*
pTable
;
}
STableObj
;
struct
SMeta
{
pthread_rwlock_t
rwLock
;
SHashObj
*
pTableObjHash
;
// uid --> STableObj
SList
*
stbList
;
// super table list
rocksdb_t
*
tbnameDb
;
// tbname --> uid
rocksdb_t
*
tagDb
;
// uid --> tag
rocksdb_t
*
schemaDb
;
size_t
totalUsed
;
};
SMeta
*
metaOpen
(
SMetaOptions
*
options
)
{
SMeta
*
pMeta
=
NULL
;
char
*
err
=
NULL
;
pMeta
=
(
SMeta
*
)
calloc
(
1
,
sizeof
(
*
pMeta
));
if
(
pMeta
==
NULL
)
{
return
NULL
;
}
pthread_rwlock_init
(
&
(
pMeta
->
rwLock
),
NULL
);
pMeta
->
pTableObjHash
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
pMeta
->
stbList
=
tdListNew
(
sizeof
(
STableObj
*
));
// Open tbname DB
rocksdb_options_t
*
tbnameDbOptions
=
rocksdb_options_create
();
pMeta
->
tbnameDb
=
rocksdb_open
(
tbnameDbOptions
,
"tbname_uid_db"
,
&
err
);
// Open tag DB
pMeta
->
tagDb
=
rocksdb_open
(
tbnameDbOptions
,
"uid_tag_db"
,
&
err
);
// Open schema DB
pMeta
->
schemaDb
=
rocksdb_open
(
tbnameDbOptions
,
"schema_db"
,
&
err
);
return
pMeta
;
}
void
metaClose
(
SMeta
*
pMeta
)
{
// TODO
}
int
metaCommit
(
SMeta
*
meta
)
{
return
0
;
}
\ No newline at end of file
source/server/vnode/meta/test/CMakeLists.txt
0 → 100644
浏览文件 @
b50676b6
add_executable
(
metaTest
""
)
target_sources
(
metaTest
PRIVATE
"../src/meta.c"
"metaTests.cpp"
)
target_include_directories
(
metaTest
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/vnode/meta"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc"
)
target_link_libraries
(
metaTest
os
util
common
rocksdb
gtest_main
)
\ No newline at end of file
source/server/vnode/meta/test/metaTests.cpp
浏览文件 @
b50676b6
#include <gtest/gtest.h>
#include <iostream>
#include "meta.h"
TEST
(
MetaTest
,
meta_open_test
)
{
std
::
cout
<<
"Hello META!"
<<
std
::
endl
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录