regressiontest.sim 3.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect

$dbPrefix = reg_db
$tb = tb
$rowNum = 8200

$ts0 = 1537146000000
$delta = 100
print ========== reg.sim
$i = 0
$db = $dbPrefix . $i

sql drop database if exists $db -x step1
step1:
H
Haojun Liao 已提交
18
sql create database $db vgroups 1 cachemodel 'last_row'
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

sql use $db
sql create table $tb (ts timestamp, c1 int)

$i = 0
$ts = $ts0

$x = 0
while $x < $rowNum
$xs = $x * $delta
$ts = $ts0 + $xs
sql insert into $tb values ( $ts , $x )
$x = $x + 1
endw

34
sql flush database $db
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

sql delete from $tb where ts=1537146000000
sql delete from $tb where ts=1537146409500

print =========================> TS-2410
sql select * from  $tb limit 20 offset 4090
print $data00
print $data10
print $data20
print $data30
print $data40
print $data50
print $data60
print $data70
print $data80
print $data90

H
Haojun Liao 已提交
52
if $data40 != @18-09-17 09:06:49.600@ then
53 54 55
 return -1
endi

56 57 58 59 60
sql select * from $tb order by ts desc;
if $rows != 8198 then
  return -1
endi

61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
sql drop database if exists $db -x step1
sql create database $db vgroups 1;

sql use $db
sql create stable st1 (ts timestamp, c  int) tags(a  int);
sql create table t1 using st1 tags(1);
sql create table t2 using st1 tags(2);

$i = 0
$ts = 1674977959000
$rowNum = 200

$x = 0
while $x < $rowNum
$xs = $x * $delta
$ts = $ts0 + $xs
sql insert into t1 values ( $ts , $x )
sql insert into t2 values ( $ts + 1000a, $x )
$x = $x + 1
$ts = $ts + 1000
endw

sql flush database $db

85 86
print ===========================>  TD-22077  && TD-21877

87 88 89 90 91 92 93 94 95
sql insert into t1 values('2018-09-17 09:00:26', 26);
sql insert into t2 values('2018-09-17 09:00:25', 25);

sql insert into t2 values('2018-09-17 09:00:30', 30);
sql flush  database reg_db0;

sql delete from st1 where ts<='2018-9-17 09:00:26';
sql select * from st1;

96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
sql drop table t1
sql drop table t2

print =========================================>TD-22196
sql create table t1 using st1 tags(1);

$i = 0
$ts = 1674977959000
$rowNum = 200

$x = 0
while $x < $rowNum
$xs = $x * $delta
$ts = $ts0 + $xs
sql insert into t1 values ( $ts , $x )
$x = $x + 1
$ts = $ts + 1000
endw

sql flush database $db
sql select min(c),max(c) from t1
if $data00 != 0 then
   return -1
endi

if $data01 != 199 then
  return -1
endi

125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
sql drop table t1

$rowNum = 8200
$ts0 = 1537146000000
sql create table t1 (ts timestamp, c1 int)

$i = 0
$ts = $ts0

$x = 0
while $x < $rowNum
$xs = $x * $delta
$ts = $ts0 + $xs
sql insert into t1 values ( $ts , $x )
$x = $x + 1
endw

sql delete from t1 where ts<=1537146409500

sql flush database $db

print =====================================>TD-22007
sql select count(*) from t1 interval(10a)

H
Haojun Liao 已提交
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
sql drop table t1

sql create table st1 (ts timestamp, k int) tags(a int);
sql insert into t1 using st1 tags(1) values('2020-1-1 10:10:10', 0);
sql insert into t2 using st1 tags(1) values('2020-1-1 10:10:11', 1);
sql insert into t3 using st1 tags(1) values('2020-1-1 10:10:12', 2);
sql insert into t4 using st1 tags(1) values('2020-1-1 10:10:13', 3);
sql insert into t5 using st1 tags(1) values('2020-1-1 10:10:14', 4);
sql insert into t6 using st1 tags(2) values('2020-1-1 10:10:15', 5);
sql insert into t7 using st1 tags(2) values('2020-1-1 10:10:16', 6);
sql insert into t8 using st1 tags(2) values('2020-1-1 10:10:17', 7);
sql insert into t9 using st1 tags(2) values('2020-1-1 10:10:18', 8);
sql insert into t10 using st1 tags(2) values('2020-1-1 10:10:19', 9);

sql select count(*) from st1
if $data00 != 10 then
  return -1
endi

sql select last_row(*) from st1 group by a
if $rows != 2 then
  return -1
endi

if $data00 != @20-01-01 10:10:19.000@ then
  return -1
endi

if $data01 != 9 then
  return -1
endi

if $data10 != @20-01-01 10:10:14.000@ then
  return -1
endi

if $data11 != 4 then
  return -1
endi

H
Haojun Liao 已提交
189 190 191 192 193 194
print ===============================================> TS-2613
sql select * from information_schema.ins_databases limit 1 offset 1;
if $rows != 1 then
  return -1
endi

195
system sh/exec.sh -n dnode1 -s stop -x SIGINT