Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
46b3204a
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
46b3204a
编写于
9月 16, 2020
作者:
S
Steven Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added limited data verification to crash_gen tool, with -v option
上级
59b080f0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
23 deletion
+37
-23
tests/pytest/crash_gen.py
tests/pytest/crash_gen.py
+37
-23
未找到文件。
tests/pytest/crash_gen.py
浏览文件 @
46b3204a
...
...
@@ -317,7 +317,7 @@ class ThreadCoordinator:
logger
.
debug
(
"[TRD] Main thread waking up at step {}, tapping worker threads"
.
format
(
self
.
_curStep
))
# Now not all threads had time to go to sleep
# Worker threads will wake up at this point, and each execute it's own task
self
.
tapAllThreads
()
# release all worker thread from their "gate"
self
.
tapAllThreads
()
# release all worker thread from their "gate
s
"
def
_syncAtBarrier
(
self
):
# Now main thread (that's us) is ready to enter a step
...
...
@@ -818,7 +818,7 @@ class MyTDSql:
def
_execInternal
(
self
,
sql
):
startTime
=
time
.
time
()
ret
=
self
.
_cursor
.
execute
(
sql
)
print
(
"
\n
SQL success: {}"
.
format
(
sql
))
#
print("\nSQL success: {}".format(sql))
queryTime
=
time
.
time
()
-
startTime
# Record the query time
cls
=
self
.
__class__
...
...
@@ -1339,7 +1339,6 @@ class StateMechine:
if
rnd
<
0
:
return
i
class
Database
:
''' We use this to represent an actual TDengine database inside a service instance,
possibly in a cluster environment.
...
...
@@ -1355,7 +1354,6 @@ class Database:
self
.
_dbNum
=
dbNum
# we assign a number to databases, for our testing purpose
self
.
_stateMachine
=
StateMechine
(
self
)
self
.
_stateMachine
.
init
(
dbc
)
self
.
_lock
=
threading
.
RLock
()
...
...
@@ -1878,9 +1876,12 @@ class TaskCreateDb(StateTransitionTask):
# Actually creating the database(es)
def
_executeInternal
(
self
,
te
:
TaskExecutor
,
wt
:
WorkerThread
):
# was: self.execWtSql(wt, "create database db")
numReplica
=
Dice
.
throw
(
3
)
+
1
# 1,2,3
self
.
execWtSql
(
wt
,
"create database {} replica {}"
.
format
(
self
.
_db
.
getName
(),
numReplica
)
)
repStr
=
""
if
gConfig
.
max_replicas
!=
1
:
numReplica
=
Dice
.
throw
(
gConfig
.
max_replicas
)
+
1
# 1,2 ... N
repStr
=
"replica {}"
.
format
(
numReplica
)
self
.
execWtSql
(
wt
,
"create database {} {}"
.
format
(
self
.
_db
.
getName
(),
repStr
)
)
class
TaskDropDb
(
StateTransitionTask
):
@
classmethod
...
...
@@ -2234,22 +2235,23 @@ class TaskAddData(StateTransitionTask):
os
.
fsync
(
self
.
fAddLogDone
)
# Now read it back and verify, we might encounter an error if table is dropped
try
:
readBack
=
dbc
.
queryScalar
(
"SELECT speed from {}.{} WHERE ts= '{}'"
.
format
(
db
.
getName
(),
regTableName
,
nextTick
))
if
readBack
!=
nextInt
:
raise
taos
.
error
.
ProgrammingError
(
"Failed to read back same data, wrote: {}, read: {}"
.
format
(
nextInt
,
readBack
),
0x999
)
except
taos
.
error
.
ProgrammingError
as
err
:
errno
=
Helper
.
convertErrno
(
err
.
errno
)
if
errno
in
[
0x991
,
0x992
]
:
# not a single result
raise
taos
.
error
.
ProgrammingError
(
"Failed to read back same data for tick: {}, wrote: {}, read: {}"
.
format
(
nextTick
,
nextInt
,
"Empty Result"
if
errno
==
0x991
else
"Multiple Result"
),
errno
)
# Re-throw no matter what
raise
if
gConfig
.
verify_data
:
# only if command line asks for it
try
:
readBack
=
dbc
.
queryScalar
(
"SELECT speed from {}.{} WHERE ts= '{}'"
.
format
(
db
.
getName
(),
regTableName
,
nextTick
))
if
readBack
!=
nextInt
:
raise
taos
.
error
.
ProgrammingError
(
"Failed to read back same data, wrote: {}, read: {}"
.
format
(
nextInt
,
readBack
),
0x999
)
except
taos
.
error
.
ProgrammingError
as
err
:
errno
=
Helper
.
convertErrno
(
err
.
errno
)
if
errno
in
[
0x991
,
0x992
]
:
# not a single result
raise
taos
.
error
.
ProgrammingError
(
"Failed to read back same data for tick: {}, wrote: {}, read: {}"
.
format
(
nextTick
,
nextInt
,
"Empty Result"
if
errno
==
0x991
else
"Multiple Result"
),
errno
)
# Re-throw no matter what
raise
self
.
activeTable
.
discard
(
i
)
# not raising an error, unlike remove
...
...
@@ -3042,6 +3044,13 @@ def main():
'--run-tdengine'
,
action
=
'store_true'
,
help
=
'Run TDengine service in foreground (default: false)'
)
parser
.
add_argument
(
'-i'
,
'--max-replicas'
,
action
=
'store'
,
default
=
1
,
type
=
int
,
help
=
'Maximum number of replicas to use, when testing against clusters. (default: 1)'
)
parser
.
add_argument
(
'-l'
,
'--larger-data'
,
...
...
@@ -3071,6 +3080,11 @@ def main():
default
=
5
,
type
=
int
,
help
=
'Number of threads to run (default: 10)'
)
parser
.
add_argument
(
'-v'
,
'--verify-data'
,
action
=
'store_true'
,
help
=
'Verify data written in a number of places by reading back (default: false)'
)
parser
.
add_argument
(
'-x'
,
'--continue-on-exception'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录