Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b5429120
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b5429120
编写于
12月 23, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add test case
上级
c7a2dd63
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
21 deletion
+39
-21
source/dnode/mgmt/impl/test/db/db.cpp
source/dnode/mgmt/impl/test/db/db.cpp
+23
-19
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+10
-0
tests/script/general/db/basic1.sim
tests/script/general/db/basic1.sim
+2
-2
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+4
-0
未找到文件。
source/dnode/mgmt/impl/test/db/db.cpp
浏览文件 @
b5429120
...
...
@@ -27,24 +27,25 @@ Testbase DndTestDb::test;
TEST_F
(
DndTestDb
,
01
_ShowDb
)
{
test
.
SendShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
""
);
CHECK_META
(
"show databases"
,
1
7
);
CHECK_META
(
"show databases"
,
1
8
);
CHECK_SCHEMA
(
0
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
-
1
+
VARSTR_HEADER_SIZE
,
"name"
);
CHECK_SCHEMA
(
1
,
TSDB_DATA_TYPE_TIMESTAMP
,
8
,
"create_time"
);
CHECK_SCHEMA
(
2
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"vgroups"
);
CHECK_SCHEMA
(
3
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"replica"
);
CHECK_SCHEMA
(
4
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"quorum"
);
CHECK_SCHEMA
(
5
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"days"
);
CHECK_SCHEMA
(
6
,
TSDB_DATA_TYPE_BINARY
,
24
+
VARSTR_HEADER_SIZE
,
"keep0,keep1,keep2"
);
CHECK_SCHEMA
(
7
,
TSDB_DATA_TYPE_INT
,
4
,
"cache"
);
CHECK_SCHEMA
(
8
,
TSDB_DATA_TYPE_INT
,
4
,
"blocks"
);
CHECK_SCHEMA
(
9
,
TSDB_DATA_TYPE_INT
,
4
,
"minrows"
);
CHECK_SCHEMA
(
10
,
TSDB_DATA_TYPE_INT
,
4
,
"maxrows"
);
CHECK_SCHEMA
(
11
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"wallevel"
);
CHECK_SCHEMA
(
12
,
TSDB_DATA_TYPE_INT
,
4
,
"fsync"
);
CHECK_SCHEMA
(
13
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"comp"
);
CHECK_SCHEMA
(
14
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"cachelast"
);
CHECK_SCHEMA
(
15
,
TSDB_DATA_TYPE_BINARY
,
3
+
VARSTR_HEADER_SIZE
,
"precision"
);
CHECK_SCHEMA
(
16
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"update"
);
CHECK_SCHEMA
(
3
,
TSDB_DATA_TYPE_INT
,
4
,
"ntables"
);
CHECK_SCHEMA
(
4
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"replica"
);
CHECK_SCHEMA
(
5
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"quorum"
);
CHECK_SCHEMA
(
6
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"days"
);
CHECK_SCHEMA
(
7
,
TSDB_DATA_TYPE_BINARY
,
24
+
VARSTR_HEADER_SIZE
,
"keep0,keep1,keep2"
);
CHECK_SCHEMA
(
8
,
TSDB_DATA_TYPE_INT
,
4
,
"cache"
);
CHECK_SCHEMA
(
9
,
TSDB_DATA_TYPE_INT
,
4
,
"blocks"
);
CHECK_SCHEMA
(
10
,
TSDB_DATA_TYPE_INT
,
4
,
"minrows"
);
CHECK_SCHEMA
(
11
,
TSDB_DATA_TYPE_INT
,
4
,
"maxrows"
);
CHECK_SCHEMA
(
12
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"wallevel"
);
CHECK_SCHEMA
(
13
,
TSDB_DATA_TYPE_INT
,
4
,
"fsync"
);
CHECK_SCHEMA
(
14
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"comp"
);
CHECK_SCHEMA
(
15
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"cachelast"
);
CHECK_SCHEMA
(
16
,
TSDB_DATA_TYPE_BINARY
,
3
+
VARSTR_HEADER_SIZE
,
"precision"
);
CHECK_SCHEMA
(
17
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"update"
);
test
.
SendShowRetrieveMsg
();
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
...
...
@@ -82,13 +83,14 @@ TEST_F(DndTestDb, 02_Create_Alter_Drop_Db) {
}
test
.
SendShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
""
);
CHECK_META
(
"show databases"
,
1
7
);
CHECK_META
(
"show databases"
,
1
8
);
test
.
SendShowRetrieveMsg
();
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt32
(
0
);
// ntables
CheckInt16
(
1
);
// replica
CheckInt16
(
1
);
// quorum
CheckInt16
(
10
);
// days
...
...
@@ -147,6 +149,7 @@ TEST_F(DndTestDb, 02_Create_Alter_Drop_Db) {
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt32
(
0
);
CheckInt16
(
1
);
// replica
CheckInt16
(
2
);
// quorum
CheckInt16
(
10
);
// days
...
...
@@ -166,7 +169,7 @@ TEST_F(DndTestDb, 02_Create_Alter_Drop_Db) {
test
.
Restart
();
test
.
SendShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
""
);
CHECK_META
(
"show databases"
,
1
7
);
CHECK_META
(
"show databases"
,
1
8
);
test
.
SendShowRetrieveMsg
();
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
...
...
@@ -174,6 +177,7 @@ TEST_F(DndTestDb, 02_Create_Alter_Drop_Db) {
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt32
(
0
);
CheckInt16
(
1
);
// replica
CheckInt16
(
2
);
// quorum
CheckInt16
(
10
);
// days
...
...
@@ -201,7 +205,7 @@ TEST_F(DndTestDb, 02_Create_Alter_Drop_Db) {
}
test
.
SendShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
""
);
CHECK_META
(
"show databases"
,
1
7
);
CHECK_META
(
"show databases"
,
1
8
);
test
.
SendShowRetrieveMsg
();
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
...
...
@@ -239,7 +243,7 @@ TEST_F(DndTestDb, 03_Create_Use_Restart_Use_Db) {
}
test
.
SendShowMetaMsg
(
TSDB_MGMT_TABLE_DB
,
""
);
CHECK_META
(
"show databases"
,
1
7
);
CHECK_META
(
"show databases"
,
1
8
);
test
.
SendShowRetrieveMsg
();
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
b5429120
...
...
@@ -876,6 +876,12 @@ static int32_t mndGetDbMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *pMe
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"ntables"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"replica"
);
...
...
@@ -1017,6 +1023,10 @@ static int32_t mndRetrieveDbs(SMnodeMsg *pMsg, SShowObj *pShow, char *data, int3
*
(
int16_t
*
)
pWrite
=
pDb
->
cfg
.
numOfVgroups
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int16_t
*
)
pWrite
=
0
;
// todo
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int16_t
*
)
pWrite
=
pDb
->
cfg
.
replications
;
cols
++
;
...
...
tests/script/general/db/basic1.sim
浏览文件 @
b5429120
...
...
@@ -15,7 +15,7 @@ if $data00 != d1 then
return -1
endi
if $data02 !=
0
then
if $data02 !=
2
then
return -1
endi
...
...
@@ -51,7 +51,7 @@ if $data00 != d4 then
return -1
endi
if $data02 !=
0
then
if $data02 !=
2
then
return -1
endi
...
...
tests/script/jenkins/basic.txt
浏览文件 @
b5429120
#======================b1-start===============
# ---- user
./test.sh -f general/user/basic1.sim
# ---- db
./test.sh -f general/db/basic1.sim
#======================b1-end===============
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录