balance2.sim 9.0 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2 3 4 5 6 7 8 9
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
system sh/deploy.sh -n dnode5 -i 5
system sh/deploy.sh -n dnode6 -i 6
system sh/deploy.sh -n dnode7 -i 7
system sh/deploy.sh -n dnode8 -i 8
S
slguan 已提交
10

11 12 13 14 15 16 17 18
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode5 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode6 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode7 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode8 -c numOfMnodes -v 3
S
slguan 已提交
19

S
scripts  
slguan 已提交
20 21 22 23 24 25 26 27
system sh/cfg.sh -n dnode1 -c wallevel -v 1
system sh/cfg.sh -n dnode2 -c wallevel -v 1
system sh/cfg.sh -n dnode3 -c wallevel -v 1
system sh/cfg.sh -n dnode4 -c wallevel -v 1
system sh/cfg.sh -n dnode5 -c wallevel -v 1
system sh/cfg.sh -n dnode6 -c wallevel -v 1
system sh/cfg.sh -n dnode7 -c wallevel -v 1
system sh/cfg.sh -n dnode8 -c wallevel -v 1
S
slguan 已提交
28

S
Shengliang Guan 已提交
29 30 31 32 33 34 35 36
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 0
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 0
system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 0
system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 0
system sh/cfg.sh -n dnode7 -c mnodeEqualVnodeNum -v 0
system sh/cfg.sh -n dnode8 -c mnodeEqualVnodeNum -v 0
S
slguan 已提交
37 38 39

print ============== step1
print ========= start dnode1
S
Shengliang Guan 已提交
40
system sh/exec.sh -n dnode1 -s start
S
slguan 已提交
41 42 43

sql connect
sleep 4001
S
slguan 已提交
44 45
sql create dnode $hostname2
sql create dnode $hostname3
S
Shengliang Guan 已提交
46 47
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
S
slguan 已提交
48 49
sleep 4001

S
scripts  
slguan 已提交
50
sql create database c_b2_d1 replica 2 maxTables 4
S
slguan 已提交
51 52 53 54 55 56 57 58
sql use c_b2_d1
sql create table c_b2_t1 (t timestamp, i int)
sql insert into c_b2_t1 values(1520000020015, 15)
sql insert into c_b2_t1 values(1520000021014, 14)
sql insert into c_b2_t1 values(1520000022013, 13)
sql insert into c_b2_t1 values(1520000023012, 12)
sql insert into c_b2_t1 values(1520000024011, 11)

S
scripts  
slguan 已提交
59
sql create database c_b2_d2 replica 2 maxTables 4
S
slguan 已提交
60 61 62 63 64 65 66 67
sql use c_b2_d2
sql create table c_b2_t2 (t timestamp, i int)
sql insert into c_b2_t2 values(1520000020025, 25)
sql insert into c_b2_t2 values(1520000021024, 24)
sql insert into c_b2_t2 values(1520000022023, 23)
sql insert into c_b2_t2 values(1520000023022, 22)
sql insert into c_b2_t2 values(1520000024021, 21)

S
scripts  
slguan 已提交
68
sql create database c_b2_d3 replica 2 maxTables 4
S
slguan 已提交
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
sql use c_b2_d3
sql create table c_b2_t3 (t timestamp, i int)
sql insert into c_b2_t3 values(1520000020035, 35)
sql insert into c_b2_t3 values(1520000021034, 34)
sql insert into c_b2_t3 values(1520000022033, 33)
sql insert into c_b2_t3 values(1520000023032, 32)
sql insert into c_b2_t3 values(1520000024031, 31)

$x = 0
show1: 
	$x = $x + 1
	sleep 3000
	if $x == 20 then 
	  return -1
	endi
sql show dnodes -x show1
S
scripts  
slguan 已提交
85
$dnode1Vnodes = $data2_1
S
slguan 已提交
86
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
87
$dnode2Vnodes = $data2_2
S
slguan 已提交
88
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
89
$dnode3Vnodes = $data2_3
S
slguan 已提交
90
print dnode3 $dnode3Vnodes
S
slguan 已提交
91 92 93 94 95 96 97 98 99 100 101 102 103

