commit.sim 2.8 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2 3 4
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
S
slguan 已提交
5

H
hjxilinx 已提交
6 7 8
system sh/cfg.sh -n dnode1 -c walLevel -v 2
system sh/cfg.sh -n dnode2 -c walLevel -v 2
system sh/cfg.sh -n dnode3 -c walLevel -v 2
9 10 11
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
S
Shengliang Guan 已提交
12 13 14
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
S
slguan 已提交
15 16

print ========= start dnode1 as master
S
Shengliang Guan 已提交
17
system sh/exec.sh -n dnode1 -s start
S
slguan 已提交
18
sql connect
H
Haojun Liao 已提交
19
sleep 2000
S
slguan 已提交
20 21

print ========= start other dnodes
S
slguan 已提交
22
sql create dnode $hostname2
S
Shengliang Guan 已提交
23
system sh/exec.sh -n dnode2 -s start
H
Haojun Liao 已提交
24
sleep 2000
S
slguan 已提交
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

print ======== step1 create db
sql create database commitdb replica 1 days 7 keep 30
sql use commitdb
sql create table tb (ts timestamp, i int)

$x = 1
while $x < 41
  $time = $x . m
  sql insert into tb values (now + $time , $x ) 
  $x = $x + 1
endw 

sql select * from tb order by ts desc
print ===> rows $rows
print ===> last $data01

if $rows != 40 then
	return -1
endi
if $data01 != 40 then
	return -1
endi

print ======== step2 stop dnode
S
Shengliang Guan 已提交
50
system sh/exec.sh -n dnode2 -s stop -x SIGINT
H
Haojun Liao 已提交
51
sleep 3000
S
Shengliang Guan 已提交
52
system sh/exec.sh -n dnode2 -s start
H
Haojun Liao 已提交
53
sleep 3000
S
slguan 已提交
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74

sql select * from tb order by ts desc
print ===> rows $rows
print ===> last $data01

if $rows != 40 then
	return -1
endi
if $data01 != 40 then
	return -1
endi

$oldnum = $rows 
$num = $rows + 2

print ======== step3 import old data
sql import into tb values (now - 10d , -10 )
  
sql import into tb values (now - 11d , -11 )

sql select * from tb order by ts desc
S
scripts  
Shengliang Guan 已提交
75 76
print ===> rows $rows expect $num
print ===> last $data01 expect  $data01
S
slguan 已提交
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

if $rows != $num then
	return -1
endi
if $data01 != 40 then
	return -1
endi

print ======== step4 import new data
sql_error import into tb values (now + 30d , 30 )
sql_error import into tb values (now + 31d , 31 )

sql select * from tb order by ts desc
print ===> rows $rows
print ===> last $data01

if $rows != $num then
	return -1
endi
if $data01 != 40 then
	return -1
endi

print ======== step5 stop dnode
S
Shengliang Guan 已提交
101
system sh/exec.sh -n dnode2 -s stop -x SIGINT
H
Haojun Liao 已提交
102
sleep 3000
S
Shengliang Guan 已提交
103
system sh/exec.sh -n dnode2 -s start
H
Haojun Liao 已提交
104
sleep 3000
S
slguan 已提交
105 106 107 108 109 110 111 112 113 114 115 116 117

sql select * from tb
print ===> rows $rows
print ===> last $data01

sql select * from tb order by ts desc
if $rows != $num then
	return -1
endi
if $data01 != 40 then
	return -1
endi

S
Shengliang Guan 已提交
118 119 120 121 122 123 124 125
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
system sh/exec.sh -n dnode4 -s stop  -x SIGINT
system sh/exec.sh -n dnode5 -s stop  -x SIGINT
system sh/exec.sh -n dnode6 -s stop  -x SIGINT
system sh/exec.sh -n dnode7 -s stop  -x SIGINT
system sh/exec.sh -n dnode8 -s stop  -x SIGINT