ignoreExpiredData.sim 3.6 KB
Newer Older
5
54liuyao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2

system sh/exec.sh -n dnode1 -s start 
sleep 50
sql connect

sql create dnode $hostname2 port 7200

system sh/exec.sh -n dnode2 -s start

print ===== step1
$x = 0
step1:
	$x = $x + 1
	sleep 1000
	if $x == 10 then
	  print ====> dnode not ready!
		return -1
	endi
X
Xiaoyu Wang 已提交
22
sql select * from information_schema.ins_dnodes
5
54liuyao 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
if $rows != 2 then
  return -1
endi
if $data(1)[4] != ready then
  goto step1
endi
if $data(2)[4] != ready then
  goto step1
endi

print ===== step2

print =============== create database
sql create database test vgroups 1
X
Xiaoyu Wang 已提交
39
sql select * from information_schema.ins_databases
5
54liuyao 已提交
40 41 42 43 44 45 46 47
if $rows != 3 then
  return -1
endi

print $data00 $data01 $data02

sql use test
sql create table t1(ts timestamp, a int, b int , c int, d double);
X
Xiaoyu Wang 已提交
48 49 50
sql create stream streams1 trigger at_once IGNORE EXPIRED 1 into streamt1 as select  _wstart, count(*) c1, sum(a) c3 from t1 interval(10s);
sql create stream streams2 trigger at_once IGNORE EXPIRED 1 into streamt2 as select  _wstart, count(*) c1, sum(a) c3 from t1 session(ts,10s);
sql create stream streams3 trigger at_once IGNORE EXPIRED 1 into streamt3 as select  _wstart, count(*) c1, sum(a) c3 from t1 state_window(a);
5
54liuyao 已提交
51 52 53 54
sql insert into t1 values(1648791213000,1,2,3,1.0);
sql insert into t1 values(1648791223001,1,2,3,1.1);
sql insert into t1 values(1648791233002,2,2,3,2.1);
sql insert into t1 values(1648791243003,2,2,3,3.1);
5
54liuyao 已提交
55
sleep 300
5
54liuyao 已提交
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
sql insert into t1 values(1648791200000,4,2,3,4.1);

$loop_count = 0
loop1:
sleep 300
sql select * from streamt1;

$loop_count = $loop_count + 1
if $loop_count == 10 then
  return -1
endi

if $rows != 4 then
  print =====rows=$rows
  goto loop1
endi

$loop_count = 0
loop2:
sleep 300
sql select * from streamt2;

$loop_count = $loop_count + 1
if $loop_count == 10 then
  return -1
endi

if $rows != 4 then
  print =====rows=$rows
  goto loop2
endi

$loop_count = 0
loop3:
sleep 300
sql select * from streamt3;

$loop_count = $loop_count + 1
if $loop_count == 10 then
  return -1
endi

if $rows != 2 then
  print =====rows=$rows
  goto loop3
endi


print =============== create database
sql create database test1 vgroups 4
X
Xiaoyu Wang 已提交
106
sql select * from information_schema.ins_databases
5
54liuyao 已提交
107 108 109 110 111 112 113 114

print ======database=$rows

sql use test1

sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
sql create table ts1 using st tags(1,1,1);
sql create table ts2 using st tags(2,2,2);
X
Xiaoyu Wang 已提交
115 116
sql create stream stream_t1 trigger at_once IGNORE EXPIRED 1 into streamtST1 as select  _wstart, count(*) c1, count(a) c2 , sum(a) c3 ,  max(b)  c5, min(c) c6 from st interval(10s) ;
sql create stream stream_t2 trigger at_once IGNORE EXPIRED 1 into streamtST2 as select  _wstart, count(*) c1, count(a) c2 , sum(a) c3 ,  max(b)  c5, min(c) c6 from st session(ts, 10s) ;
5
54liuyao 已提交
117 118
sql insert into ts1 values(1648791211000,1,2,3);
sql insert into ts1 values(1648791222001,2,2,3);
5
54liuyao 已提交
119
sleep 300
5
54liuyao 已提交
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
sql insert into ts2 values(1648791211000,1,2,3);
sql insert into ts2 values(1648791222001,2,2,3);

$loop_count = 0
loop4:
sleep 300
sql select * from streamtST1;

$loop_count = $loop_count + 1
if $loop_count == 10 then
  return -1
endi

if $data01 != 1 then
  print =====data01=$data01
  goto loop4
endi

if $data02 != 1 then
  print =====data02=$data02
  goto loop4
endi

$loop_count = 0
loop5:
sleep 300
sql select * from streamtST2;

$loop_count = $loop_count + 1
if $loop_count == 10 then
  return -1
endi

if $data01 != 1 then
  print =====data01=$data01
  goto loop5
endi

if $data02 != 1 then
  print =====data02=$data02
  goto loop5
endi

system sh/stop_dnodes.sh