Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a5b45aed
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a5b45aed
编写于
3月 28, 2022
作者:
D
dingbo
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into docs/dingbo/TD-13605-schemaless
上级
657448a5
e433834f
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
281 addition
and
255 deletion
+281
-255
docs-cn/06-insert-data/01-sql-writing.mdx
docs-cn/06-insert-data/01-sql-writing.mdx
+2
-1
documentation20/cn/12.taos-sql/docs.md
documentation20/cn/12.taos-sql/docs.md
+4
-0
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-1
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+1
-1
src/plugins/http/src/httpParser.c
src/plugins/http/src/httpParser.c
+1
-1
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+1
-1
src/util/src/terror.c
src/util/src/terror.c
+3
-3
tests/pytest/tools/taosdemoTest.py
tests/pytest/tools/taosdemoTest.py
+10
-10
tests/pytest/tools/taosdumpTest.py
tests/pytest/tools/taosdumpTest.py
+15
-14
tests/pytest/tools/taosdumpTestBenchmark.py
tests/pytest/tools/taosdumpTestBenchmark.py
+22
-22
tests/pytest/tools/taosdumpTestNanoSupport.py
tests/pytest/tools/taosdumpTestNanoSupport.py
+55
-57
tests/pytest/util/dnodes-default.py
tests/pytest/util/dnodes-default.py
+16
-16
tests/pytest/util/dnodes-no-random-fail.py
tests/pytest/util/dnodes-no-random-fail.py
+15
-16
tests/pytest/util/dnodes-random-fail.py
tests/pytest/util/dnodes-random-fail.py
+15
-16
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+108
-85
tests/system-test/5-taos-tools/basic.py
tests/system-test/5-taos-tools/basic.py
+12
-11
未找到文件。
docs-cn/06-insert-data/01-sql-writing.mdx
浏览文件 @
a5b45aed
...
...
@@ -117,6 +117,7 @@ TDengine 也提供了支持参数绑定的 Prepare API,与 MySQL 一样,这
</Tabs>
:::note
只有使用本地驱动方式连接连接,才能使用动态绑定功能。
只有使用本地驱动方式建立连接,才能使用动态绑定功能。
:::
documentation20/cn/12.taos-sql/docs.md
浏览文件 @
a5b45aed
...
...
@@ -1794,6 +1794,8 @@ TDengine支持针对数据的聚合查询。提供支持的聚合和选择函数
该函数可以应用在普通表和超级表上。
版本2.6.0.x后支持
- **ACOS**
```mysql
SELECT ACOS(field_name) FROM { tb_name | stb_name } [WHERE clause]
...
...
@@ -1812,6 +1814,8 @@ TDengine支持针对数据的聚合查询。提供支持的聚合和选择函数
该函数可以应用在普通表和超级表上。
版本2.6.0.x后支持
- **ATAN**
```mysql
SELECT ATAN(field_name) FROM { tb_name | stb_name } [WHERE clause]
...
...
src/client/src/tscSQLParser.c
浏览文件 @
a5b45aed
...
...
@@ -10113,7 +10113,7 @@ static STableMeta* extractTempTableMetaFromSubquery(SQueryInfo* pUpstream) {
static
int32_t
doValidateSubquery
(
SSqlNode
*
pSqlNode
,
int32_t
index
,
SSqlObj
*
pSql
,
SQueryInfo
*
pQueryInfo
,
char
*
msgBuf
)
{
SRelElementPair
*
subInfo
=
taosArrayGet
(
pSqlNode
->
from
->
list
,
index
);
// union all is not support currently
// union all is not support
ed
currently
SSqlNode
*
p
=
taosArrayGetP
(
subInfo
->
pSubquery
,
0
);
if
(
taosArrayGetSize
(
subInfo
->
pSubquery
)
>=
2
)
{
return
invalidOperationMsg
(
msgBuf
,
"not support union in subquery"
);
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
a5b45aed
...
...
@@ -121,7 +121,7 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
}
if
(
!
tsMnodeShowMetaFp
[
pShowMsg
->
type
]
||
!
tsMnodeShowRetrieveFp
[
pShowMsg
->
type
])
{
mWarn
(
"show type:%s is not support"
,
mnodeGetShowType
(
pShowMsg
->
type
));
mWarn
(
"show type:%s is not support
ed
"
,
mnodeGetShowType
(
pShowMsg
->
type
));
return
TSDB_CODE_COM_OPS_NOT_SUPPORT
;
}
...
...
src/plugins/http/src/httpParser.c
浏览文件 @
a5b45aed
...
...
@@ -186,7 +186,7 @@ static int32_t httpOnRequestLine(HttpParser *pParser, char *method, char *target
if
(
pContext
->
decodeMethod
!=
NULL
)
{
httpTrace
(
"context:%p, fd:%d, decode method is %s"
,
pContext
,
pContext
->
fd
,
pContext
->
decodeMethod
->
module
);
}
else
{
httpError
(
"context:%p, fd:%d, the url is not support, target:%s"
,
pContext
,
pContext
->
fd
,
target
);
httpError
(
"context:%p, fd:%d, the url is not support
ed
, target:%s"
,
pContext
,
pContext
->
fd
,
target
);
httpOnError
(
pParser
,
0
,
TSDB_CODE_HTTP_UNSUPPORT_URL
);
return
-
1
;
}
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
a5b45aed
...
...
@@ -2895,7 +2895,7 @@ static bool doHasDataInBuffer(STsdbQueryHandle* pQueryHandle) {
return
false
;
}
//todo not unref yet, since it
i
s not support multi-group interpolation query
//todo not unref yet, since it
doe
s not support multi-group interpolation query
static
UNUSED_FUNC
void
changeQueryHandleForInterpQuery
(
TsdbQueryHandleT
pHandle
)
{
// filter the queried time stamp in the first place
STsdbQueryHandle
*
pQueryHandle
=
(
STsdbQueryHandle
*
)
pHandle
;
...
...
src/util/src/terror.c
浏览文件 @
a5b45aed
...
...
@@ -334,9 +334,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_WAL_FILE_CORRUPTED, "WAL file is corrupted
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_SIZE_LIMIT
,
"WAL size exceeds limit"
)
// http
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_SERVER_OFFLINE
,
"http server is not onlin"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_UNSUPPORT_URL
,
"url is not support"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_INVALID_URL
,
"invalid url format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_SERVER_OFFLINE
,
"http server is not onlin
e
"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_UNSUPPORT_URL
,
"url is not support
ed
"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_INVALID_URL
,
"invalid url format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_NO_ENOUGH_MEMORY
,
"no enough memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_REQUSET_TOO_BIG
,
"request size is too big"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_NO_AUTH_INFO
,
"no auth info input"
)
...
...
tests/pytest/tools/taosdemoTest.py
浏览文件 @
a5b45aed
...
...
@@ -27,7 +27,7 @@ class TDTestCase:
self
.
numberOfTables
=
1000
self
.
numberOfRecords
=
100
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -35,23 +35,23 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
tdSql
.
prepare
()
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
demo
not found!"
)
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taos
Benchmark
not found!"
)
else
:
tdLog
.
info
(
"taosdemo found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"%staosBenchmark -y -t %d -n %d -b INT,INT,INT,INT"
%
tdLog
.
info
(
"taosBenchmark found: %s"
%
binPath
)
os
.
system
(
"%s -y -t %d -n %d -b INT,INT,INT,INT"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
tdSql
.
execute
(
"use test"
)
...
...
tests/pytest/tools/taosdumpTest.py
浏览文件 @
a5b45aed
...
...
@@ -35,7 +35,7 @@ class TDTestCase:
else
:
return
True
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -43,13 +43,14 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosdump"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp1"
):
...
...
@@ -78,16 +79,15 @@ class TDTestCase:
sql
+=
"(%d, %d, 'nchar%d')"
%
(
currts
+
i
,
i
%
100
,
i
%
100
)
tdSql
.
execute
(
sql
)
b
uildPath
=
self
.
getBuild
Path
()
if
(
b
uild
Path
==
""
):
b
inPath
=
self
.
get
Path
()
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosdump found: %s"
%
binPath
)
os
.
system
(
"%s
taosdump
--databases db -o ./taosdumptest/tmp1"
%
binPath
)
os
.
system
(
"%s --databases db -o ./taosdumptest/tmp1"
%
binPath
)
os
.
system
(
"%s
taosdump
--databases db1 -o ./taosdumptest/tmp2"
%
"%s --databases db1 -o ./taosdumptest/tmp2"
%
binPath
)
tdSql
.
execute
(
"drop database db"
)
...
...
@@ -95,8 +95,8 @@ class TDTestCase:
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
0
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/tmp1"
%
binPath
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/tmp2"
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/tmp1"
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/tmp2"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show databases"
)
...
...
@@ -168,9 +168,10 @@ class TDTestCase:
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
2
)
os
.
system
(
"%staosdump --databases db12312313231231321312312312_323 -o ./taosdumptest/tmp1"
%
binPath
)
"%s --databases db12312313231231321312312312_323 -o ./taosdumptest/tmp1"
%
binPath
)
tdSql
.
execute
(
"drop database db12312313231231321312312312_323"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/tmp1"
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/tmp1"
%
binPath
)
tdSql
.
execute
(
"use db12312313231231321312312312_323"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
2
)
...
...
tests/pytest/tools/taosdumpTestBenchmark.py
浏览文件 @
a5b45aed
...
...
@@ -35,7 +35,7 @@ class TDTestCase:
else
:
return
True
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -43,13 +43,14 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosdump"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
insert_data
(
self
,
tbname
,
ts_start
,
count
):
pre_insert
=
"insert into %s values"
%
tbname
...
...
@@ -81,12 +82,11 @@ class TDTestCase:
os
.
system
(
"rm -rf ./taosdumptest/tmp%d"
%
i
)
os
.
makedirs
(
"./taosdumptest/tmp%d"
%
i
)
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
b
inPath
=
self
.
getPath
(
"taosdump"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosdump found: %s"
%
binPath
)
# create db1 , one stables and one table ; create general tables
tdSql
.
execute
(
"drop database if exists dp1"
)
...
...
@@ -158,7 +158,7 @@ class TDTestCase:
2
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
self
.
ts
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
# os.system("%staosBenchmark -f tools/taosdump-insert-dp1.json -y " % binPath)
# os.system("%staosBenchmark -f tools/taosdump-insert-dp1.json -y " % b
enchB
inPath)
# create db1 , three stables:stb0,include ctables stb0_0 \ stb0_1,stb1 include ctables stb1_0 and stb1_1
# \stb3,include ctables stb3_0 and stb3_1
...
...
@@ -200,22 +200,22 @@ class TDTestCase:
"insert into gt1 values(1614218413800,8638,78.862020199)"
)
tdSql
.
execute
(
"insert into gt2 values(1614218413900,8639,78.863)"
)
# self.insert_data("t", self.ts, 300*10000);
# os.system("%staosBenchmark -f tools/taosdump-insert-dp2.json -y " % binPath)
# os.system("%staosBenchmark -f tools/taosdump-insert-dp2.json -y " % b
enchB
inPath)
# # taosdump data
# os.system("%s
taosdump
-o ./taosdumptest/tmp1 taosdump -h -ptaosdata -P 6030 -u root -o taosdumptest \
# os.system("%s -o ./taosdumptest/tmp1 taosdump -h -ptaosdata -P 6030 -u root -o taosdumptest \
# -D dp1,dp3 -N -c /home/chr/TDinternal/community/sim/dnode1/cfg/taos.cfg -s -d deflate" % binPath)
os
.
system
(
"%s
taosdump
-o ./taosdumptest/tmp0 -D dp2,dp1 -T 8"
%
"%s -o ./taosdumptest/tmp0 -D dp2,dp1 -T 8"
%
binPath
)
os
.
system
(
"%s
taosdump
-o ./taosdumptest/tmp1 dp2 st0 st1_0 gt0 -T 8"
%
"%s -o ./taosdumptest/tmp1 dp2 st0 st1_0 gt0 -T 8"
%
binPath
)
# check taosdumptest/tmp0
tdSql
.
execute
(
"drop database dp1"
)
tdSql
.
execute
(
"drop database dp2"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/tmp0 -T 8 "
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/tmp0 -T 8 "
%
binPath
)
tdSql
.
execute
(
"reset query cache"
)
tdSql
.
execute
(
"use dp1"
)
...
...
@@ -265,7 +265,7 @@ class TDTestCase:
# check taosdumptest/tmp1
tdSql
.
execute
(
"drop database dp1"
)
tdSql
.
execute
(
"drop database dp2"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/tmp1 -T 8 "
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/tmp1 -T 8 "
%
binPath
)
tdSql
.
execute
(
"reset query cache"
)
tdSql
.
execute
(
"use dp2"
)
tdSql
.
query
(
"show stables"
)
...
...
@@ -283,7 +283,7 @@ class TDTestCase:
# #check taosdumptest/tmp2
# tdSql.execute("drop database dp1")
# tdSql.execute("drop database dp2")
# os.system("%s
taosdump
-i ./taosdumptest/tmp2 -T 8 " % binPath)
# os.system("%s -i ./taosdumptest/tmp2 -T 8 " % binPath)
# tdSql.execute("use dp1")
# tdSql.query("show stables")
# tdSql.checkRows(1)
...
...
@@ -301,7 +301,7 @@ class TDTestCase:
# #check taosdumptest/tmp3
# tdSql.execute("drop database dp1")
# os.system("%s
taosdump
-i ./taosdumptest/tmp3 -T 8 " % binPath)
# os.system("%s -i ./taosdumptest/tmp3 -T 8 " % binPath)
# tdSql.execute("use dp2")
# tdSql.query("show stables")
# tdSql.checkRows(2)
...
...
@@ -317,7 +317,7 @@ class TDTestCase:
# #check taosdumptest/tmp4
# tdSql.execute("drop database dp2")
# os.system("%s
taosdump
-i ./taosdumptest/tmp4 -T 8 " % binPath)
# os.system("%s -i ./taosdumptest/tmp4 -T 8 " % binPath)
# tdSql.execute("use dp2")
# tdSql.query("show stables")
# tdSql.checkRows(2)
...
...
@@ -340,7 +340,7 @@ class TDTestCase:
# #check taosdumptest/tmp5
# tdSql.execute("drop database dp2")
# os.system("%s
taosdump
-i ./taosdumptest/tmp5 -T 8 " % binPath)
# os.system("%s -i ./taosdumptest/tmp5 -T 8 " % binPath)
# tdSql.execute("use dp2")
# tdSql.query("show stables")
# tdSql.checkRows(3)
...
...
@@ -377,7 +377,7 @@ class TDTestCase:
# tdSql.execute("drop database dp1")
# tdSql.execute("drop database dp2")
# tdSql.execute("drop database dp3")
# os.system("%s
taosdump
-i ./taosdumptest/tmp6 -T 8 " % binPath)
# os.system("%s -i ./taosdumptest/tmp6 -T 8 " % binPath)
# tdSql.execute("use dp3")
# tdSql.query("show databases")
# tdSql.checkRows(1)
...
...
@@ -394,7 +394,7 @@ class TDTestCase:
# # check taosdumptest/tmp7
# tdSql.execute("drop database dp3")
# os.system("%s
taosdump
-i ./taosdumptest/tmp7 -T 8 " % binPath)
# os.system("%s -i ./taosdumptest/tmp7 -T 8 " % binPath)
# tdSql.execute("use dp3")
# tdSql.query("show databases")
# tdSql.checkRows(1)
...
...
@@ -411,7 +411,7 @@ class TDTestCase:
# # check taosdumptest/tmp8
# tdSql.execute("drop database dp3")
# os.system("%s
taosdump
-i ./taosdumptest/tmp8 -T 8 " % binPath)
# os.system("%s -i ./taosdumptest/tmp8 -T 8 " % binPath)
# tdSql.execute("use dp3")
# tdSql.query("show stables")
# tdSql.checkRows(1)
...
...
tests/pytest/tools/taosdumpTestNanoSupport.py
浏览文件 @
a5b45aed
...
...
@@ -35,7 +35,7 @@ class TDTestCase:
else
:
return
True
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -43,13 +43,14 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
createdb
(
self
,
precision
=
"ns"
):
tb_nums
=
self
.
numberOfTables
...
...
@@ -118,12 +119,11 @@ class TDTestCase:
if
not
os
.
path
.
exists
(
"./taosdumptest/dumptmp3"
):
os
.
makedirs
(
"./taosdumptest/dumptmp3"
)
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
b
inPath
=
self
.
getPath
(
"taosdump"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosdump found: %s"
%
binPath
)
# create nano second database
...
...
@@ -132,40 +132,40 @@ class TDTestCase:
# dump all data
os
.
system
(
"%s
taosdump
--databases timedb1 -o ./taosdumptest/dumptmp1"
%
"%s --databases timedb1 -o ./taosdumptest/dumptmp1"
%
binPath
)
# dump part data with -S -E
os
.
system
(
'%s
taosdump
--databases timedb1 -S 1625068810000000000 -E 1625068860000000000 -o ./taosdumptest/dumptmp2 '
%
'%s --databases timedb1 -S 1625068810000000000 -E 1625068860000000000 -o ./taosdumptest/dumptmp2 '
%
binPath
)
os
.
system
(
'%s
taosdump
--databases timedb1 -S 1625068810000000000 -o ./taosdumptest/dumptmp3 '
%
'%s --databases timedb1 -S 1625068810000000000 -o ./taosdumptest/dumptmp3 '
%
binPath
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp2"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp2"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
510
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp3"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp3"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
900
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
# check data
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
dump_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
"test nano second : dump check data pass for all data!"
)
...
...
@@ -177,7 +177,6 @@ class TDTestCase:
os
.
system
(
"rm -rf ./taosdumptest/"
)
tdSql
.
execute
(
"drop database if exists timedb1"
)
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp1"
):
os
.
makedirs
(
"./taosdumptest/dumptmp1"
)
...
...
@@ -190,53 +189,52 @@ class TDTestCase:
if
not
os
.
path
.
exists
(
"./taosdumptest/dumptmp3"
):
os
.
makedirs
(
"./taosdumptest/dumptmp3"
)
b
uildPath
=
self
.
getBuild
Path
()
if
(
b
uild
Path
==
""
):
b
inPath
=
self
.
get
Path
()
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosdump found: %s"
%
binPath
)
self
.
createdb
(
precision
=
"us"
)
os
.
system
(
"%s
taosdump
--databases timedb1 -o ./taosdumptest/dumptmp1"
%
"%s --databases timedb1 -o ./taosdumptest/dumptmp1"
%
binPath
)
os
.
system
(
'%s
taosdump
--databases timedb1 -S 1625068810000000 -E 1625068860000000 -o ./taosdumptest/dumptmp2 '
%
'%s --databases timedb1 -S 1625068810000000 -E 1625068860000000 -o ./taosdumptest/dumptmp2 '
%
binPath
)
os
.
system
(
'%s
taosdump
--databases timedb1 -S 1625068810000000 -o ./taosdumptest/dumptmp3 '
%
'%s --databases timedb1 -S 1625068810000000 -o ./taosdumptest/dumptmp3 '
%
binPath
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp1"
%
binPath
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp2"
%
binPath
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp3"
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/dumptmp1"
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/dumptmp2"
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/dumptmp3"
%
binPath
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp2"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp2"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
510
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp3"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp3"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
900
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
# check data
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
dump_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
"test micro second : dump check data pass for all data!"
)
...
...
@@ -260,56 +258,56 @@ class TDTestCase:
if
not
os
.
path
.
exists
(
"./taosdumptest/dumptmp3"
):
os
.
makedirs
(
"./taosdumptest/dumptmp3"
)
b
uildPath
=
self
.
getBuild
Path
()
if
(
b
uild
Path
==
""
):
b
inPath
=
self
.
get
Path
()
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosdump found: %s"
%
binPath
)
self
.
createdb
(
precision
=
"ms"
)
os
.
system
(
"%s
taosdump
--databases timedb1 -o ./taosdumptest/dumptmp1"
%
"%s --databases timedb1 -o ./taosdumptest/dumptmp1"
%
binPath
)
os
.
system
(
'%s
taosdump
--databases timedb1 -S 1625068810000 -E 1625068860000 -o ./taosdumptest/dumptmp2 '
%
'%s --databases timedb1 -S 1625068810000 -E 1625068860000 -o ./taosdumptest/dumptmp2 '
%
binPath
)
os
.
system
(
'%s
taosdump
--databases timedb1 -S 1625068810000 -o ./taosdumptest/dumptmp3 '
%
'%s --databases timedb1 -S 1625068810000 -o ./taosdumptest/dumptmp3 '
%
binPath
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp1"
%
binPath
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp2"
%
binPath
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp3"
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/dumptmp1"
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/dumptmp2"
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/dumptmp3"
%
binPath
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp2"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp2"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
510
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp3"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp3"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
900
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
# check data
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
os
.
system
(
"%s -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
dump_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
"test million second : dump check data pass for all data!"
)
tdLog
.
info
(
"test million second : dump check data pass for all data!"
)
else
:
tdLog
.
info
(
"test million second : dump check data failed for all data!"
)
...
...
tests/pytest/util/dnodes-default.py
浏览文件 @
a5b45aed
...
...
@@ -40,7 +40,8 @@ class TDSimClient:
"jnidebugFlag"
:
"135"
,
"qdebugFlag"
:
"135"
,
"telemetryReporting"
:
"0"
,
}
}
def
init
(
self
,
path
):
self
.
__init__
()
self
.
path
=
path
...
...
@@ -72,14 +73,14 @@ class TDSimClient:
cmd
=
"rm -rf "
+
self
.
logDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
cmd
=
"rm -rf "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
...
...
@@ -145,11 +146,11 @@ class TDDnode:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
...
...
@@ -198,7 +199,7 @@ class TDDnode:
"dnode:%d is deployed and configured by %s"
%
(
self
.
index
,
self
.
cfgPath
))
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosd"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -206,23 +207,22 @@ class TDDnode:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
start
(
self
):
b
uildPath
=
self
.
getBuild
Path
()
b
inPath
=
self
.
get
Path
()
if
(
b
uild
Path
==
""
):
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/taosd"
tdLog
.
info
(
"taosd found: %s"
%
binPath
)
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
...
...
tests/pytest/util/dnodes-no-random-fail.py
浏览文件 @
a5b45aed
...
...
@@ -37,7 +37,7 @@ class TDSimClient:
"jnidebugFlag"
:
"135"
,
"qdebugFlag"
:
"135"
,
"telemetryReporting"
:
"0"
,
}
}
def
init
(
self
,
path
):
self
.
__init__
()
...
...
@@ -70,14 +70,14 @@ class TDSimClient:
cmd
=
"rm -rf "
+
self
.
logDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
cmd
=
"rm -rf "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
...
...
@@ -143,11 +143,11 @@ class TDDnode:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
...
...
@@ -196,7 +196,7 @@ class TDDnode:
"dnode:%d is deployed and configured by %s"
%
(
self
.
index
,
self
.
cfgPath
))
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosd"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -204,23 +204,22 @@ class TDDnode:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
start
(
self
):
b
uildPath
=
self
.
getBuild
Path
()
b
inPath
=
self
.
get
Path
()
if
(
b
uild
Path
==
""
):
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/taosd"
tdLog
.
info
(
"taosd found: %s"
%
binPath
)
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
...
...
tests/pytest/util/dnodes-random-fail.py
浏览文件 @
a5b45aed
...
...
@@ -37,7 +37,7 @@ class TDSimClient:
"jnidebugFlag"
:
"135"
,
"qdebugFlag"
:
"135"
,
"telemetryReporting"
:
"0"
,
}
}
def
init
(
self
,
path
):
self
.
__init__
()
...
...
@@ -70,14 +70,14 @@ class TDSimClient:
cmd
=
"rm -rf "
+
self
.
logDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
cmd
=
"rm -rf "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
...
...
@@ -143,11 +143,11 @@ class TDDnode:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
...
...
@@ -196,7 +196,7 @@ class TDDnode:
"dnode:%d is deployed and configured by %s"
%
(
self
.
index
,
self
.
cfgPath
))
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosd"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -204,23 +204,22 @@ class TDDnode:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
start
(
self
):
b
uildPath
=
self
.
getBuild
Path
()
b
inPath
=
self
.
get
Path
()
if
(
b
uild
Path
==
""
):
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/taosd"
tdLog
.
info
(
"taosd found: %s"
%
binPath
)
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
...
...
tests/pytest/util/dnodes.py
浏览文件 @
a5b45aed
...
...
@@ -65,9 +65,11 @@ class TDSimClient:
cmd
=
"echo %s %s >> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
def
os_string
(
self
,
path
):
os_path
=
path
.
replace
(
"/"
,
os
.
sep
)
def
os_string
(
self
,
path
):
os_path
=
path
.
replace
(
"/"
,
os
.
sep
)
return
os_path
def
deploy
(
self
):
self
.
logDir
=
self
.
os_string
(
"%s/sim/psim/log"
%
(
self
.
path
))
self
.
cfgDir
=
self
.
os_string
(
"%s/sim/psim/cfg"
%
(
self
.
path
))
...
...
@@ -76,11 +78,11 @@ class TDSimClient:
# cmd = "rm -rf " + self.logDir
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
if
os
.
path
.
exists
(
self
.
logDir
):
if
os
.
path
.
exists
(
self
.
logDir
):
try
:
shutil
.
rmtree
(
self
.
logDir
)
except
:
tdLog
.
exit
(
"del %s failed"
%
self
.
logDir
)
except
BaseException
:
tdLog
.
exit
(
"del %s failed"
%
self
.
logDir
)
# cmd = "mkdir -p " + self.logDir
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
...
...
@@ -88,11 +90,11 @@ class TDSimClient:
# cmd = "rm -rf " + self.cfgDir
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
if
os
.
path
.
exists
(
self
.
cfgDir
):
if
os
.
path
.
exists
(
self
.
cfgDir
):
try
:
shutil
.
rmtree
(
self
.
cfgDir
)
except
:
tdLog
.
exit
(
"del %s failed"
%
self
.
cfgDir
)
except
BaseException
:
tdLog
.
exit
(
"del %s failed"
%
self
.
cfgDir
)
# cmd = "mkdir -p " + self.cfgDir
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
...
...
@@ -102,8 +104,8 @@ class TDSimClient:
# tdLog.exit(cmd)
try
:
pathlib
.
Path
(
self
.
cfgPath
).
touch
()
except
:
tdLog
.
exit
(
"create %s failed"
%
self
.
cfgPath
)
except
BaseException
:
tdLog
.
exit
(
"create %s failed"
%
self
.
cfgPath
)
if
self
.
testCluster
:
self
.
cfg
(
"masterIp"
,
"192.168.0.1"
)
self
.
cfg
(
"secondIp"
,
"192.168.0.2"
)
...
...
@@ -123,36 +125,36 @@ class TDDnode:
self
.
testCluster
=
False
self
.
valgrind
=
0
self
.
cfgDict
=
{
"numOfLogLines"
:
"100000000"
,
"mnodeEqualVnodeNum"
:
"0"
,
"walLevel"
:
"2"
,
"fsync"
:
"1000"
,
"statusInterval"
:
"1"
,
"numOfMnodes"
:
"3"
,
"numOfThreadsPerCore"
:
"2.0"
,
"monitor"
:
"0"
,
"maxVnodeConnections"
:
"30000"
,
"maxMgmtConnections"
:
"30000"
,
"maxMeterConnections"
:
"30000"
,
"maxShellConns"
:
"30000"
,
"locale"
:
"en_US.UTF-8"
,
"charset"
:
"UTF-8"
,
"asyncLog"
:
"0"
,
"anyIp"
:
"0"
,
"telemetryReporting"
:
"0"
,
"dDebugFlag"
:
"135"
,
"tsdbDebugFlag"
:
"135"
,
"mDebugFlag"
:
"135"
,
"sdbDebugFlag"
:
"135"
,
"rpcDebugFlag"
:
"135"
,
"tmrDebugFlag"
:
"131"
,
"cDebugFlag"
:
"135"
,
"httpDebugFlag"
:
"135"
,
"monitorDebugFlag"
:
"135"
,
"udebugFlag"
:
"135"
,
"jnidebugFlag"
:
"135"
,
"qdebugFlag"
:
"135"
,
"maxSQLLength"
:
"1048576"
,
"numOfLogLines"
:
"100000000"
,
"mnodeEqualVnodeNum"
:
"0"
,
"walLevel"
:
"2"
,
"fsync"
:
"1000"
,
"statusInterval"
:
"1"
,
"numOfMnodes"
:
"3"
,
"numOfThreadsPerCore"
:
"2.0"
,
"monitor"
:
"0"
,
"maxVnodeConnections"
:
"30000"
,
"maxMgmtConnections"
:
"30000"
,
"maxMeterConnections"
:
"30000"
,
"maxShellConns"
:
"30000"
,
"locale"
:
"en_US.UTF-8"
,
"charset"
:
"UTF-8"
,
"asyncLog"
:
"0"
,
"anyIp"
:
"0"
,
"telemetryReporting"
:
"0"
,
"dDebugFlag"
:
"135"
,
"tsdbDebugFlag"
:
"135"
,
"mDebugFlag"
:
"135"
,
"sdbDebugFlag"
:
"135"
,
"rpcDebugFlag"
:
"135"
,
"tmrDebugFlag"
:
"131"
,
"cDebugFlag"
:
"135"
,
"httpDebugFlag"
:
"135"
,
"monitorDebugFlag"
:
"135"
,
"udebugFlag"
:
"135"
,
"jnidebugFlag"
:
"135"
,
"qdebugFlag"
:
"135"
,
"maxSQLLength"
:
"1048576"
,
"enableCoreFile"
:
"1"
,
}
...
...
@@ -200,11 +202,11 @@ class TDDnode:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
...
...
@@ -227,16 +229,16 @@ class TDDnode:
isFirstDir
=
1
if
bool
(
updatecfgDict
)
and
updatecfgDict
[
0
]
and
updatecfgDict
[
0
][
0
]:
print
(
updatecfgDict
[
0
][
0
])
for
key
,
value
in
updatecfgDict
[
0
][
0
].
items
():
if
value
==
'dataDir'
:
for
key
,
value
in
updatecfgDict
[
0
][
0
].
items
():
if
value
==
'dataDir'
:
if
isFirstDir
:
self
.
cfgDict
.
pop
(
'dataDir'
)
self
.
cfg
(
value
,
key
)
self
.
cfg
(
value
,
key
)
isFirstDir
=
0
else
:
self
.
cfg
(
value
,
key
)
self
.
cfg
(
value
,
key
)
else
:
self
.
addExtraCfg
(
key
,
value
)
self
.
addExtraCfg
(
key
,
value
)
for
key
,
value
in
self
.
cfgDict
.
items
():
self
.
cfg
(
key
,
value
)
...
...
@@ -245,8 +247,7 @@ class TDDnode:
"dnode:%d is deployed and configured by %s"
%
(
self
.
index
,
self
.
cfgPath
))
def
getBuildPath
(
self
,
tool
=
"taosd"
):
buildPath
=
""
def
getPath
(
self
,
tool
=
"taosd"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -254,24 +255,28 @@ class TDDnode:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
((
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
start
(
self
):
b
uildPath
=
self
.
getBuild
Path
()
b
inPath
=
self
.
get
Path
()
if
(
b
uild
Path
==
""
):
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found
in %s"
%
build
Path
)
tdLog
.
info
(
"taosd found
: %s"
%
bin
Path
)
binPath
=
buildPath
+
"/build/bin/taosd"
taosadapterBinPath
=
buildPath
+
"/build/bin/taosadapter"
taosadapterBinPath
=
self
.
getPath
(
"taosadapter"
)
if
(
taosadapterBinPath
==
""
):
tdLog
.
exit
(
"taosAdapter not found!"
)
else
:
tdLog
.
info
(
"taosAdapter found: %s"
%
taosadapterBinPath
)
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
...
...
@@ -288,7 +293,7 @@ class TDDnode:
print
(
cmd
)
taosadapterCmd
=
"nohup %s --opentsdb_telnet.enable=true > /dev/null 2>&1 & "
%
(
taosadapterBinPath
)
taosadapterBinPath
)
tdLog
.
info
(
taosadapterCmd
)
if
os
.
system
(
taosadapterCmd
)
!=
0
:
tdLog
.
exit
(
taosadapterCmd
)
...
...
@@ -301,18 +306,22 @@ class TDDnode:
if
self
.
valgrind
==
0
:
time
.
sleep
(
0.1
)
key
=
'from offline to online'
bkey
=
bytes
(
key
,
encoding
=
"utf8"
)
bkey
=
bytes
(
key
,
encoding
=
"utf8"
)
logFile
=
self
.
logDir
+
"/taosdlog.0"
i
=
0
while
not
os
.
path
.
exists
(
logFile
):
sleep
(
0.1
)
i
+=
1
if
i
>
50
:
if
i
>
50
:
break
popen
=
subprocess
.
Popen
(
'tail -f '
+
logFile
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
popen
=
subprocess
.
Popen
(
'tail -f '
+
logFile
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
pid
=
popen
.
pid
# print('Popen.pid:' + str(pid))
timeout
=
time
.
time
()
+
60
*
2
timeout
=
time
.
time
()
+
60
*
2
while
True
:
line
=
popen
.
stdout
.
readline
().
strip
()
if
bkey
in
line
:
...
...
@@ -322,30 +331,35 @@ class TDDnode:
tdLog
.
exit
(
'wait too long for taosd start'
)
tdLog
.
debug
(
"the dnode:%d has been started."
%
(
self
.
index
))
else
:
tdLog
.
debug
(
"wait 10 seconds for the dnode:%d to start."
%
(
self
.
index
))
tdLog
.
debug
(
"wait 10 seconds for the dnode:%d to start."
%
(
self
.
index
))
time
.
sleep
(
10
)
# time.sleep(5)
def
startWin
(
self
):
b
uildPath
=
self
.
getBuild
Path
(
"taosd.exe"
)
b
inPath
=
self
.
get
Path
(
"taosd.exe"
)
if
(
b
uild
Path
==
""
):
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosd.exe not found!"
)
else
:
tdLog
.
info
(
"taosd.exe found
in %s"
%
build
Path
)
tdLog
.
info
(
"taosd.exe found
: %s"
%
bn
Path
)
binPath
=
buildPath
+
"/build/bin/taosd.exe"
taosadapterBinPath
=
buildPath
+
"/build/bin/taosadapter.exe"
taosadapterBinPath
=
self
.
getPath
(
"taosadapter.exe"
)
if
(
taosadapterBinPath
==
""
):
tdLog
.
exit
(
"taosAdapter.exe not found!"
)
else
:
tdLog
.
info
(
"taosAdapter.exe found in %s"
%
taosadapterBuildPath
)
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
cmd
=
"mintty -h never -w hide %s -c %s"
%
(
binPath
,
self
.
cfgDir
)
binPath
,
self
.
cfgDir
)
taosadapterCmd
=
"mintty -h never -w hide %s "
%
(
taosadapterBinPath
)
taosadapterBinPath
)
if
os
.
system
(
taosadapterCmd
)
!=
0
:
tdLog
.
exit
(
taosadapterCmd
)
...
...
@@ -357,18 +371,22 @@ class TDDnode:
if
self
.
valgrind
==
0
:
time
.
sleep
(
0.1
)
key
=
'from offline to online'
bkey
=
bytes
(
key
,
encoding
=
"utf8"
)
bkey
=
bytes
(
key
,
encoding
=
"utf8"
)
logFile
=
self
.
logDir
+
"/taosdlog.0"
i
=
0
while
not
os
.
path
.
exists
(
logFile
):
sleep
(
0.1
)
i
+=
1
if
i
>
50
:
if
i
>
50
:
break
popen
=
subprocess
.
Popen
(
'tail -n +0 -f '
+
logFile
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
popen
=
subprocess
.
Popen
(
'tail -n +0 -f '
+
logFile
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
pid
=
popen
.
pid
# print('Popen.pid:' + str(pid))
timeout
=
time
.
time
()
+
60
*
2
timeout
=
time
.
time
()
+
60
*
2
while
True
:
line
=
popen
.
stdout
.
readline
().
strip
()
if
bkey
in
line
:
...
...
@@ -378,19 +396,24 @@ class TDDnode:
tdLog
.
exit
(
'wait too long for taosd start'
)
tdLog
.
debug
(
"the dnode:%d has been started."
%
(
self
.
index
))
else
:
tdLog
.
debug
(
"wait 10 seconds for the dnode:%d to start."
%
(
self
.
index
))
tdLog
.
debug
(
"wait 10 seconds for the dnode:%d to start."
%
(
self
.
index
))
time
.
sleep
(
10
)
def
startWithoutSleep
(
self
):
b
uildPath
=
self
.
getBuild
Path
()
b
inPath
=
self
.
get
Path
()
if
(
b
uild
Path
==
""
):
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found
in %s"
%
build
Path
)
tdLog
.
info
(
"taosd found
: %s"
%
bin
Path
)
binPath
=
buildPath
+
"/build/bin/taosd"
taosadapterBinPath
=
buildPath
+
"/build/bin/taosadapter"
taosadapterBinPath
=
self
.
getPath
(
"taosadapter"
)
if
(
taosadapterBinPath
==
""
):
tdLog
.
exit
(
"taosAdapter not found!"
)
else
:
tdLog
.
info
(
"taosAdapter found: %s"
%
taosadapterBinPath
)
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
...
...
@@ -420,14 +443,14 @@ class TDDnode:
taosadapterPsCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}'"
%
taosadapterToBeKilled
taosadapterProcessID
=
subprocess
.
check_output
(
taosadapterPsCmd
,
shell
=
True
).
decode
(
"utf-8"
)
taosadapterPsCmd
,
shell
=
True
).
decode
(
"utf-8"
)
while
(
taosadapterProcessID
):
taosadapterKillCmd
=
"kill -INT %s > /dev/null 2>&1"
%
taosadapterProcessID
os
.
system
(
taosadapterKillCmd
)
time
.
sleep
(
1
)
taosadapterProcessID
=
subprocess
.
check_output
(
taosadapterPsCmd
,
shell
=
True
).
decode
(
"utf-8"
)
taosadapterPsCmd
,
shell
=
True
).
decode
(
"utf-8"
)
if
self
.
valgrind
==
0
:
toBeKilled
=
"taosd"
...
...
@@ -599,7 +622,7 @@ class TDDnodes:
def
startWin
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
startWin
()
def
startWithoutSleep
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
startWithoutSleep
()
...
...
tests/system-test/5-taos-tools/basic.py
浏览文件 @
a5b45aed
...
...
@@ -23,33 +23,34 @@ import subprocess
class
TDTestCase
:
def
caseDescription
(
self
):
'''
case1<pxiao>: [TD-11977] start taosdump without taosd
case1<pxiao>: [TD-11977] start taosdump without taosd
case1<pxiao>: [TD-11977] start taosBenchmark without taosd
case1<pxiao>: [TD-11977] start taosAdaptor without taosd
'''
'''
return
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
tools
=
[
"taosdump"
,
"taosBenchmark"
,
"taos
Adaptor"
]
tdSql
.
prepare
()
tools
=
[
"taosdump"
,
"taosBenchmark"
,
"taos
adapter"
]
tdDnodes
.
stop
(
1
)
for
tool
in
tools
:
path
=
tdDnodes
.
dnodes
[
1
].
get
Build
Path
(
tool
)
for
tool
in
tools
:
path
=
tdDnodes
.
dnodes
[
1
].
getPath
(
tool
)
try
:
path
+=
"/build/bin/"
print
(
f
"
{
path
}{
tool
}
"
)
if
tool
==
"taosBenchmark"
:
os
.
system
(
f
"
{
path
}{
tool
}
-y"
)
os
.
system
(
f
"
{
path
}{
tool
}
-y"
)
elif
tool
==
"taosadapter"
:
os
.
system
(
f
"pkill -9
{
tool
}
"
)
else
:
os
.
system
(
f
"
{
path
}{
tool
}
"
)
except
:
except
BaseException
:
pass
def
stop
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录