commit.sim 3.6 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
S
scripts  
slguan 已提交
5 6
system sh/cfg.sh -n dnode1 -c wallevel -v 2
system sh/cfg.sh -n dnode2 -c wallevel -v 2
S
slguan 已提交
7 8
system sh/cfg.sh -n dnode1 -c numofMpeers -v 3
system sh/cfg.sh -n dnode2 -c numofMpeers -v 3
S
scripts  
slguan 已提交
9
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
10 11

sql connect
S
slguan 已提交
12
sql create dnode $hostname2
S
scripts  
slguan 已提交
13
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
14 15 16 17 18 19 20 21 22 23
sleep 3000

print =================== step 1 create db
sql create database c2db replica 2 days 10 keep 50
sql use c2db
sql create table tb (ts timestamp, speed int) 
sql insert into tb values(now, 0)

print =================== step2 sleep 2000 and kill dnode2(SIGINT)
sleep 2000
S
scripts  
slguan 已提交
24
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
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 50 51 52 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 1000

print =================== step3 insert into dnode1

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

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

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

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

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

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

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

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

print =================== step4
sql select count(*) from tb
print select count(*) from tb ==> $data00 (expect 936)
if $data00 != 936 then 
  return -1
endi
sql select * from tb order by ts desc
print select * from tb ==> $data00 $data01 $rows
if $data01 != 1682 then 
  return -1
endi
if $rows != 936 then 
  return -1
endi

print =================== step5 sleep kill dnode1(SIGINT) then start dnode1
S
scripts  
slguan 已提交
101
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
S
slguan 已提交
102
sleep 5000
S
scripts  
slguan 已提交
103
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
104 105 106

sleep 3000
print =================== step6 start dnode2 and sleep 10000 (wait sync complete)
S
scripts  
slguan 已提交
107
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
sleep 12000

print =================== step7
sql_error insert into tb values(now + 1000h, 100)
sql select count(*) from tb order by ts desc
print select count(*) from tb ==> $data00 (expect <= 936)
if $data00 != 936 then
  return -1
endi
$remainRows = $data00

sql select * from tb order by ts desc
print select * from tb ==> $data00 $data01 $data10 $data11 $rows

if $data11 != 1681 then
  return -1
endi
if $rows != $remainRows then 
  return -1
endi

print =================== step8 kill dnode1(SIGINT) and query
S
scripts  
slguan 已提交
130
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
S
slguan 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
sleep 2000

print =================== step9
sql select count(*) from tb order by ts desc
print select count(*) from tb ==> $data00 (expect == $remainRows  )
if $data00 > $remainRows then 
  return -1
endi
if $data00 <= 0 then 
  return -1
endi

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

if $rows != $remainRows then 
  return -1
endi

guanshengliang's avatar
scripts  
guanshengliang 已提交
151 152 153 154 155 156 157 158
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