balance2.sim 16.6 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 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

system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode5 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode6 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode7 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode8 -c numOfTotalVnodes -v 4

system sh/cfg.sh -n dnode1 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode4 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode5 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode6 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode7 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode8 -c numOfMPeers -v 3

system sh/cfg.sh -n dnode1 -c clog -v 1
system sh/cfg.sh -n dnode2 -c clog -v 1
system sh/cfg.sh -n dnode3 -c clog -v 1
system sh/cfg.sh -n dnode4 -c clog -v 1
system sh/cfg.sh -n dnode5 -c clog -v 1
system sh/cfg.sh -n dnode6 -c clog -v 1
system sh/cfg.sh -n dnode7 -c clog -v 1
system sh/cfg.sh -n dnode8 -c clog -v 1

system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 0
system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 0
system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 0
system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 0
system sh/cfg.sh -n dnode5 -c mgmtEqualVnodeNum -v 0
system sh/cfg.sh -n dnode6 -c mgmtEqualVnodeNum -v 0
system sh/cfg.sh -n dnode7 -c mgmtEqualVnodeNum -v 0
system sh/cfg.sh -n dnode8 -c mgmtEqualVnodeNum -v 0

print ============== step1
print ========= start dnode1
S
scripts  
slguan 已提交
49
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
50 51 52

sql connect
sleep 4001
S
slguan 已提交
53 54
sql create dnode $hostname2
sql create dnode $hostname3
S
scripts  
slguan 已提交
55 56
system sh/exec_up.sh -n dnode2 -s start
system sh/exec_up.sh -n dnode3 -s start
S
slguan 已提交
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
sleep 4001

sql create database c_b2_d1 replica 2 tables 4
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)

sql create database c_b2_d2 replica 2 tables 4
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)

sql create database c_b2_d3 replica 2 tables 4
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 已提交
94
$dnode1Vnodes = $data2_1
S
slguan 已提交
95
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
96
$dnode2Vnodes = $data2_2
S
slguan 已提交
97
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
98
$dnode3Vnodes = $data2_3
S
slguan 已提交
99
print dnode3 $dnode3Vnodes
S
slguan 已提交
100 101 102 103 104 105 106 107 108 109 110 111 112

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 已提交
113
sql drop dnode $hostname2
S
slguan 已提交
114 115 116 117 118 119 120 121 122 123
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 已提交
124
$dnode1Vnodes = $data2_1
S
slguan 已提交
125
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
126
$dnode2Vnodes = $data2_2
S
slguan 已提交
127
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
128
$dnode3Vnodes = $data2_3
S
slguan 已提交
129
print dnode3 $dnode3Vnodes
S
slguan 已提交
130 131 132 133 134 135 136 137 138 139 140 141

if $dnode1Vnodes != 1 then
  goto show2
endi
if $dnode2Vnodes != null then
  goto show2
endi
if $dnode3Vnodes != 1 then
  goto show2
endi

sql show mnodes
S
scripts  
slguan 已提交
142 143 144 145
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
146 147 148 149
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
150

S
scripts  
slguan 已提交
151
system sh/exec_up.sh -n dnode2 -s stop  -x SIGINT
S
slguan 已提交
152 153 154

print ============================== step3
print ========= start dnode2
S
slguan 已提交
155
sql create dnode $hostname2
S
slguan 已提交
156 157

sleep 3000
S
slguan 已提交
158
system sh/deploy.sh -n dnode2 -i 2
S
slguan 已提交
159 160 161 162 163 164
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode2 -c clog -v 1
system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 0
sleep 3000

S
scripts  
slguan 已提交
165
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
166 167 168 169 170 171 172 173 174 175
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 已提交
176
$dnode1Vnodes = $data2_1
S
slguan 已提交
177
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
178
$dnode2Vnodes = $data2_2
S
slguan 已提交
179
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
180
$dnode3Vnodes = $data2_3
S
slguan 已提交
181
print dnode3 $dnode3Vnodes
S
slguan 已提交
182 183 184 185 186 187 188 189 190 191 192 193

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

sql show mnodes
S
scripts  
slguan 已提交
194 195 196 197
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
198 199 200 201
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
202 203 204

print ============================== step4
print ========= drop dnode3
S
slguan 已提交
205
sql drop dnode $hostname3
S
slguan 已提交
206 207 208 209 210 211 212 213 214 215
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 已提交
216
$dnode1Vnodes = $data2_1
S
slguan 已提交
217
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
218
$dnode2Vnodes = $data2_2
S
slguan 已提交
219
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
220
$dnode3Vnodes = $data2_3
S
slguan 已提交
221
print dnode3 $dnode3Vnodes
S
slguan 已提交
222 223 224 225 226 227 228 229 230 231 232 233

if $dnode1Vnodes != 1 then
  goto show4
