basic4.sim 3.4 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
if $data(1)[4] != ready then
  goto step2
endi
if $data(2)[4] != ready then
  goto step2
endi
48 49
if $data(3)[4] != ready then
  goto step2
50 51
endi

52 53
print =============== step4: create mnode 3
sql create mnode on dnode 3
54 55 56 57 58 59 60 61

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

67 68 69 70 71 72
$leaderNum = 0
if $data(1)[2] == leader then
  $leaderNum = 1
endi
if $data(2)[2] == leader then
  $leaderNum = 1
73
endi
74
if  $leaderNum == 0 then
75 76
  goto step4
endi
77
if $data(3)[2] != follower then
78 79
  goto step4
endi
80
if $data(1)[3] != ready then
81 82
  goto step4
endi
83
if $data(2)[3] != ready then
84 85
  goto step4
endi
86
if $data(3)[3] != ready then
87 88 89 90
  goto step4
endi

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

94
$x = 0
95
step5: 
96 97
	$x = $x + 1
	sleep 1000
98
	if $x == 10 then
99 100
		return -1
	endi
X
Xiaoyu Wang 已提交
101
sql select * from information_schema.ins_mnodes -x step5
102 103 104
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]
105

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

126 127
print =============== step6: start dnode3
system sh/exec.sh -n dnode3 -s start
128 129
sql drop mnode on dnode 1 -x step60
step60:
130 131 132 133 134

$x = 0
step6: 
	$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 step6
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

if $rows != 2 then 
144 145
  goto step6
endi
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 155 156 157 158
  goto step6
endi
if $data(3)[2] != null then
  goto step6
endi
159
if $data(1)[3] != ready then
160 161
  goto step6
endi
162
if $data(2)[3] != ready then
163 164 165 166
  goto step6
endi
if $data(3)[3] != null then
  goto step6
167 168 169 170 171
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 已提交
172
system sh/exec.sh -n dnode4 -s stop