basic6.sim 3.2 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2
system sh/deploy.sh -n dnode1 -i 1
S
slguan 已提交
3 4
system sh/exec.sh -n dnode1 -s start
sql connect
S
Shengliang Guan 已提交
5

S
slguan 已提交
6 7 8
print ============================ dnode1 start

$i = 0
S
Shengliang Guan 已提交
9 10
$dbPrefix = db
$tbPrefix = tb
S
slguan 已提交
11 12 13 14
$db = $dbPrefix . $i
$tb = $tbPrefix . $i

print =============== step1
S
Shengliang Guan 已提交
15
sql create database $db replica 1 days 20 keep 2000 cache 16 vgroups 4
S
slguan 已提交
16 17 18 19 20
sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data00 != $db then 
  return -1
endi
S
Shengliang Guan 已提交
21
if $data02 != 4 then 
S
slguan 已提交
22 23 24 25 26 27 28 29
  return -1
endi
if $data03 != 0 then 
  return -1
endi
if $data04 != 1 then 
  return -1
endi
S
scripts  
Shengliang Guan 已提交
30
if $data06 != 20 then 
S
slguan 已提交
31 32
  return -1
endi
S
scripts  
Shengliang Guan 已提交
33
if $data08 != 16 then 
S
slguan 已提交
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
  return -1
endi
 
print =============== step2
sql create database $db
sql show databases
if $rows != 1 then 
  return -1
endi 

print =============== step3
sql drop database $db
sql show databases
if $rows != 0 then 
  return -1
endi 

print =============== step4
sql_error drop database $db

print =============== step5
sql create database $db replica 1 days 15 keep 1500
sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data00 != $db then 
  return -1
endi
if $data03 != 0 then 
  return -1
endi
if $data04 != 1 then 
  return -1
endi
S
scripts  
Shengliang Guan 已提交
67
if $data06 != 15 then 
S
slguan 已提交
68 69 70 71
  return -1
endi

print =============== step6
S
Shengliang Guan 已提交
72 73
$i = $i + 1
while $i < 5
S
slguan 已提交
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
  $db = $dbPrefix . $i
  sql create database $db
  sql use $db
  $i = $i + 1
endw

print =============== step7
$i = 0
while $i < 5
  $db = $dbPrefix . $i  
  sql drop database $db 
  $i = $i + 1
endw

print =============== step8
$i = 0
$db = $dbPrefix . $i
$tb = $tbPrefix . $i
sql create database $db
sql use $db
S
Shengliang Guan 已提交
94 95
sql create table st (ts timestamp, i int) tags (j int)
sql create table $tb using st tags(1)
S
slguan 已提交
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
sql show tables
if $rows != 1 then 
  return -1
endi

print =============== step9
sql drop database $db

print =============== step10
sql create database $db
sql use $db
sql show tables
if $rows != 0 then 
  return -1
endi

print =============== step11
S
Shengliang Guan 已提交
113 114
sql create table st (ts timestamp, i int) tags (j int)
sql create table $tb using st tags(1)
S
slguan 已提交
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
sql show tables
if $rows != 1 then 
  return -1
endi

print =============== step12
sql drop database $db

print =============== step13
sql create database $db
sql use $db
sql show tables
if $rows != 0 then 
  return -1
endi
S
Shengliang Guan 已提交
130 131 132

sql create table st (ts timestamp, i int) tags (j int)
sql create table $tb using st tags(1)
S
slguan 已提交
133 134 135 136
sql show tables
if $rows != 1 then 
  return -1
endi
S
Shengliang Guan 已提交
137

S
slguan 已提交
138 139 140 141 142
sql insert into $tb values (now+1a, 0)
sql insert into $tb values (now+2a, 1)
sql insert into $tb values (now+3a, 2)
sql insert into $tb values (now+4a, 3)
sql insert into $tb values (now+5a, 4)
S
Shengliang Guan 已提交
143 144 145 146


return 

S
slguan 已提交
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
sql select * from $tb
if $rows != 5 then 
  return -1
endi

print =============== step14
sql drop database $db

print =============== step15
sql create database $db
sql use $db
sql show tables
if $rows != 0 then 
  return -1
endi

print =============== step16
S
Shengliang Guan 已提交
164 165
sql create table st (ts timestamp, i int) tags (j int)
sql create table $tb using st tags(1)
S
slguan 已提交
166 167 168 169 170 171 172 173 174 175 176 177 178 179
sql show tables
if $rows != 1 then 
  return -1
endi
sql select * from $tb
if $rows != 0 then 
  return -1
endi

sql drop database $db
sql show databases
if $rows != 0 then 
  return -1
endi
S
scripts  
slguan 已提交
180 181

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