vnode3.sim 3.4 KB
Newer Older
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
system sh/stop_dnodes.sh

system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start

sleep 2000
sql connect

print ======================== dnode1 start

$dbPrefix = v3_db
$tbPrefix = v3_tb
$mtPrefix = v3_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200

print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i

sql create database $db
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)

$i = 0
while $i < $tbNum
  $tb = $tbPrefix . $i
  sql create table $tb using $mt tags( $i )
34

35 36 37
  $x = 0
  while $x < $rowNum
    $val = $x * 60000
38 39
    $ms = 1519833600000 + $val
    sql insert into $tb values ($ms , $x )
40
    $x = $x + 1
41 42
  endw

43
  $i = $i + 1
44
endw
45 46 47

sql show vgroups
print vgroups ==> $rows
48
if $rows != 2 then
49 50 51 52 53 54 55 56 57 58
  return -1
endi


print =============== step2
$i = 1
$tb = $tbPrefix . $i

sql select count(*) from $tb
print ===> $data00
59
if $data00 != $rowNum then
60 61 62 63 64
  return -1
endi

sql select count(tbcol) from $tb
print ===> $data00
65
if $data00 != $rowNum then
66 67 68 69
  return -1
endi

print =============== step3
70 71 72 73 74 75
# TODO : where condition
# sql select count(tbcol) from $tb where ts <= 1519833840000
# print ===> $data00
# if $data00 != 5 then
#   return -1
# endi
76 77 78 79

print =============== step4
sql select count(tbcol) as b from $tb
print ===> $data00
80
if $data00 != $rowNum then
81 82 83 84 85
  return -1
endi

print =============== step5
sql select count(tbcol) as b from $tb interval(1m)
86 87
print ===> $data00
if $data00 != 1 then
88 89 90 91
  return -1
endi

sql select count(tbcol) as b from $tb interval(1d)
92 93
print ===> $data00
if $data00 != $rowNum then
94 95 96 97
  return -1
endi

print =============== step6
98 99 100 101 102 103 104 105
# sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m)
# print ===> $data00
# if $data00 != 1 then
#   return -1
# endi
# if $rows != 5 then
#   return -1
#endi
106 107

print =============== step7
108 109 110 111 112 113 114 115 116 117 118 119
# TODO : count(*) err
# sql select count(*) from $mt
# print ===> $data00
# if $data00 != $totalNum then
#   return -1
# endi
#
# sql select count(tbcol) from $mt
# print ===> $data00
# if $data00 != $totalNum then
#   return -1
# endi
120 121

print =============== step8
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
# sql select count(tbcol) as c from $mt where ts <= 1519833840000
# print ===> $data00
# if $data00 != 50 then
#   return -1
# endi

# sql select count(tbcol) as c from $mt where tgcol < 5
# print ===> $data00
# if $data00 != 100 then
#   return -1
# endi

# sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= 1519833840000
# print ===> $data00
# if $data00 != 25 then
#   return -1
# endi
139 140

print =============== step9
141 142 143 144 145 146 147 148 149 150 151
# sql select count(tbcol) as b from $mt interval(1m)
# print ===> $data00
# if $data00 != 10 then
#   return -1
# endi
#
# sql select count(tbcol) as b from $mt interval(1d)
# print ===> $data00
# if $data00 != 200 then
#   return -1
# endi
152 153

print =============== step10
154 155 156 157 158 159 160 161 162
# sql select count(tbcol) as b from $mt group by tgcol
# print ===> $data00
# if $data00 != $rowNum then
#   return -1
# endi
#
# if $rows != $tbNum then
#   return -1
# endi
163 164

print =============== step11
165 166 167 168 169 170 171 172
# sql select count(tbcol) as b from $mt  where ts <= 1519833840000 interval(1m) group by tgcol
# print ===> $data01
# if $data01 != 1 then
#   return -1
# endi
# if $rows != 50 then
#   return -1
# endi
173 174 175 176

print =============== clear
sql drop database $db
sql show databases
177
if $rows != 2 then
178 179 180
  return -1
endi

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