basic3.sim 2.0 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 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 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 24
  return -1
endi
if $data(1)[4] != ready then
  goto step1
endi

S
Shengliang Guan 已提交
25 26
print =============== step2: create db
sql create database d1 vgroups 2 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
print =============== step3: create show stable
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
S
Shengliang Guan 已提交
33 34 35 36 37
sql show stables
if $rows != 1 then 
  return -1
endi

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

S
Shengliang Guan 已提交
47 48 49 50 51 52
print =============== step5: insert data
sql insert into ct1 values(now+0d, 10, 2.0, 3.0)
sql insert into ct1 values(now+1d, 11, 2.1, 3.1)(now+2d, -12, -2.2, -3.2)(now+3d, -13, -2.3, -3.3)
sql insert into ct2 values(now+0d, 10, 2.0, 3.0)
sql insert into ct2 values(now+1d, 11, 2.1, 3.1)(now+2d, -12, -2.2, -3.2)(now+3d, -13, -2.3, -3.3)
sql insert into ct3 values('2022-01-01 00:00:00.000', 10, 2.0, 3.0)
S
Shengliang Guan 已提交
53

S
Shengliang Guan 已提交
54 55 56 57 58
print =============== step6: query data
sql select * from ct1 where ts < now -1d and ts > now +1d 
sql select * from stb where ts < now -1d and ts > now +1d 
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 已提交
59

S
Shengliang Guan 已提交
60
_OVER:
S
Shengliang Guan 已提交
61
system sh/exec.sh -n dnode1 -s stop -x SIGINT
S
Shengliang Guan 已提交
62
print =============== check
S
Shengliang Guan 已提交
63 64
$null=

S
Shengliang Guan 已提交
65
system_content sh/checkValgrind.sh -n dnode1 
S
Shengliang Guan 已提交
66
print cmd return result ----> [ $system_content ]
S
Shengliang Guan 已提交
67 68
if $system_content > 1 then
  return -1
S
Shengliang Guan 已提交
69 70 71
endi 

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