basic1.sim 2.3 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 -v
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 1 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
print =============== step3: create show stable
S
Shengliang Guan 已提交
32 33 34 35 36 37
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 已提交
38
print =============== step4: create show table
S
Shengliang Guan 已提交
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 46
  return -1
endi

S
Shengliang Guan 已提交
47
print =============== step5: insert data
S
Shengliang Guan 已提交
48 49
sql insert into ct1 values(now+0s, 10, 2.0, 3.0)
sql insert into ct1 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 已提交
50 51 52
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)
sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0)
S
Shengliang Guan 已提交
53

S
Shengliang Guan 已提交
54
print =============== step6: query data
S
Shengliang Guan 已提交
55
sql select * from ct1
S
Shengliang Guan 已提交
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
sql select * from stb
sql select c1, c2, c3 from ct1
sql select ts, c1, c2, c3 from stb

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

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
S
Shengliang Guan 已提交
71

S
Shengliang Guan 已提交
72
_OVER:
S
Shengliang Guan 已提交
73
system sh/exec.sh -n dnode1 -s stop -x SIGINT
S
Shengliang Guan 已提交
74
print =============== check
S
Shengliang Guan 已提交
75
$null=
S
Shengliang Guan 已提交
76

S
Shengliang Guan 已提交
77
system_content sh/checkValgrind.sh -n dnode1 
S
Shengliang Guan 已提交
78
print cmd return result ----> [ $system_content ]
S
Shengliang Guan 已提交
79 80
if $system_content > 1 then
  return -1
S
Shengliang Guan 已提交
81 82 83
endi 

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