commit-merge0.sim 7.6 KB
Newer Older
1 2 3 4 5 6
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect

print =============== create database
7
sql create database db  duration 300 keep 365000d,365000d,365000d
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
sql show databases
if $rows != 3 then
  return -1
endi

print $data00 $data01 $data02

sql use db
sql create table stb1(ts timestamp, c6 double) tags (t1 int);
sql create table ct1 using stb1 tags ( 1 );
sql create table ct2 using stb1 tags ( 2 );
sql create table ct3 using stb1 tags ( 3 );
sql create table ct4 using stb1 tags ( 4 );
sql insert into ct1 values ('2022-05-01 18:30:27.001', 0.0);
sql insert into ct4 values ('2022-04-28 18:30:27.002', 0.0);
sql insert into ct1 values ('2022-05-01 18:30:17.003', 11.11);
sql insert into ct4 values ('2022-02-01 18:30:27.004', 11.11);
sql insert into ct1 values ('2022-05-01 18:30:07.005', 22.22);
sql insert into ct4 values ('2021-11-01 18:30:27.006', 22.22);
sql insert into ct1 values ('2022-05-01 18:29:27.007', 33.33);
sql insert into ct4 values ('2022-08-01 18:30:27.008', 33.33);
sql insert into ct1 values ('2022-05-01 18:20:27.009', 44.44);
sql insert into ct4 values ('2021-05-01 18:30:27.010', 44.44);
sql insert into ct1 values ('2022-05-01 18:21:27.011', 55.55);
sql insert into ct4 values ('2021-01-01 18:30:27.012', 55.55);
sql insert into ct1 values ('2022-05-01 18:22:27.013', 66.66);
sql insert into ct4 values ('2020-06-01 18:30:27.014', 66.66);
sql insert into ct1 values ('2022-05-01 18:28:37.015', 77.77);
sql insert into ct4 values ('2020-05-01 18:30:27.016', 77.77);
sql insert into ct1 values ('2022-05-01 18:29:17.017', 88.88);
sql insert into ct4 values ('2019-05-01 18:30:27.018', 88.88);
sql insert into ct1 values ('2022-05-01 18:30:20.019', 0);
sql insert into ct1 values ('2022-05-01 18:30:47.020', -99.99);
sql insert into ct1 values ('2022-05-01 18:30:49.021', NULL);
sql insert into ct1 values ('2022-05-01 18:30:51.022', -99.99);
sql insert into ct4 values ('2018-05-01 18:30:27.023', NULL) ;
sql insert into ct4 values ('2021-03-01 18:30:27.024', NULL) ;
sql insert into ct4 values ('2022-08-01 18:30:27.025', NULL) ;

print =============== select * from ct1 - memory
sql select * from stb1;
if $rows != 25 then
  print rows = $rows != 25
  return -1
endi


print =============== stop and restart taosd

$reboot_max = 10;

$reboot_cnt = 0

reboot_and_check:

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

print =============== insert duplicated records to memory - loop $reboot_max - $reboot_cnt 
sql use db
sql insert into ct1 values ('2022-05-01 18:30:27.001', 0.0);
sql insert into ct4 values ('2022-04-28 18:30:27.002', 0.0);
sql insert into ct1 values ('2022-05-01 18:30:17.003', 11.11);
sql insert into ct4 values ('2022-02-01 18:30:27.004', 11.11);
sql insert into ct1 values ('2022-05-01 18:30:07.005', 22.22);
sql insert into ct4 values ('2021-11-01 18:30:27.006', 22.22);
sql insert into ct1 values ('2022-05-01 18:29:27.007', 33.33);
sql insert into ct4 values ('2022-08-01 18:30:27.008', 33.33);
sql insert into ct1 values ('2022-05-01 18:20:27.009', 44.44);
sql insert into ct4 values ('2021-05-01 18:30:27.010', 44.44);
sql insert into ct1 values ('2022-05-01 18:21:27.011', 55.55);
sql insert into ct4 values ('2021-01-01 18:30:27.012', 55.55);
sql insert into ct1 values ('2022-05-01 18:22:27.013', 66.66);
sql insert into ct4 values ('2020-06-01 18:30:27.014', 66.66);
sql insert into ct1 values ('2022-05-01 18:28:37.015', 77.77);
sql insert into ct4 values ('2020-05-01 18:30:27.016', 77.77);
sql insert into ct1 values ('2022-05-01 18:29:17.017', 88.88);
sql insert into ct4 values ('2019-05-01 18:30:27.018', 88.88);
sql insert into ct1 values ('2022-05-01 18:30:20.019', 0);
sql insert into ct1 values ('2022-05-01 18:30:47.020', -99.99);
sql insert into ct1 values ('2022-05-01 18:30:49.021', NULL);
sql insert into ct1 values ('2022-05-01 18:30:51.022', -99.99);
sql insert into ct4 values ('2018-05-01 18:30:27.023', NULL) ;
sql insert into ct4 values ('2021-03-01 18:30:27.024', NULL) ;
sql insert into ct4 values ('2022-08-01 18:30:27.025', NULL) ;

