import.sim 2.0 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2 3

system sh/deploy.sh -n dnode1 -i 1
H
hjxilinx 已提交
4
system sh/cfg.sh -n dnode1 -c walLevel -v 0
S
slguan 已提交
5
system sh/exec.sh -n dnode1 -s start
H
Haojun Liao 已提交
6
sleep 100
S
slguan 已提交
7 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
sql connect

$dbPrefix = impt_db
$tbPrefix = tb
$stbPrefix = stb
$tbNum = 10
$rowNum = 10
$totalNum = $tbNum * $rowNum
print ========== import.sim
$i = 0
$db = $dbPrefix . $i
$stb = $stbPrefix . $i

sql drop database $db -x step1
step1:
sql create database $db 
print ====== create tables
sql use $db
sql create table tb (ts timestamp, c1 int, c2 timestamp)
sql insert into tb values ('2019-05-05 11:30:00.000', 1, now)
sql insert into tb values ('2019-05-05 12:00:00.000', 1, now)
sleep 2000
sql import into tb values ('2019-05-05 11:00:00.000', -1, now)
sleep 2000
sql import into tb values ('2019-05-05 11:59:00.000', -1, now)
sleep 2000
sql import into tb values ('2019-05-04 08:00:00.000', -1, now)
sleep 2000
sql import into tb values ('2019-05-04 07:59:00.000', -1, now)
sleep 2000

sql select * from tb
if $rows != 6 then
  return -1
endi
if $data00 != @19-05-04 07:59:00.000@ then
  return -1
endi
if $data10 != @19-05-04 08:00:00.000@ then
  return -1
endi
if $data20 != @19-05-05 11:00:00.000@ then
  return -1
endi
if $data30 != @19-05-05 11:30:00.000@ then
  return -1
endi
if $data40 != @19-05-05 11:59:00.000@ then
  return -1
endi
if $data50 != @19-05-05 12:00:00.000@ then
  return -1
endi

print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 2000
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
sql connect
H
Haojun Liao 已提交
67
sleep 100
S
slguan 已提交
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

sql use $db
sql select * from tb
if $rows != 6 then
  return -1
endi
if $data00 != @19-05-04 07:59:00.000@ then
  return -1
endi
if $data10 != @19-05-04 08:00:00.000@ then
  return -1
endi
if $data20 != @19-05-05 11:00:00.000@ then
  return -1
endi
if $data30 != @19-05-05 11:30:00.000@ then
  return -1
endi
if $data40 != @19-05-05 11:59:00.000@ then
  return -1
endi
if $data50 != @19-05-05 12:00:00.000@ then
  return -1
endi