basic4.sim 4.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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
X
Xiaoyu Wang 已提交
20
sql select * from information_schema.ins_dnodes -x step1
21 22 23 24 25 26 27 28 29 30
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
system sh/exec.sh -n dnode3 -s start

$x = 0
step2: 
	$x = $x + 1
	sleep 1000
	if $x == 5 then
		return -1
	endi
X
Xiaoyu Wang 已提交
41
sql select * from information_schema.ins_dnodes -x step2
42 43 44 45 46 47 48
if $data(1)[4] != ready then
  goto step2
endi
if $data(2)[4] != ready then
  goto step2
endi

S
Shengliang Guan 已提交
49
system sh/exec.sh -n dnode3 -s stop
50 51
sql_error create mnode on dnode 3

X
Xiaoyu Wang 已提交
52
print =============== step3: select * from information_schema.ins_mnodes
53 54 55 56 57 58 59 60

$x = 0
step3: 
	$x = $x + 1
	sleep 1000
	if $x == 10 then
		return -1
	endi
X
Xiaoyu Wang 已提交
61
sql select * from information_schema.ins_mnodes -x step3
62 63 64 65
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]

66 67 68 69 70 71
$leaderNum = 0
if $data(1)[2] == leader then
  $leaderNum = 1
endi
if $data(2)[2] == leader then
  $leaderNum = 1
72
endi
73
if  $leaderNum == 0 then
74 75
  goto step3
endi
76
if $data(3)[2] != offline then
77 78
  goto step3
endi
79
if $data(1)[3] != ready then
80 81
  goto step3
endi
82
if $data(2)[3] != ready then
83 84
  goto step3
endi
85
if $data(3)[3] != creating then
86 87 88 89 90 91 92 93 94 95 96 97 98
  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
X
Xiaoyu Wang 已提交
99
sql select * from information_schema.ins_mnodes -x step4
100 101 102 103
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]

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

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

131
$x = 0
132
step5: 
133 134
	$x = $x + 1
	sleep 1000
135
	if $x == 10 then
136 137
		return -1
	endi
X
Xiaoyu Wang 已提交
138
sql select * from information_schema.ins_mnodes -x step5
139 140 141
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]
142

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

166 167
print =============== step6: start dnode3
system sh/exec.sh -n dnode3 -s start
168 169 170 171 172

$x = 0
step6: 
	$x = $x + 1
	sleep 1000
173
	if $x == 10 then
174 175
		return -1
	endi
X
Xiaoyu Wang 已提交
176
sql select * from information_schema.ins_mnodes -x step6
177 178 179
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]
180 181

if $rows != 2 then 
182 183
  goto step6
endi
184 185 186 187 188 189
$leaderNum = 0
if $data(1)[2] == leader then
  $leaderNum = 1
endi
if $data(2)[2] == leader then
  $leaderNum = 1
190
endi
191
if  $leaderNum == 0 then
192 193 194 195 196
  goto step6
endi
if $data(3)[2] != null then
  goto step6
endi
197
if $data(1)[3] != ready then
198 199
  goto step6
endi
200
if $data(2)[3] != ready then
201 202 203 204
  goto step6
endi
if $data(3)[3] != null then
  goto step6
205 206 207 208 209
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 已提交
210
system sh/exec.sh -n dnode4 -s stop