if $dnode1Vnodes != 2 then
  goto show1
endi
if $dnode2Vnodes != 2 then
  goto show1
endi
if $dnode3Vnodes != 2 then
  goto show1
endi

print ============================== step2
print ========= drop dnode2
S
slguan 已提交
104
sql drop dnode $hostname2
S
slguan 已提交
105 106 107 108 109 110 111 112 113 114
sleep 9000

$x = 0
show2: 
	$x = $x + 1
	sleep 3000
	if $x == 20 then 
	  return -1
	endi
sql show dnodes -x show2
S
scripts  
slguan 已提交
115
$dnode1Vnodes = $data2_1
S
slguan 已提交
116
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
117
$dnode2Vnodes = $data2_2
S
slguan 已提交
118
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
119
$dnode3Vnodes = $data2_3
S
slguan 已提交
120
print dnode3 $dnode3Vnodes
S
slguan 已提交
121

S
scripts  
slguan 已提交
122
if $dnode1Vnodes != 3 then
S
slguan 已提交
123 124
  goto show2
endi
S
scripts  
Shengliang Guan 已提交
125
if $dnode2Vnodes != null then
S
slguan 已提交
126 127
  goto show2
endi
S
scripts  
slguan 已提交
128
if $dnode3Vnodes != 3 then
S
slguan 已提交
129 130 131 132
  goto show2
endi

sql show mnodes
S
scripts  
slguan 已提交
133 134 135 136
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
137 138 139 140
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
141

S
Shengliang Guan 已提交
142
system sh/exec.sh -n dnode2 -s stop  -x SIGINT
S
slguan 已提交
143 144

print ============================== step3
S
scripts  
slguan 已提交
145 146
print ========= start dnode4
sql create dnode $hostname4
S
Shengliang Guan 已提交
147
system sh/exec.sh -n dnode4 -s start
S
slguan 已提交
148 149 150 151 152 153 154 155 156 157
sleep 10000

$x = 0
show3: 
	$x = $x + 1
	sleep 3000
	if $x == 20 then 
	  return -1
	endi
sql show dnodes -x show3
S
scripts  
slguan 已提交
158
$dnode1Vnodes = $data2_1
S
slguan 已提交
159
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
160 161
$dnode4Vnodes = $data2_4
print dnode4 $dnode4Vnodes
S
scripts  
slguan 已提交
162
$dnode3Vnodes = $data2_3
S
slguan 已提交
163
print dnode3 $dnode3Vnodes
S
slguan 已提交
164 165 166 167

if $dnode1Vnodes != 2 then
  goto show3
endi
S
scripts  
slguan 已提交
168
if $dnode4Vnodes != 2 then
S
slguan 已提交
169 170 171 172 173 174 175
  goto show3
endi
if $dnode3Vnodes != 2 then
  goto show3
endi

sql show mnodes
S
scripts  
slguan 已提交
176 177 178 179
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
180 181 182 183
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
184

S
scripts  
slguan 已提交
185 186 187
if $dnode1Role != master then
  return -1
endi
S
scripts  
Shengliang Guan 已提交
188
if $dnode2Role != null then
S
scripts  
slguan 已提交
189 190 191 192 193 194 195 196 197 198
  return -1
endi
if $dnode3Role != slave then
  return -1
endi

if $dnode4Role != slave then
  return -1
endi

S
slguan 已提交
199 200
print ============================== step4
print ========= drop dnode3
S
slguan 已提交
201
sql drop dnode $hostname3
S
slguan 已提交
202 203 204 205 206 207 208 209 210 211
sleep 9000

$x = 0
show4: 
	$x = $x + 1
	sleep 3000
	if $x == 20 then 
	  return -1
	endi
