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

S
TD-1486  
Shengliang Guan 已提交
38 39 40 41 42 43 44 45 46 47
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode6 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode7 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode8 -c maxTablesPerVnode -v 4


S
slguan 已提交
48 49
print ============== step1
print ========= start dnode1
S
Shengliang Guan 已提交
50
system sh/exec.sh -n dnode1 -s start
S
slguan 已提交
51 52

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

sql show mnodes
print mnode1 $data2_1
print mnode1 $data2_2
print mnode1 $data2_3
if $data2_1 != master then
  goto step1
endi
if $data2_2 != slave then
  goto step1
endi
if $data2_3 != slave then
  goto step1
endi

S
slguan 已提交
95

R
scripts  
root 已提交
96
sql create database c_b2_d1 replica 2 
S
slguan 已提交
97 98 99 100 101 102 103 104
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)

R
scripts  
root 已提交
105
sql create database c_b2_d2 replica 2 
S
slguan 已提交
106 107 108 109 110 111 112 113
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)

R
scripts  
root 已提交
114
sql create database c_b2_d3 replica 2 
S
slguan 已提交
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
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 已提交
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
slguan 已提交
137 138 139 140 141 142 143 144 145 146 147 148 149

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 已提交
150
sql drop dnode $hostname2
S
slguan 已提交
151 152 153 154

$x = 0
show2: 
	$x = $x + 1
S
Shengliang Guan 已提交
155 156
	sleep 1000
	if $x == 30 then 
S
slguan 已提交
157 158 159
	  return -1
	endi
sql show dnodes -x show2
S
scripts  
slguan 已提交
160
$dnode1Vnodes = $data2_1
S
slguan 已提交
161
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
162
$dnode2Vnodes = $data2_2
S
slguan 已提交
163
print dnode2 $dnode2Vnodes
S
scripts  
slguan 已提交
164
$dnode3Vnodes = $data2_3
S
slguan 已提交
165
print dnode3 $dnode3Vnodes
S
slguan 已提交
166

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

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

S
Shengliang Guan 已提交
187
system sh/exec.sh -n dnode2 -s stop  -x SIGINT
S
slguan 已提交
188 189

print ============================== step3
S
scripts  
slguan 已提交
190 191
print ========= start dnode4
sql create dnode $hostname4
S
Shengliang Guan 已提交
192
system sh/exec.sh -n dnode4 -s start
S
slguan 已提交
193 194 195 196

$x = 0
show3: 
	$x = $x + 1
S
Shengliang Guan 已提交
197 198
	sleep 1000
	if $x == 30 then 
S
slguan 已提交
199 200 201
	  return -1
	endi
sql show dnodes -x show3
S
scripts  
slguan 已提交
202
$dnode1Vnodes = $data2_1
S
slguan 已提交
203
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
204 205
$dnode4Vnodes = $data2_4
print dnode4 $dnode4Vnodes
S
scripts  
slguan 已提交
206
$dnode3Vnodes = $data2_3
S
slguan 已提交
207
print dnode3 $dnode3Vnodes
S
slguan 已提交
208 209 210 211

if $dnode1Vnodes != 2 then
  goto show3
endi
S
scripts  
slguan 已提交
212
if $dnode4Vnodes != 2 then
S
slguan 已提交
213 214 215 216 217 218 219
  goto show3
endi
if $dnode3Vnodes != 2 then
  goto show3
endi

sql show mnodes
S
scripts  
slguan 已提交
220 221 222 223
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
224 225 226 227
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
228

S
scripts  
slguan 已提交
229 230 231
if $dnode1Role != master then
  return -1
endi
S
scripts  
Shengliang Guan 已提交
232
if $dnode2Role != null then
S
scripts  
slguan 已提交
233 234 235 236 237 238 239 240 241 242
  return -1
endi
if $dnode3Role != slave then
  return -1
endi

if $dnode4Role != slave then
  return -1
endi

