replica2.sim 7.6 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
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/deploy.sh -n dnode4 -i 4

system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1

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

system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000

system sh/cfg.sh -n dnode1 -c walLevel -v 2
system sh/cfg.sh -n dnode2 -c walLevel -v 2
system sh/cfg.sh -n dnode3 -c walLevel -v 2
system sh/cfg.sh -n dnode4 -c walLevel -v 2

print ========= start dnode1
system sh/exec.sh -n dnode1 -s start
sql connect

sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start
$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

55
sql create database ir2db replica 2 duration 7
56 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
sql use ir2db
sql create table tb(ts timestamp, i bigint)

print ================= step1
sql import into tb values(1520000010000, 1520000010000)
sql select * from tb;
print $rows
if $rows != 1 then 
  return -1
endi

print ================= step2
sql insert into tb values(1520000008000, 1520000008000)
print $rows
sql select * from tb;
if $rows != 2 then 
  return -1
endi

print ================= step3
sql insert into tb values(1520000020000, 1520000020000)
sql select * from tb;
print $rows
if $rows != 3 then 
  return -1
endi

print ================= step4
sql import into tb values(1520000009000, 1520000009000)
sql import into tb values(1520000015000, 1520000015000)
sql import into tb values(1520000030000, 1520000030000)
sql select * from tb;
print $rows
if $rows != 6 then 
  return -1
endi

print ================= step5
sql insert into tb values(1520000008000, 1520000008000)
sql insert into tb values(1520000014000, 1520000014000)
sql insert into tb values(1520000025000, 1520000025000)
sql insert into tb values(1520000040000, 1520000040000)
sql select * from tb;
print $rows
if $rows != 9 then 
  return -1
endi

print ================= step6
sql import into tb values(1520000007000, 1520000007000)
sql import into tb values(1520000012000, 1520000012000)
sql import into tb values(1520000023000, 1520000023000)
sql import into tb values(1520000034000, 1520000034000)
sql import into tb values(1520000050000, 1520000050000)
sql select * from tb;
print $rows
if $rows != 14 then 
  return -1
endi

print ================== dnode restart
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start

$x = 0
a1: 
	$x = $x + 1
	sleep 1000
	if $x == 40 then
	  return -1
	endi

sql show vgroups 
print online vnodes $data03
if $data03 != 2 then
	goto a1
endi

sql select * from tb;
if $rows != 14 then 
  return -1
endi

print ================= step7
sql import into tb values(1520000007001, 1520000007001)
sql import into tb values(1520000012001, 1520000012001)
sql import into tb values(1520000023001, 1520000023001)
sql import into tb values(1520000034001, 1520000034001)
sql import into tb values(1520000050001, 1520000050001)
sql select * from tb;
print $rows
if $rows != 19 then
  print expect 19, actual: $rows
  return -1
endi

print ================= step8
sql insert into tb values(1520000008002, 1520000008002)
sql insert into tb values(1520000014002, 1520000014002)
sql insert into tb values(1520000025002, 1520000025002)
sql insert into tb values(1520000060000, 1520000060000)
sql select * from tb;
print $rows
if $rows != 23 then 
  return -1
endi

print ================= step9
#1520000000000
#sql import into tb values(now-30d, 7003)
#sql import into tb values(now-20d, 34003)
#sql import into tb values(now-10d, 34003)
#sql import into tb values(now-5d, 34003)
#sql import into tb values(now+1d, 50001)
#sql import into tb values(now+2d, 50001)
#sql import into tb values(now+6d, 50001)
#sql import into tb values(now+8d, 50002)
#sql import into tb values(now+10d, 50003)
#sql import into tb values(now+12d, 50004)
#sql import into tb values(now+14d, 50001)
#sql import into tb values(now+16d, 500051)

sql import into tb values(1517408000000, 1517408000000)
sql import into tb values(1518272000000, 1518272000000)
sql import into tb values(1519136000000, 1519136000000)
sql import into tb values(1519568000000, 1519568000000)
sql import into tb values(1519654400000, 1519654400000)
sql import into tb values(1519827200000, 1519827200000)
sql import into tb values(1520345600000, 1520345600000)
sql import into tb values(1520691200000, 1520691200000)
sql import into tb values(1520864000000, 1520864000000)
sql import into tb values(1521900800000, 1521900800000)
sql import into tb values(1523110400000, 1523110400000)
sql import into tb values(1521382400000, 1521382400000)
sql select * from tb;
print $rows
if $rows != 35 then 
  return -1
endi

print ================= step10
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start

$x = 0
a2: 
	$x = $x + 1
	sleep 1000
	if $x == 40 then
	  return -1
	endi

sql show vgroups 
print online vnodes $data03
if $data03 != 2 then
	goto a2
endi

sql select * from tb;
print $rows
if $rows != 35 then 
  return -1
endi

print ================= step11

#sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003)
sql import into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5)
sql select * from tb;
if $rows != 40 then 
  return -1
endi

print ================= step12
#1520000000000
#sql import into tb values(now-19d, -19) (now-18d, -18) (now-17d, -17) (now-16d, -16) (now-15d, -15) (now-14d, -14) (now-13d, -13) (now-12d, -12) (now-11d, -11)
sql import into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14)
sql select * from tb;
print $rows
if $rows != 49 then 
  return -1
endi

print ================= step13
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s start
$x = 0
a3: 
	$x = $x + 1
	sleep 1000
	if $x == 40 then
	  return -1
	endi

sql show vgroups 
print online vnodes $data03
if $data03 != 2 then
	goto a3
endi

print ================= step14
#1520000000000
#sql import into tb values(now-48d, -48)
#sql import into tb values(now-38d, -38)
#sql import into tb values(now-28d, -28)

sql import into tb values(1515852800001, -48)
sql import into tb values(1516716800000, -38)
sql import into tb values(1517580800000, -28)

sql select * from tb;
if $rows != 52 then 
  return -1
endi

print ================= step15
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
$x = 0
a4: 
	$x = $x + 1
	sleep 1000
	if $x == 40 then
	  return -1
	endi

sql show vgroups 
print online vnodes $data03
if $data03 != 2 then
	goto a4
endi

sql select * from tb;
if $rows != 52 then 
  goto a4
endi

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