metrics.sim 2.4 KB
Newer Older
1 2 3 4 5 6
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/exec.sh -n dnode1 -s start

7
sleep 1000
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
sql connect

$dbPrefix = m_me_db
$tbPrefix = m_me_tb
$mtPrefix = m_me_mt

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

sql drop database $db -x step1
step1:
sql create database $db
sql use $db

sql create table $mt (ts timestamp, speed int) TAGS(sp int)
sql show stables
27
if $rows != 1 then
28 29 30
  return -1
endi

D
dapan1121 已提交
31 32 33 34 35 36 37
#TODO OPEN THIS WHEN STABLE DELETE WORKS
#print =============== step2
#sql drop table $mt
#sql show stables
#if $rows != 0 then
#  return -1
#endi
38

D
dapan1121 已提交
39 40 41
#print =============== step3
#sql create table $mt (ts timestamp, speed int) TAGS(sp int)
#TODO OPEN THIS WHEN STABLE DELETE WORKS
42 43

sql show stables
44
if $rows != 1 then
45 46
  return -1
endi
47
if $data00 != $mt then
48 49
  return -1
endi
50
if $data04 != 1 then
51 52
  return -1
endi
53 54 55 56 57
# TODO : select * from stable
# sql select * from $mt
# if $rows != 0 then
#   return -1
# endi
58 59 60 61 62

print =============== step4
$i = 0
$tb = $tbPrefix . $i
sql create table $tb using $mt tags(1)
63
$i = 1
64 65
$tb = $tbPrefix . $i
sql create table $tb using $mt tags(2)
66
$i = 2
67 68 69 70
$tb = $tbPrefix . $i
sql create table $tb using $mt tags(3)

sql show tables
71
if $rows != 3 then
72 73
  return -1
endi
74 75 76
# if $data03 != $mt then
#   return -1
# endi
77 78

sql show stables
79
if $rows != 1 then
80 81
  return -1
endi
82
if $data00 != $mt then
83 84
  return -1
endi
85 86 87
# if $data04 != 3 then
#   return -1
# endi
88 89 90 91

print =============== step5
$i = 0
$tb = $tbPrefix . $i
92
sql insert into $tb values (now + 1m , 1 )
93 94
$i = 1
$tb = $tbPrefix . $i
95
sql insert into $tb values (now + 1m , 1 )
96 97
$i = 2
$tb = $tbPrefix . $i
98
sql insert into $tb values (now + 1m , 1 )
99

100 101
print sleep 2000
sleep 2000
102 103 104

print =============== step6

105 106 107 108 109
# sql select * from $mt
# print select * from $mt ==> $rows $data00
# if $rows != 3 then
#   return -1
# endi
110 111

print =============== step7
112 113 114 115 116
# sql select * from $mt where sp = 1
# print select * from $mt where sp = 1 ==> $rows $data00
# if $rows != 1 then
#   return -1
# endi
117 118 119 120 121 122

print =============== step8
sql drop table $mt

print =============== step9

123 124 125 126
#sql show tables
#if $rows != 0 then
#  return -1
#endi
127 128

sql show stables
129
if $rows != 0 then
130 131 132 133 134
  return -1
endi

sql drop database $db
sql show databases
135
if $rows != 2 then
136 137 138
  return -1
endi

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