basic1.sim 3.2 KB
Newer Older
1 2 3 4 5 6 7 8 9
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
sql connect

print =============== show dnodes
sql show dnodes;
10
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
11 12 13 14 15 16 17 18 19 20
if $rows != 1 then 
  return -1
endi

if $data00 != 1 then 
  return -1
endi


sql show mnodes;
21
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
22 23 24 25 26 27 28 29
if $rows != 1 then 
  return -1
endi

if $data00 != 1 then 
  return -1
endi

30
if $data02 != leader then 
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
  return -1
endi

print =============== create dnodes
sql create dnode $hostname port 7200
sleep 2000

sql show dnodes;
if $rows != 2 then 
  return -1
endi

if $data00 != 1 then 
  return -1
endi

if $data10 != 2 then 
  return -1
endi

X
Xiaoyu Wang 已提交
51 52 53 54
# check 'vnodes' feild ?
#if $data02 != 0 then 
#  return -1
#endi
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76

if $data12 != 0 then 
  return -1
endi

if $data04 != ready then 
  return -1
endi

if $data14 != ready then 
  return -1
endi

sql show mnodes;
if $rows != 1 then 
  return -1
endi

if $data00 != 1 then 
  return -1
endi

77
if $data02 != leader then 
78 79 80 81 82 83 84 85
  return -1
endi

print =============== create database
sql create database d1 vgroups 4;
sql create database d2;

sql show databases
86
if $rows != 4 then
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
  return -1
endi

sql use d1
sql show vgroups;

if $rows != 4 then 
  return -1
endi

print =============== create table
sql use d1

sql create table st (ts timestamp, i int) tags (j int)
sql show stables
if $rows != 1 then 
  return -1
endi

print $data00 $data01 $data02

sql create table c1 using st tags(1)
sql create table c2 using st tags(2) 
sql create table c3 using st tags(2) 
sql create table c4 using st tags(2) 
sql create table c5 using st tags(2) 

sql show tables
print $data00 $data01 $data02

if $rows != 5 then 
  return -1
endi

print =============== insert data
sql insert into c1 values(now+1s, 1)
sql insert into c1 values(now+2s, 2)
sql insert into c1 values(now+3s, 3)
sql insert into c2 values(now+1s, 1)
sql insert into c2 values(now+2s, 2)
sql insert into c2 values(now+3s, 3)
sql insert into c3 values(now+1s, 1)
sql insert into c3 values(now+2s, 2)
sql insert into c3 values(now+3s, 3)
sql insert into c4 values(now+1s, 1)
sql insert into c4 values(now+2s, 2)
sql insert into c4 values(now+3s, 3)
sql insert into c5 values(now+1s, 1)
sql insert into c5 values(now+2s, 2)
sql insert into c5 values(now+3s, 3)

print =============== query data
sql select * from c1
if $rows != 3 then 
  return -1
endi

print $data00 $data01
print $data10 $data11
print $data20 $data11

if $data01 != 1 then 
  return -1
endi

if $data11 != 2 then 
  return -1
endi

if $data21 != 3 then 
  return -1
endi

sql select * from c2
if $rows != 3 then 
  return -1
endi

sql select * from c3
if $rows != 3 then 
  return -1
endi

sql select * from c4
if $rows != 3 then 
  return -1
endi

sql select * from c5
if $rows != 3 then 
  return -1
endi

X
Xiaoyu Wang 已提交
180
sql select ts, i from st
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
if $rows != 15 then 
  return -1
endi

print =============== drop dnode
sql drop dnode 2;
sql show dnodes;
if $rows != 1 then 
  return -1
endi

if $data00 != 1 then 
  return -1
endi

system sh/exec.sh -n dnode1 -s stop -x SIGINT
D
dapan1121 已提交
197
system sh/exec.sh -n dnode2 -s stop -x SIGINT