create_all_options.sim 16.7 KB
Newer Older
P
plum-lihui 已提交
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 55 56 57 58 59 60
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
system sh/exec.sh -n dnode3 -s start

$loop_cnt = 0
check_dnode_ready:
	$loop_cnt = $loop_cnt + 1
	sleep 200
	if $loop_cnt == 10 then
	  print ====> dnode not ready!
		return -1
	endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
  return -1
endi
if $data04 != ready then
  goto check_dnode_ready
endi

sql connect
sql create dnode $hostname port 7200
sql create dnode $hostname port 7300

$loop_cnt = 0
check_dnode_ready_1:
	$loop_cnt = $loop_cnt + 1
	sleep 200
	if $loop_cnt == 10 then
	  print ====> dnode not ready!
		return -1
	endi
sql show dnodes
print ===> rows: $rows 
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
print ===> $data20 $data21 $data22 $data23 $data24 $data25
if $data00 != 1 then
  return -1
endi
if $data01 != localhost:7100 then
  return -1
endi
if $data04 != ready then
  goto check_dnode_ready_1
endi
if $data14 != ready then
  goto check_dnode_ready_1
endi
if $data24 != ready then
  goto check_dnode_ready_1
endi

print ============= create database with all options
#database_option: {
61 62 63
#  | BUFFER value       [3~16384, default: 96]
#  | PAGES value        [64~16384, default: 256]
#  | PAGESIZE value     [1~16384, default: 4]
P
plum-lihui 已提交
64 65
#  | CACHELAST value    [0, 1, 2, 3, default: 0]
#  | COMP               [0 | 1 | 2, default: 2]
X
Xiaoyu Wang 已提交
66
#  | DURATION value         [60m ~ min(3650d,keep), default: 10d, unit may be minut/hour/day]
P
plum-lihui 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
#  | FSYNC value        [0 ~ 180000 ms, default: 3000]
#  | MAXROWS value      [200~10000, default: 4096]
#  | MINROWS value      [10~1000, default: 100]
#  | KEEP value         [max(1d ~ 365000d), default: 1d, unit may be minut/hour/day]
#  | PRECISION          ['ms' | 'us' | 'ns', default: ms]
#  | REPLICA value      [1 | 3, default: 1]
#  | WAL value          [1 | 2, default: 1]
#  | VGROUPS value      [default: 2]
#  | SINGLE_STABLE      [0 | 1, default: ]
#
#$data0_db  : name
#$data1_db  : create_time
#$data2_db  : vgroups
#$data3_db  : ntables
#$data4_db  : replica
82
#$data6_db  : duration
P
plum-lihui 已提交
83 84 85 86 87 88 89 90 91 92 93 94 95 96
#$data7_db  : keep
#$data10_db : minrows
#$data11_db : maxrows
#$data12_db : wal
#$data13_db : fsync
#$data14_db : comp
#$data15_db : cachelast
#$data16_db : precision

print ====> create database db, with default
sql create database db
sql show databases
print rows: $rows
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
97
if $rows != 3 then
P
plum-lihui 已提交
98 99 100 101 102 103 104 105 106 107 108 109
  return -1
endi
if $data0_db != db then # name
  return -1
endi
if $data2_db != 2 then  # vgroups
  return -1
endi
if $data3_db != 0 then  # ntables
  return -1
endi
if $data4_db != 1 then  # replica
110
  print expect 1, actual: $data4_db
P
plum-lihui 已提交
111 112
  return -1
endi
H
Haojun Liao 已提交
113
if $data5_db != no_strict then  # strict
P
plum-lihui 已提交
114 115
  return -1
endi
116
if $data6_db != 14400 then  # duration
P
plum-lihui 已提交
117 118
  return -1
endi
X
Xiaoyu Wang 已提交
119
if $data7_db != 5256000m,5256000m,5256000m then # keep
P
plum-lihui 已提交
120 121
  return -1
endi
122 123 124 125 126 127 128 129 130 131
if $data8_db != 96 then  # buffer
  return -1
endi
if $data9_db != 4 then  # pagesize
  return -1
endi
if $data10_db != 256 then  # pages
  return -1
endi
if $data11_db != 100 then  # minrows
P
plum-lihui 已提交
132 133
  return -1
endi
134
if $data12_db != 4096 then  # maxrows
P
plum-lihui 已提交
135 136
  return -1
endi
137
if $data13_db != 1 then  # wal
P
plum-lihui 已提交
138 139
  return -1
endi
140
if $data14_db != 3000 then  # fsync
P
plum-lihui 已提交
141 142
  return -1
endi
143
if $data15_db != 2 then  # comp
P
plum-lihui 已提交
144 145
  return -1
endi
146
if $data16_db != 0 then  # cachelast
P
plum-lihui 已提交
147 148
  return -1
endi
149
if $data17_db != ms then  # precision
P
plum-lihui 已提交
150 151 152 153
  return -1
endi
sql drop database db

X
Xiaoyu Wang 已提交
154 155 156 157 158 159 160 161
#print ====> BLOCKS value       [3~1000, default: 6]
#sql create database db BLOCKS 3
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $data9_db != 3 then
#  return -1
#endi
#sql drop database db
P
plum-lihui 已提交
162

