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

S
slguan 已提交
3 4 5 6 7 8 9 10
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 已提交
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

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 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

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

print ============== step1
print ========= start dnode1
S
scripts  
slguan 已提交
50
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
51 52 53
sql connect
sleep 2001

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

sql create database c_b3_d1 replica 3
sql use c_b3_d1
sql create table c_b3_t1 (t timestamp, i int)
sql insert into c_b3_t1 values(1520000020015, 15)
sql insert into c_b3_t1 values(1520000021014, 14)
sql insert into c_b3_t1 values(1520000022013, 13)
sql insert into c_b3_t1 values(1520000023012, 12)
sql insert into c_b3_t1 values(1520000024011, 11)

sql create database c_b3_d2 replica 3
sql use c_b3_d2
sql create table c_b3_t2 (t timestamp, i int)
sql insert into c_b3_t2 values(1520000020025, 25)
sql insert into c_b3_t2 values(1520000021024, 24)
sql insert into c_b3_t2 values(1520000022023, 23)
sql insert into c_b3_t2 values(1520000023022, 22)
sql insert into c_b3_t2 values(1520000024021, 21)

sql create database c_b3_d3 replica 3
sql use c_b3_d3
sql create table c_b3_t3 (t timestamp, i int) 
sql insert into c_b3_t3 values(1520000020035, 35)
sql insert into c_b3_t3 values(1520000021034, 34)
sql insert into c_b3_t3 values(1520000022033, 33)
sql insert into c_b3_t3 values(1520000023032, 32)
sql insert into c_b3_t3 values(1520000024031, 31)

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

S
scripts  
slguan 已提交
104
if $dnode1Vnodes != 3 then
S
slguan 已提交
105 106
  goto show1
endi
S
scripts  
slguan 已提交
107
if $dnode2Vnodes != 3 then
S
slguan 已提交
108 109
  goto show1
endi
S
scripts  
slguan 已提交
110
if $dnode3Vnodes != 3 then
S
slguan 已提交
111 112 113 114 115 116 117 118
  goto show1
endi
if $dnode4Vnodes != null then
  goto show1
endi

print ============================== step2
print ========= start dnode4
S
slguan 已提交
119
sql create dnode $hostname4
S
scripts  
slguan 已提交
120
system sh/exec_up.sh -n dnode4 -s start
S
slguan 已提交
121 122 123 124 125 126
sleep 9000

$x = 0
show2: 
	$x = $x + 1
	sleep 2000
S
scripts  
slguan 已提交
127
	if $x == 20 then
S
slguan 已提交
128 129 130
	  return -1
	endi
sql show dnodes -x show2
S
scripts  
slguan 已提交
131
$dnode1Vnodes = $data2_1
S
slguan 已提交
132
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
133
$dnode2Vnodes = $data2_2
S
slguan 已提交
134
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
135
$dnode3Vnodes = $data2_3
S
slguan 已提交
136
print dnode3 $dnode3Vnodes
S
scripts  
slguan 已提交
137
$dnode4Vnodes = $data2_4
S
slguan 已提交
138
print dnode4 $dnode4Vnodes
S
slguan 已提交
139 140 141 142 143 144 145

if $dnode4Vnodes != 2 then
  goto show2
endi

print ============================== step3
print ========= drop dnode2
S
slguan 已提交
146
sql drop dnode $hostname2
S
slguan 已提交
147 148 149 150 151 152
sleep 9000

$x = 0
show3: 
	$x = $x + 1
	sleep 2000
S
scripts  
slguan 已提交
153
	if $x == 20 then
S
slguan 已提交
154 155 156
	  return -1
	endi
sql show dnodes -x show3
S
scripts  
slguan 已提交
157
$dnode1Vnodes = $data2_1
S
slguan 已提交
158
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
159
$dnode2Vnodes = $data2_2
S
slguan 已提交
160
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
161
$dnode3Vnodes = $data2_3
S
slguan 已提交
162
print dnode3 $dnode3Vnodes
S
scripts  
slguan 已提交
163
$dnode4Vnodes = $data2_4
S
slguan 已提交
164
print dnode4 $dnode4Vnodes
S
slguan 已提交
165

S
scripts  
slguan 已提交
166
if $dnode1Vnodes != 3 then
S
slguan 已提交
167 168 169 170 171
  goto show3
endi
if $dnode2Vnodes != null then
  goto show3
endi
S
scripts  
slguan 已提交
172
if $dnode3Vnodes != 3 then
S
slguan 已提交
173 174
  goto show3
endi
S
scripts  
slguan 已提交
175
if $dnode4Vnodes != 3 then
S
slguan 已提交
176 177 178
  goto show3
endi

S
scripts  
slguan 已提交
179
system sh/exec_up.sh -n dnode2 -s stop  -x SIGINT
S
slguan 已提交
180 181

