320 lines
7.0 KiB
Plaintext
320 lines
7.0 KiB
Plaintext
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
|
|
sql select * from information_schema.ins_dnodes
|
|
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
|
|
sql select * from information_schema.ins_databases
|
|
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);
|
|
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);
|
|
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);
|
|
sleep 1000
|
|
sql insert into t1 values(1648791200000,4,2,3,4.1);
|
|
|
|
$loop_count = 0
|
|
loop1:
|
|
sleep 1000
|
|
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 1000
|
|
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 1000
|
|
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
|
|
sql select * from information_schema.ins_databases
|
|
|
|
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);
|
|
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) ;
|
|
sql insert into ts1 values(1648791211000,1,2,3);
|
|
sleep 1000
|
|
sql insert into ts1 values(1648791222001,2,2,3);
|
|
sleep 1000
|
|
sql insert into ts2 values(1648791222001,2,2,3);
|
|
sleep 1000
|
|
sql insert into ts2 values(1648791211000,1,2,3);
|
|
|
|
$loop_count = 0
|
|
loop4:
|
|
sleep 1000
|
|
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
|
|
|
|
if $data11 != 2 then
|
|
print =====data11=$data11
|
|
goto loop4
|
|
endi
|
|
|
|
if $data12 != 2 then
|
|
print =====data12=$data12
|
|
goto loop4
|
|
endi
|
|
|
|
$loop_count = 0
|
|
loop5:
|
|
sleep 1000
|
|
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
|
|
|
|
if $data11 != 2 then
|
|
print =====data11=$data11
|
|
goto loop4
|
|
endi
|
|
|
|
if $data12 != 2 then
|
|
print =====data12=$data12
|
|
goto loop4
|
|
endi
|
|
|
|
|
|
print =============== create database test2
|
|
sql create database test2 vgroups 4
|
|
sql select * from information_schema.ins_databases
|
|
|
|
print ======database=$rows
|
|
|
|
sql use test2;
|
|
|
|
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);
|
|
sql create table ts3 using st tags(3,3,3);
|
|
sql create table ts4 using st tags(4,4,4);
|
|
sql create stream streams_21 trigger at_once IGNORE EXPIRED 1 into streamt_21 as select _wstart, count(*) c1 from st interval(10s) ;
|
|
sleep 1000
|
|
|
|
sql insert into ts1 values(1648791211000,1,2,3);
|
|
sql insert into ts1 values(1648791211001,2,2,3);
|
|
sql insert into ts1 values(1648791211002,2,2,3);
|
|
sql insert into ts1 values(1648791211003,2,2,3);
|
|
sql insert into ts1 values(1648791211004,2,2,3);
|
|
|
|
sleep 1000
|
|
sql insert into ts2 values(1648791201000,1,2,3);
|
|
sql insert into ts2 values(1648791201001,2,2,3);
|
|
sql insert into ts2 values(1648791201002,2,2,3);
|
|
sql insert into ts2 values(1648791201003,2,2,3);
|
|
sql insert into ts2 values(1648791201004,2,2,3);
|
|
|
|
sleep 1000
|
|
sql insert into ts2 values(1648791101000,1,2,3);
|
|
sql insert into ts2 values(1648791101001,2,2,3);
|
|
sql insert into ts2 values(1648791101002,2,2,3);
|
|
sql insert into ts2 values(1648791101003,2,2,3);
|
|
sql insert into ts2 values(1648791101004,2,2,3);
|
|
|
|
|
|
$loop_count = 0
|
|
loop6:
|
|
sleep 1000
|
|
print 1 select * from streamt_21;
|
|
sql select * from streamt_21;
|
|
|
|
$loop_count = $loop_count + 1
|
|
if $loop_count == 10 then
|
|
return -1
|
|
endi
|
|
|
|
if $rows != 2 then
|
|
print =====rows=$rows
|
|
goto loop6
|
|
endi
|
|
|
|
if $data01 != 5 then
|
|
print =====data01=$data01
|
|
goto loop6
|
|
endi
|
|
|
|
if $data11 != 5 then
|
|
print =====data11=$data11
|
|
goto loop6
|
|
endi
|
|
|
|
sleep 1000
|
|
sql insert into ts3 values(1648791241000,1,2,3);
|
|
|
|
sleep 1000
|
|
sql insert into ts3 values(1648791231001,2,2,3);
|
|
sql insert into ts3 values(1648791231002,2,2,3);
|
|
sql insert into ts3 values(1648791231003,2,2,3);
|
|
sql insert into ts3 values(1648791231004,2,2,3);
|
|
|
|
$loop_count = 0
|
|
loop7:
|
|
sleep 1000
|
|
print 2 select * from streamt_21;
|
|
sql select * from streamt_21;
|
|
|
|
$loop_count = $loop_count + 1
|
|
if $loop_count == 10 then
|
|
return -1
|
|
endi
|
|
|
|
if $rows != 3 then
|
|
print =====rows=$rows
|
|
goto loop7
|
|
endi
|
|
|
|
if $data21 != 1 then
|
|
print =====data21=$data21
|
|
goto loop7
|
|
endi
|
|
|
|
sleep 1000
|
|
sql insert into ts4 values(1648791231001,2,2,3);
|
|
sql insert into ts4 values(1648791231002,2,2,3);
|
|
sql insert into ts4 values(1648791231003,2,2,3);
|
|
sql insert into ts4 values(1648791231004,2,2,3);
|
|
|
|
sleep 1000
|
|
sql insert into ts4 values(1648791211001,2,2,3);
|
|
sql insert into ts4 values(1648791211002,2,2,3);
|
|
sql insert into ts4 values(1648791211003,2,2,3);
|
|
sql insert into ts4 values(1648791211004,2,2,3);
|
|
|
|
$loop_count = 0
|
|
loop8:
|
|
sleep 1000
|
|
print 3 select * from streamt_21;
|
|
sql select * from streamt_21;
|
|
|
|
$loop_count = $loop_count + 1
|
|
if $loop_count == 10 then
|
|
return -1
|
|
endi
|
|
|
|
if $rows != 4 then
|
|
print =====rows=$rows
|
|
goto loop8
|
|
endi
|
|
|
|
if $data21 != 4 then
|
|
print =====data21=$data21
|
|
goto loop8
|
|
endi
|
|
|
|
if $data31 != 1 then
|
|
print =====data31=$data31
|
|
goto loop8
|
|
endi
|
|
|
|
print ============================end
|
|
|
|
system sh/stop_dnodes.sh
|