S
slguan 已提交
243 244
print ============================== step4
print ========= drop dnode3
S
slguan 已提交
245
sql drop dnode $hostname3
S
slguan 已提交
246 247 248 249

$x = 0
show4: 
	$x = $x + 1
S
Shengliang Guan 已提交
250 251
	sleep 1000
	if $x == 40 then 
S
slguan 已提交
252 253 254
	  return -1
	endi
sql show dnodes -x show4
S
scripts  
slguan 已提交
255
$dnode1Vnodes = $data2_1
S
slguan 已提交
256
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
257 258
$dnode4Vnodes = $data2_4
print dnode4 $dnode4Vnodes
S
scripts  
slguan 已提交
259
$dnode3Vnodes = $data2_3
S
slguan 已提交
260
print dnode3 $dnode3Vnodes
S
slguan 已提交
261

S
scripts  
slguan 已提交
262
if $dnode1Vnodes != 3 then
S
slguan 已提交
263 264
  goto show4
endi
S
scripts  
slguan 已提交
265
if $dnode4Vnodes != 3 then
S
slguan 已提交
266 267
  goto show4
endi
S
scripts  
Shengliang Guan 已提交
268
if $dnode3Vnodes != null then
S
slguan 已提交
269 270 271 272
  goto show4
endi

sql show mnodes
S
scripts  
slguan 已提交
273 274 275 276
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
$dnode4Role = $data2_4
S
slguan 已提交
277 278 279 280
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role
S
slguan 已提交
281

S
scripts  
slguan 已提交
282 283 284
if $dnode1Role != master then
  return -1
endi
S
scripts  
Shengliang Guan 已提交
285
if $dnode2Role != null then
S
scripts  
slguan 已提交
286 287
  return -1
endi
S
scripts  
Shengliang Guan 已提交
288
if $dnode3Role != null then
S
scripts  
slguan 已提交
289 290 291 292 293 294 295
  return -1
endi

if $dnode4Role != slave then
  return -1
endi

S
Shengliang Guan 已提交
296
system sh/exec.sh -n dnode3 -s stop  -x SIGINT
S
slguan 已提交
297 298 299

print ============================== step5
print ========= start dnode3
S
scripts  
slguan 已提交
300
sql create dnode $hostname5
S
Shengliang Guan 已提交
301
system sh/exec.sh -n dnode5 -s start
S
slguan 已提交
302 303 304 305

$x = 0
show5: 
	$x = $x + 1
S
Shengliang Guan 已提交
306
	sleep 1000
S
slguan 已提交
307 308 309 310
	if $x == 30 then
	  return -1
	endi
sql show dnodes -x show5
S
scripts  
slguan 已提交
311
$dnode1Vnodes = $data2_1
S
slguan 已提交
312
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
313 314 315 316
$dnode4Vnodes = $data2_4
print dnode4 $dnode4Vnodes
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
S
slguan 已提交
317 318 319 320

if $dnode1Vnodes != 2 then
  goto show5
endi
S
scripts  
slguan 已提交
321
if $dnode4Vnodes != 2 then
S
slguan 已提交
322 323
  goto show5
endi
S
scripts  
slguan 已提交
324
if $dnode5Vnodes != 2 then
S
slguan 已提交
325 326 327 328
  goto show5
endi

sql show mnodes
S
scripts  
slguan 已提交
329 330
$dnode1Role = $data2_1
$dnode4Role = $data2_4
S
scripts  
slguan 已提交
331
$dnode5Role = $data2_5
S
slguan 已提交
332 333
print dnode1 ==> $dnode1Role
print dnode4 ==> $dnode4Role
S
scripts  
slguan 已提交
334
print dnode5 ==> $dnode5Role
S
slguan 已提交
335 336

print ============================== step6
S
Shengliang Guan 已提交
337
system sh/exec.sh -n dnode1 -s stop  -x SIGINT
S
slguan 已提交
338
print stop dnode1 and sleep 10000
S
Shengliang Guan 已提交
339
sleep 5000
S
slguan 已提交
340

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

