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

S
Shengliang Guan 已提交
25 26
print =============== step2: create db
sql create database d1 vgroups 3 buffer 3
X
Xiaoyu Wang 已提交
27
sql select * from information_schema.ins_databases
S
Shengliang Guan 已提交
28 29 30 31 32 33 34 35
sql use d1
sql show vgroups

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
  return -1
endi
S
Shengliang Guan 已提交
40
sql show stables like 'stb'
S
Shengliang Guan 已提交
41

S
Shengliang Guan 已提交
42 43 44
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 已提交
45 46 47 48 49
sql show tables
if $rows != 2 then 
  return -1
endi

S
Shengliang Guan 已提交
50 51 52 53 54 55 56 57 58 59
print =============== step5: insert data
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) 

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

S
Shengliang Guan 已提交
64 65
print =============== stepa: query data
sql select * from c1
S
Shengliang Guan 已提交
66 67 68 69 70 71 72 73
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 已提交
74 75

print =============== stepb: count
S
Shengliang Guan 已提交
76 77 78 79
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 已提交
80 81

print =============== stepc: func
S
Shengliang Guan 已提交
82 83 84 85
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 已提交
86 87

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

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

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