Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
061a2161
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
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看板
提交
061a2161
编写于
8月 07, 2020
作者:
S
Steven Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adjusted crash_gen tool to accommodate new default database called log
上级
78b3d1f2
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
32 addition
and
12 deletion
+32
-12
tests/pytest/crash_gen.py
tests/pytest/crash_gen.py
+32
-12
未找到文件。
tests/pytest/crash_gen.py
浏览文件 @
061a2161
...
@@ -643,7 +643,7 @@ class DbConn:
...
@@ -643,7 +643,7 @@ class DbConn:
self
.
execute
(
"use {}"
.
format
(
dbName
))
self
.
execute
(
"use {}"
.
format
(
dbName
))
def
hasDatabases
(
self
):
def
hasDatabases
(
self
):
return
self
.
query
(
"show databases"
)
>
0
return
self
.
query
(
"show databases"
)
>
1
# We now have a "log" database by default
def
hasTables
(
self
):
def
hasTables
(
self
):
return
self
.
query
(
"show tables"
)
>
0
return
self
.
query
(
"show tables"
)
>
0
...
@@ -850,6 +850,7 @@ class DbConnNative(DbConn):
...
@@ -850,6 +850,7 @@ class DbConnNative(DbConn):
raise
RuntimeError
(
raise
RuntimeError
(
"Cannot execute database commands until connection is open"
)
"Cannot execute database commands until connection is open"
)
logger
.
debug
(
"[SQL] Executing SQL: {}"
.
format
(
sql
))
logger
.
debug
(
"[SQL] Executing SQL: {}"
.
format
(
sql
))
self
.
_lastSql
=
sql
nRows
=
self
.
_tdSql
.
execute
(
sql
)
nRows
=
self
.
_tdSql
.
execute
(
sql
)
logger
.
debug
(
logger
.
debug
(
"[SQL] Execution Result, nRows = {}, SQL = {}"
.
format
(
"[SQL] Execution Result, nRows = {}, SQL = {}"
.
format
(
...
@@ -861,6 +862,7 @@ class DbConnNative(DbConn):
...
@@ -861,6 +862,7 @@ class DbConnNative(DbConn):
raise
RuntimeError
(
raise
RuntimeError
(
"Cannot query database until connection is open"
)
"Cannot query database until connection is open"
)
logger
.
debug
(
"[SQL] Executing SQL: {}"
.
format
(
sql
))
logger
.
debug
(
"[SQL] Executing SQL: {}"
.
format
(
sql
))
self
.
_lastSql
=
sql
nRows
=
self
.
_tdSql
.
query
(
sql
)
nRows
=
self
.
_tdSql
.
query
(
sql
)
logger
.
debug
(
logger
.
debug
(
"[SQL] Query Result, nRows = {}, SQL = {}"
.
format
(
"[SQL] Query Result, nRows = {}, SQL = {}"
.
format
(
...
@@ -1771,6 +1773,9 @@ class TdSuperTable:
...
@@ -1771,6 +1773,9 @@ class TdSuperTable:
def
__init__
(
self
,
stName
):
def
__init__
(
self
,
stName
):
self
.
_stName
=
stName
self
.
_stName
=
stName
def
getName
(
self
):
return
self
.
_stName
def
create
(
self
,
dbc
,
cols
:
dict
,
tags
:
dict
):
def
create
(
self
,
dbc
,
cols
:
dict
,
tags
:
dict
):
sql
=
"CREATE TABLE db.{} ({}) TAGS ({})"
.
format
(
sql
=
"CREATE TABLE db.{} ({}) TAGS ({})"
.
format
(
self
.
_stName
,
self
.
_stName
,
...
@@ -1864,16 +1869,29 @@ class TaskReadData(StateTransitionTask):
...
@@ -1864,16 +1869,29 @@ class TaskReadData(StateTransitionTask):
wt
.
getDbConn
().
close
()
wt
.
getDbConn
().
close
()
wt
.
getDbConn
().
open
()
wt
.
getDbConn
().
open
()
for
rTbName
in
sTable
.
getRegTables
(
wt
.
getDbConn
()):
# regular tables
dbc
=
wt
.
getDbConn
()
aggExpr
=
Dice
.
choice
([
'*'
,
'count(*)'
,
'avg(speed)'
,
for
rTbName
in
sTable
.
getRegTables
(
dbc
):
# regular tables
aggExpr
=
Dice
.
choice
([
'*'
,
'count(*)'
,
'avg(speed)'
,
# 'twa(speed)', # TODO: this one REQUIRES a where statement, not reasonable
# 'twa(speed)', # TODO: this one REQUIRES a where statement, not reasonable
'sum(speed)'
,
'stddev(speed)'
,
'sum(speed)'
,
'min(speed)'
,
'max(speed)'
,
'first(speed)'
,
'last(speed)'
])
# TODO: add more from 'top'
'stddev(speed)'
,
'min(speed)'
,
'max(speed)'
,
'first(speed)'
,
'last(speed)'
])
# TODO: add more from 'top'
filterExpr
=
Dice
.
choice
([
# TODO: add various kind of WHERE conditions
None
])
try
:
try
:
self
.
execWtSql
(
wt
,
"select {} from db.{}"
.
format
(
aggExpr
,
rTbName
))
dbc
.
execute
(
"select {} from db.{}"
.
format
(
aggExpr
,
rTbName
))
if
aggExpr
not
in
[
'stddev(speed)'
]:
#TODO: STDDEV not valid for super tables?!
dbc
.
execute
(
"select {} from db.{}"
.
format
(
aggExpr
,
sTable
.
getName
()))
except
taos
.
error
.
ProgrammingError
as
err
:
except
taos
.
error
.
ProgrammingError
as
err
:
errno2
=
err
.
errno
if
(
err
.
errno
>
0
)
else
0x80000000
+
err
.
errno
errno2
=
err
.
errno
if
(
err
.
errno
>
0
)
else
0x80000000
+
err
.
errno
logger
.
debug
(
"[=] Read Failure: errno=0x{:X}, msg: {}, SQL: {}"
.
format
(
errno2
,
err
,
wt
.
getDbConn
()
.
getLastSql
()))
logger
.
debug
(
"[=] Read Failure: errno=0x{:X}, msg: {}, SQL: {}"
.
format
(
errno2
,
err
,
dbc
.
getLastSql
()))
raise
raise
class
TaskDropSuperTable
(
StateTransitionTask
):
class
TaskDropSuperTable
(
StateTransitionTask
):
...
@@ -2204,8 +2222,8 @@ class SvcManager:
...
@@ -2204,8 +2222,8 @@ class SvcManager:
# print("Process: {}".format(proc.name()))
# print("Process: {}".format(proc.name()))
self
.
svcMgrThread
=
ServiceManagerThread
()
# create the object
self
.
svcMgrThread
=
ServiceManagerThread
()
# create the object
self
.
svcMgrThread
.
start
()
print
(
"Attempting to start TAOS service started, printing out output..."
)
print
(
"Attempting to start TAOS service started, printing out output..."
)
self
.
svcMgrThread
.
start
()
self
.
svcMgrThread
.
procIpcBatch
(
self
.
svcMgrThread
.
procIpcBatch
(
trimToTarget
=
10
,
trimToTarget
=
10
,
forceOutput
=
True
)
# for printing 10 lines
forceOutput
=
True
)
# for printing 10 lines
...
@@ -2222,8 +2240,8 @@ class SvcManager:
...
@@ -2222,8 +2240,8 @@ class SvcManager:
if
self
.
svcMgrThread
.
isStopped
():
if
self
.
svcMgrThread
.
isStopped
():
self
.
svcMgrThread
.
procIpcBatch
(
outputLines
)
# one last time
self
.
svcMgrThread
.
procIpcBatch
(
outputLines
)
# one last time
self
.
svcMgrThread
=
None
self
.
svcMgrThread
=
None
print
(
"
----- End of TDengine Service Output -----
\n
"
)
print
(
"
End of TDengine Service Output
"
)
print
(
"
SMT execution terminated
"
)
print
(
"
----- TDengine Service (managed by SMT) is now terminated -----
\n
"
)
else
:
else
:
print
(
"WARNING: SMT did not terminate as expected"
)
print
(
"WARNING: SMT did not terminate as expected"
)
...
@@ -2330,6 +2348,8 @@ class ServiceManagerThread:
...
@@ -2330,6 +2348,8 @@ class ServiceManagerThread:
self
.
_status
=
MainExec
.
STATUS_STOPPING
self
.
_status
=
MainExec
.
STATUS_STOPPING
retCode
=
self
.
_tdeSubProcess
.
stop
()
retCode
=
self
.
_tdeSubProcess
.
stop
()
print
(
"Attempted to stop sub process, got return code: {}"
.
format
(
retCode
))
print
(
"Attempted to stop sub process, got return code: {}"
.
format
(
retCode
))
if
(
retCode
==-
11
):
# SGV
logger
.
error
(
"[[--ERROR--]]: TDengine service SEGV fault (check core file!)"
)
if
self
.
_tdeSubProcess
.
isRunning
():
# still running
if
self
.
_tdeSubProcess
.
isRunning
():
# still running
print
(
"FAILED to stop sub process, it is still running... pid = {}"
.
format
(
print
(
"FAILED to stop sub process, it is still running... pid = {}"
.
format
(
...
@@ -2624,12 +2644,12 @@ class ClientManager:
...
@@ -2624,12 +2644,12 @@ class ClientManager:
def
_printLastNumbers
(
self
):
# to verify data durability
def
_printLastNumbers
(
self
):
# to verify data durability
dbManager
=
DbManager
(
resetDb
=
False
)
dbManager
=
DbManager
(
resetDb
=
False
)
dbc
=
dbManager
.
getDbConn
()
dbc
=
dbManager
.
getDbConn
()
if
dbc
.
query
(
"show databases"
)
==
0
:
# no databae
if
dbc
.
query
(
"show databases"
)
<=
1
:
# no database (we have a default called "log")
return
return
dbc
.
execute
(
"use db"
)
if
dbc
.
query
(
"show tables"
)
==
0
:
# no tables
if
dbc
.
query
(
"show tables"
)
==
0
:
# no tables
return
return
dbc
.
execute
(
"use db"
)
sTbName
=
dbManager
.
getFixedSuperTableName
()
sTbName
=
dbManager
.
getFixedSuperTableName
()
# get all regular tables
# get all regular tables
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录