S
scripts  
slguan 已提交
345 346 347 348 349 350 351 352 353 354 355 356 357
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 已提交
358
system sh/exec.sh -n dnode1 -s start
S
scripts  
slguan 已提交
359

S
slguan 已提交
360 361 362 363
$x = 0
show6: 
	$x = $x + 1
	sleep 2000
364
	if $x == 10 then
S
slguan 已提交
365 366 367
	  return -1
	endi
sql show dnodes -x show6
S
scripts  
slguan 已提交
368
$dnode1Vnodes = $data2_1
S
slguan 已提交
369
print dnode1 $dnode1Vnodes
S
scripts  
slguan 已提交
370 371 372 373
$dnode4Vnodes = $data2_4
print dnode4 $dnode4Vnodes
$dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes
S
slguan 已提交
374

S
scripts  
Shengliang Guan 已提交
375
if $dnode1Vnodes != null then
S
slguan 已提交
376 377
  goto show6
endi
S
scripts  
slguan 已提交
378
if $dnode4Vnodes != 3 then
S
slguan 已提交
379 380
  goto show6
endi
S
scripts  
slguan 已提交
381
if $dnode5Vnodes != 3 then
S
slguan 已提交
382 383 384 385
  goto show6
endi

sql show mnodes
S
scripts  
slguan 已提交
386 387
$dnode1Role = $data2_1
$dnode4Role = $data2_4
S
scripts  
slguan 已提交
388
$dnode5Role = $data2_5
S
slguan 已提交
389 390
print dnode1 ==> $dnode1Role
print dnode4 ==> $dnode4Role
S
scripts  
slguan 已提交
391 392
print dnode5 ==> $dnode5Role

S
Shengliang Guan 已提交
393
#system sh/exec.sh -n dnode1 -s stop  -x SIGINT
S
slguan 已提交
394 395 396 397

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

S
scripts  
slguan 已提交
398
sql reset query cache
S
Shengliang Guan 已提交
399
sleep 100
S
scripts  
slguan 已提交
400 401

sql select * from c_b2_d1.c_b2_t1 order by t desc
S
slguan 已提交
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
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 已提交
419
sql select * from c_b2_d2.c_b2_t2 order by t desc
S
slguan 已提交
420 421
print $data01 $data11 $data21 $data31 $data41

S
scripts  
slguan 已提交
422
if $data01 != 21 then
S
slguan 已提交
423 424
  return -1
endi
S
scripts  
slguan 已提交
425
if $data11 != 22 then
S
slguan 已提交
426 427
  return -1
endi
S
scripts  
slguan 已提交
428
if $data21 != 23 then
S
slguan 已提交
429 430
  return -1
endi
S
scripts  
slguan 已提交
431
if $data31 != 24 then
S
slguan 已提交
432 433
  return -1
endi
S
scripts  
slguan 已提交
434
if $data41 != 25 then
S
slguan 已提交
435 436 437
  return -1
endi

S
scripts  
slguan 已提交
438
sql select * from c_b2_d3.c_b2_t3 order by t desc
S
slguan 已提交
439
print $data01 $data11 $data21 $data31 $data41
S
scripts  
slguan 已提交
440
if $data01 != 31 then
S
slguan 已提交
441 442
  return -1
endi
S
scripts  
slguan 已提交
443
if $data11 != 32 then
S
slguan 已提交
444 445
  return -1
endi
S
scripts  
slguan 已提交
446
if $data21 != 33 then
S
slguan 已提交
447 448
  return -1
endi
S
scripts  
slguan 已提交
449
if $data31 != 34 then
S
slguan 已提交
450 451
  return -1
endi
S
scripts  
slguan 已提交
452
if $data41 != 35 then
S
slguan 已提交
453 454 455 456
  return -1
endi

print ============================================ over
S
Shengliang Guan 已提交
457 458 459 460
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
461
system sh/exec.sh -n dnode5 -s stop  -x SIGKILL
S
Shengliang Guan 已提交
462 463 464
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