create_db.sim 3.9 KB
Newer Older
S
slguan 已提交
1 2
system sh/stop_dnodes.sh

S
slguan 已提交
3 4

system sh/deploy.sh -n dnode1 -i 1
H
hjxilinx 已提交
5
system sh/cfg.sh -n dnode1 -c walLevel -v 0
S
slguan 已提交
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 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
system sh/exec.sh -n dnode1 -s start

sleep 3000
sql connect
print ======================== dnode1 start

$dbPrefix = fi_in_db
$tbPrefix = fi_in_tb
$mtPrefix = fi_in_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200

print excuting test script create_db.sim
print =============== set up
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i

sql_error createdatabase $db
sql create database $db
sql use $db
sql show databases

if $rows != 1 then 
  return -1
endi
if $data00 != $db then 
  return -1
endi
sql drop database $db

# case1: case_insensitivity test
print =========== create_db.sim case1: case insensitivity test
sql_error CREATEDATABASE $db
sql CREATE DATABASE $db
sql use $db
sql show databases

if $rows != 1 then
  return -1
endi
if $data00 != $db then 
  return -1
endi
sql drop database $db
print case_insensitivity test passed

# case2: illegal_db_name test
print =========== create_db.sim case2: illegal_db_name test
$illegal_db1 = 1db
$illegal_db2 = d@b

sql_error create database $illegal_db1
sql_error create database $illegal_db2
print illegal_db_name test passed

# case3: chinese_char_in_db_name test
print ========== create_db.sim case3: chinese_char_in_db_name test
$CN_db1 = 数据库
$CN_db2 = 数据库1
$CN_db3 = db数据库1
sql_error create database $CN_db1
sql_error create database $CN_db2
sql_error create database $CN_db3
#sql show databases
#if $rows != 3 then
#  return -1
#endi
#if $data00 != $CN_db1 then
#  return -1
#endi
#if $data10 != $CN_db2 then
#  return -1
#endi
#if $data20 != $CN_db3 then
#  return -1
#endi
#sql drop database $CN_db1
#sql drop database $CN_db2
#sql drop database $CN_db3
print case_chinese_char_in_db_name test passed

# case4: db_already_exists
print create_db.sim case4: db_already_exists
sql create database db0
sql create database db0
sql show databases
if $rows != 1 then
  return -1
endi
sql drop database db0
print db_already_exists test passed

# case5: db_meta_data
print create_db.sim case5: db_meta_data test
# cfg params
$replica = 1 # max=3
$days = 10
$keep = 365
$rows_db = 1000
H
Haojun Liao 已提交
107
$cache = 16 # 16MB
S
slguan 已提交
108 109 110
$ablocks = 100 
$tblocks = 32 # max=512, automatically trimmed when exceeding
$ctime = 36000 # 10 hours
111
$wal = 1 # valid value is 1, 2
S
slguan 已提交
112 113
$comp = 1 # max=32, automatically trimmed when exceeding

114
sql create database $db replica $replica days $days keep $keep maxrows $rows_db cache $cache blocks 4 ctime $ctime wal $wal comp $comp
S
slguan 已提交
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
sql show databases
if $rows != 1 then
  return -1
endi
if $data00 != $db then 
 return -1
endi
if $data04 != $replica then 
 return -1
endi
if $data05 != $days then 
 return -1
endi
if $data06 != 365,365,365 then 
 return -1
endi
print data08 = $data08
132 133
if $data08 != $cache then
 print expect $cache, actual:$data08
S
slguan 已提交
134 135
 return -1
endi
136
if $data09 != 4 then
S
slguan 已提交
137 138 139
 return -1
endi

140
sql drop database $db
S
slguan 已提交
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155

## param range tests
# replica [1,3]
#sql_error create database $db replica 0
sql_error create database $db replica 4

# day [1, 3650]
sql_error create database $db day 0
sql_error create database $db day 3651 

# keep [1, infinity]
sql_error create database $db keep 0
#sql_error create database $db keep 3651

# rows [200, 10000]
sangshuduo's avatar
sangshuduo 已提交
156 157
sql_error create database $db maxrows 199
#sql_error create database $db maxrows 10001
S
slguan 已提交
158 159

# cache [100, 10485760]
160
sql_error create database $db cache 0
S
slguan 已提交
161 162 163
#sql_error create database $db cache 10485761


164
# blocks [32, 4096 overwriten by 4096 if exceeds, Note added:2018-10-24]
S
slguan 已提交
165 166 167 168 169 170 171
#sql_error create database $db tblocks 31
#sql_error create database $db tblocks 4097

# ctime [30, 40960]
sql_error create database $db ctime 29
sql_error create database $db ctime 40961

172 173
# wal {1, 2}
sql_error create database $db wal 0
sangshuduo's avatar
sangshuduo 已提交
174
sql_error create database $db wal -1
175
sql_error create database $db wal 3
S
slguan 已提交
176 177 178 179 180 181 182 183 184 185

# comp {0, 1, 2}
sql_error create database $db comp -1
sql_error create database $db comp 3

sql_error drop database $db
sql show databases
if $rows != 0 then 
  return -1
endi
S
scripts  
Shengliang Guan 已提交
186 187

system sh/exec.sh -n dnode1 -s stop -x SIGINT