endi
if $dnode2Vnodes != 1 then
  goto show4
endi
if $dnode3Vnodes != null then
  goto show4
endi

sql show mnodes
S
scripts  
slguan 已提交
234 235 236 237
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
238 239 240 241
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
242

S
scripts  
slguan 已提交
243
system sh/exec_up.sh -n dnode3 -s stop  -x SIGINT
S
slguan 已提交
244 245 246

print ============================== step5
print ========= start dnode3
S
slguan 已提交
247
sql create dnode $hostname3
S
slguan 已提交
248 249

sleep 3000
S
slguan 已提交
250
system sh/deploy.sh -n dnode3 -i 3
S
slguan 已提交
251 252 253 254 255 256
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c clog -v 1
system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 0
sleep 3000

S
scripts  
slguan 已提交
257
system sh/exec_up.sh -n dnode3 -s start
S
slguan 已提交
258 259 260 261 262 263 264 265 266 267
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 已提交
268
$dnode1Vnodes = $data2_1
S
slguan 已提交
269
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
270
$dnode2Vnodes = $data2_2
S
slguan 已提交
271
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
272
$dnode3Vnodes = $data2_3
S
slguan 已提交
273
print dnode3 $dnode3Vnodes
S
slguan 已提交
274 275 276 277 278 279 280 281 282 283 284 285

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

sql show mnodes
S
scripts  
slguan 已提交
286 287 288 289
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
290 291 292 293
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
294 295 296

print ============================== step6
print ========= drop dnode1
S
scripts  
slguan 已提交
297
system sh/exec_up.sh -n dnode1 -s stop  -x SIGINT
S
slguan 已提交
298 299 300
print stop dnode1 and sleep 10000
sleep 10000

S
slguan 已提交
301
sql drop dnode $hostname1
S
slguan 已提交
302 303 304 305 306 307 308 309 310 311 312
print drop dnode1 and sleep 9000
sleep 9000

$x = 0
show6: 
	$x = $x + 1
	sleep 2000
	if $x == 30 then
	  return -1
	endi
sql show dnodes -x show6
S
scripts  
slguan 已提交
313
$dnode1Vnodes = $data2_1
S
slguan 已提交
314
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
315
$dnode2Vnodes = $data2_2
S
slguan 已提交
316
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
317
$dnode3Vnodes = $data2_3
S
slguan 已提交
318
print dnode3 $dnode3Vnodes
S
slguan 已提交
319 320 321 322 323 324 325 326 327 328 329 330

if $dnode1Vnodes != null then
  goto show6
endi
if $dnode2Vnodes != 1 then
  goto show6
endi
if $dnode3Vnodes != 1 then
  goto show6
endi

sql show mnodes
S
scripts  
slguan 已提交
331 332 333 334
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
335 336 337 338
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
339 340 341

print ============================== step7
print ========= start dnode1
S
slguan 已提交
342
sql create dnode $hostname1
S
slguan 已提交
343 344

sql show mnodes
S
scripts  
slguan 已提交
345 346 347 348
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
349 350 351 352
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
353 354

sleep 3000
S
slguan 已提交
355
system sh/deploy.sh -n dnode1 -i 1
S
slguan 已提交
356 357 358 359 360 361
system sh/cfg.sh -n dnode1 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode1 -c clog -v 1
system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 0
sleep 3000

S
scripts  
slguan 已提交
362
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
363 364 365 366 367 368
sleep 9000

$x = 0

show7: 
	sql show mnodes
S
scripts  
slguan 已提交
369 370 371 372
	$dnode1Role = $data2_1
	$dnode2Role = $data2_2
	$dnode3Role = $data2_3
	$dnode4Role = $data2_4
S
slguan 已提交
373 374 375 376
	print dnode1 ==> $dnode1Role
	print dnode2 ==> $dnode2Role
	print dnode3 ==> $dnode3Role
	print dnode4 ==> $dnode4Role
S
slguan 已提交
377 378 379 380 381 382 383

	$x = $x + 1
	sleep 2000
	if $x == 30 then
	  return -1
	endi
sql show dnodes -x show7
S
scripts  
slguan 已提交
384
$dnode1Vnodes = $data2_1
S
slguan 已提交
385
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
386
$dnode2Vnodes = $data2_2
S
slguan 已提交
387
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
388
$dnode3Vnodes = $data2_3
S
slguan 已提交
389
print dnode3 $dnode3Vnodes
S
slguan 已提交
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412

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

print ============================== step8
print ========= add db4

sql create database c_b2_d4 replica 2 tables 4
sql use c_b2_d4
sql create table c_b2_t4 (t timestamp, i int) 
sql insert into c_b2_t4 values(1520000020045, 45)
sql insert into c_b2_t4 values(1520000021044, 44)
sql insert into c_b2_t4 values(1520000022043, 43)
sql insert into c_b2_t4 values(1520000023042, 42)
sql insert into c_b2_t4 values(1520000024041, 41)

