Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e779eed9
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看板
提交
e779eed9
编写于
11月 02, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
85e321f0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
114 addition
and
67 deletion
+114
-67
include/common/trequest.h
include/common/trequest.h
+31
-0
include/server/vnode/meta/impl/metaImpl.h
include/server/vnode/meta/impl/metaImpl.h
+58
-0
include/server/vnode/meta/meta.h
include/server/vnode/meta/meta.h
+15
-59
source/dnode/vnode/meta/src/metaMain.c
source/dnode/vnode/meta/src/metaMain.c
+6
-6
source/dnode/vnode/meta/test/metaTests.cpp
source/dnode/vnode/meta/test/metaTests.cpp
+4
-2
未找到文件。
include/common/trequest.h
0 → 100644
浏览文件 @
e779eed9
/*
* 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/>.
*/
#ifndef _TD_TREQUEST_H_
#define _TD_TREQUEST_H_
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
SRequest
SRequest
;
typedef
struct
SReqBatch
SReqBatch
;
typedef
struct
SReqBatchIter
SReqBatchIter
;
#ifdef __cplusplus
}
#endif
#endif
/*_TD_TREQUEST_H_*/
\ No newline at end of file
include/server/vnode/meta/impl/metaImpl.h
0 → 100644
浏览文件 @
e779eed9
/*
* 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/>.
*/
#ifndef _TD_META_IMPL_H_
#define _TD_META_IMPL_H_
#include "os.h"
#include "taosmsg.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
uint64_t
tb_uid_t
;
typedef
enum
{
META_INIT_TABLE
=
0
,
META_SUPER_TABLE
=
1
,
META_CHILD_TABLE
=
2
,
META_NORMAL_TABLE
=
3
}
EMetaTableT
;
typedef
struct
SSuperTableOpts
{
tb_uid_t
uid
;
STSchema
*
pSchema
;
// (ts timestamp, a int)
STSchema
*
pTagSchema
;
// (tag1 binary(10), tag2 int)
}
SSuperTableOpts
;
typedef
struct
SChildTableOpts
{
tb_uid_t
suid
;
// super table uid
SKVRow
tags
;
// tag value of the child table
}
SChildTableOpts
;
typedef
struct
SNormalTableOpts
{
STSchema
*
pSchema
;
}
SNormalTableOpts
;
struct
STableOptions
{
int8_t
type
;
char
*
name
;
union
{
SSuperTableOpts
superOpts
;
SChildTableOpts
childOpts
;
SNormalTableOpts
normalOpts
;
};
};
#ifdef __cplusplus
}
#endif
#endif
/*_TD_META_IMPL_H_*/
\ No newline at end of file
include/server/vnode/meta/meta.h
浏览文件 @
e779eed9
...
@@ -16,81 +16,37 @@
...
@@ -16,81 +16,37 @@
#ifndef _TD_META_H_
#ifndef _TD_META_H_
#define _TD_META_H_
#define _TD_META_H_
#include "taosmsg.h"
#include "impl/metaImpl.h"
#include "os.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
/* ------------------------ APIs Exposed ------------------------ */
// Types exported
// Types exported
typedef
uint64_t
tb_uid_t
;
typedef
struct
SMeta
SMeta
;
typedef
struct
SMeta
SMeta
;
typedef
struct
SMetaOptions
SMetaOptions
;
typedef
struct
SMetaOpts
SMetaOpts
;
typedef
struct
STableOptions
STableOptions
;
typedef
struct
SMetaQueryHandle
SMetaQueryHandle
;
typedef
struct
SMetaQueryOpts
SMetaQueryOpts
;
typedef
struct
STableOpts
STableOpts
;
// SMeta operations
// SMeta operations
int
metaCreate
(
const
char
*
path
);
SMeta
*
metaOpen
(
const
char
*
path
,
const
SMetaOptions
*
);
void
metaDestroy
(
const
char
*
path
);
SMeta
*
metaOpen
(
SMetaOpts
*
);
void
metaClose
(
SMeta
*
);
void
metaClose
(
SMeta
*
);
int
metaCreateTable
(
SMeta
*
,
const
STableOpts
*
);
void
metaRemove
(
const
char
*
path
);
int
meta
DropTable
(
SMeta
*
,
uint64_t
tuid_t
);
int
meta
CreateTable
(
SMeta
*
pMeta
,
const
STableOptions
*
);
int
meta
AlterTable
(
SMeta
*
,
void
*
);
int
meta
DropTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
int
metaCommit
(
SMeta
*
);
int
metaCommit
(
SMeta
*
);
// Options
// Options
SMetaOpts
*
metaOptionsCreate
();
SMetaOptions
*
metaOptionsCreate
();
void
metaOptionsDestroy
(
SMetaOpts
*
);
void
metaOptionsDestroy
(
SMetaOptions
*
);
void
metaOptionsSetCache
(
SMetaOpts
*
,
size_t
capacity
);
void
metaOptionsSetCache
(
SMetaOptions
*
,
size_t
capacity
);
// SMetaQueryHandle
SMetaQueryHandle
*
metaQueryHandleCreate
(
SMetaQueryOpts
*
);
void
metaQueryHandleDestroy
(
SMetaQueryHandle
*
);
// SMetaQueryOpts
SMetaQueryOpts
*
metaQueryOptionsCreate
();
void
metaQueryOptionsDestroy
(
SMetaQueryOpts
*
);
// STableOpts
// STableOpts
#define META_TABLE_OPTS_DECLARE(name) STableOpts name = {0}
#define META_TABLE_OPTS_DECLARE(name) STableOpts name = {0}
void
metaNormalTableOptsInit
(
STableOpts
*
,
const
char
*
name
,
const
STSchema
*
pSchema
);
void
metaNormalTableOptsInit
(
STableOpt
ion
s
*
,
const
char
*
name
,
const
STSchema
*
pSchema
);
void
metaSuperTableOptsInit
(
STableOpts
*
,
const
char
*
name
,
tb_uid_t
uid
,
const
STSchema
*
pSchema
,
void
metaSuperTableOptsInit
(
STableOpt
ion
s
*
,
const
char
*
name
,
tb_uid_t
uid
,
const
STSchema
*
pSchema
,
const
STSchema
*
pTagSchema
);
const
STSchema
*
pTagSchema
);
void
metaChildTableOptsInit
(
STableOpts
*
,
const
char
*
name
,
tb_uid_t
suid
,
const
SKVRow
tags
);
void
metaChildTableOptsInit
(
STableOptions
*
,
const
char
*
name
,
tb_uid_t
suid
,
const
SKVRow
tags
);
void
metaTableOptsClear
(
STableOpts
*
);
void
metaTableOptsClear
(
STableOptions
*
);
/* ------------------------ Impl should hidden ------------------------ */
typedef
enum
{
META_INIT_TABLE
=
0
,
META_SUPER_TABLE
=
1
,
META_CHILD_TABLE
=
2
,
META_NORMAL_TABLE
=
3
}
EMetaTableT
;
typedef
struct
SSuperTableOpts
{
tb_uid_t
uid
;
STSchema
*
pSchema
;
// (ts timestamp, a int)
STSchema
*
pTagSchema
;
// (tag1 binary(10), tag2 int)
}
SSuperTableOpts
;
typedef
struct
SChildTableOpts
{
tb_uid_t
suid
;
// super table uid
SKVRow
tags
;
// tag value of the child table
}
SChildTableOpts
;
typedef
struct
SNormalTableOpts
{
STSchema
*
pSchema
;
}
SNormalTableOpts
;
struct
STableOpts
{
int8_t
type
;
char
*
name
;
union
{
SSuperTableOpts
superOpts
;
SChildTableOpts
childOpts
;
SNormalTableOpts
normalOpts
;
};
};
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/vnode/meta/src/metaMain.c
浏览文件 @
e779eed9
...
@@ -21,7 +21,7 @@ static int metaCreateSuperTable(SMeta *pMeta, const char *tbname, const SSuperTa
...
@@ -21,7 +21,7 @@ static int metaCreateSuperTable(SMeta *pMeta, const char *tbname, const SSuperTa
static
int
metaCreateChildTable
(
SMeta
*
pMeta
,
const
char
*
tbname
,
const
SChildTableOpts
*
pChildTableOpts
);
static
int
metaCreateChildTable
(
SMeta
*
pMeta
,
const
char
*
tbname
,
const
SChildTableOpts
*
pChildTableOpts
);
static
int
metaCreateNormalTable
(
SMeta
*
pMeta
,
const
char
*
tbname
,
const
SNormalTableOpts
*
pNormalTableOpts
);
static
int
metaCreateNormalTable
(
SMeta
*
pMeta
,
const
char
*
tbname
,
const
SNormalTableOpts
*
pNormalTableOpts
);
SMeta
*
metaOpen
(
SMetaOpt
s
*
pMetaOpts
)
{
SMeta
*
metaOpen
(
const
char
*
path
,
const
SMetaOption
s
*
pMetaOpts
)
{
SMeta
*
pMeta
=
NULL
;
SMeta
*
pMeta
=
NULL
;
pMeta
=
(
SMeta
*
)
calloc
(
1
,
sizeof
(
*
pMeta
));
pMeta
=
(
SMeta
*
)
calloc
(
1
,
sizeof
(
*
pMeta
));
...
@@ -81,7 +81,7 @@ void metaClose(SMeta *pMeta) {
...
@@ -81,7 +81,7 @@ void metaClose(SMeta *pMeta) {
}
}
}
}
int
metaCreateTable
(
SMeta
*
pMeta
,
const
STableOpts
*
pTableOpts
)
{
int
metaCreateTable
(
SMeta
*
pMeta
,
const
STableOpt
ion
s
*
pTableOpts
)
{
size_t
vallen
;
size_t
vallen
;
char
*
pUid
;
char
*
pUid
;
...
@@ -213,13 +213,13 @@ static int metaCreateNormalTable(SMeta *pMeta, const char *tbname, const SNormal
...
@@ -213,13 +213,13 @@ static int metaCreateNormalTable(SMeta *pMeta, const char *tbname, const SNormal
return
0
;
return
0
;
}
}
void
metaNormalTableOptsInit
(
STableOpts
*
pTableOpts
,
const
char
*
name
,
const
STSchema
*
pSchema
)
{
void
metaNormalTableOptsInit
(
STableOpt
ion
s
*
pTableOpts
,
const
char
*
name
,
const
STSchema
*
pSchema
)
{
pTableOpts
->
type
=
META_NORMAL_TABLE
;
pTableOpts
->
type
=
META_NORMAL_TABLE
;
pTableOpts
->
name
=
strdup
(
name
);
pTableOpts
->
name
=
strdup
(
name
);
pTableOpts
->
normalOpts
.
pSchema
=
tdDupSchema
(
pSchema
);
pTableOpts
->
normalOpts
.
pSchema
=
tdDupSchema
(
pSchema
);
}
}
void
metaSuperTableOptsInit
(
STableOpts
*
pTableOpts
,
const
char
*
name
,
tb_uid_t
uid
,
const
STSchema
*
pSchema
,
void
metaSuperTableOptsInit
(
STableOpt
ion
s
*
pTableOpts
,
const
char
*
name
,
tb_uid_t
uid
,
const
STSchema
*
pSchema
,
const
STSchema
*
pTagSchema
)
{
const
STSchema
*
pTagSchema
)
{
pTableOpts
->
type
=
META_SUPER_TABLE
;
pTableOpts
->
type
=
META_SUPER_TABLE
;
pTableOpts
->
name
=
strdup
(
name
);
pTableOpts
->
name
=
strdup
(
name
);
...
@@ -228,14 +228,14 @@ void metaSuperTableOptsInit(STableOpts *pTableOpts, const char *name, tb_uid_t u
...
@@ -228,14 +228,14 @@ void metaSuperTableOptsInit(STableOpts *pTableOpts, const char *name, tb_uid_t u
pTableOpts
->
superOpts
.
pTagSchema
=
tdDupSchema
(
pTagSchema
);
pTableOpts
->
superOpts
.
pTagSchema
=
tdDupSchema
(
pTagSchema
);
}
}
void
metaChildTableOptsInit
(
STableOpts
*
pTableOpts
,
const
char
*
name
,
tb_uid_t
suid
,
const
SKVRow
tags
)
{
void
metaChildTableOptsInit
(
STableOpt
ion
s
*
pTableOpts
,
const
char
*
name
,
tb_uid_t
suid
,
const
SKVRow
tags
)
{
pTableOpts
->
type
=
META_CHILD_TABLE
;
pTableOpts
->
type
=
META_CHILD_TABLE
;
pTableOpts
->
name
=
strdup
(
name
);
pTableOpts
->
name
=
strdup
(
name
);
pTableOpts
->
childOpts
.
suid
=
suid
;
pTableOpts
->
childOpts
.
suid
=
suid
;
pTableOpts
->
childOpts
.
tags
=
tdKVRowDup
(
tags
);
pTableOpts
->
childOpts
.
tags
=
tdKVRowDup
(
tags
);
}
}
void
metaTableOptsClear
(
STableOpts
*
pTableOpts
)
{
void
metaTableOptsClear
(
STableOpt
ion
s
*
pTableOpts
)
{
switch
(
pTableOpts
->
type
)
{
switch
(
pTableOpts
->
type
)
{
case
META_NORMAL_TABLE
:
case
META_NORMAL_TABLE
:
tfree
(
pTableOpts
->
name
);
tfree
(
pTableOpts
->
name
);
...
...
source/dnode/vnode/meta/test/metaTests.cpp
浏览文件 @
e779eed9
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include "meta.h"
#include "meta.h"
#if 0
static STSchema *metaGetSimpleSchema() {
static STSchema *metaGetSimpleSchema() {
STSchema * pSchema = NULL;
STSchema * pSchema = NULL;
STSchemaBuilder sb = {0};
STSchemaBuilder sb = {0};
...
@@ -38,7 +39,7 @@ static SKVRow metaGetSimpleTags() {
...
@@ -38,7 +39,7 @@ static SKVRow metaGetSimpleTags() {
TEST(MetaTest, DISABLED_meta_create_1m_normal_tables_test) {
TEST(MetaTest, DISABLED_meta_create_1m_normal_tables_test) {
// Open Meta
// Open Meta
SMeta
*
meta
=
metaOpen
(
NULL
);
SMeta *meta = metaOpen(NULL
, NULL
);
std::cout << "Meta is opened!" << std::endl;
std::cout << "Meta is opened!" << std::endl;
// Create 1000000 normal tables
// Create 1000000 normal tables
...
@@ -100,4 +101,5 @@ TEST(MetaTest, meta_create_1m_child_tables_test) {
...
@@ -100,4 +101,5 @@ TEST(MetaTest, meta_create_1m_child_tables_test) {
// Destroy Meta
// Destroy Meta
metaDestroy("meta");
metaDestroy("meta");
std::cout << "Meta is destroyed!" << std::endl;
std::cout << "Meta is destroyed!" << std::endl;
}
}
\ No newline at end of file
#endif
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录