ignoreExpiredData.sim 3.7 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 1000
5
54liuyao 已提交
56 57 58 59
sql insert into t1 values(1648791200000,4,2,3,4.1);

$loop_count = 0
loop1:
5
54liuyao 已提交
60
sleep 1000
5
54liuyao 已提交
61 62 63 64 65 66 67 68 69 70 71 72 73 74
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:
5
54liuyao 已提交
75
sleep 1000
5
54liuyao 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88 89
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:
5
54liuyao 已提交
90
sleep 1000
5
54liuyao 已提交
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
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
sql insert into ts1 values(1648791211000,1,2,3);
5
54liuyao 已提交
118
sleep 1000
5
54liuyao 已提交
119
sql insert into ts1 values(1648791222001,2,2,3);
5
54liuyao 已提交
120
sleep 1000
5
54liuyao 已提交
121
sql insert into ts2 values(1648791211000,1,2,3);
5
54liuyao 已提交
122
sleep 1000
5
54liuyao 已提交
123 124 125 126
sql insert into ts2 values(1648791222001,2,2,3);

$loop_count = 0
loop4:
5
54liuyao 已提交
127
sleep 1000
5
54liuyao 已提交
128 129 130 131 132 133 134
sql select * from streamtST1;

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

L
liuyao 已提交
135
if $data01 != 2 then
5
54liuyao 已提交
136 137 138 139
  print =====data01=$data01
  goto loop4
endi

L
liuyao 已提交
140
if $data02 != 2 then
5
54liuyao 已提交
141 142 143 144 145 146
  print =====data02=$data02
  goto loop4
endi

$loop_count = 0
loop5:
5
54liuyao 已提交
147
sleep 1000
5
54liuyao 已提交
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
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

165
system sh/stop_dnodes.sh