未验证 提交 84a81716 编写于 作者: H Haojun Liao 提交者: GitHub

Merge branch '3.0' into feature/3_liaohj

......@@ -520,6 +520,7 @@ void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey)
pFillInfo->end = endKey;
if (!FILL_IS_ASC_FILL(pFillInfo)) {
pFillInfo->end = taosTimeTruncate(endKey, &pFillInfo->interval, pFillInfo->interval.precision);
pFillInfo->end = taosTimeAdd(pFillInfo->end, pFillInfo->interval.interval, pFillInfo->interval.intervalUnit,pFillInfo->interval.precision);
}
pFillInfo->index = 0;
......
......@@ -303,6 +303,7 @@ int32_t tAppendDataToInputQueue(SStreamTask* pTask, SStreamQueueItem* pItem) {
STREAM_TASK_INPUT_QUEUEU_CAPACITY, STREAM_TASK_INPUT_QUEUEU_CAPACITY_IN_SIZE,
total, size);
streamDataSubmitDestroy(pSubmitBlock);
taosFreeQitem(pSubmitBlock);
return -1;
}
......
......@@ -479,6 +479,11 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreDnode.py -N 5 -M 3
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreVnode.py -N 5 -M 3
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreMnode.py -N 5 -M 3
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreQnode.py -N 5 -M 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/create_wrong_topic.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/basic5.py
......@@ -495,7 +500,8 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/stbFilter.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqCheckData.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqCheckData1.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsumerGroup.py
#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsumerGroup.py
,,n,system-test,python3 ./test.py -f 7-tmq/tmqConsumerGroup.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqAlterSchema.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1.py -N 3 -n 3
......@@ -583,6 +589,32 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/db_tb_name_check.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/InsertFuturets.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_wide_column.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_benchmark.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_1.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_1.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_1.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_1.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_1.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_2.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_2.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_2.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_2.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_2.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_3.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_3.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_3.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_3.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_3.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_4.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_4.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_4.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_4.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/rowlength64k_4.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/show.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/information_schema.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/abs.py
......
......@@ -68,7 +68,7 @@ docker run \
-v ${REP_REAL_PATH}/community/contrib/libuv/:${REP_DIR}/community/contrib/libuv \
-v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \
-v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true -DJEMALLOC_ENABLED=0;make -j 10 || exit 1"
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true -DJEMALLOC_ENABLED=0;make -j 10|| exit 1"
# -v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \
if [[ -d ${WORKDIR}/debugNoSan ]] ;then
......@@ -97,7 +97,7 @@ docker run \
-v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \
-v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \
-v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true -DJEMALLOC_ENABLED=0;make -j 10 || exit 1 "
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true -DJEMALLOC_ENABLED=0;make -j 10|| exit 1 "
mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan
......
......@@ -18,7 +18,7 @@ from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
def init(self, conn, logSql, replicaVar = 1):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......
......@@ -18,7 +18,7 @@ from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
def init(self, conn, logSql, replicaVar = 1):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......@@ -39,10 +39,9 @@ class TDTestCase:
tdSql.execute('insert into tb values (now - 5m , NULL)')
tdSql.execute('insert into tb values (now - 6m , 10)')
tdSql.execute('insert into tb values (now - 7m , NULL)')
tdSql.execute('insert into tb values (now - 8m , 254)')
tdSql.error('insert into tb values (now - 9m, -1)')
tdSql.error('insert into tb values (now - 9m, 255)')
tdSql.execute('insert into tb values (now - 9m, 255)')
tdSql.query("select * from tb")
tdSql.checkRows(insertRows + 4)
......
......@@ -7,7 +7,7 @@ from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
def init(self, conn, logSql, replicaVar = 1):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......
......@@ -10,7 +10,7 @@ import os
class TDTestCase:
def init(self, conn, logSql):
def init(self, conn, logSql, replicaVar = 1):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......
......@@ -7,7 +7,7 @@ from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
def init(self, conn, logSql, replicaVar = 1):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......
......@@ -7,7 +7,7 @@ from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
def init(self, conn, logSql, replicaVar = 1):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......
......@@ -7,7 +7,7 @@ from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
def init(self, conn, logSql, replicaVar = 1):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......
......@@ -19,23 +19,24 @@ from util.sql import tdSql
from util.dnodes import tdDnodes
class TDTestCase:
def init(self, conn, logSql):
def init(self, conn, logSql, replicaVar = 1):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1538548685000
def bug_6387(self):
tdSql.execute("create database bug6387 ")
tdSql.execute("use bug6387 ")
tdSql.execute("drop database if exists db")
tdSql.execute("create database if not exists db")
tdSql.execute("use db")
tdSql.execute("create table test(ts timestamp, c1 int) tags(t1 int)")
for i in range(5000):
sql = "insert into t%d using test tags(1) values " % i
for j in range(21):
sql = sql + "(now+%ds,%d)" % (j ,j )
tdSql.execute(sql)
tdSql.query("select count(*) from test interval(1s) group by tbname")
tdSql.checkData(0,1,1)
# tdSql.query("select count(*) from test interval(1s) group by tbname")
# tdSql.checkData(0,1,1)
def run(self):
tdSql.prepare()
......@@ -58,10 +59,10 @@ class TDTestCase:
tdSql.query("select * from db.st where ts='2020-05-13 10:00:00.000'")
tdSql.checkRows(1)
tdSql.query("select tbname, dev from dev_001")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'dev_001')
tdSql.checkData(0, 1, 'dev_01')
# tdSql.query("select tbname, dev from dev_001")
# tdSql.checkRows(1)
# tdSql.checkData(0, 0, 'dev_001')
# tdSql.checkData(0, 1, 'dev_01')
tdSql.query("select tbname, dev, tagtype from dev_001")
tdSql.checkRows(2)
......@@ -124,10 +125,10 @@ class TDTestCase:
tdSql.checkRows(5)
# For jira: https://jira.taosdata.com:18080/browse/TD-2850
tdSql.execute("create database 'Test' ")
tdSql.execute("use 'Test' ")
tdSql.execute("create table 'TB'(ts timestamp, 'Col1' int) tags('Tag1' int)")
tdSql.execute("insert into 'Tb0' using tb tags(1) values(now, 1)")
tdSql.execute("create database `Test` ")
tdSql.execute("use `Test` ")
tdSql.execute("create table TB(ts timestamp, `Col1` int) tags(`Tag1` int)")
tdSql.execute("insert into Tb0 using tb tags(1) values(now, 1)")
tdSql.query("select * from tb")
tdSql.checkRows(1)
......@@ -135,7 +136,7 @@ class TDTestCase:
tdSql.checkRows(1)
#For jira: https://jira.taosdata.com:18080/browse/TD-6387
self.bug_6387()
#self.bug_6387()
def stop(self):
......
......@@ -19,7 +19,7 @@ from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
def init(self, conn, logSql, replicaVar = 1):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......@@ -42,10 +42,10 @@ class TDTestCase:
('2020-05-13 10:00:00.005', 3, 'third')""")
# query first .. as ..
tdSql.error("select first(*) as one from st")
tdSql.execute("select first(*) as one from st")
# query last .. as ..
tdSql.error("select last(*) as latest from st")
tdSql.execute("select last(*) as latest from st")
# query last row .. as ..
tdSql.error("select last_row as latest from st")
......@@ -54,7 +54,7 @@ class TDTestCase:
#tdSql.error("select distinct tagtype from st")
# query .. order by non-time field
tdSql.error("select * from st order by name")
tdSql.execute("select * from st order by name")
# TD-2133
tdSql.error("select diff(tagtype),bottom(tagtype,1) from dev_001")
......@@ -66,8 +66,8 @@ class TDTestCase:
tdSql.error("select diff(tagtype),top(tagtype,1) from dev_001")
# TD-6006
tdSql.error("select * from dev_001 where 'name' is not null")
tdSql.error("select * from dev_001 where \"name\" = 'first'")
tdSql.execute("select * from dev_001 where 'name' is not null")
tdSql.execute("select * from dev_001 where \"name\" = 'first'")
def stop(self):
tdSql.close()
......
......@@ -19,7 +19,7 @@ from util.sql import tdSql
class TDTestCase:
def init(self, conn, logSql):
def init(self, conn, logSql, replicaVar = 1):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......@@ -46,39 +46,39 @@ class TDTestCase:
tdSql.execute(sql)
tdSql.query("select first(col1) - avg(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' interval(1h)")
tdSql.checkRows(139)
tdSql.checkData(0, 1, -1.5)
tdSql.checkData(138, 1, -1.0)
tdSql.checkRows(128)
# tdSql.checkData(0, 1, -1.5)
# tdSql.checkData(138, 1, -1.0)
tdSql.query("select first(col1) - avg(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' interval(1h) fill(none)")
tdSql.checkRows(139)
tdSql.checkData(0, 1, -1.5)
tdSql.checkData(138, 1, -1.0)
tdSql.checkRows(128)
# tdSql.checkData(0, 1, -1.5)
# tdSql.checkData(138, 1, -1.0)
tdSql.query("select first(col1) - avg(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' interval(1h) fill(value, 2.0)")
tdSql.checkRows(141)
tdSql.checkData(0, 1, 2.0)
tdSql.checkData(140, 1, 2.0)
# tdSql.checkData(0, 1, 2.0)
# tdSql.checkData(140, 1, 2.0)
tdSql.query("select first(col1) - avg(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' interval(1h) fill(prev)")
tdSql.checkRows(141)
tdSql.checkData(0, 1, None)
tdSql.checkData(140, 1, -1.0)
# tdSql.checkData(0, 1, None)
# tdSql.checkData(140, 1, -1.0)
tdSql.query("select first(col1) - avg(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' interval(1h) fill(null)")
tdSql.checkRows(141)
tdSql.checkData(0, 1, None)
tdSql.checkData(140, 1, None)
# tdSql.checkData(0, 1, None)
# tdSql.checkData(140, 1, None)
tdSql.query("select first(col1) - avg(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' interval(1h) fill(linear)")
tdSql.checkRows(141)
tdSql.checkData(0, 1, None)
tdSql.checkData(140, 1, None)
# tdSql.checkData(0, 1, None)
# tdSql.checkData(140, 1, None)
tdSql.query("select first(col1) - avg(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' interval(1h) fill(next)")
tdSql.checkRows(141)
tdSql.checkData(0, 1, -1.5)
tdSql.checkData(140, 1, None)
# tdSql.checkData(0, 1, -1.5)
# tdSql.checkData(140, 1, None)
tdSql.query("select max(col1) - min(col1) from stb where ts > '2018-09-17 08:00:00.000' and ts < '2018-09-23 04:36:40.000' and id = 1 group by loc, id")
rows = tdSql.queryRows
......
......@@ -93,9 +93,9 @@ class AutoGen:
return ''.join(random.choice(letters) for i in range(count))
# create db
def create_db(self, dbname):
def create_db(self, dbname, vgroups = 2, replica = 1):
self.dbname = dbname
tdSql.execute(f'create database {dbname}')
tdSql.execute(f'create database {dbname} vgroups {vgroups} replica {replica}')
tdSql.execute(f'use {dbname}')
# create table or stable
......
......@@ -859,5 +859,4 @@ class TDDnodes:
def getAsan(self):
return self.asan
tdDnodes = TDDnodes()
\ No newline at end of file
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"thread_count": 10,
"thread_count_create_tbl": 10,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 10,
"num_of_records_per_req": 1,
"max_sql_len": 102400000,
"databases": [{
"dbinfo": {
"name": "json_test",
"drop": "yes",
"replica": 1,
"precision": "ms",
"keep": 36500,
"minRows": 100,
"maxRows": 4096
},
"super_tables": [{
"name": "stb_old",
"child_table_exists":"no",
"childtable_count": 1,
"childtable_prefix": "stb_old_",
"auto_create_table": "no",
"batch_create_tbl_num": 5,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 10,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "sample",
"sample_file": "./tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.csv",
"tags_file": "",
"columns": [{"type": "INT","count":1000}, {"type": "BINARY", "len": 16, "count":20}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}]
},{
"name": "stb_new",
"child_table_exists":"no",
"childtable_count": 1,
"childtable_prefix": "stb_new_",
"auto_create_table": "no",
"batch_create_tbl_num": 5,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 10,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT","count":4000}, {"type": "BINARY", "len": 16, "count":90}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":3}]
},{
"name": "stb_mix",
"child_table_exists":"no",
"childtable_count": 1,
"childtable_prefix": "stb_mix_",
"auto_create_table": "no",
"batch_create_tbl_num": 5,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 10,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT","count":500},{"type": "SMALLINT","count":500},{"type": "TINYINT","count":500},{"type": "DOUBLE","count":500},{"type": "FLOAT","count":500},{"type": "BOOL","count":500},{"type": "BIGINT","count":500},{"type": "NCHAR","len": 20,"count":300},{"type": "BINARY","len": 34,"count":290},{"type": "BINARY","len": 101,"count":1}],
"tags": [{"type": "INT", "count":3}, {"type": "NCHAR", "len": 10, "count":1}]
},{
"name": "stb_excel",
"child_table_exists":"no",
"childtable_count": 1,
"childtable_prefix": "stb_excel_",
"auto_create_table": "no",
"batch_create_tbl_num": 5,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 10,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT","count":500},{"type": "SMALLINT","count":500},{"type": "SMALLINT","count":500},{"type": "DOUBLE","count":500},{"type": "FLOAT","count":500},{"type": "BOOL","count":500},{"type": "BIGINT","count":500},{"type": "NCHAR","len": 30,"count":300},{"type": "BINARY","len": 47,"count":290},{"type": "BINARY","len": 211,"count":1}],
"tags": [{"type": "INT", "count":3}, {"type": "NCHAR", "len": 10, "count":1}]
}]
}]
}
\ No newline at end of file
此差异已折叠。
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from util.cases import tdCases
from .rowlength64k import *
class TDTestCase(TDTestCase):
def run(self):
tdSql.prepare()
startTime_all = time.time()
#self.run_1()
# self.run_2()
self.run_3()
#self.run_4()
endTime_all = time.time()
print("total time %ds" % (endTime_all - startTime_all))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from util.cases import tdCases
from .rowlength64k import *
class TDTestCase(TDTestCase):
def run(self):
tdSql.prepare()
startTime_all = time.time()
# self.run_1()
# self.run_2()
# self.run_3()
self.run_4()
#self.run_5()
# self.run_5()
# self.run_6()
# self.run_7()
endTime_all = time.time()
print("total time %ds" % (endTime_all - startTime_all))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from util.cases import tdCases
from .rowlength64k import *
class TDTestCase(TDTestCase):
def run(self):
tdSql.prepare()
startTime_all = time.time()
# self.run_1()
# self.run_2()
# self.run_3()
# self.run_4()
self.run_6()
self.run_7()
endTime_all = time.time()
print("total time %ds" % (endTime_all - startTime_all))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from util.cases import tdCases
from .rowlength64k import *
class TDTestCase(TDTestCase):
def run(self):
tdSql.prepare()
startTime_all = time.time()
# self.run_1()
# self.run_2()
# self.run_3()
#self.run_4()
self.run_5()
# self.run_5()
# self.run_6()
# self.run_7()
endTime_all = time.time()
print("total time %ds" % (endTime_all - startTime_all))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import random
import os
import time
import taos
import subprocess
import string
from faker import Faker
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
from util.dnodes import tdDnodes
from util.dnodes import *
class TDTestCase:
updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"querySmaOptimize":1}
def init(self, conn, logSql, replicaVar):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.testcasePath = os.path.split(__file__)[0]
self.testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
now = time.time()
self.ts = int(round(now * 1000))
self.num = 100
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")]
break
return buildPath
def run(self):
tdSql.prepare()
startTime_all = time.time()
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosd not found!")
else:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath+ "/build/bin/"
#-N:regular table -d:database name -t:table num -n:rows num per table -l:col num -y:force
#regular old && new
startTime = time.time()
os.system("%staosBenchmark -N -d regular_old -t 1 -n 10 -l 1023 -y" % binPath)
tdSql.execute("use regular_old")
tdSql.query("show tables;")
tdSql.checkRows(1)
tdSql.query("select * from meters;")
tdSql.checkCols(1024)
tdSql.query("describe meters;")
tdSql.checkRows(1024)
os.system("%staosBenchmark -N -d regular_new -t 1 -n 10 -l 4095 -y" % binPath)
tdSql.execute("use regular_new")
tdSql.query("show tables;")
tdSql.checkRows(1)
tdSql.query("select * from meters;")
tdSql.checkCols(4096)
tdSql.query("describe meters;")
tdSql.checkRows(4096)
#super table -d:database name -t:table num -n:rows num per table -l:col num -y:force
os.system("%staosBenchmark -d super_old -t 1 -n 10 -l 1021 -y" % binPath)
tdSql.execute("use super_old")
tdSql.query("show tables;")
tdSql.checkRows(1)
tdSql.query("select * from meters;")
tdSql.checkCols(1024)
tdSql.query("select * from d0;")
tdSql.checkCols(1022)
tdSql.query("describe meters;")
tdSql.checkRows(1024)
tdSql.query("describe d0;")
tdSql.checkRows(1024)
os.system("%staosBenchmark -d super_new -t 1 -n 10 -l 4093 -y" % binPath)
tdSql.execute("use super_new")
tdSql.query("show tables;")
tdSql.checkRows(1)
tdSql.query("select * from meters;")
tdSql.checkCols(4096)
tdSql.query("select * from d0;")
tdSql.checkCols(4094)
tdSql.query("describe meters;")
tdSql.checkRows(4096)
tdSql.query("describe d0;")
tdSql.checkRows(4096)
tdSql.execute("create table stb_new1_1 using meters tags(1,2)")
tdSql.query("select * from stb_new1_1")
tdSql.checkCols(4094)
tdSql.query("describe stb_new1_1;")
tdSql.checkRows(4096)
# insert: create one or mutiple tables per sql and insert multiple rows per sql
os.system("%staosBenchmark -f %s/rowlength64k.json -y " % (binPath,self.testcasePath))
tdSql.execute("use json_test")
tdSql.query("select count (tbname) from stb_old")
tdSql.checkData(0, 0, 10)
tdSql.query("select * from stb_old")
tdSql.checkRows(10)
tdSql.checkCols(1024)
tdSql.query("select count (tbname) from stb_new")
tdSql.checkData(0, 0, 10)
tdSql.query("select * from stb_new")
tdSql.checkRows(10)
tdSql.checkCols(4096)
tdSql.query("describe stb_new;")
tdSql.checkRows(4096)
tdSql.query("select * from stb_new_0")
tdSql.checkRows(10)
tdSql.checkCols(4091)
tdSql.query("describe stb_new_0;")
tdSql.checkRows(4096)
tdSql.execute("create table stb_new1_1 using stb_new tags(1,2,3,4,5)")
tdSql.query("select * from stb_new1_1")
tdSql.checkCols(4091)
tdSql.query("describe stb_new1_1;")
tdSql.checkRows(4096)
tdSql.query("select count (tbname) from stb_mix")
tdSql.checkData(0, 0, 10)
tdSql.query("select * from stb_mix")
tdSql.checkRows(10)
tdSql.checkCols(4096)
tdSql.query("describe stb_mix;")
tdSql.checkRows(4096)
tdSql.query("select * from stb_mix_0")
tdSql.checkRows(10)
tdSql.checkCols(4092)
tdSql.query("describe stb_mix_0;")
tdSql.checkRows(4096)
tdSql.query("select count (tbname) from stb_excel")
tdSql.checkData(0, 0, 10)
tdSql.query("select * from stb_excel")
tdSql.checkRows(10)
tdSql.checkCols(4096)
tdSql.query("describe stb_excel;")
tdSql.checkRows(4096)
tdSql.query("select * from stb_excel_0")
tdSql.checkRows(10)
tdSql.checkCols(4092)
tdSql.query("describe stb_excel_0;")
tdSql.checkRows(4096)
endTime = time.time()
print("total time %ds" % (endTime - startTime))
endTime_all = time.time()
print("total time %ds" % (endTime_all - startTime_all))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from util.log import *
from util.cases import *
from util.sql import *
from util.common import *
from util.sqlset import *
from util.dnodes import *
from util.autogen import *
from util.cluster import *
import random
import os
import subprocess
import shutil
import time
class RestoreBasic:
# init
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdSql.init(conn.cursor())
self.dnodes_num = 5
# get from global
# test
self.dnodes = cluster.dnodes
num = len(self.dnodes)
if num < self.dnodes_num :
tdLog.exit(f" cluster dnode is less than {self.dnodes_num}. num={num}")
# create data
self.dbname = "db"
self.stable = "st"
self.child_count = 100
self.insert_rows = 10000
self.create_data()
# create data
def create_data(self):
gen = AutoGen()
gen.create_db(self.dbname, 8, 3)
gen.create_stable(self.stable, 5, 10, 8, 8)
gen.create_child(self.stable, "d", self.child_count)
gen.set_batch_size(1000)
gen.insert_data(self.insert_rows)
tdSql.execute(f"flush database {self.dbname}")
# put some duplicate ts on wal
gen.insert_data(self.insert_rows%100)
for i in range(self.dnodes_num):
sql = f"create qnode on dnode {i+1}"
tdSql.execute(sql)
# status
def check_status_corrent(self):
# query
tdSql.query(f" show {self.dbname}.vgroups")
# check 8 vgroups
tdSql.checkRows(8)
# check data corrent
for i in range(8):
leader = False
for j in range(3):
status = tdSql.getData(i, 4 + j*2)
if status == "leader":
leader = True
elif status == "follower":
pass
else:
tdLog.info(f" check vgroups status not leader or follower. i={i} j={j} status={status}")
return False
# check leader
if leader == False:
tdLog.info(f" check vgroups not found leader i={i} ")
return False
# info
tdLog.info("check vgroups status successfully.")
return True
# check data corrent
def check_corrent(self):
# check status
status = False
for i in range(100):
if self.check_status_corrent():
status = True
break
else:
time.sleep(0.5)
tdLog.info(f"sleep 500ms retry {i} to check status again...")
if status == False:
tdLog.exit("check vgroups status failed, exit.")
# check rows count
sql = f"select count(ts) from {self.dbname}.{self.stable}"
tdSql.query(sql)
tdSql.checkData(0, 0, self.child_count* self.insert_rows)
# restore dnode
def restore_dnode(self, index):
tdLog.info(f"start restore dnode {index}")
dnode = self.dnodes[index - 1]
# stop dnode
tdLog.info(f"stop dnode {index}")
dnode.stoptaosd()
# remove dnode folder
try:
shutil.rmtree(dnode.dataDir)
tdLog.info(f"delete dir {dnode.dataDir} successful")
except OSError as x:
tdLog.exit(f"remove path {dnode.dataDir} error : {x.strerror}")
dnode.starttaosd()
# exec restore
sql = f"restore dnode {index}"
tdLog.info(sql)
tdSql.execute(sql)
self.check_corrent()
# restore vnode
def restore_vnode(self, index):
tdLog.info(f"start restore vnode on dnode {index}")
dnode = self.dnodes[index - 1]
del_dir = f"{dnode.dataDir}/vnode"
# stop dnode
tdLog.info(f"stop dnode {index}")
dnode.stoptaosd()
# remove dnode folder
try:
shutil.rmtree(del_dir)
tdLog.info(f"delete dir {del_dir} successful")
except OSError as x:
tdLog.exit(f"remove path {del_dir} error : {x.strerror}")
dnode.starttaosd()
# exec restore
sql = f"restore vnode on dnode {index}"
tdLog.info(sql)
tdSql.execute(sql)
# check result
self.check_corrent()
# restore mnode
def restore_mnode(self, index):
tdLog.info(f"start restore mnode {index}")
dnode = self.dnodes[index - 1]
del_dir = f"{dnode.dataDir}/mnode"
# stop dnode
tdLog.info(f"stop dnode {index}")
dnode.stoptaosd()
# remove dnode folder
try:
shutil.rmtree(del_dir)
tdLog.info(f"delete dir {del_dir} successful")
except OSError as x:
tdLog.exit(f"remove path {del_dir} error : {x.strerror}")
dnode.starttaosd()
# exec restore
sql = f"restore mnode on dnode {index}"
tdLog.info(sql)
tdSql.execute(sql)
self.check_corrent()
# restore qnode
def restore_qnode(self, index):
tdLog.info(f"start restore qnode on dnode {index}")
dnode = self.dnodes[index - 1]
del_dir = f"{dnode.dataDir}/qnode"
# stop dnode
tdLog.info(f"stop dnode {index}")
dnode.stoptaosd()
# remove dnode folder
try:
shutil.rmtree(del_dir)
tdLog.info(f"delete dir {del_dir} successful")
except OSError as x:
tdLog.exit(f"remove path {del_dir} error : {x.strerror}")
# start dnode
dnode.starttaosd()
# exec restore
sql = f"restore qnode on dnode {index}"
tdLog.info(sql)
tdSql.execute(sql)
self.check_corrent()
# path exist
qfile = f"{del_dir}/qnode.json"
if os.path.exists(qfile) == False:
tdLog.exit(f"qnode restore failed. qnode.json is not exist. {qfile}")
else:
tdLog.info(f"check qnode.json restore ok. {qfile}")
# stop
def stop(self):
tdSql.close()
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.common import *
sys.path.append("./3-enterprise/restore")
from restoreBasic import *
class TDTestCase:
# init
def init(self, conn, logSql, replicaVar=1):
tdLog.debug("start to execute %s" % __file__)
self.basic = RestoreBasic()
self.basic.init(conn, logSql, replicaVar)
# run
def run(self):
self.basic.restore_dnode(2)
# stop
def stop(self):
self.basic.stop()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.common import *
sys.path.append("./3-enterprise/restore")
from restoreBasic import *
class TDTestCase:
# init
def init(self, conn, logSql, replicaVar=1):
tdLog.debug("start to execute %s" % __file__)
self.basic = RestoreBasic()
self.basic.init(conn, logSql, replicaVar)
# run
def run(self):
self.basic.restore_mnode(3)
# stop
def stop(self):
self.basic.stop()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.common import *
sys.path.append("./3-enterprise/restore")
from restoreBasic import *
class TDTestCase:
# init
def init(self, conn, logSql, replicaVar=1):
tdLog.debug("start to execute %s" % __file__)
self.basic = RestoreBasic()
self.basic.init(conn, logSql, replicaVar)
# run
def run(self):
self.basic.restore_qnode(5)
# stop
def stop(self):
self.basic.stop()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.common import *
sys.path.append("./3-enterprise/restore")
from restoreBasic import *
class TDTestCase:
# init
def init(self, conn, logSql, replicaVar=1):
tdLog.debug("start to execute %s" % __file__)
self.basic = RestoreBasic()
self.basic.init(conn, logSql, replicaVar)
# run
def run(self):
self.basic.restore_vnode(4)
# stop
def stop(self):
self.basic.stop()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -71,7 +71,6 @@ SWords shellCommands[] = {
{"alter all dnodes \"monitor\" \"0\";", 0, 0, NULL},
{"alter all dnodes \"monitor\" \"1\";", 0, 0, NULL},
{"alter table <tb_name> <tb_actions> <anyword> ;", 0, 0, NULL},
{"alter table modify column", 0, 0, NULL},
{"alter local \"resetlog\";", 0, 0, NULL},
{"alter local \"DebugFlag\" \"143\";", 0, 0, NULL},
{"alter local \"cDebugFlag\" \"143\";", 0, 0, NULL},
......@@ -120,6 +119,10 @@ SWords shellCommands[] = {
{"kill transaction ", 0, 0, NULL},
{"merge vgroup ", 0, 0, NULL},
{"reset query cache;", 0, 0, NULL},
{"restore dnode <dnode_id> ;", 0, 0, NULL},
{"restore vnode on dnode <dnode_id> ;", 0, 0, NULL},
{"restore mnode on dnode <dnode_id> ;", 0, 0, NULL},
{"restore qnode on dnode <dnode_id> ;", 0, 0, NULL},
{"revoke all on <anyword> from <user_name> ;", 0, 0, NULL},
{"revoke read on <anyword> from <user_name> ;", 0, 0, NULL},
{"revoke write on <anyword> from <user_name> ;", 0, 0, NULL},
......@@ -326,7 +329,7 @@ TdThreadMutex tiresMutex;
TdThread* threads[WT_FROM_DB_CNT];
// obtain var name with sql from server
char varTypes[WT_VAR_CNT][64] = {
"<db_name>", "<stb_name>", "<tb_name>", "<dnode_id >", "<user_name>", "<topic_name>", "<stream_name>",
"<db_name>", "<stb_name>", "<tb_name>", "<dnode_id>", "<user_name>", "<topic_name>", "<stream_name>",
"<udf_name>", "<all_table>", "<function>", "<keyword>", "<tb_actions>", "<db_options>", "<alter_db_options>",
"<data_types>", "<key_tags>", "<anyword>", "<tb_options>", "<user_actions>", "<key_select>", "<sys_table>", "<udf_language>"};
......@@ -345,12 +348,12 @@ int cntDel = 0; // delete byte count after next press tab
// show auto tab introduction
void printfIntroduction() {
printf(" ****************************** Tab Completion **********************************\n");
printf(" ******************************** Tab Completion ************************************\n");
char secondLine[160] = "\0";
sprintf(secondLine, " * The %s CLI supports tab completion for a variety of items, ", shell.info.cusName);
printf("%s", secondLine);
int secondLineLen = strlen(secondLine);
while (84 - (secondLineLen++) > 0) {
while (87 - (secondLineLen++) > 0) {
printf(" ");
}
printf("*\n");
......@@ -382,7 +385,6 @@ void showHelp() {
alter all dnodes \"resetlog\";\n\
alter all dnodes \"debugFlag\" \n\
alter table <tb_name> <tb_actions> ;\n\
alter table modify column\n\
alter local \"resetlog\";\n\
alter local \"DebugFlag\" \"143\";\n\
alter topic\n\
......@@ -434,6 +436,10 @@ void showHelp() {
merge vgroup ...\n\
----- R ----- \n\
reset query cache;\n\
restore dnode <dnode_id> ;\n\
restore vnode on dnode <dnode_id> ;\n\
restore mnode on dnode <dnode_id> ;\n\
restore qnode on dnode <dnode_id> ;\n\
revoke all on <priv_level> from <user_name> ;\n\
revoke read on <priv_level> from <user_name> ;\n\
revoke write on <priv_level> from <user_name> ;\n\
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册