system sh/stop_dnodes.sh system sh/ip.sh -i 1 -s up system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1 system sh/cfg.sh -n dnode1 -c commitLog -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect $i = 0 $dbPrefix = tb_fm_db $tbPrefix = tb_fm_tb $db = $dbPrefix . $i $tb = $tbPrefix . $i print =============== step1 sql drop database -x step1 step1: sql create database $db sql use $db $x = 0 create1: $x = $x + 1 sleep 1000 if $x == 20 then return -1 endi sql create table $tb (ts timestamp, speed int) -x create1 #commit to file will trigger if insert 82 rows $N = 82 $x = $N * 2 $y = $N $expect = $y while $x > $y $ms = $x . m $xt = - . $x sql insert into $tb values (now - $ms , $xt ) $x = $x - 1 endw sql select * from $tb print sql select * from $tb -> $rows points if $rows != $expect then return -1 endi $x = $N $y = $N * 2 $expect = $N * 2 while $x < $y $ms = $x . m sql insert into $tb values (now + $ms , $x ) $x = $x + 1 endw sql select * from $tb print sql select * from $tb -> $rows points if $rows != $expect then return -1 endi $R = 4 $R = $R - 1 $y = $N * $R $expect = $y + $N $expect = $expect + $N $x = $N * 3 $y = $y + $x while $x < $y $ms = $x . m sql insert into $tb values (now + $ms , $x ) $x = $x + 1 endw sql select * from $tb print sql select * from $tb -> $rows points if $rows != $expect then return -1 endi print =============== step 2 $result1 = $N $result2 = $N * 2 $N1 = $result2 + 1 $step = $N1 . m $start1 = now- . $step $start2 = now $start3 = now+ . $step $end1 = now- . $step $end2 = now $end3 = now+ . $step sql select * from $tb where ts < $start1 and ts > $end1 if $rows != 0 then return -1 endi sql select * from $tb where ts < $start1 and ts > $end2 if $rows != 0 then return -1 endi sql select * from $tb where ts < $start1 and ts > $end3 if $rows != 0 then return -1 endi sql select * from $tb where ts < $start2 and ts > $end1 print select * from $tb where ts < $start2 and ts > $end1 -> $rows points if $rows != $result1 then return -1 endi sql select * from $tb where ts < $start2 and ts > $end2 if $rows != 0 then return -1 endi sql select * from $tb where ts < $start2 and ts > $end3 if $rows != 0 then return -1 endi sql select * from $tb where ts < $start3 and ts > $end1 print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points if $rows != $result2 then return -1 endi sql select * from $tb where ts < $start3 and ts > $end2 print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points if $rows != $result1 then return -1 endi sql select * from $tb where ts < $start3 and ts > $end3 if $rows != 0 then return -1 endi print ================= order by ts desc sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc if $rows != 0 then return -1 endi sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc if $rows != 0 then return -1 endi sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc if $rows != 0 then return -1 endi sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points if $rows != $result1 then return -1 endi sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc if $rows != 0 then return -1 endi sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc if $rows != 0 then return -1 endi sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points if $rows != $result2 then return -1 endi sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points if $rows != $result1 then return -1 endi sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc if $rows != 0 then return -1 endi clear: sql drop database $db sql show databases if $rows != 0 then return -1 endi