stableOp.sim 1.6 KB
Newer Older
D
dapan1121 已提交
1 2 3
system sh/stop_dnodes.sh

system sh/deploy.sh -n dnode1 -i 1
4
system sh/cfg.sh -n dnode1 -c walLevel -v 1
D
dapan1121 已提交
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
system sh/exec.sh -n dnode1 -s start

sleep 100
sql connect
print ======================== dnode1 start

$dbPrefix = fi_in_db
$tbPrefix = fi_in_tb
$stbPrefix = fi_in_stb
$mtPrefix = fi_in_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200

print create_tb test
print =============== set up
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
$stb = $stbPrefix . $i

sql create database $db
sql use $db

# case1: create stable test
print =========== stableOp.sim case1: create/alter/drop stable test
sql CREATE STABLE $stb (TS TIMESTAMP, COL1 INT) TAGS (ID INT);
sql show stables

if $rows != 1 then
  return -1
endi
print data00 = $data00
if $data00 != $stb then 
  return -1
endi

sql_error CREATE STABLE $tb using $stb tags (1);

sql create table $tb using $stb tags (2);
sql show tables

if $rows != 1 then
  return -1
endi

sql alter stable $stb add column COL2 DOUBLE;

sql insert into $tb values (now, 1, 2.0);

sql select * from $tb ;

if $rows != 1 then
  return -1
endi

sql alter stable $stb drop column COL2;

sql_error insert into $tb values (now, 1, 2.0);

sql alter stable $stb add tag tag2 int;

sql alter stable $stb change tag tag2 tag3;

sql_error drop stable $tb

sql drop table $tb ;

sql show tables

if $rows != 0 then
  return -1
endi

sql DROP STABLE $stb
sql show stables

if $rows != 0 then
  return -1
endi

print create/alter/drop stable test passed

sql drop database $db
sql show databases
if $rows != 0 then 
  return -1
endi

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