提交 f740fd61 编写于 作者: X Xiaoyu Wang

fix: use 'duration' instead of 'days' for create database

上级 19ab15b1
...@@ -42,7 +42,7 @@ class TDTestCase: ...@@ -42,7 +42,7 @@ class TDTestCase:
tdDnodes.start(3) tdDnodes.start(3)
def run(self): def run(self):
tdSql.execute('create database db replica 3 days 7') tdSql.execute('create database db replica 3 duration 7')
tdSql.execute('use db') tdSql.execute('use db')
for tid in range(1, 11): for tid in range(1, 11):
tdSql.execute('create table tb%d(ts timestamp, i int)' % tid) tdSql.execute('create table tb%d(ts timestamp, i int)' % tid)
......
...@@ -83,7 +83,7 @@ class TDTestCase: ...@@ -83,7 +83,7 @@ class TDTestCase:
tdSql.checkData(0, 0, np.max(floatData)) tdSql.checkData(0, 0, np.max(floatData))
# test case: https://jira.taosdata.com:18080/browse/TD-2583 # test case: https://jira.taosdata.com:18080/browse/TD-2583
tdSql.execute("create database test days 2") tdSql.execute("create database test duration 2")
tdSql.execute("create table car(ts timestamp, speed int)") tdSql.execute("create table car(ts timestamp, speed int)")
tdSql.execute("insert into car values(now, -1)") tdSql.execute("insert into car values(now, -1)")
tdSql.execute("insert into car values(now-10d, null)") tdSql.execute("insert into car values(now-10d, null)")
......
...@@ -83,7 +83,7 @@ class TDTestCase: ...@@ -83,7 +83,7 @@ class TDTestCase:
tdSql.checkData(0, 0, np.min(floatData)) tdSql.checkData(0, 0, np.min(floatData))
# test case: https://jira.taosdata.com:18080/browse/TD-2583 # test case: https://jira.taosdata.com:18080/browse/TD-2583
tdSql.execute("create database test days 2") tdSql.execute("create database test duration 2")
tdSql.execute("create table car(ts timestamp, speed int)") tdSql.execute("create table car(ts timestamp, speed int)")
tdSql.execute("insert into car values(now, 1)") tdSql.execute("insert into car values(now, 1)")
tdSql.execute("insert into car values(now-10d, null)") tdSql.execute("insert into car values(now-10d, null)")
......
...@@ -264,7 +264,7 @@ class TDTestCase: ...@@ -264,7 +264,7 @@ class TDTestCase:
def td4288(self): def td4288(self):
tdLog.printNoPrefix("==========TD-4288==========") tdLog.printNoPrefix("==========TD-4288==========")
# keep ~ [days,365000] # keep ~ [duration,365000]
tdSql.execute("drop database if exists db") tdSql.execute("drop database if exists db")
tdSql.execute("create database if not exists db") tdSql.execute("create database if not exists db")
tdSql.query("show variables") tdSql.query("show variables")
......
...@@ -32,7 +32,7 @@ class TDTestCase: ...@@ -32,7 +32,7 @@ class TDTestCase:
print("==============step1") print("==============step1")
tdSql.execute("create database if not exists demo keep 36500;"); tdSql.execute("create database if not exists demo keep 36500;");
print("==============create db demo keep 365000 days") print("==============create db demo keep 365000 duration")
tdSql.execute("use demo;") tdSql.execute("use demo;")
tdSql.execute("CREATE table if not exists test (ts timestamp, f1 int);") tdSql.execute("CREATE table if not exists test (ts timestamp, f1 int);")
print("==============create table test") print("==============create table test")
......
...@@ -51,7 +51,7 @@ class TDTestRetetion: ...@@ -51,7 +51,7 @@ class TDTestRetetion:
def run(self): def run(self):
tdLog.info("=============== step1") tdLog.info("=============== step1")
tdSql.execute('create database test keep 3 days 1;') tdSql.execute('create database test keep 3 duration 1;')
tdSql.execute('use test;') tdSql.execute('use test;')
tdSql.execute('create table test(ts timestamp,i int);') tdSql.execute('create table test(ts timestamp,i int);')
......
...@@ -66,7 +66,7 @@ class TDTestCase: ...@@ -66,7 +66,7 @@ class TDTestCase:
tdDnodes.deploy(1,cfg) tdDnodes.deploy(1,cfg)
tdDnodes.startWithoutSleep(1) tdDnodes.startWithoutSleep(1)
tdSql.execute("create database test days 1") tdSql.execute("create database test duration 1")
tdSql.execute("use test") tdSql.execute("use test")
tdSql.execute("create table stb(ts timestamp, c int) tags(t int)") tdSql.execute("create table stb(ts timestamp, c int) tags(t int)")
...@@ -85,7 +85,7 @@ class TDTestCase: ...@@ -85,7 +85,7 @@ class TDTestCase:
tdLog.info("================= step3") tdLog.info("================= step3")
tdSql.execute('drop database test') tdSql.execute('drop database test')
for i in range(50): for i in range(50):
tdSql.execute("create database test%d days 1" %(i)) tdSql.execute("create database test%d duration 1" %(i))
tdSql.execute("use test%d" %(i)) tdSql.execute("use test%d" %(i))
tdSql.execute("create table tb (ts timestamp,i int)") tdSql.execute("create table tb (ts timestamp,i int)")
for j in range(10): for j in range(10):
......
...@@ -56,7 +56,7 @@ class TDTestCase: ...@@ -56,7 +56,7 @@ class TDTestCase:
tdDnodes.deploy(1,cfg) tdDnodes.deploy(1,cfg)
tdDnodes.startWithoutSleep(1) tdDnodes.startWithoutSleep(1)
tdSql.execute("create database test days 1 keep 15,5,10") tdSql.execute("create database test duration 1 keep 15,5,10")
tdSql.execute("use test") tdSql.execute("use test")
tdSql.execute("create table tb(ts timestamp, c int)") tdSql.execute("create table tb(ts timestamp, c int)")
......
...@@ -66,7 +66,7 @@ class TDTestCase: ...@@ -66,7 +66,7 @@ class TDTestCase:
"name": "db", "name": "db",
"drop": "yes", "drop": "yes",
"replica": 1, "replica": 1,
"days": 10, "duration": 10,
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
......
...@@ -81,7 +81,7 @@ class JoinPerf: ...@@ -81,7 +81,7 @@ class JoinPerf:
"name": self.dbname, "name": self.dbname,
"drop": self.drop, "drop": self.drop,
"replica": 1, "replica": 1,
"days": 10, "duration": 10,
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
......
...@@ -75,7 +75,7 @@ class Taosdemo: ...@@ -75,7 +75,7 @@ class Taosdemo:
"name": self.dbname, "name": self.dbname,
"drop": self.drop, "drop": self.drop,
"replica": 1, "replica": 1,
"days": 10, "duration": 10,
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
......
...@@ -57,7 +57,7 @@ class TDTestCase: ...@@ -57,7 +57,7 @@ class TDTestCase:
"name": "db", "name": "db",
"drop": "yes", "drop": "yes",
"replica": 1, "replica": 1,
"days": 10, "duration": 10,
"cache": 16, "cache": 16,
"blocks": 8, "blocks": 8,
"precision": "ms", "precision": "ms",
......
...@@ -138,7 +138,7 @@ class TDTestCase: ...@@ -138,7 +138,7 @@ class TDTestCase:
sqls_ls = [ sqls_ls = [
'drop database if exists nsdbsql;', 'drop database if exists nsdbsql;',
'create database nsdbsql precision "ns" keep 3600 days 6 update 1;', 'create database nsdbsql precision "ns" keep 3600 duration 6 update 1;',
'use nsdbsql;', 'use nsdbsql;',
'CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);', 'CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);',
'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);', 'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);',
......
...@@ -125,7 +125,7 @@ class TDTestCase: ...@@ -125,7 +125,7 @@ class TDTestCase:
tdSql.checkData(0, 0, 600) tdSql.checkData(0, 0, 600)
# check taosdemo -s # check taosdemo -s
sqls_ls = ['drop database if exists nsdbsql;','create database nsdbsql precision "ns" keep 36 days 6 update 1;', sqls_ls = ['drop database if exists nsdbsql;','create database nsdbsql precision "ns" keep 36 duration 6 update 1;',
'use nsdbsql;','CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);', 'use nsdbsql;','CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);',
'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);', 'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);',
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 10.2, 219, 0.32);', 'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 10.2, 219, 0.32);',
......
...@@ -60,8 +60,8 @@ class TDTestCase: ...@@ -60,8 +60,8 @@ class TDTestCase:
if not os.path.exists("./taosdumptest/tmp2"): if not os.path.exists("./taosdumptest/tmp2"):
os.makedirs("./taosdumptest/tmp2") os.makedirs("./taosdumptest/tmp2")
tdSql.execute("drop database if exists db") tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ") tdSql.execute("create database db duration 11 keep 3649 blocks 8 ")
tdSql.execute("create database db1 days 12 keep 3640 blocks 7 ") tdSql.execute("create database db1 duration 12 keep 3640 blocks 7 ")
tdSql.execute("use db") tdSql.execute("use db")
tdSql.execute( tdSql.execute(
"create table st(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))") "create table st(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))")
...@@ -102,7 +102,7 @@ class TDTestCase: ...@@ -102,7 +102,7 @@ class TDTestCase:
tdSql.query("show databases") tdSql.query("show databases")
tdSql.checkRows(2) tdSql.checkRows(2)
dbresult = tdSql.queryResult dbresult = tdSql.queryResult
# 6--days,7--keep0,keep1,keep, 12--block, # 6--duration,7--keep0,keep1,keep, 12--block,
isCommunity = self.checkCommunity() isCommunity = self.checkCommunity()
print("iscommunity: %d" % isCommunity) print("iscommunity: %d" % isCommunity)
......
...@@ -60,7 +60,7 @@ class TDTestCase: ...@@ -60,7 +60,7 @@ class TDTestCase:
def build_db(precision, start_time): def build_db(precision, start_time):
tdSql.execute("drop database if exists timedb1") tdSql.execute("drop database if exists timedb1")
tdSql.execute( tdSql.execute(
"create database timedb1 days 10 keep 365 blocks 8 precision "+"\""+precision+"\"") "create database timedb1 duration 10 keep 365 blocks 8 precision "+"\""+precision+"\"")
tdSql.execute("use timedb1") tdSql.execute("use timedb1")
tdSql.execute( tdSql.execute(
......
...@@ -30,7 +30,7 @@ class TDTestCase: ...@@ -30,7 +30,7 @@ class TDTestCase:
tdSql.execute(s) tdSql.execute(s)
s = 'drop database if exists db' s = 'drop database if exists db'
tdSql.execute(s) tdSql.execute(s)
s = 'create database db days 30' s = 'create database db duration 30'
tdSql.execute(s) tdSql.execute(s)
s = 'use db' s = 'use db'
tdSql.execute(s) tdSql.execute(s)
......
...@@ -30,7 +30,7 @@ class TDTestCase: ...@@ -30,7 +30,7 @@ class TDTestCase:
tdSql.execute(s) tdSql.execute(s)
s = 'drop database if exists db' s = 'drop database if exists db'
tdSql.execute(s) tdSql.execute(s)
s = 'create database db update 1 days 30' s = 'create database db update 1 duration 30'
tdSql.execute(s) tdSql.execute(s)
s = 'use db' s = 'use db'
tdSql.execute(s) tdSql.execute(s)
......
...@@ -50,7 +50,7 @@ class TDTestCase: ...@@ -50,7 +50,7 @@ class TDTestCase:
tdSql.execute(sql) tdSql.execute(sql)
sql = 'drop database if exists db' sql = 'drop database if exists db'
tdSql.execute(sql) tdSql.execute(sql)
sql = 'create database db update 1 days 30;' sql = 'create database db update 1 duration 30;'
tdSql.execute(sql) tdSql.execute(sql)
sql = 'use db;' sql = 'use db;'
tdSql.execute(sql) tdSql.execute(sql)
......
...@@ -49,7 +49,7 @@ class TDTestCase: ...@@ -49,7 +49,7 @@ class TDTestCase:
tdSql.execute(sql) tdSql.execute(sql)
sql = 'drop database if exists db' sql = 'drop database if exists db'
tdSql.execute(sql) tdSql.execute(sql)
sql = 'create database db update 0 days 30;' sql = 'create database db update 0 duration 30;'
tdSql.execute(sql) tdSql.execute(sql)
sql = 'use db;' sql = 'use db;'
tdSql.execute(sql) tdSql.execute(sql)
......
...@@ -34,7 +34,7 @@ class TDTestCase: ...@@ -34,7 +34,7 @@ class TDTestCase:
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
tdSql.execute("create database udb update 1 days 30") tdSql.execute("create database udb update 1 duration 30")
tdSql.execute("use udb") tdSql.execute("use udb")
print("==============step 1: UPDATE THE LAST RECORD REPEATEDLY") print("==============step 1: UPDATE THE LAST RECORD REPEATEDLY")
......
...@@ -57,7 +57,7 @@ class TDSql: ...@@ -57,7 +57,7 @@ class TDSql:
tdLog.notice("'reset query cache' is not supported") tdLog.notice("'reset query cache' is not supported")
s = 'drop database if exists db' s = 'drop database if exists db'
self.cursor.execute(s) self.cursor.execute(s)
s = 'create database db days 300' s = 'create database db duration 300'
self.cursor.execute(s) self.cursor.execute(s)
s = 'use db' s = 'use db'
self.cursor.execute(s) self.cursor.execute(s)
......
...@@ -63,7 +63,7 @@ class TDTaosdemoCfg: ...@@ -63,7 +63,7 @@ class TDTaosdemoCfg:
"name": 'db', "name": 'db',
"drop": 'yes', "drop": 'yes',
"replica": 1, "replica": 1,
"days": 10, "duration": 10,
"cache": 16, "cache": 16,
"blocks": 6, "blocks": 6,
"precision": "ms", "precision": "ms",
......
...@@ -9,7 +9,7 @@ sleep 2000 ...@@ -9,7 +9,7 @@ sleep 2000
sql connect sql connect
print ============= create database print ============= create database
sql create database db cache 2 blocks 4 days 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1 sql create database db cache 2 blocks 4 duration 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1
sql show databases sql show databases
if $data00 != db then if $data00 != db then
return -1 return -1
...@@ -87,13 +87,13 @@ sql_error alter database db quorum 4 ...@@ -87,13 +87,13 @@ sql_error alter database db quorum 4
sql_error alter database db quorum 5 sql_error alter database db quorum 5
sql_error alter database db quorum -1 sql_error alter database db quorum -1
print ============== step days print ============== step duration
sql_error alter database db days 0 sql_error alter database db duration 0
sql_error alter database db days 1 sql_error alter database db duration 1
sql_error alter database db days 2 sql_error alter database db duration 2
sql_error alter database db days 10 sql_error alter database db duration 10
sql_error alter database db days 50 sql_error alter database db duration 50
sql_error alter database db days 100 sql_error alter database db duration 100
print ============== step keep print ============== step keep
sql show databases sql show databases
......
...@@ -26,7 +26,7 @@ system sh/exec.sh -n dnode2 -s start ...@@ -26,7 +26,7 @@ system sh/exec.sh -n dnode2 -s start
sleep 2000 sleep 2000
print ======== step1 create db print ======== step1 create db
sql create database keepdb replica 1 keep 30 days 7 sql create database keepdb replica 1 keep 30 duration 7
sql use keepdb sql use keepdb
sql create table tb (ts timestamp, i int) sql create table tb (ts timestamp, i int)
...@@ -201,7 +201,7 @@ sql alter database keepdb keep 0 -x error2 ...@@ -201,7 +201,7 @@ sql alter database keepdb keep 0 -x error2
return -1 return -1
error2: error2:
sql alter database keepdb days 1 -x error3 sql alter database keepdb duration 1 -x error3
return -1 return -1
error3: error3:
......
...@@ -171,7 +171,7 @@ sql_error create topic t1 partitions -1; ...@@ -171,7 +171,7 @@ sql_error create topic t1 partitions -1;
sql_error create topic t1 partitions 10001; sql_error create topic t1 partitions 10001;
print =============step3 create with db para print =============step3 create with db para
sql create topic db cache 2 blocks 4 days 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1 sql create topic db cache 2 blocks 4 duration 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1
sql show databases sql show databases
if $data00 != db then if $data00 != db then
return -1 return -1
...@@ -199,7 +199,7 @@ if $data09 != 4 then ...@@ -199,7 +199,7 @@ if $data09 != 4 then
endi endi
sql drop topic db; sql drop topic db;
sql create topic db cache 2 blocks 4 days 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1 partitions 7 sql create topic db cache 2 blocks 4 duration 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1 partitions 7
sql show databases sql show databases
if $data00 != db then if $data00 != db then
return -1 return -1
...@@ -334,19 +334,19 @@ sql_error alter topic db quorum 4 ...@@ -334,19 +334,19 @@ sql_error alter topic db quorum 4
sql_error alter topic db quorum 5 sql_error alter topic db quorum 5
sql_error alter topic db quorum -1 sql_error alter topic db quorum -1
print ============== step days print ============== step duration
sql_error alter database db days 0 sql_error alter database db duration 0
sql_error alter database db days 1 sql_error alter database db duration 1
sql_error alter database db days 2 sql_error alter database db duration 2
sql_error alter database db days 10 sql_error alter database db duration 10
sql_error alter database db days 50 sql_error alter database db duration 50
sql_error alter database db days 100 sql_error alter database db duration 100
sql_error alter topic db days 0 sql_error alter topic db duration 0
sql_error alter topic db days 1 sql_error alter topic db duration 1
sql_error alter topic db days 2 sql_error alter topic db duration 2
sql_error alter topic db days 10 sql_error alter topic db duration 10
sql_error alter topic db days 50 sql_error alter topic db duration 50
sql_error alter topic db days 100 sql_error alter topic db duration 100
print ============== step keep print ============== step keep
sql show databases sql show databases
......
...@@ -30,7 +30,7 @@ sleep 2000 ...@@ -30,7 +30,7 @@ sleep 2000
sql connect sql connect
print ========= step1 print ========= step1
sql create database ic1db days 7; sql create database ic1db duration 7;
sql create table ic1db.tb(ts timestamp, s int); sql create table ic1db.tb(ts timestamp, s int);
sql insert into ic1db.tb values(now-30d, -30); sql insert into ic1db.tb values(now-30d, -30);
sql insert into ic1db.tb values(now-20d, -20); sql insert into ic1db.tb values(now-20d, -20);
...@@ -50,7 +50,7 @@ if $rows != 12 then ...@@ -50,7 +50,7 @@ if $rows != 12 then
endi endi
print ========= step2 print ========= step2
sql create database ic2db days 7; sql create database ic2db duration 7;
sql create table ic2db.tb(ts timestamp, s int); sql create table ic2db.tb(ts timestamp, s int);
sql insert into ic2db.tb values(now, 0); sql insert into ic2db.tb values(now, 0);
sql import into ic2db.tb values(now-30d, -30); sql import into ic2db.tb values(now-30d, -30);
......
...@@ -30,7 +30,7 @@ system sh/exec.sh -n dnode1 -s start ...@@ -30,7 +30,7 @@ system sh/exec.sh -n dnode1 -s start
sleep 2000 sleep 2000
sql connect sql connect
sql create database ir1db days 7 sql create database ir1db duration 7
sql use ir1db sql use ir1db
sql create table tb(ts timestamp, i bigint) sql create table tb(ts timestamp, i bigint)
......
...@@ -20,7 +20,7 @@ $db = $dbPrefix . $i ...@@ -20,7 +20,7 @@ $db = $dbPrefix . $i
$mt = $mtPrefix . $i $mt = $mtPrefix . $i
sql drop database if exists $db sql drop database if exists $db
sql create database $db days 10 keep 20,20,20 sql create database $db duration 10 keep 20,20,20
sql use $db sql use $db
sql_error alter database $db keep "20" sql_error alter database $db keep "20"
......
...@@ -20,7 +20,7 @@ $db = $dbPrefix . $i ...@@ -20,7 +20,7 @@ $db = $dbPrefix . $i
$mt = $mtPrefix . $i $mt = $mtPrefix . $i
sql drop database if exists $db sql drop database if exists $db
sql create database $db days 10 keep 20 sql create database $db duration 10 keep 20
sql use $db sql use $db
sql show databases sql show databases
if $rows != 1 then if $rows != 1 then
......
...@@ -101,7 +101,7 @@ print db_already_exists test passed ...@@ -101,7 +101,7 @@ print db_already_exists test passed
print create_db.sim case5: db_meta_data test print create_db.sim case5: db_meta_data test
# cfg params # cfg params
$replica = 1 # max=3 $replica = 1 # max=3
$days = 10 $duration = 10
$keep = 365,365,365 $keep = 365,365,365
$rows_db = 1000 $rows_db = 1000
$cache = 16 # 16MB $cache = 16 # 16MB
...@@ -111,7 +111,7 @@ $ctime = 36000 # 10 hours ...@@ -111,7 +111,7 @@ $ctime = 36000 # 10 hours
$wal = 1 # valid value is 1, 2 $wal = 1 # valid value is 1, 2
$comp = 1 # max=32, automatically trimmed when exceeding $comp = 1 # max=32, automatically trimmed when exceeding
sql create database $db replica $replica days $days keep $keep maxrows $rows_db cache $cache blocks 4 ctime $ctime wal $wal comp $comp sql create database $db replica $replica duration $duration keep $keep maxrows $rows_db cache $cache blocks 4 ctime $ctime wal $wal comp $comp
sql show databases sql show databases
if $rows != 1 then if $rows != 1 then
return -1 return -1
...@@ -122,7 +122,7 @@ endi ...@@ -122,7 +122,7 @@ endi
if $data04 != $replica then if $data04 != $replica then
return -1 return -1
endi endi
if $data06 != $days then if $data06 != $duration then
return -1 return -1
endi endi
if $data07 != 365,365,365 then if $data07 != 365,365,365 then
......
...@@ -101,7 +101,7 @@ print db_already_exists test passed ...@@ -101,7 +101,7 @@ print db_already_exists test passed
print create_db.sim case5: db_meta_data test print create_db.sim case5: db_meta_data test
# cfg params # cfg params
$replica = 1 # max=3 $replica = 1 # max=3
$days = 10 $duration = 10
$keep = 365 $keep = 365
$rows_db = 1000 $rows_db = 1000
$cache = 16 # 16MB $cache = 16 # 16MB
...@@ -111,7 +111,7 @@ $ctime = 36000 # 10 hours ...@@ -111,7 +111,7 @@ $ctime = 36000 # 10 hours
$wal = 1 # valid value is 1, 2 $wal = 1 # valid value is 1, 2
$comp = 1 # max=32, automatically trimmed when exceeding $comp = 1 # max=32, automatically trimmed when exceeding
sql create database $db replica $replica days $days keep $keep maxrows $rows_db cache $cache blocks 4 ctime $ctime wal $wal comp $comp sql create database $db replica $replica duration $duration keep $keep maxrows $rows_db cache $cache blocks 4 ctime $ctime wal $wal comp $comp
sql show databases sql show databases
if $rows != 1 then if $rows != 1 then
return -1 return -1
...@@ -122,7 +122,7 @@ endi ...@@ -122,7 +122,7 @@ endi
if $data04 != $replica then if $data04 != $replica then
return -1 return -1
endi endi
if $data06 != $days then if $data06 != $duration then
return -1 return -1
endi endi
if $data07 != 365 then if $data07 != 365 then
......
...@@ -62,7 +62,7 @@ print ============= create database ...@@ -62,7 +62,7 @@ print ============= create database
# | PAGES value [64~16384, default: 256] # | PAGES value [64~16384, default: 256]
# | CACHELAST value [0, 1, 2, 3] # | CACHELAST value [0, 1, 2, 3]
# | FSYNC value [0 ~ 180000 ms] # | FSYNC value [0 ~ 180000 ms]
# | KEEP value [days, 365000] # | KEEP value [duration, 365000]
# | REPLICA value [1 | 3] # | REPLICA value [1 | 3]
# | WAL value [1 | 2] # | WAL value [1 | 2]
...@@ -92,7 +92,7 @@ endi ...@@ -92,7 +92,7 @@ endi
if $data5_db != no_strict then # strict if $data5_db != no_strict then # strict
return -1 return -1
endi endi
if $data6_db != 345600 then # days if $data6_db != 345600 then # duration
return -1 return -1
endi endi
if $data7_db != 1440000m,1440000m,1440000m then # keep if $data7_db != 1440000m,1440000m,1440000m then # keep
...@@ -222,11 +222,11 @@ sql_error alter database db replica 0 ...@@ -222,11 +222,11 @@ sql_error alter database db replica 0
#sql_error alter database db quorum 4 #sql_error alter database db quorum 4
#sql_error alter database db quorum 5 #sql_error alter database db quorum 5
#print ============== modify days #print ============== modify duration
sql_error alter database db days 480 sql_error alter database db duration 480
sql_error alter database db days 360 sql_error alter database db duration 360
sql_error alter database db days 0 sql_error alter database db duration 0
sql_error alter database db days 14400 # set over than keep sql_error alter database db duration 14400 # set over than keep
print ============== modify keep print ============== modify keep
sql alter database db keep 2400 sql alter database db keep 2400
......
...@@ -15,7 +15,7 @@ $tb = $tbPrefix . $i ...@@ -15,7 +15,7 @@ $tb = $tbPrefix . $i
print =============== step1 print =============== step1
# quorum presicion # quorum presicion
sql create database $db vgroups 8 replica 1 days 2 keep 10 minrows 80 maxrows 10000 wal 2 fsync 1000 comp 0 cachelast 2 precision 'us' sql create database $db vgroups 8 replica 1 duration 2 keep 10 minrows 80 maxrows 10000 wal 2 fsync 1000 comp 0 cachelast 2 precision 'us'
sql show databases sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
...@@ -66,7 +66,7 @@ print =============== step4 ...@@ -66,7 +66,7 @@ print =============== step4
sql_error drop database $db sql_error drop database $db
print =============== step5 print =============== step5
sql create database $db replica 1 days 15 keep 1500 sql create database $db replica 1 duration 15 keep 1500
sql show databases sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data20 != $db then if $data20 != $db then
......
...@@ -79,7 +79,7 @@ print ============= create database with all options ...@@ -79,7 +79,7 @@ print ============= create database with all options
#$data2_db : vgroups #$data2_db : vgroups
#$data3_db : ntables #$data3_db : ntables
#$data4_db : replica #$data4_db : replica
#$data6_db : days #$data6_db : duration
#$data7_db : keep #$data7_db : keep
#$data10_db : minrows #$data10_db : minrows
#$data11_db : maxrows #$data11_db : maxrows
...@@ -113,7 +113,7 @@ endi ...@@ -113,7 +113,7 @@ endi
if $data5_db != no_strict then # strict if $data5_db != no_strict then # strict
return -1 return -1
endi endi
if $data6_db != 14400 then # days if $data6_db != 14400 then # duration
return -1 return -1
endi endi
if $data7_db != 5256000m,5256000m,5256000m then # keep if $data7_db != 5256000m,5256000m,5256000m then # keep
......
...@@ -5,7 +5,7 @@ sleep 50 ...@@ -5,7 +5,7 @@ sleep 50
sql connect sql connect
print =============== create database print =============== create database
sql create database db days 300 keep 365000d,365000d,365000d sql create database db duration 300 keep 365000d,365000d,365000d
sql show databases sql show databases
if $rows != 3 then if $rows != 3 then
return -1 return -1
......
...@@ -5,7 +5,7 @@ sleep 500 ...@@ -5,7 +5,7 @@ sleep 500
sql connect sql connect
print =============== create database print =============== create database
sql create database d0 days 300 sql create database d0 duration 300
sql use d0 sql use d0
print =============== create super table and child table print =============== create super table and child table
......
...@@ -6,7 +6,7 @@ system sh/exec.sh -n dnode1 -s start ...@@ -6,7 +6,7 @@ system sh/exec.sh -n dnode1 -s start
sql connect sql connect
print ======== step1 print ======== step1
sql create database d1 replica 1 days 7 keep 50 sql create database d1 replica 1 duration 7 keep 50
sql use d1 sql use d1
sql create table tb (ts timestamp, a int) sql create table tb (ts timestamp, a int)
sql insert into tb values(now-28d, -28) sql insert into tb values(now-28d, -28)
......
...@@ -6,7 +6,7 @@ system sh/exec.sh -n dnode1 -s start ...@@ -6,7 +6,7 @@ system sh/exec.sh -n dnode1 -s start
sql connect sql connect
print ======== step1 print ======== step1
sql create database d1 replica 1 days 7 keep 50 sql create database d1 replica 1 duration 7 keep 50
sql use d1 sql use d1
sql create table tb (ts timestamp, a int) sql create table tb (ts timestamp, a int)
sql insert into tb values(now-30d, -28) sql insert into tb values(now-30d, -28)
......
...@@ -24,7 +24,7 @@ system sh/exec.sh -n dnode2 -s start ...@@ -24,7 +24,7 @@ system sh/exec.sh -n dnode2 -s start
sleep 2000 sleep 2000
print ======== step1 create db print ======== step1 create db
sql create database commitdb replica 1 days 7 keep 30 sql create database commitdb replica 1 duration 7 keep 30
sql use commitdb sql use commitdb
sql create table tb (ts timestamp, i int) sql create table tb (ts timestamp, i int)
......
...@@ -52,7 +52,7 @@ if $data4_2 != ready then ...@@ -52,7 +52,7 @@ if $data4_2 != ready then
goto step1 goto step1
endi endi
sql create database ir2db replica 2 days 7 sql create database ir2db replica 2 duration 7
sql use ir2db sql use ir2db
sql create table tb(ts timestamp, i bigint) sql create table tb(ts timestamp, i bigint)
......
...@@ -58,7 +58,7 @@ if $data4_3 != ready then ...@@ -58,7 +58,7 @@ if $data4_3 != ready then
goto step1 goto step1
endi endi
sql create database ir3db replica 3 days 7 sql create database ir3db replica 3 duration 7
sql use ir3db sql use ir3db
sql create table tb(ts timestamp, i bigint) sql create table tb(ts timestamp, i bigint)
......
...@@ -17,7 +17,7 @@ $db = $dbPrefix . $i ...@@ -17,7 +17,7 @@ $db = $dbPrefix . $i
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
print =============== step1 print =============== step1
sql create database $db replica 1 days 20 keep 2000 cache 16 sql create database $db replica 1 duration 20 keep 2000 cache 16
sql show databases sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data00 != $db then if $data00 != $db then
...@@ -57,7 +57,7 @@ print =============== step4 ...@@ -57,7 +57,7 @@ print =============== step4
sql_error drop database $db sql_error drop database $db
print =============== step5 print =============== step5
sql create database $db replica 1 days 15 keep 1500 sql create database $db replica 1 duration 15 keep 1500
sql show databases sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data00 != $db then if $data00 != $db then
......
...@@ -60,7 +60,7 @@ class TDTestCase: ...@@ -60,7 +60,7 @@ class TDTestCase:
def prepare_data(self): def prepare_data(self):
tdSql.execute("drop database if exists db ") tdSql.execute("drop database if exists db ")
tdSql.execute("create database if not exists db days 300") tdSql.execute("create database if not exists db duration 300")
tdSql.execute("use db") tdSql.execute("use db")
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
...@@ -63,7 +63,7 @@ class TDTestCase: ...@@ -63,7 +63,7 @@ class TDTestCase:
def prepare_data(self): def prepare_data(self):
tdSql.execute("drop database if exists db") tdSql.execute("drop database if exists db")
tdSql.execute("create database if not exists db replica 1 days 300") tdSql.execute("create database if not exists db replica 1 duration 300")
tdSql.execute("use db") tdSql.execute("use db")
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
...@@ -62,7 +62,7 @@ class TDTestCase: ...@@ -62,7 +62,7 @@ class TDTestCase:
def prepare_data(self): def prepare_data(self):
tdSql.execute("drop database if exists db ") tdSql.execute("drop database if exists db ")
tdSql.execute("create database if not exists db days 300") tdSql.execute("create database if not exists db duration 300")
tdSql.execute("use db") tdSql.execute("use db")
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
...@@ -59,7 +59,7 @@ class TDTestCase: ...@@ -59,7 +59,7 @@ class TDTestCase:
def prepare_data(self): def prepare_data(self):
tdSql.execute("drop database if exists db ") tdSql.execute("drop database if exists db ")
tdSql.execute("create database if not exists db days 300") tdSql.execute("create database if not exists db duration 300")
tdSql.execute("use db") tdSql.execute("use db")
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
...@@ -68,7 +68,7 @@ class TDTestCase: ...@@ -68,7 +68,7 @@ class TDTestCase:
def prepare_tag_datas(self): def prepare_tag_datas(self):
# prepare datas # prepare datas
tdSql.execute("create database if not exists testdb keep 3650 days 1000") tdSql.execute("create database if not exists testdb keep 3650 duration 1000")
tdSql.execute(" use testdb ") tdSql.execute(" use testdb ")
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
...@@ -628,7 +628,7 @@ class TDTestCase: ...@@ -628,7 +628,7 @@ class TDTestCase:
def basic_sample_query(self): def basic_sample_query(self):
tdSql.execute(" drop database if exists db ") tdSql.execute(" drop database if exists db ")
tdSql.execute(" create database if not exists db days 300 ") tdSql.execute(" create database if not exists db duration 300 ")
tdSql.execute(" use db ") tdSql.execute(" use db ")
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
...@@ -104,7 +104,7 @@ class TDTestCase: ...@@ -104,7 +104,7 @@ class TDTestCase:
tdSql.error("drop mnode on dnode 1;") tdSql.error("drop mnode on dnode 1;")
tdSql.execute("drop database if exists db") tdSql.execute("drop database if exists db")
tdSql.execute("create database if not exists db replica 1 days 300") tdSql.execute("create database if not exists db replica 1 duration 300")
tdSql.execute("use db") tdSql.execute("use db")
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
...@@ -104,7 +104,7 @@ class TDTestCase: ...@@ -104,7 +104,7 @@ class TDTestCase:
tdSql.error("drop mnode on dnode 1;") tdSql.error("drop mnode on dnode 1;")
tdSql.execute("drop database if exists db") tdSql.execute("drop database if exists db")
tdSql.execute("create database if not exists db replica 1 days 300") tdSql.execute("create database if not exists db replica 1 duration 300")
tdSql.execute("use db") tdSql.execute("use db")
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
...@@ -163,7 +163,7 @@ class TDTestCase: ...@@ -163,7 +163,7 @@ class TDTestCase:
# fisrt add data : db\stable\childtable\general table # fisrt add data : db\stable\childtable\general table
tdSql.execute("drop database if exists db2") tdSql.execute("drop database if exists db2")
tdSql.execute("create database if not exists db2 replica 1 days 300") tdSql.execute("create database if not exists db2 replica 1 duration 300")
tdSql.execute("use db2") tdSql.execute("use db2")
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
...@@ -53,7 +53,7 @@ class TDTestCase: ...@@ -53,7 +53,7 @@ class TDTestCase:
# fisrt add data : db\stable\childtable\general table # fisrt add data : db\stable\childtable\general table
for couti in count: for couti in count:
tdSql.execute("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti)
tdSql.execute("create database if not exists db%d replica 1 days 300" %couti) tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti)
tdSql.execute("use db%d" %couti) tdSql.execute("use db%d" %couti)
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
...@@ -53,7 +53,7 @@ class TDTestCase: ...@@ -53,7 +53,7 @@ class TDTestCase:
# fisrt add data : db\stable\childtable\general table # fisrt add data : db\stable\childtable\general table
for couti in count: for couti in count:
tdSql.execute("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti)
tdSql.execute("create database if not exists db%d replica 1 days 300" %couti) tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti)
tdSql.execute("use db%d" %couti) tdSql.execute("use db%d" %couti)
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
...@@ -54,7 +54,7 @@ class TDTestCase: ...@@ -54,7 +54,7 @@ class TDTestCase:
# fisrt add data : db\stable\childtable\general table # fisrt add data : db\stable\childtable\general table
for couti in count: for couti in count:
tdSql.execute("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti)
tdSql.execute("create database if not exists db%d replica 1 days 300" %couti) tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti)
tdSql.execute("use db%d" %couti) tdSql.execute("use db%d" %couti)
tdSql.execute( tdSql.execute(
'''create table stb1 '''create table stb1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册