import.sim 1.2 KB
Newer Older
S
slguan 已提交
1 2 3 4 5 6 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
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 clog -v 0
system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4

print ========= start dnode1 as master
system sh/exec.sh -n dnode1 -s start
sleep 3000
sql connect

print ======== step1 
sql create database d1 replica 1 days 7 keep 50
sql use d1
sql create table tb (ts timestamp, a int)
sql insert into tb values(now-30d, -28)
sql insert into tb values(now-27d, -27)
sql insert into tb values(now-26d, -26)
sql select count(a) from tb
if $data00 != 3 then
  return -1
endi

print ======== step2
#sql alter table tb(ts timestamp, a int, b smallint)
sql alter table tb add column b smallint
sql insert into tb values(now-25d, -25, 0)
sql insert into tb values(now-22d, -24, 1)
sql insert into tb values(now-20d, -23, 2)
sql select count(b) from tb
if $data00 != 3 then
  return -1
endi

print ========= step3
sql import into tb values(now-23d, -23, 0)
sql import into tb values(now-21d, -21, 0)
sql select count(b) from tb
if $data00 != 5 then
  return -1
endi

sql_error import into tb values(now-29d, -29, 0)
sql select count(b) from tb
if $data00 != 5 then
  return -1
endi