print =============== select * from ct1 - merge memory and file - loop $reboot_max - $reboot_cnt 
sql select * from ct1;
if $rows != 13 then
  print rows = $rows != 13
  return -1
endi
print $data[0][0] $data[0][1]
print $data[1][0] $data[1][1]
print $data[2][0] $data[2][1]
print $data[3][0] $data[3][1]
print $data[4][0] $data[4][1]
print $data[5][0] $data[5][1]
print $data[6][0] $data[6][1]
print $data[7][0] $data[7][1]
print $data[8][0] $data[8][1]
print $data[9][0] $data[9][1]
print $data[10][0] $data[10][1]
print $data[11][0] $data[11][1]
print $data[12][0] $data[12][1]

if $data[0][1] != 44.440000000 then
    print $data[0][1] != 44.440000000
    return -1
endi
if $data[1][1] != 55.550000000 then
    print $data[1][1] != 55.550000000
    return -1
endi
if $data[2][1] != 66.660000000 then
    print $data[2][1] != 66.660000000
    return -1
endi
if $data[3][1] != 77.770000000 then
    print $data[3][1] != 77.770000000
    return -1
endi
if $data[4][1] != 88.880000000 then
    print $data[4][1] != 88.880000000
    return -1
endi
if $data[5][1] != 33.330000000 then
    print $data[5][1] != 33.330000000
    return -1
endi
if $data[6][1] != 22.220000000 then
    print $data[6][1] != 22.220000000
    return -1
endi
if $data[7][1] != 11.110000000 then
    print $data[7][1] != 11.110000000
    return -1
endi
if $data[8][1] != 0.000000000 then
    print $data[8][1] != 0.000000000
    return -1
endi
if $data[9][1] != 0.000000000 then
    print $data[9][1] != 0.000000000
    return -1
endi
if $data[10][1] != -99.990000000 then
    print $data[10][1] != -99.990000000
    return -1
endi
if $data[11][1] != NULL then
    print $data[11][1] != NULL
    return -1
endi
if $data[12][1] != -99.990000000 then
    print $data[12][1] != -99.990000000
    return -1
endi
 
print =============== select * from ct4 - merge memory and file - loop $reboot_max - $reboot_cnt 
sql select * from ct4;
if $rows != 12 then
  print rows = $rows != 12
  return -1
endi

print $data[0][0] $data[0][1]
print $data[1][0] $data[1][1]
print $data[2][0] $data[2][1]
print $data[3][0] $data[3][1]
print $data[4][0] $data[4][1]
print $data[5][0] $data[5][1]
print $data[6][0] $data[6][1]
print $data[7][0] $data[7][1]
print $data[8][0] $data[8][1]
print $data[9][0] $data[9][1]
print $data[10][0] $data[10][1]
print $data[11][0] $data[11][1]

if $data[0][1] != NULL then
    print $data[0][1] != NULL
    return -1
endi
if $data[1][1] != 88.880000000 then
    print $data[1][1] != 88.880000000
    return -1
endi
if $data[2][1] != 77.770000000 then
    print $data[2][1] != 77.770000000
    return -1
endi
if $data[3][1] != 66.660000000 then
    print $data[3][1] != 66.660000000
    return -1
endi
if $data[4][1] != 55.550000000 then
    print $data[4][1] != 55.550000000
    return -1
endi
if $data[5][1] != NULL then
    print $data[5][1] != NULL
    return -1
endi
if $data[6][1] != 44.440000000 then
    print $data[6][1] != 44.440000000
    return -1
endi
if $data[7][1] != 22.220000000 then
    print $data[7][1] != 22.220000000
    return -1
endi
if $data[8][1] != 11.110000000 then
    print $data[8][1] != 11.110000000
    return -1
endi
if $data[9][1] != 0.000000000 then
    print $data[9][1] != 0.000000000
    return -1
endi
if $data[10][1] != 33.330000000 then
    print $data[10][1] != 33.330000000
    return -1
endi
if $data[11][1] != NULL then
    print $data[11][1] != NULL
    return -1
endi


if $reboot_cnt > $reboot_max then
    print reboot_cnt $reboot_cnt > reboot_max $reboot_max
    return 0
else
    print reboot_cnt $reboot_cnt <= reboot_max $reboot_max
    $reboot_cnt = $reboot_cnt + 1
    goto reboot_and_check
endi