181 lines
4.2 KiB
Plaintext
181 lines
4.2 KiB
Plaintext
system sh/stop_dnodes.sh
|
|
system sh/deploy.sh -n dnode1 -i 1
|
|
system sh/exec.sh -n dnode1 -s start
|
|
sleep 50
|
|
sql connect
|
|
|
|
print ===================================== force window close with sliding test
|
|
print ============ create db
|
|
sql create database test1 vgroups 2 precision 'us';
|
|
|
|
sql use test1
|
|
sql create stable st1(ts timestamp, a int) tags(t int);
|
|
sql create table tu11 using st1 tags(1);
|
|
|
|
sql_error create stream stream11 trigger force_window_close into str_dst1 as select _wstart, count(*) from st1 partition by tbname interval(5s) sliding(6s);
|
|
sql_error create stream stream11 trigger force_window_close into str_dst1 as select _wstart, count(*) from st1 partition by tbname interval(5s) sliding(9a);
|
|
sql_error create stream stream11 trigger force_window_close into str_dst1 as select _wstart, count(*) from st1 partition by tbname interval(5s) sliding(1.1s);
|
|
sql create stream stream11 trigger force_window_close into str_dst1 as select _wstart, _wend, count(*) from st1 partition by tbname interval(5s) sliding(1s);
|
|
run tsim/stream/checkTaskStatus.sim
|
|
|
|
sql insert into tu11 values(now, 1);
|
|
sleep 5500
|
|
|
|
$loop_count = 0
|
|
|
|
loop01:
|
|
sleep 500
|
|
$loop_count = $loop_count + 1
|
|
if $loop_count == 20 then
|
|
goto end_loop0
|
|
endi
|
|
|
|
print insert data
|
|
sql insert into tu11 values(now, 1);
|
|
goto loop01
|
|
|
|
end_loop0:
|
|
|
|
sleep 10000
|
|
|
|
sql select sum(`count(*)`) from (select * from str_dst1)
|
|
|
|
if $data00 != 100 then
|
|
print expect 100, actual: $data00
|
|
return -1
|
|
endi
|
|
|
|
print ========================================== create database
|
|
sql create database test vgroups 2;
|
|
sql select * from information_schema.ins_databases
|
|
if $rows != 4 then
|
|
return -1
|
|
endi
|
|
|
|
print $data00 $data01 $data02
|
|
|
|
sql use test
|
|
sql create stable st(ts timestamp, a int) tags(t int);
|
|
sql create table tu1 using st tags(1);
|
|
|
|
sql create stream stream1 trigger force_window_close into str_dst as select _wstart, count(*) from st partition by tbname interval(5s);
|
|
run tsim/stream/checkTaskStatus.sim
|
|
|
|
sql insert into tu1 values(now, 1);
|
|
sleep 5500
|
|
|
|
sql pause stream stream1
|
|
|
|
$loop_count = 0
|
|
|
|
loop1:
|
|
sleep 500
|
|
$loop_count = $loop_count + 1
|
|
if $loop_count == 20 then
|
|
goto end_loop1
|
|
endi
|
|
|
|
sql insert into tu1 values(now, 1);
|
|
goto loop1
|
|
|
|
end_loop1:
|
|
sql resume stream stream1
|
|
sleep 5000
|
|
|
|
sql select sum(`count(*)`) from (select * from str_dst)
|
|
|
|
if $data00 != 20 then
|
|
print expect 20, actual: $data00
|
|
return -1
|
|
endi
|
|
|
|
sql drop database test
|
|
|
|
print ===================================== micro precision db test
|
|
print ============ create db
|
|
sql create database test vgroups 2 precision 'us';
|
|
|
|
sql use test
|
|
sql create stable st(ts timestamp, a int) tags(t int);
|
|
sql create table tu1 using st tags(1);
|
|
|
|
sql create stream stream1 trigger force_window_close into str_dst as select _wstart, count(*) from st partition by tbname interval(5s);
|
|
run tsim/stream/checkTaskStatus.sim
|
|
|
|
sql insert into tu1 values(now, 1);
|
|
sleep 5500
|
|
|
|
sql pause stream stream1
|
|
|
|
$loop_count = 0
|
|
|
|
loop0:
|
|
sleep 500
|
|
$loop_count = $loop_count + 1
|
|
if $loop_count == 20 then
|
|
goto end_loop
|
|
endi
|
|
|
|
sql insert into tu1 values(now, 1);
|
|
goto loop0
|
|
|
|
end_loop:
|
|
|
|
sql resume stream stream1
|
|
sleep 5000
|
|
|
|
sql select sum(`count(*)`) from (select * from str_dst)
|
|
|
|
if $data00 != 20 then
|
|
print expect 20, actual: $data00
|
|
return -1
|
|
endi
|
|
|
|
sql drop stream stream1
|
|
sql drop table str_dst
|
|
|
|
print ============================= too long watermark test
|
|
sql drop table tu1;
|
|
sql create table tu1 using st tags(1);
|
|
sql create stream stream2 trigger force_window_close watermark 30s into str_dst as select _wstart, count(*), now() from st partition by tbname interval(5s);
|
|
run tsim/stream/checkTaskStatus.sim
|
|
|
|
$loop_count = 0
|
|
|
|
loop2:
|
|
sleep 500
|
|
$loop_count = $loop_count + 1
|
|
if $loop_count == 20 then
|
|
goto end_loop3
|
|
endi
|
|
|
|
sql insert into tu1 values(now, 1);
|
|
goto loop2
|
|
|
|
end_loop3:
|
|
|
|
sql select count(*) from str_dst
|
|
print =================rows: $data00
|
|
|
|
if $data00 != 0 then
|
|
print expect 0, actual $data00
|
|
return -1
|
|
endi
|
|
|
|
sleep 35000
|
|
|
|
sql select sum(`count(*)`) from (select * from str_dst)
|
|
if $data00 != 19 then
|
|
print expect 19, actual: $data00
|
|
return -1
|
|
endi
|
|
|
|
sql select round(timediff(`now()`, `_wstart`)/1000000) from str_dst;
|
|
if $data00 != 35.000000000 then
|
|
print expect 35.000000000 , actual $data00
|
|
return -1
|
|
endi
|
|
|
|
|
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|