Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
codyshao
TDengine
提交
6623cb63
T
TDengine
项目概览
codyshao
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
2
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,发现更多精彩内容 >>
提交
6623cb63
编写于
5月 08, 2020
作者:
S
Steven Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Discovered TD-255 crash with params: -p -s 50 -t 10
上级
55a418ca
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
17 deletion
+58
-17
.gitignore
.gitignore
+1
-0
tests/pytest/crash_gen.py
tests/pytest/crash_gen.py
+57
-17
未找到文件。
.gitignore
浏览文件 @
6623cb63
...
...
@@ -11,6 +11,7 @@ debs/
rpms/
mac/
*.pyc
.mypy_cache
*.tmp
*.swp
src/connector/nodejs/node_modules/
...
...
tests/pytest/crash_gen.py
浏览文件 @
6623cb63
...
...
@@ -61,6 +61,13 @@ class WorkerThread:
if
(
gConfig
.
per_thread_db_connection
):
# type: ignore
self
.
_dbConn
=
DbConn
()
def
logDebug
(
self
,
msg
):
logger
.
info
(
" t[{}] {}"
.
format
(
self
.
_tid
,
msg
))
def
logInfo
(
self
,
msg
):
logger
.
info
(
" t[{}] {}"
.
format
(
self
.
_tid
,
msg
))
def
getTaskExecutor
(
self
):
return
self
.
_tc
.
getTaskExecutor
()
...
...
@@ -172,6 +179,7 @@ class ThreadCoordinator:
# At this point, all threads should be pass the overall "barrier" and before the per-thread "gate"
self
.
_dbState
.
transition
(
self
.
_executedTasks
)
# at end of step, transiton the DB state
self
.
resetExecutedTasks
()
# clear the tasks after we are done
# Get ready for next step
logger
.
info
(
"<-- Step {} finished"
.
format
(
self
.
_curStep
))
...
...
@@ -221,7 +229,11 @@ class ThreadCoordinator:
dbState
=
self
.
getDbState
()
tasks
=
dbState
.
getTasksAtState
()
i
=
Dice
.
throw
(
len
(
tasks
))
return
copy
.
copy
(
tasks
[
i
])
# Needs a fresh copy, to save execution results, etc.
# return copy.copy(tasks[i]) # Needs a fresh copy, to save execution results, etc.
return
tasks
[
i
].
clone
()
def
resetExecutedTasks
(
self
):
self
.
_executedTasks
=
[]
# should be under single thread
def
saveExecutedTask
(
self
,
task
):
with
self
.
_lock
:
...
...
@@ -512,6 +524,7 @@ class DbState():
if
not
isinstance
(
task
,
cls
):
continue
if
task
.
isSuccess
():
task
.
logDebug
(
"Task success found"
)
sCnt
+=
1
if
(
sCnt
>=
2
):
raise
RuntimeError
(
"Unexpected more than 1 success with task: {}"
.
format
(
cls
))
...
...
@@ -551,43 +564,70 @@ class TaskExecutor():
def
__init__
(
self
,
curStep
):
self
.
_curStep
=
curStep
def
getCurStep
(
self
):
return
self
.
_curStep
def
execute
(
self
,
task
:
Task
,
wt
:
WorkerThread
):
# execute a task on a thread
task
.
execute
(
wt
)
def
logInfo
(
self
,
msg
):
logger
.
info
(
" T[{}.x]: "
.
format
(
self
.
_curStep
)
+
msg
)
#
def logInfo(self, msg):
#
logger.info(" T[{}.x]: ".format(self._curStep) + msg)
def
logDebug
(
self
,
msg
):
logger
.
debug
(
" T[{}.x]: "
.
format
(
self
.
_curStep
)
+
msg
)
#
def logDebug(self, msg):
#
logger.debug(" T[{}.x]: ".format(self._curStep) + msg)
class
Task
():
taskSn
=
100
@
classmethod
def
allocTaskNum
(
cls
):
cls
.
taskSn
+=
1
return
cls
.
taskSn
def
__init__
(
self
,
dbState
:
DbState
):
self
.
_dbState
=
dbState
self
.
_workerThread
=
None
self
.
_err
=
None
self
.
_curStep
=
None
# Assign an incremental task serial number
self
.
_taskNum
=
self
.
allocTaskNum
()
def
isSuccess
(
self
):
return
self
.
_err
==
None
def
clone
(
self
):
newTask
=
self
.
__class__
(
self
.
_dbState
)
return
newTask
def
logDebug
(
self
,
msg
):
self
.
_workerThread
.
logDebug
(
"s[{}.{}] {}"
.
format
(
self
.
_curStep
,
self
.
_taskNum
,
msg
))
def
logInfo
(
self
,
msg
):
self
.
_workerThread
.
logInfo
(
"s[{}.{}] {}"
.
format
(
self
.
_curStep
,
self
.
_taskNum
,
msg
))
def
_executeInternal
(
self
,
te
:
TaskExecutor
,
wt
:
WorkerThread
):
raise
RuntimeError
(
"To be implemeted by child classes, class name: {}"
.
format
(
self
.
__class__
.
__name__
))
def
execute
(
self
,
wt
:
WorkerThread
):
wt
.
verifyThreadSelf
()
self
.
_workerThread
=
wt
# type: ignore
te
=
wt
.
getTaskExecutor
()
te
.
logDebug
(
"[-] executing task {}..."
.
format
(
self
.
__class__
.
__name__
))
self
.
_curStep
=
te
.
getCurStep
()
self
.
logDebug
(
"[-] executing task {}..."
.
format
(
self
.
__class__
.
__name__
))
self
.
_err
=
None
try
:
self
.
_executeInternal
(
te
,
wt
)
# TODO: no return value?
except
taos
.
error
.
ProgrammingError
as
err
:
te
.
logDebug
(
"[=]Taos Execution exception: {0}"
.
format
(
err
))
self
.
logDebug
(
"[=]Taos Execution exception: {0}"
.
format
(
err
))
self
.
_err
=
err
except
:
te
.
logDebug
(
"[=]Unexpected exception"
)
self
.
logDebug
(
"[=]Unexpected exception"
)
raise
te
.
logDebug
(
"[X] task execution completed, status: {}"
.
format
(
self
.
isSuccess
()
))
self
.
logDebug
(
"[X] task execution completed, {}, status: {}"
.
format
(
self
.
__class__
.
__name__
,
"Success"
if
self
.
isSuccess
()
else
"Failure"
))
def
execSql
(
self
,
sql
):
return
self
.
_dbState
.
execute
(
sql
)
...
...
@@ -603,9 +643,9 @@ class DropDbTask(Task):
class
CreateTableTask
(
Task
):
def
_executeInternal
(
self
,
te
:
TaskExecutor
,
wt
:
WorkerThread
):
tIndex
=
self
.
_dbState
.
addTable
()
te
.
logDebug
(
"Creating a table {} ..."
.
format
(
tIndex
))
self
.
logDebug
(
"Creating a table {} ..."
.
format
(
tIndex
))
wt
.
execSql
(
"create table db.table_{} (ts timestamp, speed int)"
.
format
(
tIndex
))
te
.
logDebug
(
"Table {} created."
.
format
(
tIndex
))
self
.
logDebug
(
"Table {} created."
.
format
(
tIndex
))
self
.
_dbState
.
releaseTable
(
tIndex
)
class
CreateFixedTableTask
(
Task
):
...
...
@@ -617,9 +657,9 @@ class DropTableTask(Task):
def
_executeInternal
(
self
,
te
:
TaskExecutor
,
wt
:
WorkerThread
):
tableName
=
self
.
_dbState
.
getTableNameToDelete
()
if
(
not
tableName
):
# May be "False"
te
.
logInfo
(
"Cannot generate a table to delete, skipping..."
)
self
.
logInfo
(
"Cannot generate a table to delete, skipping..."
)
return
te
.
logInfo
(
"Dropping a table db.{} ..."
.
format
(
tableName
))
self
.
logInfo
(
"Dropping a table db.{} ..."
.
format
(
tableName
))
wt
.
execSql
(
"drop table db.{}"
.
format
(
tableName
))
class
DropFixedTableTask
(
Task
):
...
...
@@ -630,16 +670,16 @@ class DropFixedTableTask(Task):
class
AddDataTask
(
Task
):
def
_executeInternal
(
self
,
te
:
TaskExecutor
,
wt
:
WorkerThread
):
ds
=
self
.
_dbState
te
.
logInfo
(
"Adding some data... numQueue={}"
.
format
(
ds
.
tableNumQueue
.
toText
()))
self
.
logInfo
(
"Adding some data... numQueue={}"
.
format
(
ds
.
tableNumQueue
.
toText
()))
tIndex
=
ds
.
pickAndAllocateTable
()
if
(
tIndex
==
None
):
te
.
logInfo
(
"No table found to add data, skipping..."
)
self
.
logInfo
(
"No table found to add data, skipping..."
)
return
sql
=
"insert into db.table_{} values ('{}', {});"
.
format
(
tIndex
,
ds
.
getNextTick
(),
ds
.
getNextInt
())
te
.
logDebug
(
"Executing SQL: {}"
.
format
(
sql
))
self
.
logDebug
(
"Executing SQL: {}"
.
format
(
sql
))
wt
.
execSql
(
sql
)
ds
.
releaseTable
(
tIndex
)
te
.
logDebug
(
"Finished adding data"
)
self
.
logDebug
(
"Finished adding data"
)
class
AddFixedDataTask
(
Task
):
def
_executeInternal
(
self
,
te
:
TaskExecutor
,
wt
:
WorkerThread
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录