parent
aa80815f2d
commit
7c66719128
|
@ -78,5 +78,6 @@ class TDTestCase:
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success("%s successfully executed" % __file__)
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
tdCases.addWindows(__file__, TDTestCase())
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
tdCases.addLinux(__file__, TDTestCase())
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
|
|
@ -40,6 +40,9 @@ class TDTestCase:
|
||||||
ret = tdSql.query('select server_status() as result')
|
ret = tdSql.query('select server_status() as result')
|
||||||
tdSql.checkData(0, 0, 1)
|
tdSql.checkData(0, 0, 1)
|
||||||
|
|
||||||
|
ret = tdSql.execute('alter dnode 127.0.0.1 debugFlag 135')
|
||||||
|
tdLog.info("alter dnode ret: %d" % ret)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success("%s successfully executed" % __file__)
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
ulimit -c unlimited
|
ulimit -c unlimited
|
||||||
|
|
||||||
python3 ./test.py -f client/client.py
|
|
||||||
python3 ./test.py -f insert/basic.py
|
python3 ./test.py -f insert/basic.py
|
||||||
python3 ./test.py -f insert/int.py
|
python3 ./test.py -f insert/int.py
|
||||||
python3 ./test.py -f insert/float.py
|
python3 ./test.py -f insert/float.py
|
||||||
|
@ -151,3 +150,6 @@ python3 ./test.py -f stream/stream2.py
|
||||||
|
|
||||||
#alter table
|
#alter table
|
||||||
python3 ./test.py -f alter/alter_table_crash.py
|
python3 ./test.py -f alter/alter_table_crash.py
|
||||||
|
|
||||||
|
# client
|
||||||
|
python3 ./test.py -f client/client.py
|
||||||
|
|
|
@ -75,6 +75,7 @@ class DBWriteNonStop:
|
||||||
self.cursor.close()
|
self.cursor.close()
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
|
|
||||||
|
|
||||||
test = DBWriteNonStop()
|
test = DBWriteNonStop()
|
||||||
test.connectDB()
|
test.connectDB()
|
||||||
test.createTable()
|
test.createTable()
|
||||||
|
|
|
@ -89,16 +89,24 @@ class TDTestCase:
|
||||||
tdSql.checkRows(101)
|
tdSql.checkRows(101)
|
||||||
|
|
||||||
# range for int type on column
|
# range for int type on column
|
||||||
tdSql.query("select * from st%s where num > 50 and num < 100" % curType)
|
tdSql.query(
|
||||||
|
"select * from st%s where num > 50 and num < 100" %
|
||||||
|
curType)
|
||||||
tdSql.checkRows(49)
|
tdSql.checkRows(49)
|
||||||
|
|
||||||
tdSql.query("select * from st%s where num >= 50 and num < 100" % curType)
|
tdSql.query(
|
||||||
|
"select * from st%s where num >= 50 and num < 100" %
|
||||||
|
curType)
|
||||||
tdSql.checkRows(50)
|
tdSql.checkRows(50)
|
||||||
|
|
||||||
tdSql.query("select * from st%s where num > 50 and num <= 100" % curType)
|
tdSql.query(
|
||||||
|
"select * from st%s where num > 50 and num <= 100" %
|
||||||
|
curType)
|
||||||
tdSql.checkRows(50)
|
tdSql.checkRows(50)
|
||||||
|
|
||||||
tdSql.query("select * from st%s where num >= 50 and num <= 100" % curType)
|
tdSql.query(
|
||||||
|
"select * from st%s where num >= 50 and num <= 100" %
|
||||||
|
curType)
|
||||||
tdSql.checkRows(51)
|
tdSql.checkRows(51)
|
||||||
|
|
||||||
# > for int type on tag
|
# > for int type on tag
|
||||||
|
@ -137,13 +145,19 @@ class TDTestCase:
|
||||||
tdSql.query("select * from st%s where id > 5 and id < 7" % curType)
|
tdSql.query("select * from st%s where id > 5 and id < 7" % curType)
|
||||||
tdSql.checkRows(10)
|
tdSql.checkRows(10)
|
||||||
|
|
||||||
tdSql.query("select * from st%s where id >= 5 and id < 7" % curType)
|
tdSql.query(
|
||||||
|
"select * from st%s where id >= 5 and id < 7" %
|
||||||
|
curType)
|
||||||
tdSql.checkRows(20)
|
tdSql.checkRows(20)
|
||||||
|
|
||||||
tdSql.query("select * from st%s where id > 5 and id <= 7" % curType)
|
tdSql.query(
|
||||||
|
"select * from st%s where id > 5 and id <= 7" %
|
||||||
|
curType)
|
||||||
tdSql.checkRows(20)
|
tdSql.checkRows(20)
|
||||||
|
|
||||||
tdSql.query("select * from st%s where id >= 5 and id <= 7" % curType)
|
tdSql.query(
|
||||||
|
"select * from st%s where id >= 5 and id <= 7" %
|
||||||
|
curType)
|
||||||
tdSql.checkRows(30)
|
tdSql.checkRows(30)
|
||||||
|
|
||||||
print(
|
print(
|
||||||
|
|
|
@ -68,13 +68,61 @@ class MetadataQuery:
|
||||||
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
|
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
|
||||||
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
|
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
|
||||||
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')''' %
|
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')''' %
|
||||||
(base + i + 1,
|
(base + i + 1, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100,
|
100, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100,
|
10000, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100,
|
1000000, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100,
|
100000000, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100,
|
100 * 1.1, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100))
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
10000, (base + i) %
|
||||||
|
1000000, (base + i) %
|
||||||
|
100000000, (base + i) %
|
||||||
|
100 * 1.1, (base + i) %
|
||||||
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
10000, (base + i) %
|
||||||
|
1000000, (base + i) %
|
||||||
|
100000000, (base + i) %
|
||||||
|
100 * 1.1, (base + i) %
|
||||||
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
10000, (base + i) %
|
||||||
|
1000000, (base + i) %
|
||||||
|
100000000, (base + i) %
|
||||||
|
100 * 1.1, (base + i) %
|
||||||
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
10000, (base + i) %
|
||||||
|
1000000, (base + i) %
|
||||||
|
100000000, (base + i) %
|
||||||
|
100 * 1.1, (base + i) %
|
||||||
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
10000, (base + i) %
|
||||||
|
1000000, (base + i) %
|
||||||
|
100000000, (base + i) %
|
||||||
|
100 * 1.1, (base + i) %
|
||||||
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100))
|
||||||
|
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"insert into t%d values(%d, 1) (%d, 2) (%d, 3) (%d, 4) (%d, 5)" %
|
"insert into t%d values(%d, 1) (%d, 2) (%d, 3) (%d, 4) (%d, 5)" %
|
||||||
|
|
|
@ -19,6 +19,7 @@ import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
class MyThread(threading.Thread):
|
class MyThread(threading.Thread):
|
||||||
|
|
||||||
def __init__(self, func, args=()):
|
def __init__(self, func, args=()):
|
||||||
|
@ -35,6 +36,7 @@ class MyThread(threading.Thread):
|
||||||
except Exception:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class MetadataQuery:
|
class MetadataQuery:
|
||||||
def initConnection(self):
|
def initConnection(self):
|
||||||
self.tables = 100
|
self.tables = 100
|
||||||
|
@ -45,7 +47,12 @@ class MetadataQuery:
|
||||||
self.user = "root"
|
self.user = "root"
|
||||||
self.password = "taosdata"
|
self.password = "taosdata"
|
||||||
self.config = "/etc/taos"
|
self.config = "/etc/taos"
|
||||||
self.conn = taos.connect( self.host, self.user, self.password, self.config)
|
self.conn = taos.connect(
|
||||||
|
self.host,
|
||||||
|
self.user,
|
||||||
|
self.password,
|
||||||
|
self.config)
|
||||||
|
|
||||||
def connectDB(self):
|
def connectDB(self):
|
||||||
return self.conn.cursor()
|
return self.conn.cursor()
|
||||||
|
|
||||||
|
@ -79,18 +86,67 @@ class MetadataQuery:
|
||||||
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
|
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
|
||||||
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
|
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
|
||||||
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')''' %
|
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')''' %
|
||||||
(base + i + 1,
|
(base + i + 1, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100,
|
100, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100,
|
10000, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100,
|
1000000, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100,
|
100000000, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100,
|
100 * 1.1, (base + i) %
|
||||||
(base + i) %100, (base + i) %10000, (base + i) %1000000, (base + i) %100000000, (base + i) %100 * 1.1, (base + i) %100 * 2.3, (base + i) %2, (base + i) %100, (base + i) %100))
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
10000, (base + i) %
|
||||||
|
1000000, (base + i) %
|
||||||
|
100000000, (base + i) %
|
||||||
|
100 * 1.1, (base + i) %
|
||||||
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
10000, (base + i) %
|
||||||
|
1000000, (base + i) %
|
||||||
|
100000000, (base + i) %
|
||||||
|
100 * 1.1, (base + i) %
|
||||||
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
10000, (base + i) %
|
||||||
|
1000000, (base + i) %
|
||||||
|
100000000, (base + i) %
|
||||||
|
100 * 1.1, (base + i) %
|
||||||
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
10000, (base + i) %
|
||||||
|
1000000, (base + i) %
|
||||||
|
100000000, (base + i) %
|
||||||
|
100 * 1.1, (base + i) %
|
||||||
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
10000, (base + i) %
|
||||||
|
1000000, (base + i) %
|
||||||
|
100000000, (base + i) %
|
||||||
|
100 * 1.1, (base + i) %
|
||||||
|
100 * 2.3, (base + i) %
|
||||||
|
2, (base + i) %
|
||||||
|
100, (base + i) %
|
||||||
|
100))
|
||||||
for j in range(self.records):
|
for j in range(self.records):
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"insert into t%d values(%d, %d)" %
|
"insert into t%d values(%d, %d)" %
|
||||||
(base + i + 1, self.ts + j, j))
|
(base + i + 1, self.ts + j, j))
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
def queryWithTagId(self, threadId, tagId, queryNum):
|
def queryWithTagId(self, threadId, tagId, queryNum):
|
||||||
print("---------thread%d start-----------" % threadId)
|
print("---------thread%d start-----------" % threadId)
|
||||||
query = '''select tgcol1, tgcol2, tgcol3, tgcol4, tgcol5, tgcol6, tgcol7, tgcol8, tgcol9,
|
query = '''select tgcol1, tgcol2, tgcol3, tgcol4, tgcol5, tgcol6, tgcol7, tgcol8, tgcol9,
|
||||||
|
@ -110,6 +166,7 @@ class MetadataQuery:
|
||||||
latancy.append((time.time() - startTime))
|
latancy.append((time.time() - startTime))
|
||||||
print("---------thread%d end-----------" % threadId)
|
print("---------thread%d end-----------" % threadId)
|
||||||
return latancy
|
return latancy
|
||||||
|
|
||||||
def queryData(self, query):
|
def queryData(self, query):
|
||||||
cursor = self.connectDB()
|
cursor = self.connectDB()
|
||||||
cursor.execute("use test")
|
cursor.execute("use test")
|
||||||
|
@ -144,6 +201,21 @@ if __name__ == '__main__':
|
||||||
threads[i].join()
|
threads[i].join()
|
||||||
latancys.extend(threads[i].get_result())
|
latancys.extend(threads[i].get_result())
|
||||||
print("Total query: %d" % (queryNum * t.numOfTherads))
|
print("Total query: %d" % (queryNum * t.numOfTherads))
|
||||||
print("statistic(s): mean= %f, P50 = %f, P75 = %f, P95 = %f, P99 = %f"
|
print(
|
||||||
%(sum(latancys)/(queryNum * t.numOfTherads), np.percentile(latancys, 50), np.percentile(latancys, 75), np.percentile(latancys, 95), np.percentile(latancys, 99)))
|
"statistic(s): mean= %f, P50 = %f, P75 = %f, P95 = %f, P99 = %f" %
|
||||||
|
(sum(latancys) /
|
||||||
|
(
|
||||||
|
queryNum *
|
||||||
|
t.numOfTherads),
|
||||||
|
np.percentile(
|
||||||
|
latancys,
|
||||||
|
50),
|
||||||
|
np.percentile(
|
||||||
|
latancys,
|
||||||
|
75),
|
||||||
|
np.percentile(
|
||||||
|
latancys,
|
||||||
|
95),
|
||||||
|
np.percentile(
|
||||||
|
latancys,
|
||||||
|
99)))
|
||||||
|
|
|
@ -23,7 +23,6 @@ class TDTestCase:
|
||||||
tdLog.debug("start to execute %s" % __file__)
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
tdSql.init(conn.cursor())
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
|
||||||
self.rowNum = 5000
|
self.rowNum = 5000
|
||||||
self.ts = 1537146000000
|
self.ts = 1537146000000
|
||||||
|
|
||||||
|
@ -36,7 +35,9 @@ class TDTestCase:
|
||||||
"create table t1 using st tags('dev_001')")
|
"create table t1 using st tags('dev_001')")
|
||||||
|
|
||||||
for i in range(self.rowNum):
|
for i in range(self.rowNum):
|
||||||
tdSql.execute("insert into t1 values(%d, 'taosdata%d', %d)" % (self.ts + i, i + 1, i + 1))
|
tdSql.execute(
|
||||||
|
"insert into t1 values(%d, 'taosdata%d', %d)" %
|
||||||
|
(self.ts + i, i + 1, i + 1))
|
||||||
|
|
||||||
tdSql.query("select last(*) from st")
|
tdSql.query("select last(*) from st")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
|
|
@ -330,7 +330,6 @@ class Test (Thread):
|
||||||
self.q.put(-1)
|
self.q.put(-1)
|
||||||
tdLog.exit("second thread failed, first thread exit too")
|
tdLog.exit("second thread failed, first thread exit too")
|
||||||
|
|
||||||
|
|
||||||
elif (self.threadId == 2):
|
elif (self.threadId == 2):
|
||||||
while True:
|
while True:
|
||||||
self.dbEvent.wait()
|
self.dbEvent.wait()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
ulimit -c unlimited
|
ulimit -c unlimited
|
||||||
|
|
||||||
python3 ./test.py -f client/client.py
|
|
||||||
python3 ./test.py -f insert/basic.py
|
python3 ./test.py -f insert/basic.py
|
||||||
python3 ./test.py -f insert/int.py
|
python3 ./test.py -f insert/int.py
|
||||||
python3 ./test.py -f insert/float.py
|
python3 ./test.py -f insert/float.py
|
||||||
|
@ -146,4 +145,5 @@ python3 ./test.py -f stream/stream2.py
|
||||||
#alter table
|
#alter table
|
||||||
python3 ./test.py -f alter/alter_table_crash.py
|
python3 ./test.py -f alter/alter_table_crash.py
|
||||||
|
|
||||||
|
# client
|
||||||
|
python3 ./test.py -f client/client.py
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
ulimit -c unlimited
|
ulimit -c unlimited
|
||||||
|
|
||||||
# client
|
|
||||||
python3 ./test.py $1 -f client/client.py
|
|
||||||
python3 ./test.py $1 -s && sleep 1
|
|
||||||
|
|
||||||
# insert
|
# insert
|
||||||
python3 ./test.py $1 -f insert/basic.py
|
python3 ./test.py $1 -f insert/basic.py
|
||||||
python3 ./test.py $1 -s && sleep 1
|
python3 ./test.py $1 -s && sleep 1
|
||||||
|
@ -35,3 +31,7 @@ python3 ./test.py $1 -s && sleep 1
|
||||||
python3 ./test.py $1 -f query/filter.py
|
python3 ./test.py $1 -f query/filter.py
|
||||||
python3 ./test.py $1 -s && sleep 1
|
python3 ./test.py $1 -s && sleep 1
|
||||||
|
|
||||||
|
# client
|
||||||
|
python3 ./test.py $1 -f client/client.py
|
||||||
|
python3 ./test.py $1 -s && sleep 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue