Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
王长生-AnH
TDengine
提交
35f5a204
T
TDengine
项目概览
王长生-AnH
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
35f5a204
编写于
5月 15, 2020
作者:
S
Shuduo Sang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
read boundary value from taosdef.h
上级
9e031188
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
470 addition
and
5 deletion
+470
-5
tests/pytest/dbmgmt/__init__.py
tests/pytest/dbmgmt/__init__.py
+0
-0
tests/pytest/dbmgmt/createTableAndDropDnodes.py
tests/pytest/dbmgmt/createTableAndDropDnodes.py
+151
-0
tests/pytest/dbmgmt/createTableAndKillDnodes.py
tests/pytest/dbmgmt/createTableAndKillDnodes.py
+172
-0
tests/pytest/dbmgmt/database-name-boundary.py
tests/pytest/dbmgmt/database-name-boundary.py
+70
-0
tests/pytest/dbmgmt/dropDB_memory_test.py
tests/pytest/dbmgmt/dropDB_memory_test.py
+67
-0
tests/pytest/table/tablename-boundary.py
tests/pytest/table/tablename-boundary.py
+5
-1
tests/pytest/tag_lite/create-tags-boundary.py
tests/pytest/tag_lite/create-tags-boundary.py
+5
-2
tests/pytest/test.py
tests/pytest/test.py
+0
-2
未找到文件。
tests/pytest/dbmgmt/__init__.py
0 → 100644
浏览文件 @
35f5a204
tests/pytest/dbmgmt/createTableAndDropDnodes.py
0 → 100644
浏览文件 @
35f5a204
# -*- coding: utf-8 -*-
import
sys
import
taos
import
threading
import
traceback
import
random
import
datetime
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
info
(
"prepare cluster"
)
tdDnodes
.
stopAll
()
tdDnodes
.
deploy
(
1
)
tdDnodes
.
start
(
1
)
self
.
conn
=
taos
.
connect
(
config
=
tdDnodes
.
getSimCfgPath
())
tdSql
.
init
(
self
.
conn
.
cursor
())
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
execute
(
'create dnode 192.168.0.2'
)
tdDnodes
.
deploy
(
2
)
tdDnodes
.
start
(
2
)
tdSql
.
execute
(
'create dnode 192.168.0.3'
)
tdDnodes
.
deploy
(
3
)
tdDnodes
.
start
(
3
)
time
.
sleep
(
3
)
self
.
db
=
"db"
self
.
stb
=
"stb"
self
.
tbPrefix
=
"tb"
self
.
tbNum
=
100000
self
.
count
=
0
# self.conn = taos.connect(config=tdDnodes.getSimCfgPath())
self
.
threadNum
=
1
# threadLock = threading.Lock()
# global counter for number of tables created by all threads
self
.
global_counter
=
0
tdSql
.
init
(
self
.
conn
.
cursor
())
def
_createTable
(
self
,
threadId
):
print
(
"Thread%d : createTable"
%
(
threadId
))
conn
=
taos
.
connect
(
config
=
tdDnodes
.
getSimCfgPath
())
cursor
=
conn
.
cursor
()
i
=
0
try
:
sql
=
"use %s"
%
(
self
.
db
)
cursor
.
execute
(
sql
)
while
i
<
self
.
tbNum
:
if
(
i
%
self
.
threadNum
==
threadId
):
cursor
.
execute
(
"create table tb%d using %s tags(%d)"
%
(
i
+
1
,
self
.
stb
,
i
+
1
))
with
threading
.
Lock
():
self
.
global_counter
+=
1
i
+=
1
except
Exception
as
e
:
tdLog
.
info
(
"Failure when creating table tb%d, exception: %s"
%
(
i
+
1
,
str
(
e
)))
finally
:
cursor
.
close
()
conn
.
close
()
def
_interfereDnodes
(
self
,
threadId
,
dnodeId
):
conn
=
taos
.
connect
(
config
=
tdDnodes
.
getSimCfgPath
())
cursor
=
conn
.
cursor
()
# interfere dnode while creating table
print
(
"Thread%d to interfere dnode%d"
%
(
threadId
,
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.05
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"drop dnode 192.168.0.%d"
%
(
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.15
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"create dnode 192.168.0.%d"
%
(
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.35
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"drop dnode 192.168.0.%d"
%
(
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.45
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"create dnode 192.168.0.%d"
%
(
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.65
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"drop dnode 192.168.0.%d"
%
(
dnodeId
))
while
self
.
global_counter
<
self
.
tbNum
*
0.85
:
time
.
sleep
(
0.2
)
cursor
.
execute
(
"create dnode 192.168.0.%d"
%
(
dnodeId
))
def
run
(
self
):
tdLog
.
info
(
"================= creating database with replica 2"
)
threadId
=
0
threads
=
[]
try
:
tdSql
.
execute
(
"drop database if exists %s"
%
(
self
.
db
))
tdSql
.
execute
(
"create database %s replica 2 cache 2048 ablocks 2.0 tblocks 10 tables 2000"
%
(
self
.
db
))
tdLog
.
sleep
(
3
)
tdSql
.
execute
(
"use %s"
%
(
self
.
db
))
tdSql
.
execute
(
"create table %s (ts timestamp, c1 bigint, stime timestamp) tags(tg1 bigint)"
%
(
self
.
stb
))
tdLog
.
info
(
"Start to create tables"
)
while
threadId
<
self
.
threadNum
:
tdLog
.
info
(
"Thread-%d starts to create tables"
%
(
threadId
))
cThread
=
threading
.
Thread
(
target
=
self
.
_createTable
,
name
=
"thread-%d"
%
(
threadId
),
args
=
(
threadId
,
))
cThread
.
start
()
threads
.
append
(
cThread
)
threadId
+=
1
except
Exception
as
e
:
tdLog
.
info
(
"Failed to create tb%d, exception: %s"
%
(
i
,
str
(
e
)))
# tdDnodes.stopAll()
finally
:
time
.
sleep
(
1
)
threading
.
Thread
(
target
=
self
.
_interfereDnodes
,
name
=
"thread-interfereDnode%d"
%
(
3
),
args
=
(
1
,
3
,
)).
start
()
for
t
in
range
(
len
(
threads
)):
tdLog
.
info
(
"Join threads"
)
# threads[t].start()
threads
[
t
].
join
()
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
self
.
tbNum
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addCluster
(
__file__
,
TDTestCase
())
tests/pytest/dbmgmt/createTableAndKillDnodes.py
0 → 100644
浏览文件 @
35f5a204
# -*- coding: utf-8 -*-
import
sys
import
taos
import
threading
import
traceback
import
random
import
datetime
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
info
(
"prepare cluster"
)
tdDnodes
.
stopAll
()
tdDnodes
.
deploy
(
1
)
tdDnodes
.
start
(
1
)
self
.
conn
=
taos
.
connect
(
config
=
tdDnodes
.
getSimCfgPath
())
tdSql
.
init
(
self
.
conn
.
cursor
())
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
execute
(
'create dnode 192.168.0.2'
)
tdDnodes
.
deploy
(
2
)
tdDnodes
.
start
(
2
)
tdSql
.
execute
(
'create dnode 192.168.0.3'
)
tdDnodes
.
deploy
(
3
)
tdDnodes
.
start
(
3
)
time
.
sleep
(
3
)
self
.
db
=
"db"
self
.
stb
=
"stb"
self
.
tbPrefix
=
"tb"
self
.
tbNum
=
100000
self
.
count
=
0
# self.conn = taos.connect(config=tdDnodes.getSimCfgPath())
self
.
threadNum
=
1
# threadLock = threading.Lock()
# global counter for number of tables created by all threads
self
.
global_counter
=
0
tdSql
.
init
(
self
.
conn
.
cursor
())
def
_createTable
(
self
,
threadId
):
print
(
"Thread%d : createTable"
%
(
threadId
))
conn
=
taos
.
connect
(
config
=
tdDnodes
.
getSimCfgPath
())
cursor
=
conn
.
cursor
()
i
=
0
try
:
sql
=
"use %s"
%
(
self
.
db
)
cursor
.
execute
(
sql
)
while
i
<
self
.
tbNum
:
if
(
i
%
self
.
threadNum
==
threadId
):
cursor
.
execute
(
"create table tb%d using %s tags(%d)"
%
(
i
+
1
,
self
.
stb
,
i
+
1
))
with
threading
.
Lock
():
self
.
global_counter
+=
1
time
.
sleep
(
0.01
)
i
+=
1
except
Exception
as
e
:
tdLog
.
info
(
"Failure when creating table tb%d, exception: %s"
%
(
i
+
1
,
str
(
e
)))
finally
:
cursor
.
close
()
conn
.
close
()
def
_interfereDnodes
(
self
,
threadId
,
dnodeId
):
# interfere dnode while creating table
print
(
"Thread%d to interfere dnode%d"
%
(
threadId
,
dnodeId
))
percent
=
0.05
loop
=
int
(
1
/
(
2
*
percent
))
for
t
in
range
(
1
,
loop
):
while
self
.
global_counter
<
self
.
tbNum
*
(
t
*
percent
):
time
.
sleep
(
0.2
)
tdDnodes
.
forcestop
(
dnodeId
)
while
self
.
global_counter
<
self
.
tbNum
*
((
t
+
1
)
*
percent
):
time
.
sleep
(
0.2
)
tdDnodes
.
start
(
dnodeId
)
# while self.global_counter < self.tbNum * 0.05:
# time.sleep(0.2)
# tdDnodes.forcestop(dnodeId)
# while self.global_counter < self.tbNum * 0.10:
# time.sleep(0.2)
# tdDnodes.start(dnodeId)
# while self.global_counter < self.tbNum * 0.15:
# time.sleep(0.2)
# tdDnodes.forcestop(dnodeId)
# while self.global_counter < self.tbNum * 0.20:
# time.sleep(0.2)
# tdDnodes.start(dnodeId)
# while self.global_counter < self.tbNum * 0.25:
# time.sleep(0.2)
# tdDnodes.forcestop(dnodeId)
# while self.global_counter < self.tbNum * 0.30:
# time.sleep(0.2)
# tdDnodes.start(dnodeId)
# while self.global_counter < self.tbNum * 0.35:
# time.sleep(0.2)
# tdDnodes.forcestop(dnodeId)
# while self.global_counter < self.tbNum * 0.40:
# time.sleep(0.2)
# tdDnodes.start(dnodeId)
# while self.global_counter < self.tbNum * 0.45:
# time.sleep(0.2)
# tdDnodes.forcestop(dnodeId)
# while self.global_counter < self.tbNum * 0.50:
# time.sleep(0.2)
# tdDnodes.start(dnodeId)
def
run
(
self
):
tdLog
.
info
(
"================= creating database with replica 2"
)
threadId
=
0
threads
=
[]
try
:
tdSql
.
execute
(
"drop database if exists %s"
%
(
self
.
db
))
tdSql
.
execute
(
"create database %s replica 2 cache 1024 ablocks 2.0 tblocks 4 tables 1000"
%
(
self
.
db
))
tdLog
.
sleep
(
3
)
tdSql
.
execute
(
"use %s"
%
(
self
.
db
))
tdSql
.
execute
(
"create table %s (ts timestamp, c1 bigint, stime timestamp) tags(tg1 bigint)"
%
(
self
.
stb
))
tdLog
.
info
(
"Start to create tables"
)
while
threadId
<
self
.
threadNum
:
tdLog
.
info
(
"Thread-%d starts to create tables"
%
(
threadId
))
cThread
=
threading
.
Thread
(
target
=
self
.
_createTable
,
name
=
"thread-%d"
%
(
threadId
),
args
=
(
threadId
,
))
cThread
.
start
()
threads
.
append
(
cThread
)
threadId
+=
1
except
Exception
as
e
:
tdLog
.
info
(
"Failed to create tb%d, exception: %s"
%
(
i
,
str
(
e
)))
# tdDnodes.stopAll()
finally
:
time
.
sleep
(
1
)
threading
.
Thread
(
target
=
self
.
_interfereDnodes
,
name
=
"thread-interfereDnode%d"
%
(
3
),
args
=
(
1
,
3
,
)).
start
()
for
t
in
range
(
len
(
threads
)):
tdLog
.
info
(
"Join threads"
)
# threads[t].start()
threads
[
t
].
join
()
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
self
.
tbNum
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addCluster
(
__file__
,
TDTestCase
())
tests/pytest/dbmgmt/database-name-boundary.py
0 → 100644
浏览文件 @
35f5a204
###################################################################
# 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
import
datetime
import
string
import
random
import
subprocess
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
chars
=
string
.
ascii_uppercase
+
string
.
ascii_lowercase
getDbNameLen
=
"grep -w '#define TSDB_DB_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'"
dbNameMaxLen
=
int
(
subprocess
.
check_output
(
getDbNameLen
,
shell
=
True
))
tdLog
.
notice
(
"DB name max length is %d"
%
dbNameMaxLen
)
tdLog
.
info
(
"=============== step1"
)
db_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
(
dbNameMaxLen
+
1
)))
tdLog
.
info
(
'db_name length %d'
%
len
(
db_name
))
tdLog
.
info
(
'create database %s'
%
db_name
)
tdSql
.
error
(
'create database %s'
%
db_name
)
tdLog
.
info
(
"=============== step2"
)
db_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
dbNameMaxLen
))
tdLog
.
info
(
'db_name length %d'
%
len
(
db_name
))
tdLog
.
info
(
'create database %s'
%
db_name
)
tdSql
.
execute
(
'create database %s'
%
db_name
)
tdSql
.
query
(
'show databases'
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
db_name
.
lower
())
tdLog
.
info
(
"=============== step3"
)
db_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
(
dbNameMaxLen
-
1
)))
tdLog
.
info
(
'db_name length %d'
%
len
(
db_name
))
tdLog
.
info
(
'create database %s'
%
db_name
)
tdSql
.
execute
(
'create database %s'
%
db_name
)
tdSql
.
query
(
'show databases'
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
db_name
.
lower
())
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/dbmgmt/dropDB_memory_test.py
0 → 100644
浏览文件 @
35f5a204
###################################################################
# 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
import
taos
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
tdSql
.
prepare
()
tbNum
=
10000
insertRows
=
1
db
=
"db"
loop
=
2
tdSql
.
execute
(
"drop database if exists %s"
%
(
db
))
tdSql
.
execute
(
"reset query cache"
)
tdLog
.
sleep
(
1
)
for
k
in
range
(
1
,
loop
+
1
):
tdLog
.
info
(
"===========Loop%d starts============"
%
(
k
))
tdSql
.
execute
(
"create database %s cache 163840 ablocks 40 maxtables 5000 wal 0"
%
(
db
))
tdSql
.
execute
(
"use %s"
%
(
db
))
tdSql
.
execute
(
"create table stb (ts timestamp, c1 int) tags(t1 bigint, t2 double)"
)
for
j
in
range
(
1
,
tbNum
):
tdSql
.
execute
(
"create table tb%d using stb tags(%d, %d)"
%
(
j
,
j
,
j
))
for
j
in
range
(
1
,
tbNum
):
for
i
in
range
(
0
,
insertRows
):
tdSql
.
execute
(
"insert into tb%d values (now + %dm, %d)"
%
(
j
,
i
,
i
))
tdSql
.
query
(
"select * from tb%d"
%
(
j
))
tdSql
.
checkRows
(
insertRows
)
tdLog
.
info
(
"insert %d rows into tb%d"
%
(
insertRows
,
j
))
# tdSql.sleep(3)
tdSql
.
execute
(
"drop database %s"
%
(
db
))
tdLog
.
sleep
(
2
)
tdLog
.
info
(
"===========Loop%d completed!============="
%
(
k
))
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
#tdCases.addWindows(__file__, TDTestCase())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/table/tablename-boundary.py
浏览文件 @
35f5a204
...
...
@@ -3,6 +3,7 @@
import
sys
import
string
import
random
import
subprocess
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
...
...
@@ -16,8 +17,11 @@ class TDTestCase:
def
run
(
self
):
tdSql
.
prepare
()
getTableNameLen
=
"grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'"
tableNameMaxLen
=
int
(
subprocess
.
check_output
(
getTableNameLen
,
shell
=
True
))
tdLog
.
notice
(
"table name max length is %d"
%
tableNameMaxLen
)
chars
=
string
.
ascii_uppercase
+
string
.
ascii_lowercase
tb_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
192
))
tb_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
tableNameMaxLen
))
tdLog
.
info
(
'tb_name length %d'
%
len
(
tb_name
))
tdLog
.
info
(
'create table %s (ts timestamp, value int)'
%
tb_name
)
tdSql
.
error
(
'create table %s (ts timestamp, speed binary(4089))'
%
tb_name
)
...
...
tests/pytest/tag_lite/create-tags-boundary.py
浏览文件 @
35f5a204
...
...
@@ -12,6 +12,7 @@
# -*- coding: utf-8 -*-
import
sys
import
subprocess
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
...
...
@@ -25,7 +26,9 @@ class TDTestCase:
def
run
(
self
):
tdSql
.
prepare
()
boundary
=
32
getMaxTagNum
=
"grep -w TSDB_MAX_TAGS ../../src/inc/taosdef.h|awk '{print $3}'"
boundary
=
int
(
subprocess
.
check_output
(
getMaxTagNum
,
shell
=
True
))
tdLog
.
notice
(
"get max tags number is %d"
%
boundary
)
for
x
in
range
(
0
,
boundary
):
stb_name
=
"stb%d"
%
x
...
...
@@ -40,7 +43,7 @@ class TDTestCase:
tdSql
.
checkRows
(
boundary
)
stb_name
=
"stb%d"
%
(
boundary
+
1
)
tagSeq
=
tagSeq
+
", tag%d int"
%
(
boundary
+
1
)
tagSeq
=
tagSeq
+
", tag%d int"
%
(
boundary
)
tdLog
.
info
(
"create table %s (ts timestamp, value int) tags (%s)"
%
(
stb_name
,
tagSeq
))
tdSql
.
error
(
"create table %s (ts timestamp, value int) tags (%s)"
%
(
stb_name
,
tagSeq
))
tdSql
.
query
(
"show stables"
)
...
...
tests/pytest/test.py
浏览文件 @
35f5a204
...
...
@@ -70,8 +70,6 @@ if __name__ == "__main__":
toBeKilled
=
"valgrind.bin"
killCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -HUP "
%
toBeKilled
# os.system(killCmd)
# time.sleep(1)
psCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}'"
%
toBeKilled
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录