sql show dnodes -x show4
S
scripts  
slguan 已提交
212
$dnode1Vnodes = $data2_1
S
slguan 已提交
213
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
214 215
$dnode4Vnodes = $data2_4
print dnode4 $dnode4Vnodes
S
scripts  
slguan 已提交
216
$dnode3Vnodes = $data2_3
S
slguan 已提交
217
print dnode3 $dnode3Vnodes
S
slguan 已提交
218

S
scripts  
slguan 已提交
219
if $dnode1Vnodes != 3 then
S
slguan 已提交
220 221
  goto show4
endi
S
scripts  
slguan 已提交
222
if $dnode4Vnodes != 3 then
S
slguan 已提交
223 224
  goto show4
endi
S
scripts  
Shengliang Guan 已提交
225
if $dnode3Vnodes != null then
S
slguan 已提交
226 227 228 229
  goto show4
endi

sql show mnodes
S
scripts  
slguan 已提交
230 231 232 233
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
234 235 236 237
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
238

S
scripts  
slguan 已提交
239 240 241
if $dnode1Role != master then
  return -1
endi
S
scripts  
Shengliang Guan 已提交
242
if $dnode2Role != null then
S
scripts  
slguan 已提交
243 244
  return -1
endi
S
scripts  
Shengliang Guan 已提交
245
if $dnode3Role != null then
S
scripts  
slguan 已提交
246 247 248 249 250 251 252
  return -1
endi

if $dnode4Role != slave then
  return -1
endi

S
Shengliang Guan 已提交
253
system sh/exec.sh -n dnode3 -s stop  -x SIGINT
S
slguan 已提交
254 255 256

print ============================== step5
print ========= start dnode3
S
scripts  
slguan 已提交
257
sql create dnode $hostname5
S
Shengliang Guan 已提交
258
system sh/exec.sh -n dnode5 -s start
S
slguan 已提交
259 260 261 262 263 264 265 266 267 268
sleep 9000

$x = 0
show5: 
	$x = $x + 1
	sleep 2000
	if $x == 30 then
	  return -1
	endi
sql show dnodes -x show5
S
scripts  
slguan 已提交
269
$dnode1Vnodes = $data2_1
S
slguan 已提交
270
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
271 272 273 274
$dnode4Vnodes = $data2_4
print dnode4 $dnode4Vnodes
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
S
slguan 已提交
275 276 277 278

if $dnode1Vnodes != 2 then
  goto show5
endi
S
scripts  
slguan 已提交
279
if $dnode4Vnodes != 2 then
S
slguan 已提交
280 281
  goto show5
endi
S
scripts  
slguan 已提交
282
if $dnode5Vnodes != 2 then
S
slguan 已提交
283 284 285 286
  goto show5
endi

sql show mnodes
S
scripts  
slguan 已提交
287 288
$dnode1Role = $data2_1
$dnode4Role = $data2_4
S
scripts  
slguan 已提交
289
$dnode5Role = $data2_5
S
slguan 已提交
290 291
print dnode1 ==> $dnode1Role
print dnode4 ==> $dnode4Role
S
scripts  
slguan 已提交
292
print dnode5 ==> $dnode5Role
S
slguan 已提交
293 294

print ============================== step6
S
Shengliang Guan 已提交
295
system sh/exec.sh -n dnode1 -s stop  -x SIGINT
S
slguan 已提交
296 297 298
print stop dnode1 and sleep 10000
sleep 10000

S
slguan 已提交
299
sql drop dnode $hostname1
S
slguan 已提交
300 301 302
print drop dnode1 and sleep 9000
sleep 9000

S
scripts  
slguan 已提交
303 304 305 306 307 308 309 310 311 312 313 314 315
sql show mnodes
$dnode1Role = $data2_1
$dnode4Role = $data2_4
$dnode5Role = $data2_5
print dnode1 ==> $dnode1Role
print dnode4 ==> $dnode4Role
print dnode5 ==> $dnode5Role

if $dnode1Role != offline then
  return -1
endi

print ============================== step6.1
S
Shengliang Guan 已提交
316
system sh/exec.sh -n dnode1 -s start
S
scripts  
slguan 已提交
317