print ============================== step4
S
scripts  
slguan 已提交
182 183
sql create dnode $hostname5
system sh/exec_up.sh -n dnode5 -s start
S
slguan 已提交
184 185 186 187 188 189
sleep 10000

$x = 0
show4: 
	$x = $x + 1
	sleep 2000
S
scripts  
slguan 已提交
190
	if $x == 20 then
S
slguan 已提交
191 192 193
	  return -1
	endi
sql show dnodes -x show4
S
scripts  
slguan 已提交
194
$dnode1Vnodes = $data2_1
S
slguan 已提交
195
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
196 197
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
S
scripts  
slguan 已提交
198
$dnode3Vnodes = $data2_3
S
slguan 已提交
199
print dnode3 $dnode3Vnodes
S
scripts  
slguan 已提交
200
$dnode4Vnodes = $data2_4
S
slguan 已提交
201
print dnode4 $dnode4Vnodes
S
slguan 已提交
202

S
scripts  
slguan 已提交
203
if $dnode5Vnodes != 2 then
S
slguan 已提交
204 205 206 207 208
  goto show4
endi

print ============================== step5
print ========= drop dnode3
S
slguan 已提交
209
sql drop dnode $hostname3
S
slguan 已提交
210 211 212 213 214 215
sleep 9000

$x = 0
show5: 
	$x = $x + 1
	sleep 2000
S
scripts  
slguan 已提交
216
	if $x == 20 then
S
slguan 已提交
217 218 219
	  return -1
	endi
sql show dnodes -x show5
S
scripts  
slguan 已提交
220
$dnode1Vnodes = $data2_1
S
slguan 已提交
221
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
222 223
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
S
scripts  
slguan 已提交
224
$dnode3Vnodes = $data2_3
S
slguan 已提交
225
print dnode3 $dnode3Vnodes
S
scripts  
slguan 已提交
226
$dnode4Vnodes = $data2_4
S
slguan 已提交
227
print dnode4 $dnode4Vnodes
S
slguan 已提交
228

S
scripts  
slguan 已提交
229
if $dnode1Vnodes != 3 then
S
slguan 已提交
230 231
  goto show5
endi
S
scripts  
slguan 已提交
232
if $dnode5Vnodes != 3 then
S
slguan 已提交
233 234 235 236 237
  goto show5
endi
if $dnode3Vnodes != null then
  goto show5
endi
S
scripts  
slguan 已提交
238
if $dnode4Vnodes != 3 then
S
slguan 已提交
239 240 241
  goto show5
endi

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

print ============================== step6
S
scripts  
slguan 已提交
245 246
sql create dnode $hostname6
system sh/exec_up.sh -n dnode6 -s start
S
slguan 已提交
247 248 249 250 251 252
sleep 9000

$x = 0
show6: 
	$x = $x + 1
	sleep 2000
S
scripts  
slguan 已提交
253
	if $x == 20 then
S
slguan 已提交
254 255 256
	  return -1
	endi
sql show dnodes -x show6
S
scripts  
slguan 已提交
257
$dnode1Vnodes = $data2_1
S
slguan 已提交
258
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
259
$dnode4Vnodes = $data2_4
S
slguan 已提交
260
print dnode4 $dnode4Vnodes
S
scripts  
slguan 已提交
261 262 263 264
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
$dnode6Vnodes = $data2_6
print dnode6 $dnode6Vnodes
S
slguan 已提交
265

S
scripts  
slguan 已提交
266
if $dnode6Vnodes != 2 then
S
slguan 已提交
267 268 269 270 271
  goto show6
endi

print ============================== step7
print ========= drop dnode4
S
slguan 已提交
272
sql drop dnode $hostname4
S
slguan 已提交
273 274 275 276 277 278
sleep 9000

$x = 0
show7: 
	$x = $x + 1
	sleep 2000
S
scripts  
slguan 已提交
279
	if $x == 20 then
S
slguan 已提交
280 281 282
	  return -1
	endi
sql show dnodes -x show7
S
scripts  
slguan 已提交
283
$dnode1Vnodes = $data2_1
S
slguan 已提交
284
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
285
$dnode4Vnodes = $data2_4
S
slguan 已提交
286
print dnode4 $dnode4Vnodes
S
scripts  
slguan 已提交
287 288 289 290
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
$dnode6Vnodes = $data2_6
print dnode6 $dnode6Vnodes
S
slguan 已提交
291

S
scripts  
slguan 已提交
292
if $dnode1Vnodes != 3 then
S
slguan 已提交
293 294
  goto show7
endi
S
scripts  
slguan 已提交
295
if $dnode5Vnodes != 3 then
S
slguan 已提交
296 297
  goto show7
endi
S
scripts  
slguan 已提交
298
if $dnode6Vnodes != 3 then
S
slguan 已提交
299 300 301 302 303 304
  goto show7
endi
if $dnode4Vnodes != null then
  goto show7
endi

S
scripts  
slguan 已提交
305
system sh/exec_up.sh -n dnode4 -s stop  -x SIGINT
S
slguan 已提交
306 307

