basic4.sim 4.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
system sh/stop_dnodes.sh
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/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
sql connect

print =============== step1: create dnodes
sql create dnode $hostname port 7200
sql create dnode $hostname port 7300

$x = 0
step1: 
	$x = $x + 1
	sleep 1000
	if $x == 5 then
		return -1
	endi
sql show dnodes -x step1
if $data(1)[4] != ready then
  goto step1
endi
if $data(2)[4] != ready then
  goto step1
endi

print =============== step2: create mnode 2
sql create mnode on dnode 2
sql_error create mnode on dnode 3
31

32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
system sh/exec.sh -n dnode3 -s start

$x = 0
step2: 
	$x = $x + 1
	sleep 1000
	if $x == 5 then
		return -1
	endi
sql show dnodes -x step2
if $data(1)[4] != ready then
  goto step2
endi
if $data(2)[4] != ready then
  goto step2
endi
S
Shengliang Guan 已提交
48 49 50
if $data(3)[4] != ready then
  goto step2
endi
51

S
Shengliang Guan 已提交
52
system sh/exec.sh -n dnode3 -s stop -x SIGKILL
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
sql_error create mnode on dnode 3

print =============== step3: show mnodes

$x = 0
step3: 
	$x = $x + 1
	sleep 1000
	if $x == 10 then
		return -1
	endi
sql show mnodes -x step3
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] 
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] 
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]

69 70 71 72 73 74
$leaderNum = 0
if $data(1)[2] == leader then
  $leaderNum = 1
endi
if $data(2)[2] == leader then
  $leaderNum = 1
75
endi
76
if  $leaderNum == 0 then
77 78
  goto step3
endi
79
if $data(3)[2] != offline then
80 81
  goto step3
endi
82
if $data(1)[3] != ready then
83 84
  goto step3
endi
85
if $data(2)[3] != ready then
86 87
  goto step3
endi
88
if $data(3)[3] != creating then
89 90 91 92 93 94 95 96 97 98 99 100 101 102
  goto step3
endi

print =============== step4: start dnode3
system sh/exec.sh -n dnode3 -s start

$x = 0
step4: 
	$x = $x + 1
	sleep 1000
	if $x == 10 then
		return -1
	endi
sql show mnodes -x step4
103 104 105 106
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] 
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] 
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]

107 108 109 110 111 112
$leaderNum = 0
if $data(1)[2] == leader then
  $leaderNum = 1
endi
if $data(2)[2] == leader then
  $leaderNum = 1
113
endi
114
if  $leaderNum == 0 then
115 116
  goto step4
endi
117
if $data(3)[2] != follower then
118 119
  goto step4
endi
120
if $data(1)[3] != ready then
121 122
  goto step4
endi
123
if $data(2)[3] != ready then
124 125
  goto step4
endi
126
if $data(3)[3] != ready then
127 128 129 130
  goto step4
endi

print =============== step5: drop mnode 3 and stop dnode3
S
Shengliang Guan 已提交
131 132 133
system sh/exec.sh -n dnode3 -s stop -x SIGKILL
sql_error drop mnode on dnode 3

134
$x = 0
135
step5: 
136 137
	$x = $x + 1
	sleep 1000
138
	if $x == 10 then
139 140
		return -1
	endi
141 142 143 144
sql show mnodes -x step5
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] 
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] 
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
145

146 147 148 149 150 151
$leaderNum = 0
if $data(1)[2] == leader then
  $leaderNum = 1
endi
if $data(2)[2] == leader then
  $leaderNum = 1
152
endi
153
if  $leaderNum == 0 then
154
  goto step5
155
endi
156
if $data(3)[2] != offline then
157
  goto step5
158
endi
159
if $data(1)[3] != ready then
160 161
  goto step5
endi
162
if $data(2)[3] != ready then
163 164
  goto step5
endi
165
if $data(3)[3] != dropping then
166
  goto step5
167 168
endi

169 170
print =============== step6: start dnode3
system sh/exec.sh -n dnode3 -s start
171 172 173 174 175

$x = 0
step6: 
	$x = $x + 1
	sleep 1000
176
	if $x == 10 then
177 178 179
		return -1
	endi
sql show mnodes -x step6
180 181 182
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] 
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] 
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
183 184

if $rows != 2 then 
185 186
  goto step6
endi
187 188 189 190 191 192
$leaderNum = 0
if $data(1)[2] == leader then
  $leaderNum = 1
endi
if $data(2)[2] == leader then
  $leaderNum = 1
193
endi
194
if  $leaderNum == 0 then
195 196 197 198 199
  goto step6
endi
if $data(3)[2] != null then
  goto step6
endi
200
if $data(1)[3] != ready then
201 202
  goto step6
endi
203
if $data(2)[3] != ready then
204 205 206 207
  goto step6
endi
if $data(3)[3] != null then
  goto step6
208 209 210 211 212
endi

system sh/exec.sh -n dnode1 -s stop
system sh/exec.sh -n dnode2 -s stop
system sh/exec.sh -n dnode3 -s stop
L
Liu Jicong 已提交
213
system sh/exec.sh -n dnode4 -s stop