S
slguan 已提交
318 319 320 321
$x = 0
show6: 
	$x = $x + 1
	sleep 2000
322
	if $x == 10 then
S
slguan 已提交
323 324 325
	  return -1
	endi
sql show dnodes -x show6
S
scripts  
slguan 已提交
326
$dnode1Vnodes = $data2_1
S
slguan 已提交
327
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
328 329 330 331
$dnode4Vnodes = $data2_4
print dnode4 $dnode4Vnodes
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
S
slguan 已提交
332

S
scripts  
Shengliang Guan 已提交
333
if $dnode1Vnodes != null then
S
slguan 已提交
334 335
  goto show6
endi
S
scripts  
slguan 已提交
336
if $dnode4Vnodes != 3 then
S
slguan 已提交
337 338
  goto show6
endi
S
scripts  
slguan 已提交
339
if $dnode5Vnodes != 3 then
S
slguan 已提交
340 341 342 343
  goto show6
endi

sql show mnodes
S
scripts  
slguan 已提交
344 345
$dnode1Role = $data2_1
$dnode4Role = $data2_4
S
scripts  
slguan 已提交
346
$dnode5Role = $data2_5
S
slguan 已提交
347 348
print dnode1 ==> $dnode1Role
print dnode4 ==> $dnode4Role
S
scripts  
slguan 已提交
349 350
print dnode5 ==> $dnode5Role

S
Shengliang Guan 已提交
351
#system sh/exec.sh -n dnode1 -s stop  -x SIGINT
S
slguan 已提交
352 353 354 355

print ============================== step12
print ========= check data

S
scripts  
slguan 已提交
356
sql reset query cache
S
scripts  
slguan 已提交
357
sleep 1000
S
scripts  
slguan 已提交
358 359

sql select * from c_b2_d1.c_b2_t1 order by t desc
S
slguan 已提交
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
print $data01 $data11 $data21 $data31 $data41
if $data01 != 11 then
  return -1
endi
if $data11 != 12 then
  return -1
endi
if $data21 != 13 then
  return -1
endi
if $data31 != 14 then
  return -1
endi
if $data41 != 15 then
  return -1
endi

S
scripts  
slguan 已提交
377
sql select * from c_b2_d2.c_b2_t2 order by t desc
S
slguan 已提交
378 379
print $data01 $data11 $data21 $data31 $data41

S
scripts  
slguan 已提交
380
if $data01 != 21 then
S
slguan 已提交
381 382
  return -1
endi
S
scripts  
slguan 已提交
383
if $data11 != 22 then
S
slguan 已提交
384 385
  return -1
endi
S
scripts  
slguan 已提交
386
if $data21 != 23 then
S
slguan 已提交
387 388
  return -1
endi
S
scripts  
slguan 已提交
389
if $data31 != 24 then
S
slguan 已提交
390 391
  return -1
endi
S
scripts  
slguan 已提交
392
if $data41 != 25 then
S
slguan 已提交
393 394 395
  return -1
endi

S
scripts  
slguan 已提交
396
sql select * from c_b2_d3.c_b2_t3 order by t desc
S
slguan 已提交
397
print $data01 $data11 $data21 $data31 $data41
S
scripts  
slguan 已提交
398
if $data01 != 31 then
S
slguan 已提交
399 400
  return -1
endi
S
scripts  
slguan 已提交
401
if $data11 != 32 then
S
slguan 已提交
402 403
  return -1
endi
S
scripts  
slguan 已提交
404
if $data21 != 33 then
S
slguan 已提交
405 406
  return -1
endi
S
scripts  
slguan 已提交
407
if $data31 != 34 then
S
slguan 已提交
408 409
  return -1
endi
S
scripts  
slguan 已提交
410
if $data41 != 35 then
S
slguan 已提交
411 412 413 414
  return -1
endi

print ============================================ over
S
Shengliang Guan 已提交
415 416 417 418
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
419
system sh/exec.sh -n dnode5 -s stop  -x SIGKILL
S
Shengliang Guan 已提交
420 421 422
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