X
Xiaoyu Wang 已提交
163 164 165 166 167 168 169 170 171 172
#sql create database db BLOCKS 1000
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $data9_db != 1000 then
#  return -1
#endi
#sql drop database db
#sql_error create database db BLOCKS 2
#sql_error create database db BLOCKS 0
#sql_error create database db BLOCKS -1
P
plum-lihui 已提交
173

X
Xiaoyu Wang 已提交
174 175 176 177 178 179 180 181
#print ====> CACHE value [default: 16]
#sql create database db CACHE 1
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $data8_db != 1 then
#  return -1
#endi
#sql drop database db
P
plum-lihui 已提交
182

X
Xiaoyu Wang 已提交
183 184 185 186 187 188 189
#sql create database db CACHE 128
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $data8_db != 128 then
#  return -1
#endi
#sql drop database db
P
plum-lihui 已提交
190 191 192 193 194

print ====> CACHELAST value [0, 1, 2, 3, default: 0]
sql create database db CACHELAST 1
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
195
if $data16_db != 1 then
P
plum-lihui 已提交
196 197 198 199 200 201 202
  return -1
endi
sql drop database db

sql create database db CACHELAST 2
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
203
if $data16_db != 2 then
P
plum-lihui 已提交
204 205 206 207 208 209 210
  return -1
endi
sql drop database db

sql create database db CACHELAST 3
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
211
if $data16_db != 3 then
P
plum-lihui 已提交
212 213 214 215 216 217 218 219 220 221
  return -1
endi
sql drop database db
sql_error create database db CACHELAST 4
sql_error create database db CACHELAST -1

print ====> COMP [0 | 1 | 2, default: 2]
sql create database db COMP 1
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
222
if $data15_db != 1 then
P
plum-lihui 已提交
223 224 225 226 227 228 229
  return -1
endi
sql drop database db

sql create database db COMP 0
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
230
if $data15_db != 0 then
P
plum-lihui 已提交
231 232 233 234 235 236
  return -1
endi
sql drop database db
sql_error create database db COMP 3
sql_error create database db COMP -1

X
Xiaoyu Wang 已提交
237
#print ====> DURATION value [60m ~ min(3650d,keep), default: 10d, unit may be minut/hour/day]
P
plum-lihui 已提交
238
#print ====> KEEP value [max(1d ~ 365000d), default: 1d, unit may be minut/hour/day]
X
Xiaoyu Wang 已提交
239
#sql create database db DURATION 60m KEEP 60m
P
plum-lihui 已提交
240 241 242 243 244 245 246 247 248
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $data6_db != 60 then
#  return -1
#endi
#if $data7_db != 60,60,60 then
#  return -1
#endi
#sql drop database db
X
Xiaoyu Wang 已提交
249
#sql create database db DURATION 60m KEEP 1d
P
plum-lihui 已提交
250 251 252 253 254 255 256 257
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $data6_db != 60 then
#  return -1
#endi
#if $data7_db != 1440,1440,1440 then
#  return -1
#endi
X
Xiaoyu Wang 已提交
258
#sql create database db DURATION 3650d KEEP 365000d
P
plum-lihui 已提交
259 260 261 262 263 264 265 266 267
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $data6_db != 5256000 then
#  return -1
#endi
#if $data7_db != 525600000,525600000,525600000 then
#  return -1
#endi
#sql drop database db
X
Xiaoyu Wang 已提交
268 269 270 271
#sql_error create database db DURATION -59m
#sql_error create database db DURATION 59m
#sql_error create database db DURATION 5256001m
#sql_error create database db DURATION 3651d
P
plum-lihui 已提交
272 273 274 275 276 277 278 279 280
#sql_error create database db KEEP -59m
#sql_error create database db KEEP 14399m
#sql_error create database db KEEP 525600001m
#sql_error create database db KEEP 365001d

print ====> FSYNC value [0 ~ 180000 ms, default: 3000]
sql create database db FSYNC 0
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
281
if $data14_db != 0 then
P
plum-lihui 已提交
282 283 284 285 286 287 288
  return -1
endi
sql drop database db

sql create database db FSYNC 180000
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
289
if $data14_db != 180000 then
P
plum-lihui 已提交
290 291 292 293 294 295 296 297 298 299
  return -1
endi
sql drop database db
sql_error create database db FSYNC 180001
sql_error create database db FSYNC -1

print ====> MAXROWS value [200~10000, default: 4096], MINROWS value [10~1000, default: 100]
sql create database db MAXROWS 10000 MINROWS 1000
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
300
if $data11_db != 1000 then
P
plum-lihui 已提交
301 302
  return -1
endi
303
if $data12_db != 10000 then
P
plum-lihui 已提交
304 305 306 307 308 309 310
  return -1
endi
sql drop database db

sql create database db MAXROWS 200 MINROWS 10
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
311
if $data11_db != 10 then
P
plum-lihui 已提交
312 313
  return -1
endi
314
if $data12_db != 200 then
P
plum-lihui 已提交
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
  return -1
