checkError2.sim 3.6 KB
Newer Older
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 5 6
system sh/exec.sh -n dnode1 -s start -v
sql connect

S
Shengliang Guan 已提交
7
print =============== step1: create drop show dnodes
S
Shengliang Guan 已提交
8 9 10 11 12
$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 2 buffer 3
S
Shengliang Guan 已提交
27 28 29 30 31 32 33 34 35 36
sql show databases
sql use d1
sql show vgroups

print =============== step3: create show stable
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
sql show stables
if $rows != 1 then 
  return -1
endi
S
Shengliang Guan 已提交
37

S
Shengliang Guan 已提交
38
print =============== step4: create show table
39
sql create table ct1 using stb tags(1000)
S
Shengliang Guan 已提交
40 41
sql create table ct2 using stb tags(2000)
sql create table ct3 using stb tags(3000)
S
Shengliang Guan 已提交
42
sql show tables
S
Shengliang Guan 已提交
43
if $rows != 3 then 
S
Shengliang Guan 已提交
44 45
  return -1
endi
46

S
Shengliang Guan 已提交
47
print =============== step5: insert data (null / update)
48
sql insert into ct1 values(now+0s, 10, 2.0, 3.0)
S
Shengliang Guan 已提交
49
sql insert into ct1 values(now+1s, 11, 2.1, NULL)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3)
S
Shengliang Guan 已提交
50 51
sql insert into ct2 values(now+0s, 10, 2.0, 3.0)
sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3)
S
Shengliang Guan 已提交
52 53 54
sql insert into ct3 values('2021-01-01 00:00:00.000', NULL, NULL, 3.0)
sql insert into ct3 values('2022-03-02 16:59:00.010', 3  , 4, 5), ('2022-03-02 16:59:00.010', 33 , 4, 5), ('2022-04-01 16:59:00.011', 4,  4, 5), ('2022-04-01 16:59:00.011', 6,  4, 5), ('2022-03-06 16:59:00.013', 8,  4, 5);
sql insert into ct3 values('2022-03-02 16:59:00.010', 103, 1, 2), ('2022-03-02 16:59:00.010', 303, 3, 4), ('2022-04-01 16:59:00.011', 40, 5, 6), ('2022-04-01 16:59:00.011', 60, 4, 5), ('2022-03-06 16:59:00.013', 80, 4, 5);
55

S
Shengliang Guan 已提交
56
print =============== step6: query data
S
Shengliang Guan 已提交
57
sql select * from ct1
S
Shengliang Guan 已提交
58
sql select * from stb
S
Shengliang Guan 已提交
59 60
sql select c1, c2, c3 from ct1
sql select ts, c1, c2, c3 from stb
S
Shengliang Guan 已提交
61 62
sql select * from ct1 where ts < now -1d and ts > now +1d 
sql select * from stb where ts < now -1d and ts > now +1d 
S
Shengliang Guan 已提交
63 64
sql select * from ct1 where ts < now -1d and ts > now +1d order by ts desc 
sql select * from stb where ts < now -1d and ts > now +1d order by ts desc 
S
Shengliang Guan 已提交
65 66 67 68 69 70

print =============== step7: count
sql select count(*) from ct1;
sql select count(*) from stb;
sql select count(ts), count(c1), count(c2), count(c3) from ct1
sql select count(ts), count(c1), count(c2), count(c3) from stb
S
Shengliang Guan 已提交
71 72
sql select count(*) from ct1 where ts < now -1d and ts > now +1d 
sql select count(*) from stb where ts < now -1d and ts > now +1d
S
Shengliang Guan 已提交
73 74 75 76 77 78

print =============== step8: func
sql select first(ts), first(c1), first(c2), first(c3) from ct1
sql select min(c1), min(c2), min(c3) from ct1
sql select max(c1), max(c2), max(c3) from ct1
sql select sum(c1), sum(c2), sum(c3) from ct1
79

S
Shengliang Guan 已提交
80
print =============== step9: insert select
S
Shengliang Guan 已提交
81 82 83 84
sql create table ct4 using stb tags(4000);
sql insert into ct4 select * from ct1;
sql select * from ct4;
sql insert into ct4 select ts,c1,c2,c3 from stb;
S
Shengliang Guan 已提交
85

S
Shengliang Guan 已提交
86 87 88
sql create table tb1 (ts timestamp, c1 int, c2 float, c3 double);
sql insert into tb1 (ts, c1, c2, c3) select * from ct1;
sql select * from tb1;
S
Shengliang Guan 已提交
89

S
Shengliang Guan 已提交
90 91 92
sql create table tb2 (ts timestamp, f1 binary(10), c1 int, c2 double);
sql insert into tb2 (c2, c1, ts) select c2+1, c1, ts+3 from ct2;
sql select * from tb2;
S
Shengliang Guan 已提交
93

S
Shengliang Guan 已提交
94
_OVER:
95
system sh/exec.sh -n dnode1 -s stop -x SIGINT
S
Shengliang Guan 已提交
96
print =============== check
S
Shengliang Guan 已提交
97
$null=
S
Shengliang Guan 已提交
98

S
Shengliang Guan 已提交
99
system_content sh/checkValgrind.sh -n dnode1 
S
Shengliang Guan 已提交
100
print cmd return result ----> [ $system_content ]
S
Shengliang Guan 已提交
101
if $system_content > 0 then
S
Shengliang Guan 已提交
102
  return -1
103
endi 
P
plum-lihui 已提交
104 105

if $system_content == $null then
S
Shengliang Guan 已提交
106
  return -1
P
plum-lihui 已提交
107
endi