dnode3.sim 4.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
system sh/stop_dnodes.sh

system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode2 -c walLevel -v 1
system sh/cfg.sh -n dnode3 -c walLevel -v 1
system sh/cfg.sh -n dnode4 -c walLevel -v 1
11 12 13 14
# system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
# system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
# system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4
# system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4
15 16 17 18
system sh/exec.sh -n dnode1 -s start

sql connect

19 20
sql create dnode $hostname PORT 7200
sql create dnode $hostname PORT 7300
21 22 23 24
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start
$x = 0
25
createDnode:
26 27
	$x = $x + 1
	sleep 1000
28
	if $x == 20 then
29 30 31 32 33
	  return -1
	endi
sql show dnodes;
if $data4_2 == offline then
  goto createDnode
34
endi
35 36
if $data4_3 == offline then
  goto createDnode
37
endi
38 39
if $data4_4 == offline then
  goto createDnode
40
endi
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

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

$dbPrefix = r3v3_db
$tbPrefix = r3v3_tb
$mtPrefix = r3v3_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200

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

56
sql create database $db
57 58 59 60 61 62 63
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 )
64

65 66 67
  $x = 0
  while $x < $rowNum
    $val = $x * 60000
68 69
    $ms = 1519833600000 + $val
    sql insert into $tb values ($ms , $x )
70
    $x = $x + 1
71 72
  endw

73
  $i = $i + 1
74
endw
75 76 77

sql show vgroups
print vgroups ==> $rows
78
if $rows != 2 then
79 80 81 82 83 84 85 86 87 88 89
  return -1
endi

sleep 100

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

sql select count(*) from $tb
print ===> $data00
90
if $data00 != $rowNum then
91 92 93 94 95
  return -1
endi

sql select count(tbcol) from $tb
print ===> $data00
96
if $data00 != $rowNum then
97 98 99 100
  return -1
endi

print =============== step3
101 102 103 104 105 106
# TODO : where condition
# sql select count(tbcol) from $tb where ts <= 1519833840000
# print ===> $data00
# if $data00 != 5 then
#   return -1
# endi
107 108 109 110

print =============== step4
sql select count(tbcol) as b from $tb
print ===> $data00
111
if $data00 != $rowNum then
112 113 114 115 116
  return -1
endi

print =============== step5
sql select count(tbcol) as b from $tb interval(1m)
117 118
print ===> $data00
if $data00 != 1 then
119 120 121 122
  return -1
endi

sql select count(tbcol) as b from $tb interval(1d)
123 124
print ===> $data00
if $data00 != $rowNum then
125 126 127 128
  return -1
endi

print =============== step6
129 130 131 132 133 134 135 136
# 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
137 138

print =============== step7
139 140 141 142 143 144 145 146 147 148 149 150
# print select count(*) from $mt
# 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
151 152

print =============== step8
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
# 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
170 171

print =============== step9
172 173 174 175 176 177 178 179 180 181 182 183
# TODO : group by in stable
# 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
184 185

print =============== step10
186 187 188 189 190 191 192 193 194
# 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
195 196

print =============== step11
197 198 199 200 201 202 203 204
# sql select count(tbcol) as b from $mt  where ts <= 1519833840000 interval(1m) group by tgcol
# print ===> $data00
# if $data00 != 1 then
#   return -1
# endi
# if $rows != 50 then
#   return -1
# endi
205 206 207 208

print =============== clear
sql drop database $db
sql show databases
209
if $rows != 2 then
210 211 212
  return -1
endi

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