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

S
slguan 已提交
3 4 5
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
S
slguan 已提交
6 7 8 9 10

system sh/cfg.sh -n dnode1 -c offlineThreshold -v 10
system sh/cfg.sh -n dnode2 -c offlineThreshold -v 10
system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10

S
slguan 已提交
11 12 13 14
system sh/cfg.sh -n dnode1 -c balanceInterval -v 5
system sh/cfg.sh -n dnode2 -c balanceInterval -v 5
system sh/cfg.sh -n dnode3 -c balanceInterval -v 5

S
Shengliang Guan 已提交
15 16 17
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
S
slguan 已提交
18

S
scripts  
slguan 已提交
19 20 21
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
S
slguan 已提交
22 23

print ========== step1
S
Shengliang Guan 已提交
24
system sh/exec.sh -n dnode1 -s start
S
slguan 已提交
25
sql connect
S
slguan 已提交
26
sql create dnode $hostname2
S
Shengliang Guan 已提交
27
system sh/exec.sh -n dnode2 -s start
S
slguan 已提交
28 29
sleep 3000

R
scripts  
root 已提交
30
sql create database d1 replica 2 
S
slguan 已提交
31
sql create table d1.t1(ts timestamp, i int)
S
scripts  
Shengliang Guan 已提交
32
sql insert into d1.t1 values(1588262400001, 1)
S
slguan 已提交
33 34

sql show dnodes
S
slguan 已提交
35 36 37 38
print dnode1 $data4_1
print dnode1 $data4_2

if $data4_1 != ready then
S
slguan 已提交
39 40
  return -1
endi
S
slguan 已提交
41
if $data4_2 != ready then
S
slguan 已提交
42 43 44 45
  return -1
endi

print ========== step2
S
Shengliang Guan 已提交
46
system sh/exec.sh -n dnode2 -s stop -x SIGINT
S
slguan 已提交
47
sleep 8000
S
slguan 已提交
48 49

sql show dnodes
S
slguan 已提交
50 51 52 53
print dnode1 $data4_1
print dnode1 $data4_2

if $data4_1 != ready then
S
slguan 已提交
54 55
  return -1
endi
S
slguan 已提交
56
if $data4_2 != offline then
S
slguan 已提交
57 58 59 60
  return -1
endi

print ========== step3
S
slguan 已提交
61
sleep 10000
S
slguan 已提交
62 63

sql show dnodes
S
slguan 已提交
64 65 66 67
print dnode1 $data4_1
print dnode1 $data4_2

if $data4_1 != ready then
S
slguan 已提交
68 69
  return -1
endi
S
slguan 已提交
70
if $data4_2 != dropping then
S
slguan 已提交
71 72 73 74
  return -1
endi

print ========== step4
S
slguan 已提交
75
sql create dnode $hostname3
S
Shengliang Guan 已提交
76 77
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode2 -s start
S
slguan 已提交
78
sql drop dnode $hostname2
S
slguan 已提交
79 80 81 82 83 84

sleep 5000
$x = 0
show4: 
	$x = $x + 1
	sleep 5000
S
scripts  
Shengliang Guan 已提交
85
	if $x == 10 then 
S
slguan 已提交
86 87 88 89
	  return -1
	endi

sql show dnodes
S
scripts  
Shengliang Guan 已提交
90 91 92
print dnode1 $data4_1
print dnode2 $data4_2
print dnode3 $data4_3
S
slguan 已提交
93 94
if $data4_1 != ready then
  goto show4
S
slguan 已提交
95
endi
S
scripts  
Shengliang Guan 已提交
96
if $data4_2 != null then
S
slguan 已提交
97
  goto show4
S
slguan 已提交
98
endi
S
slguan 已提交
99 100
if $data4_3 != ready then
  goto show4
S
slguan 已提交
101 102 103
endi

print ======================== step5
S
slguan 已提交
104 105 106
sql reset query cache
sleep 1000

S
slguan 已提交
107 108 109 110 111
sql select * from d1.t1
if $rows != 1 then
  return -1
endi

S
Shengliang Guan 已提交
112 113 114 115 116 117 118 119
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