endi
sql drop database db
sql_error create database db MAXROWS -1
sql_error create database db MAXROWS 0
sql_error create database db MAXROWS 199
sql_error create database db MAXROWS 10001
sql_error create database db MINROWS -1
sql_error create database db MINROWS 0
sql_error create database db MINROWS 9
sql_error create database db MINROWS 1001
sql_error create database db MAXROWS 500 MINROWS 1000

print ====> PRECISION ['ms' | 'us' | 'ns', default: ms]
sql create database db PRECISION 'us'
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
332
if $data17_db != us then
P
plum-lihui 已提交
333 334 335 336 337 338 339
  return -1
endi
sql drop database db

sql create database db PRECISION 'ns'
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
340
if $data17_db != ns then
P
plum-lihui 已提交
341 342 343 344 345 346
  return -1
endi
sql drop database db
sql_error create database db PRECISION 'as'
sql_error create database db PRECISION -1

P
plum-lihui 已提交
347 348
print ====> QUORUM value [1 | 2, default: 1] 3.0 not support this item
#sql_error create database db QUORUM 2
P
plum-lihui 已提交
349 350 351 352 353 354 355
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $data5_db != 2 then
#  return -1
#endi
#sql drop database db

S
Shengliang Guan 已提交
356 357 358 359 360 361 362
#sql create database db QUORUM 1
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $data5_db != 1 then
#  return -1
#endi
#sql drop database db
P
plum-lihui 已提交
363 364 365 366 367
sql_error create database db QUORUM 1
sql_error create database db QUORUM 2
sql_error create database db QUORUM 3
sql_error create database db QUORUM 0
sql_error create database db QUORUM -1
P
plum-lihui 已提交
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389

print ====> REPLICA value [1 | 3, default: 1]
sql create database db REPLICA 3
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
if $data4_db != 3 then
  return -1
endi
sql drop database db

sql create database db REPLICA 1
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
if $data4_db != 1 then
  return -1
endi
sql drop database db
sql_error create database db REPLICA 2
sql_error create database db REPLICA 0
sql_error create database db REPLICA -1
sql_error create database db REPLICA 4

X
Xiaoyu Wang 已提交
390 391 392 393
#print ====> TTL value [1d ~ , default: 1]
#sql create database db TTL 1
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
P
plum-lihui 已提交
394 395 396
#if $dataXX_db != 1 then
#  return -1
#endi
X
Xiaoyu Wang 已提交
397
#sql drop database db
P
plum-lihui 已提交
398

X
Xiaoyu Wang 已提交
399 400 401
#sql create database db TTL 10
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
P
plum-lihui 已提交
402 403 404
#if $dataXX_db != 10 then
#  return -1
#endi
X
Xiaoyu Wang 已提交
405 406 407
#sql drop database db
#sql_error create database db TTL 0
#sql_error create database db TTL -1
P
plum-lihui 已提交
408 409 410 411 412

print ====> WAL value [1 | 2, default: 1]
sql create database db WAL 2
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
413
if $data13_db != 2 then
P
plum-lihui 已提交
414 415 416 417 418 419 420
  return -1
endi
sql drop database db

sql create database db WAL 1
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
421
if $data13_db != 1 then
P
plum-lihui 已提交
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
  return -1
endi
sql drop database db
sql_error create database db WAL 3
sql_error create database db WAL -1
sql_error create database db WAL 0

print ====> VGROUPS value [1~4096, default: 2]
sql create database db VGROUPS 1
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
if $data2_db != 1 then
  return -1
endi
sql drop database db

sql create database db VGROUPS 16
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
if $data2_db != 16 then
  return -1
endi
sql drop database db
sql_error create database db VGROUPS 4097
sql_error create database db VGROUPS -1
sql_error create database db VGROUPS 0

print ====> SINGLE_STABLE [0 | 1, default: ]
sql create database db SINGLE_STABLE 1
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $dataXXXX_db != 1 then
#  return -1
#endi
sql drop database db

sql create database db SINGLE_STABLE 0
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#if $dataXXXX_db != 0 then
#  return -1
#endi
sql drop database db
sql_error create database db SINGLE_STABLE 2
sql_error create database db SINGLE_STABLE -1

X
Xiaoyu Wang 已提交
468 469 470 471
#print ====> STREAM_MODE [0 | 1, default: ]
#sql create database db STREAM_MODE 1
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
P
plum-lihui 已提交
472 473 474
#if $dataXXX_db != 1 then
#  return -1
#endi
X
Xiaoyu Wang 已提交
475
#sql drop database db
P
plum-lihui 已提交
476

X
Xiaoyu Wang 已提交
477 478 479
#sql create database db STREAM_MODE 0
#sql show databases
#print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
P
plum-lihui 已提交
480 481 482
#if $dataXXX_db != 0 then
#  return -1
#endi
X
Xiaoyu Wang 已提交
483 484 485
#sql drop database db
#sql_error create database db STREAM_MODE 2
#sql_error create database db STREAM_MODE -1
P
plum-lihui 已提交
486

487 488 489
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