replica3.sim 7.6 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
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
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
S
slguan 已提交
12

S
Shengliang Guan 已提交
13 14 15 16
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 10
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 10
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 10
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 10
S
slguan 已提交
17

S
scripts  
slguan 已提交
18 19 20 21
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000
S
slguan 已提交
22

S
scripts  
Shengliang Guan 已提交
23 24 25 26
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
system sh/cfg.sh -n dnode4 -c walLevel -v 2
S
slguan 已提交
27 28

print ========= start dnode1
S
Shengliang Guan 已提交
29
system sh/exec.sh -n dnode1 -s start
S
slguan 已提交
30 31
sql connect

S
slguan 已提交
32 33
sql create dnode $hostname2
sql create dnode $hostname3
R
scripts  
root 已提交
34
system sh/exec.sh -n dnode2 -s start
S
Shengliang Guan 已提交
35
system sh/exec.sh -n dnode3 -s start
S
slguan 已提交
36

S
Shengliang Guan 已提交
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
$x = 0
step1: 
	$x = $x + 1
	sleep 1000
	if $x == 10 then
		return -1
	endi

sql show dnodes
print dnode1 $data4_1
print dnode2 $data4_2
print dnode3 $data4_3
print dnode4 $data4_4

if $data4_1 != ready then
  goto step1
endi
if $data4_2 != ready then
  goto step1
endi
if $data4_3 != ready then
  goto step1
endi
S
slguan 已提交
60 61 62

sql create database ir3db replica 3 days 7
sql use ir3db
S
scripts  
Shengliang Guan 已提交
63
sql create table tb(ts timestamp, i bigint)
S
slguan 已提交
64 65

print ================= step1
S
scripts  
Shengliang Guan 已提交
66
sql import into tb values(1520000010000, 1520000010000)
S
slguan 已提交
67
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
68
print $rows
S
slguan 已提交
69 70 71 72 73
if $rows != 1 then 
  return -1
endi

print ================= step2
S
scripts  
Shengliang Guan 已提交
74
sql insert into tb values(1520000008000, 1520000008000)
guanshengliang's avatar
scripts  
guanshengliang 已提交
75
print $rows
S
slguan 已提交
76
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
77
if $rows != 2 then 
S
slguan 已提交
78 79 80 81
  return -1
endi

print ================= step3
S
scripts  
Shengliang Guan 已提交
82
sql insert into tb values(1520000020000, 1520000020000)
S
slguan 已提交
83
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
84 85
print $rows
if $rows != 3 then 
S
slguan 已提交
86 87 88 89
  return -1
endi

print ================= step4
S
scripts  
Shengliang Guan 已提交
90 91 92
sql import into tb values(1520000009000, 1520000009000)
sql import into tb values(1520000015000, 1520000015000)
sql import into tb values(1520000030000, 1520000030000)
S
slguan 已提交
93
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
94 95
print $rows
if $rows != 6 then 
S
slguan 已提交
96 97 98 99
  return -1
endi

print ================= step5
S
scripts  
Shengliang Guan 已提交
100 101 102 103
sql insert into tb values(1520000008000, 1520000008000)
sql insert into tb values(1520000014000, 1520000014000)
sql insert into tb values(1520000025000, 1520000025000)
sql insert into tb values(1520000040000, 1520000040000)
S
slguan 已提交
104
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
105 106
print $rows
if $rows != 9 then 
S
slguan 已提交
107 108 109 110
  return -1
endi

print ================= step6
S
scripts  
Shengliang Guan 已提交
111 112 113 114 115
sql import into tb values(1520000007000, 1520000007000)
sql import into tb values(1520000012000, 1520000012000)
sql import into tb values(1520000023000, 1520000023000)
sql import into tb values(1520000034000, 1520000034000)
sql import into tb values(1520000050000, 1520000050000)
S
slguan 已提交
116
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
117 118
print $rows
if $rows != 14 then 
S
slguan 已提交
119 120 121
  return -1
endi

S
scripts  
Shengliang Guan 已提交
122
print ================== dnode restart
S
Shengliang Guan 已提交
123 124
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
S
Shengliang Guan 已提交
125 126 127 128 129 130 131 132 133 134 135 136 137
$x = 0
a4: 
	$x = $x + 1
	sleep 1000
	if $x == 40 then
	  return -1
	endi
sql show vgroups 
print online vnodes $data03
if $data03 != 3 then
	goto a4
endi

S
scripts  
Shengliang Guan 已提交
138 139 140 141
sql select * from tb;
if $rows != 14 then 
  return -1
endi
S
slguan 已提交
142 143

print ================= step7
S
scripts  
Shengliang Guan 已提交
144 145 146 147 148
sql import into tb values(1520000007001, 1520000007001)
sql import into tb values(1520000012001, 1520000012001)
sql import into tb values(1520000023001, 1520000023001)
sql import into tb values(1520000034001, 1520000034001)
sql import into tb values(1520000050001, 1520000050001)
S
slguan 已提交
149
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
150
print $rows
S
scripts  
Shengliang Guan 已提交
151 152
if $rows != 19 then
  print expect 19, actual: $rows
S
slguan 已提交
153 154 155 156
  return -1
endi