print ============================== step8
S
scripts  
slguan 已提交
308 309
sql create dnode $hostname7
system sh/exec_up.sh -n dnode7 -s start
S
slguan 已提交
310 311 312 313 314 315
sleep 9000

$x = 0
show8: 
	$x = $x + 1
	sleep 2000
S
scripts  
slguan 已提交
316
	if $x == 20 then
S
slguan 已提交
317 318 319
	  return -1
	endi
sql show dnodes -x show8
S
scripts  
slguan 已提交
320
$dnode1Vnodes = $data2_1
S
slguan 已提交
321
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
322 323 324 325 326 327 328 329
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
$dnode6Vnodes = $data2_6
print dnode6 $dnode6Vnodes
$dnode7Vnodes = $data2_7
print dnode7 $dnode7Vnodes

if $dnode7Vnodes != 2 then
S
slguan 已提交
330 331 332 333 334
  goto show8
endi

print ============================== step9
print ========= drop dnode1
S
scripts  
slguan 已提交
335
system sh/exec_up.sh -n dnode1 -s stop  -x SIGINT
S
slguan 已提交
336 337 338
print stop dnode1 and sleep 10000
sleep 10000

S
slguan 已提交
339
sql drop dnode $hostname1
S
slguan 已提交
340 341 342 343 344 345 346
print drop dnode1 and sleep 9000
sleep 9000

$x = 0
show9: 
	$x = $x + 1
	sleep 2000
S
scripts  
slguan 已提交
347
	if $x == 20 then
S
slguan 已提交
348 349 350
	  return -1
	endi
sql show dnodes -x show9
S
scripts  
slguan 已提交
351 352 353 354 355 356 357
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
$dnode6Vnodes = $data2_6
print dnode6 $dnode6Vnodes
$dnode7Vnodes = $data2_7
print dnode7 $dnode7Vnodes

S
scripts  
slguan 已提交
358
if $dnode5Vnodes != 3 then
S
slguan 已提交
359 360
  goto show9
endi
S
scripts  
slguan 已提交
361
if $dnode6Vnodes != 3 then
S
slguan 已提交
362 363
  goto show9
endi
S
scripts  
slguan 已提交
364
if $dnode7Vnodes != 3 then
S
slguan 已提交
365 366 367 368 369 370 371 372 373 374 375 376
  goto show9
endi

print ============================== step11
print ========= add db4

sql create database c_b3_d4 replica 3
sql use c_b3_d4
$x = 0
create4: 
	$x = $x + 1
	sleep 2000
S
scripts  
slguan 已提交
377
	if $x == 20 then
S
slguan 已提交
378 379 380 381 382 383 384 385
	  return -1
	endi
sql create table c_b3_t4 (t timestamp, i int) -x create4
sql insert into c_b3_t4 values(1520000020045, 45)
sql insert into c_b3_t4 values(1520000021044, 44)
sql insert into c_b3_t4 values(1520000022043, 43)
sql insert into c_b3_t4 values(1520000023042, 42)
sql insert into c_b3_t4 values(1520000024041, 41)
S
scripts  
slguan 已提交
386 387

sleep 3000
S
slguan 已提交
388 389 390 391 392

$x = 0
show11: 
	$x = $x + 1
	sleep 2000
S
scripts  
slguan 已提交
393
	if $x == 20 then
S
slguan 已提交
394 395
	  return -1
	endi
S
scripts  
slguan 已提交
396 397 398 399 400 401
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
$dnode6Vnodes = $data2_6
print dnode6 $dnode6Vnodes
$dnode7Vnodes = $data2_7
print dnode7 $dnode7Vnodes
S
slguan 已提交
402

S
scripts  
slguan 已提交
403 404 405 406
if $dnode5Vnodes != 4 then
  goto show11
endi
if $dnode6Vnodes != 4 then
S
slguan 已提交
407 408
  goto show11
endi
S
scripts  
slguan 已提交
409
if $dnode7Vnodes != 4 then
S
slguan 已提交
410 411 412
  goto show11
endi

S
scripts  
slguan 已提交
413
system sh/exec_up.sh -n dnode1 -s stop  -x SIGINT
S
slguan 已提交
414 415

print ============================== step13
S
scripts  
slguan 已提交
416 417 418
sql reset query cache
sleep 1000

S
slguan 已提交
419 420
print ========= check data

S
scripts  
slguan 已提交
421
sql select * from c_b3_d1.c_b3_t1 order by t desc
S
slguan 已提交
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
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 已提交
439
sql select * from c_b3_d2.c_b3_t2 order by t desc
S
slguan 已提交
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
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

S
scripts  
slguan 已提交
458
sql select * from c_b3_d3.c_b3_t3 order by t desc
S
slguan 已提交
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
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

print ============================================ over
S
scripts  
slguan 已提交
477 478 479 480 481 482 483 484
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