Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6b36c2ae
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6b36c2ae
编写于
11月 29, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
e861bdeb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
72 addition
and
13 deletion
+72
-13
include/dnode/vnode/meta/meta.h
include/dnode/vnode/meta/meta.h
+1
-1
include/dnode/vnode/vnode.h
include/dnode/vnode/vnode.h
+6
-6
source/dnode/vnode/impl/test/vnodeApiTests.cpp
source/dnode/vnode/impl/test/vnodeApiTests.cpp
+65
-6
未找到文件。
include/dnode/vnode/meta/meta.h
浏览文件 @
6b36c2ae
...
...
@@ -65,7 +65,7 @@ typedef struct STbCfg {
struct
{
/// super table UID
tb_uid_t
suid
;
S
Row
*
pTag
;
S
KVRow
pTag
;
}
ctbCfg
;
};
}
STbCfg
;
...
...
include/dnode/vnode/vnode.h
浏览文件 @
6b36c2ae
...
...
@@ -162,14 +162,14 @@ typedef struct {
char
info
[];
}
SVnodeRsp
;
#define VNODE_INIT_CREATE_STB_REQ(
VER,
NAME, TTL, KEEP, SUID, PSCHEMA, PTAGSCHEMA) \
{ .ver =
(VER)
, .ctReq = META_INIT_STB_CFG(NAME, TTL, KEEP, SUID, PSCHEMA, PTAGSCHEMA) }
#define VNODE_INIT_CREATE_STB_REQ(NAME, TTL, KEEP, SUID, PSCHEMA, PTAGSCHEMA) \
{ .ver =
0
, .ctReq = META_INIT_STB_CFG(NAME, TTL, KEEP, SUID, PSCHEMA, PTAGSCHEMA) }
#define VNODE_INIT_CREATE_CTB_REQ(
VER,
NAME, TTL, KEEP, SUID, PTAG) \
{ .ver =
(VER)
, .ctReq = META_INIT_CTB_CFG(NAME, TTL, KEEP, SUID, PTAG) }
#define VNODE_INIT_CREATE_CTB_REQ(NAME, TTL, KEEP, SUID, PTAG) \
{ .ver =
0
, .ctReq = META_INIT_CTB_CFG(NAME, TTL, KEEP, SUID, PTAG) }
#define VNODE_INIT_CREATE_NTB_REQ(
VER,
NAME, TTL, KEEP, SUID, PSCHEMA) \
{ .ver =
(VER)
, .ctReq = META_INIT_NTB_CFG(NAME, TTL, KEEP, SUID, PSCHEMA) }
#define VNODE_INIT_CREATE_NTB_REQ(NAME, TTL, KEEP, SUID, PSCHEMA) \
{ .ver =
0
, .ctReq = META_INIT_NTB_CFG(NAME, TTL, KEEP, SUID, PSCHEMA) }
int
vnodeBuildReq
(
void
**
buf
,
const
SVnodeReq
*
pReq
,
uint8_t
type
);
void
*
vnodeParseReq
(
void
*
buf
,
SVnodeReq
*
pReq
,
uint8_t
type
);
...
...
source/dnode/vnode/impl/test/vnodeApiTests.cpp
浏览文件 @
6b36c2ae
...
...
@@ -3,6 +3,63 @@
#include "vnode.h"
static
STSchema
*
createBasicSchema
()
{
STSchemaBuilder
sb
;
STSchema
*
pSchema
=
NULL
;
tdInitTSchemaBuilder
(
&
sb
,
0
);
tdAddColToSchema
(
&
sb
,
TSDB_DATA_TYPE_TIMESTAMP
,
0
,
0
);
for
(
int
i
=
1
;
i
<
10
;
i
++
)
{
tdAddColToSchema
(
&
sb
,
TSDB_DATA_TYPE_INT
,
i
,
0
);
}
pSchema
=
tdGetSchemaFromBuilder
(
&
sb
);
tdDestroyTSchemaBuilder
(
&
sb
);
return
pSchema
;
}
static
STSchema
*
createBasicTagSchema
()
{
STSchemaBuilder
sb
;
STSchema
*
pSchema
=
NULL
;
tdInitTSchemaBuilder
(
&
sb
,
0
);
tdAddColToSchema
(
&
sb
,
TSDB_DATA_TYPE_TIMESTAMP
,
0
,
0
);
for
(
int
i
=
10
;
i
<
12
;
i
++
)
{
tdAddColToSchema
(
&
sb
,
TSDB_DATA_TYPE_BINARY
,
i
,
20
);
}
pSchema
=
tdGetSchemaFromBuilder
(
&
sb
);
tdDestroyTSchemaBuilder
(
&
sb
);
return
pSchema
;
}
static
SKVRow
createBasicTag
()
{
SKVRowBuilder
rb
;
SKVRow
pTag
;
tdInitKVRowBuilder
(
&
rb
);
for
(
int
i
=
10
;
i
<
12
;
i
++
)
{
void
*
pVal
=
malloc
(
sizeof
(
VarDataLenT
)
+
strlen
(
"foo"
));
varDataLen
(
pVal
)
=
strlen
(
"foo"
);
memcpy
(
varDataVal
(
pVal
),
"foo"
,
strlen
(
"foo"
));
tdAddColToKVRow
(
&
rb
,
i
,
TSDB_DATA_TYPE_BINARY
,
pVal
);
free
(
pVal
);
}
pTag
=
tdGetKVRowFromBuilder
(
&
rb
);
tdDestroyKVRowBuilder
(
&
rb
);
return
pTag
;
}
TEST
(
vnodeApiTest
,
vnodeOpen_vnodeClose_test
)
{
GTEST_ASSERT_GE
(
vnodeInit
(),
0
);
...
...
@@ -13,12 +70,12 @@ TEST(vnodeApiTest, vnodeOpen_vnodeClose_test) {
tb_uid_t
suid
=
1638166374163
;
{
// Create a super table
STSchema
*
pSchema
=
NULL
;
STSchema
*
pTagSchema
=
NULL
;
STSchema
*
pSchema
=
createBasicSchema
()
;
STSchema
*
pTagSchema
=
createBasicTagSchema
()
;
char
tbname
[
128
]
=
"st"
;
SArray
*
pMsgs
=
(
SArray
*
)
taosArrayInit
(
1
,
sizeof
(
SRpcMsg
*
));
SVnodeReq
vCreateSTbReq
=
VNODE_INIT_CREATE_STB_REQ
(
0
,
tbname
,
UINT32_MAX
,
UINT32_MAX
,
suid
,
pSchema
,
pTagSchema
);
SVnodeReq
vCreateSTbReq
=
VNODE_INIT_CREATE_STB_REQ
(
tbname
,
UINT32_MAX
,
UINT32_MAX
,
suid
,
pSchema
,
pTagSchema
);
int
zs
=
vnodeBuildReq
(
NULL
,
&
vCreateSTbReq
,
TSDB_MSG_TYPE_CREATE_TABLE
);
SRpcMsg
*
pMsg
=
(
SRpcMsg
*
)
malloc
(
sizeof
(
SRpcMsg
)
+
zs
);
...
...
@@ -36,6 +93,8 @@ TEST(vnodeApiTest, vnodeOpen_vnodeClose_test) {
free
(
pMsg
);
taosArrayClear
(
pMsgs
);
tdFreeSchema
(
pSchema
);
tdFreeSchema
(
pTagSchema
);
}
{
...
...
@@ -45,10 +104,10 @@ TEST(vnodeApiTest, vnodeOpen_vnodeClose_test) {
for
(
int
i
=
0
;
i
<
ntables
/
batch
;
i
++
)
{
SArray
*
pMsgs
=
(
SArray
*
)
taosArrayInit
(
batch
,
sizeof
(
SRpcMsg
*
));
for
(
int
j
=
0
;
j
<
batch
;
j
++
)
{
S
Row
*
pTag
=
NULL
;
char
tbname
[
128
];
S
KVRow
pTag
=
createBasicTag
()
;
char
tbname
[
128
];
sprintf
(
tbname
,
"tb%d"
,
i
*
batch
+
j
);
SVnodeReq
vCreateCTbReq
=
VNODE_INIT_CREATE_CTB_REQ
(
0
,
tbname
,
UINT32_MAX
,
UINT32_MAX
,
suid
,
pTag
);
SVnodeReq
vCreateCTbReq
=
VNODE_INIT_CREATE_CTB_REQ
(
tbname
,
UINT32_MAX
,
UINT32_MAX
,
suid
,
pTag
);
int
tz
=
vnodeBuildReq
(
NULL
,
&
vCreateCTbReq
,
TSDB_MSG_TYPE_CREATE_TABLE
);
SRpcMsg
*
pMsg
=
(
SRpcMsg
*
)
malloc
(
sizeof
(
SRpcMsg
)
+
tz
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录