From 18ee0e03f456d15560fe836d48a69c14572d9d23 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 21 Jul 2022 11:39:27 +0800 Subject: [PATCH] test: add case to reproduce deadlock --- tests/script/tsim/parser/function.sim | 99 +++++++++------------------ 1 file changed, 31 insertions(+), 68 deletions(-) diff --git a/tests/script/tsim/parser/function.sim b/tests/script/tsim/parser/function.sim index 451947e82a..1b13a7f1fd 100644 --- a/tests/script/tsim/parser/function.sim +++ b/tests/script/tsim/parser/function.sim @@ -38,15 +38,12 @@ sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts< if $rows != 1 then return -1 endi - if $data00 != 2.063999891 then return -1 endi - if $data01 != 2.063999891 then return -1 endi - if $data02 != 1 then return -1 endi @@ -55,165 +52,135 @@ sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts< if $rows != 1 then return -1 endi - if $data00 != 2.089999914 then return -1 endi - if $data01 != 2.089999914 then return -1 endi - if $data02 != 2 then return -1 endi -sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:07:00' interval(1m) order by ts asc +sql select _wstart, twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:07:00' interval(1m) if $rows != 2 then return -1 endi - if $data00 != @15-08-18 00:00:00.000@ then return -1 endi - if $data01 != 2.068333156 then return -1 endi - if $data02 != 2.063999891 then return -1 endi - if $data03 != 1 then return -1 endi - if $data10 != @15-08-18 00:06:00.000@ then return -1 endi - if $data11 != 2.115999937 then return -1 endi - if $data12 != 2.115999937 then return -1 endi - if $data13 != 1 then return -1 endi -sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:07:00' interval(1m) order by ts desc; +sql select _wstart, twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:07:00' interval(1m) +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 +print $data20 $data21 $data22 $data23 $data24 $data25 $data26 if $rows != 2 then return -1 endi - -if $data00 != @15-08-18 00:06:00.000@ then +if $data10 != @15-08-18 00:06:00.000@ then + return -1 +endi +if $data11 != 2.115999937 then + return -1 +endi +if $data12 != 2.115999937 then + return -1 +endi +if $data13 != 1 then + return -1 +endi +if $data01 != 2.068333156 then return -1 endi -if $data01 != 2.115999937 then - return -1 -endi - -if $data02 != 2.115999937 then - return -1 -endi - -if $data03 != 1 then - return -1 -endi - -if $data11 != 2.068333156 then - return -1 -endi - -sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:27:00' interval(10m) order by ts asc +sql select _wstart, twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:27:00' interval(10m) if $rows != 3 then return -1 endi - if $data01 != 2.088666666 then return -1 endi - if $data02 != 2.089999914 then return -1 endi - if $data03 != 2 then return -1 endi - if $data11 != 2.077099980 then return -1 endi - if $data12 != 2.077000022 then return -1 endi - if $data13 != 2 then return -1 endi - if $data21 != 2.069333235 then return -1 endi - if $data22 != 2.040999889 then return -1 endi - if $data23 != 1 then return -1 endi -sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:27:00' interval(10m) order by ts desc +sql select _wstart, twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:27:00' interval(10m) if $rows != 3 then return -1 endi - -if $data01 != 2.069333235 then +if $data21 != 2.069333235 then return -1 endi - if $data11 != 2.077099980 then return -1 endi - -if $data21 != 2.088666666 then +if $data01 != 2.088666666 then return -1 endi -sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' order by ts asc +sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' if $data00 != 2.073699975 then return -1 endi - if $data01 != 2.070999980 then return -1 endi - if $data02 != 6 then return -1 endi -sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' order by ts desc +sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' if $rows != 1 then return -1 endi - if $data00 != 2.073699975 then return -1 endi - if $data01 != 2.070999980 then return -1 endi - if $data02 != 6 then return -1 endi @@ -223,9 +190,8 @@ if $rows != 0 then return -1 endi -sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' interval(10m) order by ts asc -sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' interval(10m) order by ts desc - +sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' interval(10m) +sql select twa(k),avg(k),count(1) from t1 where ts>='2015-8-18 00:00:00' and ts<='2015-8-18 00:30:00' interval(10m) #todo add test case while column filter exists for twa query @@ -254,26 +220,26 @@ sql insert into tm1 values('2020-12-28 18:11:52.412', 3); print =====================> td-2610 sql select twa(k)from tm1 where ts>='2020-11-19 18:11:45.773' and ts<='2020-12-9 18:11:17.098' -if $rows != 0 then +if $rows != 1 then return -1 endi +if $data00 != NULL then + return -1 +endi print =====================> td-2609 sql select apercentile(k, 50) from tm1 where ts>='2020-10-30 18:11:56.680' and ts<='2020-12-09 18:11:17.098' if $rows != 1 then return -1 endi - if $data00 != -1000.000000000 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 1000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect -sleep 100 sql use m_func_db0 @@ -282,7 +248,6 @@ sql select min(k) from tm1 where ts>='2020-11-19 18:11:45.773' and ts<='2020-12- if $rows != 1 then return -1 endi - if $data00 != 1 then print expect 1, actual: $data00 return -1 @@ -299,12 +264,10 @@ sql select last(ts) from tm1 interval(17a) limit 776 offset 3 if $rows != 3 then return -1 endi - sql select last(ts) from tm1 interval(17a) limit 1000 offset 4 if $rows != 2 then return -1 endi - sql select last(ts) from tm1 interval(17a) order by ts desc limit 1000 offset 0 if $rows != 6 then return -1 @@ -314,7 +277,7 @@ print =============================> TD-6086 sql create stable td6086st(ts timestamp, d double) tags(t nchar(50)); sql create table td6086ct1 using td6086st tags("ct1"); sql create table td6086ct2 using td6086st tags("ct2"); -sql SELECT LAST(d),t FROM td6086st WHERE tbname in ('td6086ct1', 'td6086ct2') and ts>="2019-07-30 00:00:00" and ts<="2021-08-31 00:00:00" interval(1800s) fill(prev) GROUP BY tbname; +sql SELECT LAST(d),t FROM td6086st WHERE tbname in ('td6086ct1', 'td6086ct2') and ts>="2019-07-30 00:00:00" and ts<="2021-08-31 00:00:00" partition BY tbname interval(1800s) fill(prev); print ==================> td-2624 sql create table tm2(ts timestamp, k int, b binary(12));