replica3.sim 4.9 KB
Newer Older
S
slguan 已提交
1 2
system sh/stop_dnodes.sh

S
slguan 已提交
3 4 5 6
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
S
slguan 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

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 dnode4 -c numOfMPeers -v 1

system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 10
system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 10
system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 10
system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 10

system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2000
system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 2000
system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 2000
system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 2000

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 dnode3 -c commitlog -v 0
system sh/cfg.sh -n dnode4 -c commitlog -v 0

print ========= start dnode1
S
scripts  
slguan 已提交
29
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
30 31 32
sleep 5000
sql connect

S
slguan 已提交
33
sql create dnode $hostname2
S
scripts  
slguan 已提交
34
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
35
sql create dnode $hostname3
S
scripts  
slguan 已提交
36
system sh/exec_up.sh -n dnode3 -s start
S
slguan 已提交
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


sql create database ir3db replica 3 days 7
sql use ir3db
sql create table tb(ts timestamp, i int)

print ================= step1
sql import into tb values(now+10000a, 10000)
sql select * from tb;
if $rows != 1 then 
  return -1
endi

print ================= step2
sql insert into tb values(now+8000a, 8000)
sql select * from tb;
if $rows != 1 then 
  return -1
endi

print ================= step3
sql insert into tb values(now+20000a, 20000)
sql select * from tb;
if $rows != 2 then 
  return -1
endi

print ================= step4
sql import into tb values(now+8000a, 9000)
sql import into tb values(now+15000a, 15000)
sql import into tb values(now+30000a, 30000)
sql select * from tb;
if $rows != 5 then 
  return -1
endi

print ================= step5
sql insert into tb values(now+8000a, 8000)
sql insert into tb values(now+14000a, 14000)
sql insert into tb values(now+25000a, 25000)
sql insert into tb values(now+40000a, 40000)
sql select * from tb;
if $rows != 6 then 
  return -1
endi

print ================= step6
sql import into tb values(now+7000a, 7000)
sql import into tb values(now+12000a, 12000)
sql import into tb values(now+23000a, 23000)
sql import into tb values(now+34000a, 34000)
sql import into tb values(now+50000a, 50000)
sql select * from tb;
if $rows != 11 then 
  return -1
endi

#print ================== dnode restart
S
scripts  
slguan 已提交
95
#system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
S
slguan 已提交
96
#sleep 5000
S
scripts  
slguan 已提交
97
#system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
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
#sleep 5000
#sql select * from tb;
#if $rows != 11 then 
#  return -1
#endi

print ================= step7
sql import into tb values(now+7001a, 7001)
sql import into tb values(now+12001a, 12001)
sql import into tb values(now+23001a, 23001)
sql import into tb values(now+34001a, 34001)
sql import into tb values(now+50001a, 50001)
sql select * from tb;
if $rows != 16 then 
  return -1
endi

print ================= step8
sql insert into tb values(now+8002a, 8002)
sql insert into tb values(now+14002a, 14002)
sql insert into tb values(now+25002a, 25002)
sql insert into tb values(now+200000a, 60000)
sql select * from tb;
if $rows != 17 then 
  return -1
endi

print ================= step9
sql import into tb values(now-30d, 7003)
sql import into tb values(now-20d, 34003)
sql import into tb values(now-10d, 34003)
sql import into tb values(now-5d, 34003)
sql import into tb values(now+1m, 50001)
sql import into tb values(now+2m, 50001)
sql import into tb values(now+6m, 50001)
sql import into tb values(now+8m, 50002)
sql import into tb values(now+10m, 50003)
sql import into tb values(now+12m, 50004)
sql import into tb values(now+14m, 50001)
sql import into tb values(now+16m, 500051)
sql select * from tb;
if $rows != 29 then 
  return -1
endi

print ================= step10
S
scripts  
slguan 已提交
144
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
S
slguan 已提交
145
sleep 5000
S
scripts  
slguan 已提交
146
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
sleep 5000
sql select * from tb;
if $rows != 29 then 
  return -1
endi

print ================= step11
sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003)
sql select * from tb;
if $rows != 34 then 
  return -1
endi

print ================= step12
sql import into tb values(now-19d, 7003) (now-18d, 7003) (now-17d, 7003) (now-16d, 7003) (now-15d, 7003) (now-14d, 7003) (now-13d, 7003) (now-12d, 7003) (now-11d, 7003)
sql select * from tb;
if $rows != 43 then 
  return -1
endi

print ================= step13
S
scripts  
slguan 已提交
168
system sh/exec_up.sh -n dnode2 -s stop 
S
slguan 已提交
169 170 171 172 173 174 175 176 177 178 179 180
sleep 5000

print ================= step14
sql import into tb values(now-48d, 34003)
sql import into tb values(now-38d, 50001)
sql import into tb values(now-28d, 50001)
sql select * from tb;
if $rows != 46 then 
  return -1
endi

print ================= step15
S
scripts  
slguan 已提交
181
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
182
sleep 8000
S
scripts  
slguan 已提交
183
system sh/exec_up.sh -n dnode3 -s stop
S
slguan 已提交
184 185 186 187 188
sleep 3000

if $rows != 46 then 
  return -1
endi