create_db.sim 4.2 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 107 108 109 110
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
$cache = 4096 # 4 kb
$ablocks = 100 
$tblocks = 32 # max=512, automatically trimmed when exceeding
$ctime = 36000 # 10 hours
sangshuduo's avatar
sangshuduo 已提交
111
$wal = 0 # valid value is 0, 1, 2
S
slguan 已提交
112 113
$comp = 1 # max=32, automatically trimmed when exceeding

sangshuduo's avatar
sangshuduo 已提交
114
sql create database $db replica $replica days $days keep $keep maxrows $rows_db cache $cache ablocks $ablocks tblocks $tblocks 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 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
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
if $data08 != $rows_db then 
 return -1
endi
if $data09 != $cache then 
 return -1
endi
sql drop database $db

# ablocks_smaller_than_tblocks
#$ablocks = 50
#$tblocks = 100
#sql_error create database $db ablocks $ablocks tblocks $tblocks

## 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 已提交
159 160
sql_error create database $db maxrows 199
#sql_error create database $db maxrows 10001
S
slguan 已提交
161 162 163 164 165

# cache [100, 10485760]
sql_error create database $db cache 99
#sql_error create database $db cache 10485761

S
scripts  
slguan 已提交
166
# ablocks [overwriten by 4*maxtablesPerVnode, 409600]
S
slguan 已提交
167 168 169 170 171 172 173 174 175 176 177
sql_error create database $db ablocks -1
#sql_error create database $db ablocks 409601

# tblocks [32, 4096 overwriten by 4096 if exceeds, Note added:2018-10-24]
#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

sangshuduo's avatar
sangshuduo 已提交
178 179 180
# wal {0, 1}
sql_error create database $db wal -1
#sql_error create database $db wal 2
S
slguan 已提交
181 182 183 184 185 186 187 188 189 190

# 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 已提交
191 192

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