Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1b75d0b0
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1b75d0b0
编写于
6月 02, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/query' of
https://github.com/taosdata/TDengine
into feature/query
上级
363fc8b9
7af2372b
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
79 addition
and
889 deletion
+79
-889
src/rpc/src/rpcTcp.c
src/rpc/src/rpcTcp.c
+1
-1
tests/pytest/crash_gen.py
tests/pytest/crash_gen.py
+78
-16
tests/pytest/crash_gen_0519.py
tests/pytest/crash_gen_0519.py
+0
-831
tests/pytest/crash_gen_0519.sh
tests/pytest/crash_gen_0519.sh
+0
-41
未找到文件。
src/rpc/src/rpcTcp.c
浏览文件 @
1b75d0b0
...
...
@@ -211,7 +211,7 @@ static void* taosAcceptTcpConnection(void *arg) {
tTrace
(
"%s TCP server socket was shutdown, exiting..."
,
pServerObj
->
label
);
break
;
}
tError
(
"%s TCP accept failure(%s)"
,
pServerObj
->
label
,
errno
,
strerror
(
errno
));
tError
(
"%s TCP accept failure(%s)"
,
pServerObj
->
label
,
strerror
(
errno
));
continue
;
}
...
...
tests/pytest/crash_gen.py
浏览文件 @
1b75d0b0
...
...
@@ -609,7 +609,8 @@ class StateDbOnly(AnyState):
]
def
verifyTasksToState
(
self
,
tasks
,
newState
):
self
.
assertAtMostOneSuccess
(
tasks
,
DropDbTask
)
# not true in massively parralel cases
if
(
not
self
.
hasTask
(
tasks
,
CreateDbTask
)
):
self
.
assertAtMostOneSuccess
(
tasks
,
DropDbTask
)
# only if we don't create any more
self
.
assertIfExistThenSuccess
(
tasks
,
DropDbTask
)
# self.assertAtMostOneSuccess(tasks, CreateFixedTableTask) # not true in massively parrallel cases
# Nothing to be said about adding data task
...
...
@@ -619,7 +620,8 @@ class StateDbOnly(AnyState):
# self._state = self.STATE_EMPTY
elif
(
self
.
hasSuccess
(
tasks
,
CreateFixedSuperTableTask
)
):
# did not drop db, create table success
# self.assertHasTask(tasks, CreateFixedTableTask) # tried to create table
self
.
assertAtMostOneSuccess
(
tasks
,
CreateFixedSuperTableTask
)
# at most 1 attempt is successful
if
(
not
self
.
hasTask
(
tasks
,
DropFixedSuperTableTask
)
):
self
.
assertAtMostOneSuccess
(
tasks
,
CreateFixedSuperTableTask
)
# at most 1 attempt is successful, if we don't drop anything
self
.
assertNoTask
(
tasks
,
DropDbTask
)
# should have have tried
# if ( not self.hasSuccess(tasks, AddFixedDataTask) ): # just created table, no data yet
# # can't say there's add-data attempts, since they may all fail
...
...
@@ -674,7 +676,7 @@ class StateHasData(AnyState):
if
(
not
self
.
hasTask
(
tasks
,
CreateDbTask
)):
# without a create_db task
self
.
assertNoTask
(
tasks
,
DropDbTask
)
# we must have drop_db task
self
.
hasSuccess
(
tasks
,
DropFixedSuperTableTask
)
self
.
assertAtMostOneSuccess
(
tasks
,
DropFixedSuperTableTask
)
# TODO: dicy
#
self.assertAtMostOneSuccess(tasks, DropFixedSuperTableTask) # TODO: dicy
elif
(
newState
.
equals
(
AnyState
.
STATE_TABLE_ONLY
)
):
# data deleted
self
.
assertNoTask
(
tasks
,
DropDbTask
)
self
.
assertNoTask
(
tasks
,
DropFixedSuperTableTask
)
...
...
@@ -689,9 +691,9 @@ class StateHasData(AnyState):
# State of the database as we believe it to be
class
DbState
():
def
__init__
(
self
):
def
__init__
(
self
,
resetDb
=
True
):
self
.
tableNumQueue
=
LinearQueue
()
self
.
_lastTick
=
datetime
.
datetime
(
2019
,
1
,
1
)
# initial date time tick
self
.
_lastTick
=
self
.
setupLastTick
()
#
datetime.datetime(2019, 1, 1) # initial date time tick
self
.
_lastInt
=
0
# next one is initial integer
self
.
_lock
=
threading
.
RLock
()
...
...
@@ -712,12 +714,32 @@ class DbState():
except
:
print
(
"[=] Unexpected exception"
)
raise
self
.
_dbConn
.
resetDb
()
# drop and recreate DB
self
.
_state
=
StateEmpty
()
# initial state, the result of above
if
resetDb
:
self
.
_dbConn
.
resetDb
()
# drop and recreate DB
self
.
_state
=
self
.
_findCurrentState
()
def
getDbConn
(
self
):
return
self
.
_dbConn
def
getState
(
self
):
return
self
.
_state
# We aim to create a starting time tick, such that, whenever we run our test here once
# We should be able to safely create 100,000 records, which will not have any repeated time stamp
# when we re-run the test in 3 minutes (180 seconds), basically we should expand time duration
# by a factor of 500.
# TODO: what if it goes beyond 10 years into the future
def
setupLastTick
(
self
):
t1
=
datetime
.
datetime
(
2020
,
5
,
30
)
t2
=
datetime
.
datetime
.
now
()
elSec
=
t2
.
timestamp
()
-
t1
.
timestamp
()
# print("elSec = {}".format(elSec))
t3
=
datetime
.
datetime
(
2012
,
1
,
1
)
# default "keep" is 10 years
t4
=
datetime
.
datetime
.
fromtimestamp
(
t3
.
timestamp
()
+
elSec
*
500
)
# see explanation above
logger
.
info
(
"Setting up TICKS to start from: {}"
.
format
(
t4
))
return
t4
def
pickAndAllocateTable
(
self
):
# pick any table, and "use" it
return
self
.
tableNumQueue
.
pickAndAllocate
()
...
...
@@ -743,7 +765,7 @@ class DbState():
return
self
.
_lastInt
def
getNextBinary
(
self
):
return
"
Los_Angeles
_{}"
.
format
(
self
.
getNextInt
())
return
"
Beijing_Shanghai_Los_Angeles_New_York_San_Francisco_Chicago_Beijing_Shanghai_Los_Angeles_New_York_San_Francisco_Chicago
_{}"
.
format
(
self
.
getNextInt
())
def
getNextFloat
(
self
):
return
0.9
+
self
.
getNextInt
()
...
...
@@ -1089,7 +1111,7 @@ class CreateFixedSuperTableTask(StateTransitionTask):
def
_executeInternal
(
self
,
te
:
TaskExecutor
,
wt
:
WorkerThread
):
tblName
=
self
.
_dbState
.
getFixedSuperTableName
()
wt
.
execSql
(
"create table db.{} (ts timestamp, speed int) tags (b binary(20), f float) "
.
format
(
tblName
))
wt
.
execSql
(
"create table db.{} (ts timestamp, speed int) tags (b binary(20
0
), f float) "
.
format
(
tblName
))
# No need to create the regular tables, INSERT will do that automatically
...
...
@@ -1148,12 +1170,13 @@ class AddFixedDataTask(StateTransitionTask):
ds
=
self
.
_dbState
wt
.
execSql
(
"use db"
)
# TODO: seems to be an INSERT bug to require this
for
i
in
range
(
10
):
# 0 to 9
sql
=
"insert into db.reg_table_{} using {} tags ('{}', {}) values ('{}', {});"
.
format
(
i
,
ds
.
getFixedSuperTableName
(),
ds
.
getNextBinary
(),
ds
.
getNextFloat
(),
ds
.
getNextTick
(),
ds
.
getNextInt
())
wt
.
execSql
(
sql
)
for
j
in
range
(
10
)
:
sql
=
"insert into db.reg_table_{} using {} tags ('{}', {}) values ('{}', {});"
.
format
(
i
,
ds
.
getFixedSuperTableName
(),
ds
.
getNextBinary
(),
ds
.
getNextFloat
(),
ds
.
getNextTick
(),
ds
.
getNextInt
())
wt
.
execSql
(
sql
)
#---------- Non State-Transition Related Tasks ----------#
...
...
@@ -1301,7 +1324,9 @@ def main():
ch
=
logging
.
StreamHandler
()
logger
.
addHandler
(
ch
)
dbState
=
DbState
()
# resetDb = False # DEBUG only
# dbState = DbState(resetDb) # DBEUG only!
dbState
=
DbState
()
# Regular function
Dice
.
seed
(
0
)
# initial seeding of dice
tc
=
ThreadCoordinator
(
ThreadPool
(
dbState
,
gConfig
.
num_threads
,
gConfig
.
max_steps
,
0
),
...
...
@@ -1309,6 +1334,43 @@ def main():
dbState
)
# # Hack to exercise reading from disk, imcreasing coverage. TODO: fix
# dbc = dbState.getDbConn()
# sTbName = dbState.getFixedSuperTableName()
# dbc.execute("create database if not exists db")
# if not dbState.getState().equals(StateEmpty()):
# dbc.execute("use db")
# rTables = None
# try: # the super table may not exist
# sql = "select TBNAME from db.{}".format(sTbName)
# logger.info("Finding out tables in super table: {}".format(sql))
# dbc.query(sql) # TODO: analyze result set later
# logger.info("Fetching result")
# rTables = dbc.getQueryResult()
# logger.info("Result: {}".format(rTables))
# except taos.error.ProgrammingError as err:
# logger.info("Initial Super table OPS error: {}".format(err))
# # sys.exit()
# if ( not rTables == None):
# # print("rTables[0] = {}, type = {}".format(rTables[0], type(rTables[0])))
# try:
# for rTbName in rTables : # regular tables
# ds = dbState
# logger.info("Inserting into table: {}".format(rTbName[0]))
# sql = "insert into db.{} values ('{}', {});".format(
# rTbName[0],
# ds.getNextTick(), ds.getNextInt())
# dbc.execute(sql)
# for rTbName in rTables : # regular tables
# dbc.query("select * from db.{}".format(rTbName[0])) # TODO: check success failure
# logger.info("Initial READING operation is successful")
# except taos.error.ProgrammingError as err:
# logger.info("Initial WRITE/READ error: {}".format(err))
# Sandbox testing code
# dbc = dbState.getDbConn()
# while True:
...
...
tests/pytest/crash_gen_0519.py
已删除
100755 → 0
浏览文件 @
363fc8b9
此差异已折叠。
点击以展开。
tests/pytest/crash_gen_0519.sh
已删除
100755 → 0
浏览文件 @
363fc8b9
#!/bin/bash
# This is the script for us to try to cause the TDengine server or client to crash
#
# PREPARATION
#
# 1. Build an compile the TDengine source code that comes with this script, in the same directory tree
# 2. Please follow the direction in our README.md, and build TDengine in the build/ directory
# 3. Adjust the configuration file if needed under build/test/cfg/taos.cfg
# 4. Run the TDengine server instance: cd build; ./build/bin/taosd -c test/cfg
# 5. Make sure you have a working Python3 environment: run /usr/bin/python3 --version, and you should get 3.6 or above
# 6. Make sure you have the proper Python packages: # sudo apt install python3-setuptools python3-pip python3-distutils
#
# RUNNING THIS SCRIPT
#
# This script assumes the source code directory is intact, and that the binaries has been built in the
# build/ directory, as such, will will load the Python libraries in the directory tree, and also load
# the TDengine client shared library (so) file, in the build/directory, as evidenced in the env
# variables below.
#
# Running the script is simple, no parameter is needed (for now, but will change in the future).
#
# Happy Crashing...
# Due to the heavy path name assumptions/usage, let us require that the user be in the current directory
EXEC_DIR
=
`
dirname
"
$0
"
`
if
[[
$EXEC_DIR
!=
"."
]]
then
echo
"ERROR: Please execute
`
basename
"
$0
"
`
in its own directory (for now anyway, pardon the dust)"
exit
-1
fi
# First we need to set up a path for Python to find our own TAOS modules, so that "import" can work.
export
PYTHONPATH
=
$(
pwd
)
/../../src/connector/python/linux/python3
# Then let us set up the library path so that our compiled SO file can be loaded by Python
export
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:
$(
pwd
)
/../../build/build/lib
# Now we are all let, and let's see if we can find a crash. Note we pass all params
./crash_gen_0519.py
$@
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录