S
slguan 已提交
413
sql create dnode $hostname4
S
scripts  
slguan 已提交
414
system sh/exec_up.sh -n dnode4 -s start
S
slguan 已提交
415 416 417
sleep 9000

sql show mnodes
S
scripts  
slguan 已提交
418 419 420 421
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
422 423 424 425
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
426 427 428 429 430 431 432 433 434

$x = 0
show8: 
	$x = $x + 1
	sleep 2000
	if $x == 30 then
	  return -1
	endi
sql show dnodes -x show8
S
scripts  
slguan 已提交
435
$dnode1Vnodes = $data2_1
S
slguan 已提交
436
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
437
$dnode2Vnodes = $data2_2
S
slguan 已提交
438
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
439
$dnode3Vnodes = $data2_3
S
slguan 已提交
440
print dnode3 $dnode3Vnodes
S
scripts  
slguan 已提交
441
$dnode4Vnodes = $data2_4
S
slguan 已提交
442
print dnode4 $dnode4Vnodes
S
slguan 已提交
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458

if $dnode1Vnodes != 2 then
  goto show8
endi
if $dnode2Vnodes != 2 then
  goto show8
endi
if $dnode3Vnodes != 2 then
  goto show8
endi
if $dnode4Vnodes != 2 then
  goto show8
endi

print ============================== step9
print ========= drop dnode1.4
S
slguan 已提交
459 460
sql drop dnode $hostname1
sql drop dnode $hostname4
S
slguan 已提交
461 462 463
sleep 10000

sql show mnodes
S
scripts  
slguan 已提交
464 465 466 467
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
468 469 470 471
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
472 473 474 475 476 477 478 479 480

$x = 0
show9: 
	$x = $x + 1
	sleep 2000
	if $x == 30 then
	  return -1
	endi
sql show dnodes -x show9
S
scripts  
slguan 已提交
481
$dnode1Vnodes = $data2_1
S
slguan 已提交
482
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
483
$dnode2Vnodes = $data2_2
S
slguan 已提交
484
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
485
$dnode3Vnodes = $data2_3
S
slguan 已提交
486
print dnode3 $dnode3Vnodes
S
scripts  
slguan 已提交
487
$dnode4Vnodes = $data2_4
S
slguan 已提交
488
print dnode4 $dnode4Vnodes
S
slguan 已提交
489 490 491 492 493 494 495 496 497 498 499 500 501 502

if $dnode1Vnodes != null then
  goto show9
endi
if $dnode2Vnodes != 0 then
  goto show9
endi
if $dnode3Vnodes != 0 then
  goto show9
endi
if $dnode4Vnodes != null then
  goto show9
endi

S
scripts  
slguan 已提交
503 504
system sh/exec_up.sh -n dnode1 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode4 -s stop  -x SIGINT
S
slguan 已提交
505 506 507

print ============================== step10
print ========= start dnode1.4
S
slguan 已提交
508 509
sql create dnode $hostname1
sql create dnode $hostname4
S
slguan 已提交
510 511

sleep 3000
S
slguan 已提交
512 513
system sh/deploy.sh -n dnode1 -i 1
ssystem sh/cfg.sh -n dnode1 -c numOfMPeers -v 3
S
slguan 已提交
514 515 516 517 518 519
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode1 -c clog -v 1
system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 0
sleep 3000

sleep 3000
S
slguan 已提交
520
system sh/deploy.sh -n dnode4 -i 4
S
slguan 已提交
521 522 523 524 525 526
system sh/cfg.sh -n dnode4 -c numOfMPeers -v 3
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode4 -c clog -v 1
system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 0
sleep 3000

S
scripts  
slguan 已提交
527 528
system sh/exec_up.sh -n dnode1 -s start
system sh/exec_up.sh -n dnode4 -s start
S
slguan 已提交
529 530 531 532 533
sleep 10000

$x = 0
show10: 
	sql show mnodes
S
scripts  
slguan 已提交
534 535 536 537
	$dnode1Role = $data2_1
	$dnode2Role = $data2_2
	$dnode3Role = $data2_3
	$dnode4Role = $data2_4
S
slguan 已提交
538 539 540 541
	print dnode1 ==> $dnode1Role
	print dnode2 ==> $dnode2Role
	print dnode3 ==> $dnode3Role
	print dnode4 ==> $dnode4Role
S
slguan 已提交
542 543 544 545 546 547 548
	
	$x = $x + 1
	sleep 2000
	if $x == 30 then
	  return -1
	endi
