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
S
slguan 已提交
9 10 11 12 13 14 15 16
system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4

print ========= start dnode1 as master
S
slguan 已提交
17
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
18 19 20 21
sql connect
sleep 3000

print ========= start other dnodes
S
slguan 已提交
22
sql create dnode $hostname2
S
slguan 已提交
23
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
24 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
sleep 3000

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
slguan 已提交
50
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
S
slguan 已提交
51
sleep 5000
S
slguan 已提交
52
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
sleep 3000

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
print ===> rows $rows
print ===> last $data01

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
slguan 已提交
101
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
S
slguan 已提交
102
sleep 5000
S
slguan 已提交
103
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
104 105 106 107 108 109 110 111 112 113 114 115 116 117
sleep 3000

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

guanshengliang's avatar
scripts  
guanshengliang 已提交
118 119 120 121 122 123 124 125
system sh/exec_up.sh -n dnode1 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode3 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode4 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode5 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode6 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode7 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode8 -s stop  -x SIGINT