print ================= step8
S
scripts  
Shengliang Guan 已提交
157 158 159 160
sql insert into tb values(1520000008002, 1520000008002)
sql insert into tb values(1520000014002, 1520000014002)
sql insert into tb values(1520000025002, 1520000025002)
sql insert into tb values(1520000060000, 1520000060000)
S
slguan 已提交
161
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
162
print $rows
S
scripts  
Shengliang Guan 已提交
163
if $rows != 23 then 
S
slguan 已提交
164 165 166 167
  return -1
endi

print ================= step9
guanshengliang's avatar
scripts  
guanshengliang 已提交
168 169 170 171 172 173 174 175 176 177 178 179 180 181
#1520000000000
#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+1d, 50001)
#sql import into tb values(now+2d, 50001)
#sql import into tb values(now+6d, 50001)
#sql import into tb values(now+8d, 50002)
#sql import into tb values(now+10d, 50003)
#sql import into tb values(now+12d, 50004)
#sql import into tb values(now+14d, 50001)
#sql import into tb values(now+16d, 500051)

S
scripts  
Shengliang Guan 已提交
182 183 184 185 186 187 188 189 190 191 192 193
sql import into tb values(1517408000000, 1517408000000)
sql import into tb values(1518272000000, 1518272000000)
sql import into tb values(1519136000000, 1519136000000)
sql import into tb values(1519568000000, 1519568000000)
sql import into tb values(1519654400000, 1519654400000)
sql import into tb values(1519827200000, 1519827200000)
sql import into tb values(1520345600000, 1520345600000)
sql import into tb values(1520691200000, 1520691200000)
sql import into tb values(1520864000000, 1520864000000)
sql import into tb values(1521900800000, 1521900800000)
sql import into tb values(1523110400000, 1523110400000)
sql import into tb values(1521382400000, 1521382400000)
S
slguan 已提交
194
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
195
print $rows
S
scripts  
Shengliang Guan 已提交
196
if $rows != 35 then 
S
slguan 已提交
197 198 199 200
  return -1
endi

print ================= step10
S
Shengliang Guan 已提交
201 202
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
S
Shengliang Guan 已提交
203 204 205 206 207 208 209 210 211 212 213 214 215 216

$x = 0
step10: 
	$x = $x + 1
	sleep 1000
	if $x == 40 then
	  return -1
	endi
sql show vgroups 
print online vnodes $data03
if $data03 != 3 then
	goto step10
endi

S
slguan 已提交
217
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
218
print $rows
S
scripts  
Shengliang Guan 已提交
219
if $rows != 35 then 
S
slguan 已提交
220 221 222 223
  return -1
endi

print ================= step11
guanshengliang's avatar
scripts  
guanshengliang 已提交
224 225

#sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003)
S
scripts  
Shengliang Guan 已提交
226
sql import into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5)
S
slguan 已提交
227
sql select * from tb;
S
scripts  
Shengliang Guan 已提交
228
if $rows != 40 then 
S
slguan 已提交
229 230 231 232
  return -1
endi

print ================= step12
guanshengliang's avatar
scripts  
guanshengliang 已提交
233
#1520000000000
S
scripts  
Shengliang Guan 已提交
234 235
#sql import into tb values(now-19d, -19) (now-18d, -18) (now-17d, -17) (now-16d, -16) (now-15d, -15) (now-14d, -14) (now-13d, -13) (now-12d, -12) (now-11d, -11)
sql import into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14)
S
slguan 已提交
236
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
237
print $rows
S
scripts  
Shengliang Guan 已提交
238
if $rows != 49 then 
S
slguan 已提交
239 240 241 242
  return -1
endi

print ================= step13
S
Shengliang Guan 已提交
243
system sh/exec.sh -n dnode2 -s stop -x SIGINT
H
Haojun Liao 已提交
244
sleep 3000
S
Shengliang Guan 已提交
245
system sh/exec.sh -n dnode2 -s start
H
Haojun Liao 已提交
246
sleep 3000
S
slguan 已提交
247 248

print ================= step14
guanshengliang's avatar
scripts  
guanshengliang 已提交
249
#1520000000000
S
scripts  
Shengliang Guan 已提交
250 251 252
#sql import into tb values(now-48d, -48)
#sql import into tb values(now-38d, -38)
#sql import into tb values(now-28d, -28)
guanshengliang's avatar
scripts  
guanshengliang 已提交
253

S
scripts  
Shengliang Guan 已提交
254 255 256
sql import into tb values(1515852800001, -48)
sql import into tb values(1516716800000, -38)
sql import into tb values(1517580800000, -28)
guanshengliang's avatar
scripts  
guanshengliang 已提交
257

S
slguan 已提交
258
sql select * from tb;
S
scripts  
Shengliang Guan 已提交
259
if $rows != 52 then 
S
slguan 已提交
260 261 262 263
  return -1
endi

print ================= step15
S
Shengliang Guan 已提交
264 265
system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s start
S
Shengliang Guan 已提交
266 267 268 269 270 271 272 273 274 275 276 277
$x = 0
step15: 
	$x = $x + 1
	sleep 1000
	if $x == 40 then
	  return -1
	endi
sql show vgroups 
print online vnodes $data03
if $data03 != 3 then
	goto step15
endi
S
slguan 已提交
278

S
Shengliang Guan 已提交
279
sql select * from tb;
S
scripts  
Shengliang Guan 已提交
280
if $rows != 52 then 
S
slguan 已提交
281 282
  return -1
endi
guanshengliang's avatar
scripts  
guanshengliang 已提交
283

S
Shengliang Guan 已提交
284 285 286 287 288 289 290 291
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