sql show dnodes -x show10
S
scripts  
slguan 已提交
549
$dnode1Vnodes = $data2_1
S
slguan 已提交
550
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
551
$dnode2Vnodes = $data2_2
S
slguan 已提交
552
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
553
$dnode3Vnodes = $data2_3
S
slguan 已提交
554
print dnode3 $dnode3Vnodes
S
scripts  
slguan 已提交
555
$dnode4Vnodes = $data2_4
S
slguan 已提交
556
print dnode4 $dnode4Vnodes
S
slguan 已提交
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573

if $dnode1Vnodes != 2 then
  goto show10
endi
if $dnode2Vnodes != 2 then
  goto show10
endi
if $dnode3Vnodes != 2 then
  goto show10
endi
if $dnode4Vnodes != 2 then
  goto show10
endi

print ============================== step11

sql show mnodes
S
scripts  
slguan 已提交
574 575 576 577
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
578 579 580 581
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608

sql create database c_b2_d5 replica 2 tables 4
sql use c_b2_d5;
sql create table c_b2_t5 (t timestamp, i int)
sql insert into c_b2_t5 values(1520000020055, 55)
sql insert into c_b2_t5 values(1520000021054, 54)
sql insert into c_b2_t5 values(1520000022053, 53)
sql insert into c_b2_t5 values(1520000023052, 52)
sql insert into c_b2_t5 values(1520000024051, 51)

sql create database c_b2_d6 replica 2 tables 4
sql use c_b2_d6
sql create table c_b2_t6 (t timestamp, i int) 
sql insert into c_b2_t6 values(1520000020065, 65)
sql insert into c_b2_t6 values(1520000021064, 64)
sql insert into c_b2_t6 values(1520000022063, 63)
sql insert into c_b2_t6 values(1520000023062, 62)
sql insert into c_b2_t6 values(1520000024061, 61)

$x = 0
show11: 
	$x = $x + 1
	sleep 2000
	if $x == 30 then
	  return -1
	endi
sql show dnodes -x show11
S
scripts  
slguan 已提交
609
$dnode1Vnodes = $data2_1
S
slguan 已提交
610
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
611
$dnode2Vnodes = $data2_2
S
slguan 已提交
612
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
613
$dnode3Vnodes = $data2_3
S
slguan 已提交
614
print dnode3 $dnode3Vnodes
S
scripts  
slguan 已提交
615
$dnode4Vnodes = $data2_4
S
slguan 已提交
616
print dnode4 $dnode4Vnodes
S
slguan 已提交
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631

if $dnode1Vnodes != 1 then
  goto show11
endi
if $dnode2Vnodes != 1 then
  goto show11
endi
if $dnode3Vnodes != 1 then
  goto show11
endi
if $dnode4Vnodes != 1 then
  goto show11
endi

sql show mnodes
S
scripts  
slguan 已提交
632 633 634 635
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
636 637 638 639
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760

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

sql use c_b2_d1
sql select * from c_b2_t1 order by t desc
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

sql use c_b2_d2
sql select * from c_b2_t2 order by t desc
print $data01 $data11 $data21 $data31 $data41

#if $data01 != 21 then
#  return -1
#endi
#if $data11 != 22 then
#  return -1
#endi
#if $data21 != 23 then
#  return -1
#endi
#if $data31 != 24 then
#  return -1
#endi
#if $data41 != 25 then
#  return -1
#endi

sql use c_b2_d3
sql select * from c_b2_t3 order by t desc
print $data01 $data11 $data21 $data31 $data41
if $data01 != 31 then
  return -1
endi
if $data11 != 32 then
  return -1
endi
if $data21 != 33 then
  return -1
endi
if $data31 != 34 then
  return -1
endi
if $data41 != 35 then
  return -1
endi

sql use c_b2_d4
sql select * from c_b2_t4 order by t desc
print $data01 $data11 $data21 $data31 $data41
if $data01 != 41 then
  return -1
endi
if $data11 != 42 then
  return -1
endi
if $data21 != 43 then
  return -1
endi
if $data31 != 44 then
  return -1
endi
if $data41 != 45 then
  return -1
endi

sql use c_b2_d5
sql select * from c_b2_t5 order by t desc
print $data01 $data11 $data21 $data31 $data41
if $data01 != 51 then
  return -1
endi
if $data11 != 52 then
  return -1
endi
if $data21 != 53 then
  return -1
endi
if $data31 != 54 then
  return -1
endi
if $data41 != 55 then
  return -1
endi

sql use c_b2_d6
sql select * from c_b2_t6 order by t desc
print $data01 $data11 $data21 $data31 $data41
if $data01 != 61 then
  return -1
endi
if $data11 != 62 then
  return -1
endi
if $data21 != 63 then
  return -1
endi
if $data31 != 64 then
  return -1
endi
if $data41 != 65 then
  return -1
endi


print ============================================ over
S
scripts  
slguan 已提交
761 762 763 764 765 766 767 768
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
S
slguan 已提交
769 770