metrics.sim 2.2 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
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
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
23
if $rows != 1 then
24 25 26
  return -1
endi

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

D
dapan1121 已提交
35 36 37
#print =============== step3
#sql create table $mt (ts timestamp, speed int) TAGS(sp int)
#TODO OPEN THIS WHEN STABLE DELETE WORKS
38 39

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

print =============== step4
$i = 0
$tb = $tbPrefix . $i
sql create table $tb using $mt tags(1)
59
$i = 1
60 61
$tb = $tbPrefix . $i
sql create table $tb using $mt tags(2)
62
$i = 2
63 64 65 66
$tb = $tbPrefix . $i
sql create table $tb using $mt tags(3)

sql show tables
67
if $rows != 3 then
68 69
  return -1
endi
70 71 72
# if $data03 != $mt then
#   return -1
# endi
73 74

sql show stables
75
if $rows != 1 then
76 77
  return -1
endi
78
if $data00 != $mt then
79 80
  return -1
endi
81 82 83
# if $data04 != 3 then
#   return -1
# endi
84 85 86 87

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

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

98 99 100 101 102
# sql select * from $mt
# print select * from $mt ==> $rows $data00
# if $rows != 3 then
#   return -1
# endi
103 104

print =============== step7
105 106 107 108 109
# sql select * from $mt where sp = 1
# print select * from $mt where sp = 1 ==> $rows $data00
# if $rows != 1 then
#   return -1
# endi
110 111 112 113 114 115

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

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

116 117 118 119
#sql show tables
#if $rows != 0 then
#  return -1
#endi
120 121

sql show stables
122
if $rows != 0 then
123 124 125 126 127
  return -1
endi

sql drop database $db
sql show databases
128
if $rows != 2 then
129 130 131
  return -1
endi

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