Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0f8bb6fa
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看板
提交
0f8bb6fa
编写于
11月 10, 2022
作者:
W
wenzhouwww@live.cn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update enh crash_gen tasks
上级
a6a004fd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
33 deletion
+30
-33
tests/pytest/crash_gen/crash_gen_main.py
tests/pytest/crash_gen/crash_gen_main.py
+30
-33
未找到文件。
tests/pytest/crash_gen/crash_gen_main.py
浏览文件 @
0f8bb6fa
...
...
@@ -549,7 +549,12 @@ class ThreadCoordinator:
# pick a task type for current state
db
=
self
.
pickDatabase
()
taskType
=
db
.
getStateMachine
().
pickTaskType
()
# dynamic name of class
if
Dice
.
throw
(
2
)
==
1
:
taskType
=
db
.
getStateMachine
().
pickTaskType
()
# dynamic name of class
else
:
taskType
=
db
.
getStateMachine
().
balance_pickTaskType
()
# and an method can get balance task types
pass
return
taskType
(
self
.
_execStats
,
db
)
# create a task from it
def
resetExecutedTasks
(
self
):
...
...
@@ -680,8 +685,6 @@ class AnyState:
CAN_CREATE_STREAM
=
3
# super table must exists
CAN_CREATE_TOPIC
=
3
# super table must exists
CAN_CREATE_CONSUMERS
=
3
CAN_CREATE_SMA
=
3
CAN_DROP_SMA
=
3
CAN_DROP_FIXED_SUPER_TABLE
=
4
CAN_DROP_TOPIC
=
4
CAN_DROP_STREAM
=
4
...
...
@@ -746,12 +749,6 @@ class AnyState:
def
canCreateConsumers
(
self
):
return
self
.
_info
[
self
.
CAN_CREATE_CONSUMERS
]
def
canCreateSma
(
self
):
return
self
.
_info
[
self
.
CAN_CREATE_SMA
]
def
canDropSma
(
self
):
return
self
.
_info
[
self
.
CAN_DROP_SMA
]
def
canCreateStreams
(
self
):
return
self
.
_info
[
self
.
CAN_CREATE_STREAM
]
...
...
@@ -1093,6 +1090,28 @@ class StateMechine:
# Logging.debug(" (weighted random:{}/{}) ".format(i, len(taskTypes)))
return
taskTypes
[
i
]
def
balance_pickTaskType
(
self
):
# all the task types we can choose from at curent state
BasicTypes
=
self
.
getTaskTypes
()
weightsTypes
=
BasicTypes
.
copy
()
# this matrixs can balance the Frequency of different types of tasks
weight_matrixs
=
{
'TaskDropDb'
:
5
,
'TaskDropTopics'
:
20
,
'TaskDropStreams'
:
10
,
'TaskDropStreamTables'
:
10
,
'TaskReadData'
:
50
,
'TaskDropSuperTable'
:
5
,
'TaskAlterTags'
:
3
,
'TaskAddData'
:
10
,
'TaskDeleteData'
:
10
,
'TaskCreateDb'
:
10
,
'TaskCreateStream'
:
3
,
'TaskCreateTopic'
:
3
,
'TaskCreateConsumers'
:
10
,
'TaskCreateSuperTable'
:
10
}
# task type : weghts matrixs
for
task
,
weights
in
weight_matrixs
.
items
():
for
basicType
in
BasicTypes
:
if
basicType
.
__name__
==
task
:
for
_
in
range
(
weights
):
weightsTypes
.
append
(
basicType
)
task
=
random
.
sample
(
weightsTypes
,
1
)
return
task
[
0
]
# ref:
# https://eli.thegreenplace.net/2010/01/22/weighted-random-generation-in-python/
def
_weighted_choice_sub
(
self
,
weights
)
->
int
:
...
...
@@ -1395,6 +1414,8 @@ class Task():
0x386
,
# Database in droping status
0x03E1
,
# failed on tmq_subscribe ,topic not exist
0x03ed
,
# Topic must be dropped first, SQL: drop database db_0
0x0203
,
# Invalid value
...
...
@@ -1942,30 +1963,6 @@ class TaskDropTopics(StateTransitionTask):
if
sTable
.
hasTopics
(
wt
.
getDbConn
()):
sTable
.
dropTopics
(
wt
.
getDbConn
(),
dbname
,
None
)
# drop topics of database
sTable
.
dropTopics
(
wt
.
getDbConn
(),
dbname
,
tblName
)
# drop topics of stable
class
TaskCreateSma
(
StateTransitionTask
):
@
classmethod
def
getEndState
(
cls
):
return
StateHasData
()
@
classmethod
def
canBeginFrom
(
cls
,
state
:
AnyState
):
return
state
.
canCreateSma
()
def
_executeInternal
(
self
,
te
:
TaskExecutor
,
wt
:
WorkerThread
):
# dbname = self._db.getName()
if
not
self
.
_db
.
exists
(
wt
.
getDbConn
()):
Logging
.
debug
(
"Skipping task, no DB yet"
)
return
sTable
=
self
.
_db
.
getFixedSuperTable
()
# type: TdSuperTable
# wt.execSql("use db") # should always be in place
# tblName = sTable.getName()
if
sTable
.
hasStreams
(
wt
.
getDbConn
()):
sTable
.
dropStreams
(
wt
.
getDbConn
())
# drop stream of database
# sTable.dropStreamTables(wt.getDbConn()) # drop streamtables of stable
class
TaskDropStreams
(
StateTransitionTask
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录