Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c978eb12
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
c978eb12
编写于
1月 19, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-13101
上级
af9178c5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
161 addition
and
34 deletion
+161
-34
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+20
-14
source/libs/tfs/test/tfsTest.cpp
source/libs/tfs/test/tfsTest.cpp
+43
-2
tests/script/sim/db/basic1.sim
tests/script/sim/db/basic1.sim
+97
-17
tests/script/sim/db/basic6.sim
tests/script/sim/db/basic6.sim
+1
-1
未找到文件。
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
c978eb12
...
...
@@ -540,35 +540,41 @@ static int32_t mndRetrieveVgroups(SMnodeMsg *pReq, SShowObj *pShow, char *data,
int32_t
cols
=
0
;
char
*
pWrite
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pShow
->
db
);
if
(
pDb
==
NULL
)
return
0
;
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pShow
->
pIter
,
(
void
**
)
&
pVgroup
);
if
(
pShow
->
pIter
==
NULL
)
break
;
cols
=
0
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
pVgroup
->
vgId
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
pVgroup
->
numOfTables
;
cols
++
;
if
(
pVgroup
->
dbUid
==
pDb
->
uid
)
{
cols
=
0
;
for
(
int32_t
i
=
0
;
i
<
pShow
->
replica
;
++
i
)
{
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int
16_t
*
)
pWrite
=
pVgroup
->
vnodeGid
[
i
].
dnode
Id
;
*
(
int
32_t
*
)
pWrite
=
pVgroup
->
vg
Id
;
cols
++
;
const
char
*
role
=
mndGetRoleStr
(
pVgroup
->
vnodeGid
[
i
].
role
);
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
role
,
pShow
->
bytes
[
cols
])
;
*
(
int32_t
*
)
pWrite
=
pVgroup
->
numOfTables
;
cols
++
;
for
(
int32_t
i
=
0
;
i
<
pShow
->
replica
;
++
i
)
{
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int16_t
*
)
pWrite
=
pVgroup
->
vnodeGid
[
i
].
dnodeId
;
cols
++
;
const
char
*
role
=
mndGetRoleStr
(
pVgroup
->
vnodeGid
[
i
].
role
);
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
role
,
pShow
->
bytes
[
cols
]);
cols
++
;
}
numOfRows
++
;
}
sdbRelease
(
pSdb
,
pVgroup
);
numOfRows
++
;
}
mndReleaseDb
(
pMnode
,
pDb
);
mndVacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
return
numOfRows
;
...
...
source/libs/tfs/test/tfsTest.cpp
浏览文件 @
c978eb12
...
...
@@ -60,6 +60,7 @@ TEST_F(TfsTest, 02_AllocDisk) {
dCfg
.
level
=
0
;
dCfg
.
primary
=
1
;
taosRemoveDir
(
root
);
taosMkDir
(
root
);
STfs
*
pTfs
=
tfsOpen
(
&
dCfg
,
1
);
ASSERT_NE
(
pTfs
,
nullptr
);
...
...
@@ -110,6 +111,7 @@ TEST_F(TfsTest, 03_Dir) {
dCfg
.
level
=
0
;
dCfg
.
primary
=
1
;
taosRemoveDir
(
root
);
taosMkDir
(
root
);
STfs
*
pTfs
=
tfsOpen
(
&
dCfg
,
1
);
ASSERT_NE
(
pTfs
,
nullptr
);
...
...
@@ -130,7 +132,7 @@ TEST_F(TfsTest, 03_Dir) {
EXPECT_EQ
(
taosDirExist
(
ap2
),
0
);
char
p3
[]
=
"p3/p2/p1/p0"
;
char
ap3
[
128
]
=
{
0
};
char
ap3
[
128
]
=
{
0
};
snprintf
(
ap3
,
128
,
"%s%s%s"
,
root
,
TD_DIRSEP
,
p3
);
EXPECT_NE
(
taosDirExist
(
ap3
),
0
);
EXPECT_NE
(
tfsMkdir
(
pTfs
,
p3
),
0
);
...
...
@@ -155,4 +157,43 @@ TEST_F(TfsTest, 03_Dir) {
EXPECT_NE
(
taosDirExist
(
ap4
),
0
);
tfsClose
(
pTfs
);
}
\ No newline at end of file
}
#if 0
TEST_F(TfsTest, 04_File) {
int32_t code = 0;
SDiskCfg dCfg = {0};
tstrncpy(dCfg.dir, root, TSDB_FILENAME_LEN);
dCfg.level = 0;
dCfg.primary = 1;
taosRemoveDir(root);
taosMkDir(root);
STfs *pTfs = tfsOpen(&dCfg, 1);
ASSERT_NE(pTfs, nullptr);
STfsFile file0;
STfsFile file1;
STfsFile file2;
STfsFile file3;
STfsFile file4;
SDiskID did0 = {0};
SDiskID did1 = {0};
SDiskID did2 = {0};
SDiskID did3 = {0};
SDiskID did4 = {0};
did3.id = 1;
did4.level = 1;
tfsInitFile(pTfs, &file0, did0, "fname");
tfsInitFile(pTfs, &file1, did1, "fname");
tfsInitFile(pTfs, &file2, did2, "fnamex");
tfsInitFile(pTfs, &file3, did3, "fname");
tfsInitFile(pTfs, &file4, did4, "fname");
EXPECT_TRUE(tfsIsSameFile(&file0, &file1));
EXPECT_FALSE(tfsIsSameFile(&file0, &file2));
EXPECT_FALSE(tfsIsSameFile(&file0, &file3));
EXPECT_FALSE(tfsIsSameFile(&file0, &file4));
tfsClose(pTfs);
}
#endif
\ No newline at end of file
tests/script/sim/db/basic1.sim
浏览文件 @
c978eb12
...
...
@@ -4,7 +4,7 @@ system sh/exec.sh -n dnode1 -s start
sql connect
print =============== create database
sql create database d1
sql create database d1
vgroups 2
sql show databases
if $rows != 1 then
return -1
...
...
@@ -22,6 +22,21 @@ if $data03 != 0 then
return -1
endi
print =============== show vgroups1
sql use d1
sql show vgroups
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
print =============== drop database
sql drop database d1
sql show databases
...
...
@@ -30,14 +45,68 @@ if $rows != 0 then
endi
print =============== more databases
sql create database d2
sql create database d3
sql create database d4
sql create database d2
vgroups 2
sql create database d3
vgroups 3
sql create database d4
vgroups 4
sql show databases
if $rows != 3 then
return -1
endi
print =============== show vgroups2
sql show d2.vgroups
if $rows != 2 then
return -1
endi
if $data00 != 4 then
return -1
endi
if $data10 != 5 then
return -1
endi
print =============== show vgroups3
sql show d3.vgroups
if $rows != 3 then
return -1
endi
if $data00 != 6 then
return -1
endi
if $data10 != 7 then
return -1
endi
if $data20 != 8 then
return -1
endi
print =============== show vgroups4
sql show d4.vgroups
if $rows != 4 then
return -1
endi
if $data00 != 9 then
return -1
endi
if $data10 != 10 then
return -1
endi
if $data20 != 11 then
return -1
endi
if $data30 != 12 then
return -1
endi
print =============== drop database
sql drop database d2
sql drop database d3
...
...
@@ -50,7 +119,7 @@ if $data00 != d4 then
return -1
endi
if $data02 !=
2
then
if $data02 !=
4
then
return -1
endi
...
...
@@ -58,19 +127,12 @@ if $data03 != 0 then
return -1
endi
print =============== show vgroups
sql show databases
if $rows != 1 then
return -1
endi
print =============== show vgroups4 again
sql_error use d1
sql use d4
sql show vgroups
if $rows != 2 then
if $rows != 4 then
return -1
endi
...
...
@@ -81,15 +143,16 @@ if $data00 != 1 then
return -1
endi
if $data02 !=
2
then
if $data02 !=
4
then
return -1
endi
print =============== restart
system sh/exec.sh -n dnode1 -s stop -x SIGKILL
system sh/exec.sh -n dnode1 -s start
sql show databases
if $rows != 1 then
return -1
endi
...
...
@@ -99,7 +162,24 @@ sql_error use d1
sql use d4
sql show vgroups
if $rows != 2 then
if $rows != 4 then
return -1
endi
sql create database d5 vgroups 5;
sql use d5
sql show vgroups
if $rows != 5 then
return -1
endi
sql show d4.vgroups
if $rows != 4 then
return -1
endi
sql show d5.vgroups
if $rows != 5 then
return -1
endi
...
...
tests/script/sim/db/basic6.sim
浏览文件 @
c978eb12
...
...
@@ -94,8 +94,8 @@ sql use $db
sql create table st (ts timestamp, i int) tags (j int)
sql create table $tb using st tags(1)
return
system sh/exec.sh -n dnode1 -s stop -x SIGINT
return
sql show tables
if $rows != 1 then
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录