commit.sim 3.2 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2 3 4 5


system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
S
slguan 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 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 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
system sh/cfg.sh -n dnode1 -c commitLog -v 0
system sh/cfg.sh -n dnode2 -c commitLog -v 0
system sh/cfg.sh -n dnode1 -c numofMpeers -v 3
system sh/cfg.sh -n dnode2 -c numofMpeers -v 3
system sh/exec.sh -n dnode1 -s start

sql connect
sql create dnode 192.168.0.2
system sh/exec.sh -n dnode2 -s start
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
system sh/exec.sh -n dnode2 -s stop -x SIGINT
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
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 5000
system sh/exec.sh -n dnode1 -s start

sleep 3000
print =================== step6 start dnode2 and sleep 10000 (wait sync complete)
system sh/exec.sh -n dnode2 -s start
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
system sh/exec.sh -n dnode1 -s stop -x SIGINT
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

system sh/exec.sh -n dnode1 -s start