Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a33799fe
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看板
提交
a33799fe
编写于
11月 28, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: adjust alter replica case
上级
af06f93f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
121 addition
and
46 deletion
+121
-46
tests/script/tsim/db/alter_replica_13.sim
tests/script/tsim/db/alter_replica_13.sim
+64
-24
tests/script/tsim/db/alter_replica_31.sim
tests/script/tsim/db/alter_replica_31.sim
+57
-22
未找到文件。
tests/script/tsim/db/alter_replica_13.sim
浏览文件 @
a33799fe
...
...
@@ -3,6 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c supportVnodes -v 0
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
...
...
@@ -34,7 +35,7 @@ if $data(2)[4] != ready then
endi
print =============== step2: create database
sql create database db vgroups
1
sql create database db vgroups
4
sql select * from information_schema.ins_databases
if $rows != 3 then
return -1
...
...
@@ -43,14 +44,9 @@ if $data(db)[4] != 1 then
return -1
endi
sql select * from information_schema.ins_dnodes
if $data(2)[2] != 1 then
return -1
endi
# vnodes
sql select * from information_schema.ins_dnodes
if $data(2)[2] !=
1
then
if $data(2)[2] !=
4
then
return -1
endi
...
...
@@ -61,13 +57,28 @@ if $data(2)[3] != 2 then
endi
sql_error alter database db replica 3
sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd"
sql create table db.ctb using db.stb tags(101, "102")
sql insert into db.ctb values(now, 1, "2")
sql select * from db.stb
if $rows != 1 then
return -1
endi
sql create table db.ctb0 using db.stb tags(100, "100")
sql create table db.ctb1 using db.stb tags(101, "101")
sql create table db.ctb2 using db.stb tags(102, "102")
sql create table db.ctb3 using db.stb tags(103, "103")
sql create table db.ctb4 using db.stb tags(104, "104")
sql create table db.ctb5 using db.stb tags(105, "105")
sql create table db.ctb6 using db.stb tags(106, "106")
sql create table db.ctb7 using db.stb tags(107, "107")
sql create table db.ctb8 using db.stb tags(108, "108")
sql create table db.ctb9 using db.stb tags(109, "109")
sql insert into db.ctb0 values(now, 0, "0")
sql insert into db.ctb1 values(now, 1, "1")
sql insert into db.ctb2 values(now, 2, "2")
sql insert into db.ctb3 values(now, 3, "3")
sql insert into db.ctb4 values(now, 4, "4")
sql insert into db.ctb5 values(now, 5, "5")
sql insert into db.ctb6 values(now, 6, "6")
sql insert into db.ctb7 values(now, 7, "7")
sql insert into db.ctb8 values(now, 8, "8")
sql insert into db.ctb9 values(now, 9, "9")
print =============== step3: create dnodes
sql create dnode $hostname port 7300
...
...
@@ -106,6 +117,8 @@ endi
print ============= step4: alter database
sql alter database db replica 3
$leaderIndex = 0
$x = 0
step4:
$x = $x + 1
...
...
@@ -114,46 +127,73 @@ step4:
print ====> dnode not ready!
return -1
endi
sql show db.vgroups
print ===> rows: $rows
print ===> $data00 $data01 $data02 $data03 $data04 $data05
if $data[0][4]
!
= leader then
goto step4
if $data[0][4]
=
= leader then
$leaderIndex = 1
endi
if $data[0][6]
!= follow
er then
goto step4
if $data[0][6]
== lead
er then
$leaderIndex = 2
endi
if $data[0][8] != follower then
if $data[0][8] == leader then
$leaderIndex = 3
endi
if $$leaderIndex == 0 then
goto step4
endi
print leaderIndex ==> $leaderIndex
print ============= step5: result
$i = 0
while $i < 10
$i = $i + 1
sleep 1000
$leaderIndex2 = 0
sql show db.vgroups
print ===> loop: $i | v0: $data03 $data04 | v1: $data05 $data06 | v2: $data07 $data08
if $data[0][4]
!
= leader then
return -
1
if $data[0][4]
=
= leader then
$leaderIndex2 =
1
endi
if $data[0][6] == leader then
return -1
$leaderIndex2 = 2
endi
if $data[0][8] == leader then
$leaderIndex2 = 3
endi
print leaderIndex2 ==> $leaderIndex2
if $leaderIndex2 != $leaderIndex then
return -1
endi
endw
print ============= step5: check data
sql select * from db.ctb0
if $rows != 1 then
return -1
endi
print ============= step5: stop dnode 2
sql select * from db.stb
sql select * from db.ctb1
if $rows != 1 then
return -1
endi
return
sql select * from db.ctb2
if $rows != 1 then
return -1
endi
sql select * from db.stb
if $rows != 10 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
...
...
tests/script/tsim/db/alter_replica_31.sim
浏览文件 @
a33799fe
...
...
@@ -3,6 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c supportVnodes -v 0
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
...
...
@@ -45,7 +46,7 @@ if $data(4)[4] != ready then
endi
print =============== step2: create database
sql create database db vgroups
1
replica 3
sql create database db vgroups
4
replica 3
sql select * from information_schema.ins_databases
if $rows != 3 then
return -1
...
...
@@ -54,26 +55,15 @@ if $data(db)[4] != 3 then
return -1
endi
sql select * from information_schema.ins_dnodes
if $data(2)[2] != 1 then
return -1
endi
if $data(3)[2] != 1 then
return -1
endi
if $data(4)[2] != 1 then
return -1
endi
# vnodes
sql select * from information_schema.ins_dnodes
if $data(2)[2] !=
1
then
if $data(2)[2] !=
4
then
return -1
endi
if $data(3)[2] !=
1
then
if $data(3)[2] !=
4
then
return -1
endi
if $data(4)[2] !=
1
then
if $data(4)[2] !=
4
then
return -1
endi
...
...
@@ -112,20 +102,50 @@ if $hasleader != 1 then
endi
sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd"
sql create table db.ctb using db.stb tags(101, "102")
sql insert into db.ctb values(now, 1, "2")
sql create table db.ctb0 using db.stb tags(100, "100")
sql create table db.ctb1 using db.stb tags(101, "101")
sql create table db.ctb2 using db.stb tags(102, "102")
sql create table db.ctb3 using db.stb tags(103, "103")
sql create table db.ctb4 using db.stb tags(104, "104")
sql create table db.ctb5 using db.stb tags(105, "105")
sql create table db.ctb6 using db.stb tags(106, "106")
sql create table db.ctb7 using db.stb tags(107, "107")
sql create table db.ctb8 using db.stb tags(108, "108")
sql create table db.ctb9 using db.stb tags(109, "109")
sql insert into db.ctb0 values(now, 0, "0")
sql insert into db.ctb1 values(now, 1, "1")
sql insert into db.ctb2 values(now, 2, "2")
sql insert into db.ctb3 values(now, 3, "3")
sql insert into db.ctb4 values(now, 4, "4")
sql insert into db.ctb5 values(now, 5, "5")
sql insert into db.ctb6 values(now, 6, "6")
sql insert into db.ctb7 values(now, 7, "7")
sql insert into db.ctb8 values(now, 8, "8")
sql insert into db.ctb9 values(now, 9, "9")
sql show db.vgroups
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08
sleep 100
sql select * from db.ctb
print ===> $data00 $data01 $data02 $data03 $data04 $data05
sql select * from db.ctb0
if $rows != 1 then
return -1
endi
sql select * from db.ctb1
if $rows != 1 then
return -1
endi
sql select * from db.ctb2
if $rows != 1 then
return -1
endi
sql select * from db.stb
if $rows != 10 then
return -1
endi
print ============= step3: alter database
sql alter database db replica 1
$hasleader = 0
...
...
@@ -140,7 +160,7 @@ step3:
endi
sql show db.vgroups
print ===> rows: $rows
if $rows !=
1
then
if $rows !=
4
then
goto step3
endi
if $data(2)[4] == leader then
...
...
@@ -157,11 +177,26 @@ if $hasleader != 1 then
endi
print ============= step5: stop dnode 2
sql select * from db.stb
sql select * from db.ctb0
if $rows != 1 then
return -1
endi
sql select * from db.ctb1
if $rows != 1 then
return -1
endi
sql select * from db.ctb2
if $rows != 1 then
return -1
endi
sql select * from db.stb
if $rows != 10 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录