basic1.sim 4.5 KB
Newer Older
S
Shengliang Guan 已提交
1 2
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
S
Shengliang Guan 已提交
3
system sh/cfg.sh -n dnode1 -c debugflag -v 131
S
Shengliang Guan 已提交
4
system sh/exec.sh -n dnode1 -s start
S
Shengliang Guan 已提交
5 6
sql connect

S
Shengliang Guan 已提交
7 8 9 10 11 12
print =============== step1: create drop show dnodes
$x = 0
step1:
	$x = $x + 1
	sleep 1000
	if $x == 10 then
S
Shengliang Guan 已提交
13
	  print ---> dnode not ready!
S
Shengliang Guan 已提交
14 15 16
		return -1
	endi
sql show dnodes
S
Shengliang Guan 已提交
17
print ---> $data00 $data01 $data02 $data03 $data04 $data05
S
Shengliang Guan 已提交
18 19 20
if $rows != 1 then
  return -1
endi
S
Shengliang Guan 已提交
21 22 23
if $data(1)[4] != ready then
  goto step1
endi
S
Shengliang Guan 已提交
24

S
Shengliang Guan 已提交
25
print =============== step2: create db
S
Shengliang Guan 已提交
26
sql create database d1 vgroups 3 buffer 3
S
Shengliang Guan 已提交
27
sql show databases
S
Shengliang Guan 已提交
28 29
sql use d1
sql show vgroups
S
Shengliang Guan 已提交
30

S
Shengliang Guan 已提交
31 32 33 34 35
print =============== step3: create show stable, include all type
sql create table if not exists stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(16), c9 nchar(16), c10 timestamp, c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned) tags (t1 bool, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 float, t7 double, t8 binary(16), t9 nchar(16), t10 timestamp, t11 tinyint unsigned, t12 smallint unsigned, t13 int unsigned, t14 bigint unsigned)
sql create stable if not exists stb_1 (ts timestamp, c1 int) tags (j int)
sql create table stb_2 (ts timestamp, c1 int) tags (t1 int)
sql create stable stb_3 (ts timestamp, c1 int) tags (t1 int)
S
Shengliang Guan 已提交
36
sql show stables
S
Shengliang Guan 已提交
37
if $rows != 4 then 
S
Shengliang Guan 已提交
38 39 40
  return -1
endi

S
Shengliang Guan 已提交
41 42 43
print =============== step4: ccreate child table
sql create table c1 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
sql create table c2 using stb tags(false, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 2', 'child tbl 2', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
S
Shengliang Guan 已提交
44
sql show tables
S
Shengliang Guan 已提交
45
if $rows != 2 then 
S
Shengliang Guan 已提交
46 47 48
  return -1
endi

S
Shengliang Guan 已提交
49
print =============== step5: insert data
S
Shengliang Guan 已提交
50 51 52 53 54 55 56 57 58 59 60 61
sql insert into c1 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
sql insert into c2 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
sql insert into c2 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)

print =============== step6: alter insert
sql insert into c3 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) 
sql insert into c3 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) 

print ===============  restart
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start -v
S
Shengliang Guan 已提交
62

S
Shengliang Guan 已提交
63 64
print =============== stepa: query data
sql select * from c1
S
Shengliang Guan 已提交
65 66 67 68 69 70 71 72
sql select * from stb
sql select * from stb_1
sql select ts, c1, c2, c3 from c1
sql select ts, c1, c2, c3 from stb
sql select ts, c1 from stb_2
sql select ts, c1, t1 from c1
sql select ts, c1, t1 from stb
sql select ts, c1, t1 from stb_2
S
Shengliang Guan 已提交
73

S
Shengliang Guan 已提交
74
print =============== stepb: count
S
Shengliang Guan 已提交
75 76 77 78
sql select count(*) from c1;
sql select count(*) from stb;
sql select count(ts), count(c1), count(c2), count(c3) from c1
sql select count(ts), count(c1), count(c2), count(c3) from stb
S
Shengliang Guan 已提交
79

S
Shengliang Guan 已提交
80
print =============== stepc: func
S
Shengliang Guan 已提交
81 82 83 84
sql select first(ts), first(c1), first(c2), first(c3) from c1
sql select min(c2), min(c3), min(c4) from c1
sql select max(c2), max(c3), max(c4) from c1
sql select sum(c2), sum(c3), sum(c4) from c1
S
Shengliang Guan 已提交
85

S
Shengliang Guan 已提交
86
_OVER:
S
Shengliang Guan 已提交
87
system sh/exec.sh -n dnode1 -s stop -x SIGINT
S
Shengliang Guan 已提交
88
print =============== check
S
Shengliang Guan 已提交
89
$null=
S
Shengliang Guan 已提交
90

S
Shengliang Guan 已提交
91
system_content sh/checkValgrind.sh -n dnode1 
S
Shengliang Guan 已提交
92
print cmd return result ----> [ $system_content ]
S
Shengliang Guan 已提交
93 94
if $system_content > 1 then
  return -1
S
Shengliang Guan 已提交
95 96 97
endi 

if $system_content == $null then
S
Shengliang Guan 已提交
98
  return -1
S
Shengliang Guan 已提交
99
endi