Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
07c99df6
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
07c99df6
编写于
6月 21, 2021
作者:
haoranc
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:taosdata/TDengine into test/chr
上级
8015a2a4
1af6c539
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
632 addition
and
10 deletion
+632
-10
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+1
-1
src/sync/inc/syncInt.h
src/sync/inc/syncInt.h
+1
-0
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+26
-8
src/sync/src/syncRetrieve.c
src/sync/src/syncRetrieve.c
+7
-1
tests/pytest/crash_gen/valgrind_taos.supp
tests/pytest/crash_gen/valgrind_taos.supp
+226
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/functions/queryTestCases.py
tests/pytest/functions/queryTestCases.py
+364
-0
tests/pytest/insert/binary.py
tests/pytest/insert/binary.py
+6
-0
未找到文件。
src/kit/shell/src/shellEngine.c
浏览文件 @
07c99df6
...
...
@@ -248,7 +248,7 @@ int32_t shellRunCommand(TAOS* con, char* command) {
if
(
quote
==
c
)
{
quote
=
0
;
}
else
if
(
c
==
'\''
||
c
==
'"'
)
{
}
else
if
(
quote
==
0
&&
(
c
==
'\''
||
c
==
'"'
)
)
{
quote
=
c
;
}
...
...
src/sync/inc/syncInt.h
浏览文件 @
07c99df6
...
...
@@ -132,6 +132,7 @@ void * syncRestoreData(void *param);
int32_t
syncSaveIntoBuffer
(
SSyncPeer
*
pPeer
,
SWalHead
*
pHead
);
void
syncRestartConnection
(
SSyncPeer
*
pPeer
);
void
syncBroadcastStatus
(
SSyncNode
*
pNode
);
uint32_t
syncResolvePeerFqdn
(
SSyncPeer
*
pPeer
);
SSyncPeer
*
syncAcquirePeer
(
int64_t
rid
);
void
syncReleasePeer
(
SSyncPeer
*
pPeer
);
...
...
src/sync/src/syncMain.c
浏览文件 @
07c99df6
...
...
@@ -559,7 +559,8 @@ static void syncClosePeerConn(SSyncPeer *pPeer) {
static
void
syncRemovePeer
(
SSyncPeer
*
pPeer
)
{
sInfo
(
"%s, it is removed"
,
pPeer
->
id
);
pPeer
->
ip
=
0
;
//pPeer->ip = 0;
pPeer
->
fqdn
[
0
]
=
'\0'
;
syncClosePeerConn
(
pPeer
);
//taosRemoveRef(tsPeerRefId, pPeer->rid);
syncReleasePeer
(
pPeer
);
...
...
@@ -585,20 +586,31 @@ static void syncStopCheckPeerConn(SSyncPeer *pPeer) {
sDebug
(
"%s, stop check peer connection"
,
pPeer
->
id
);
}
uint32_t
syncResolvePeerFqdn
(
SSyncPeer
*
pPeer
)
{
uint32_t
ip
=
taosGetIpv4FromFqdn
(
pPeer
->
fqdn
);
if
(
ip
==
0xFFFFFFFF
)
{
sError
(
"failed to resolve peer fqdn:%s since %s"
,
pPeer
->
fqdn
,
strerror
(
errno
));
terrno
=
TSDB_CODE_RPC_FQDN_ERROR
;
return
0
;
}
return
ip
;
}
static
SSyncPeer
*
syncAddPeer
(
SSyncNode
*
pNode
,
const
SNodeInfo
*
pInfo
)
{
uint32_t
ip
=
taosGetIpv4FromFqdn
(
pInfo
->
nodeFqdn
);
/*
uint32_t ip = taosGetIpv4FromFqdn(pInfo->nodeFqdn);
if (ip == 0xFFFFFFFF) {
sError("failed to add peer, can resolve fqdn:%s since %s", pInfo->nodeFqdn, strerror(errno));
terrno = TSDB_CODE_RPC_FQDN_ERROR;
return NULL;
}
*/
SSyncPeer
*
pPeer
=
calloc
(
1
,
sizeof
(
SSyncPeer
));
if
(
pPeer
==
NULL
)
return
NULL
;
pPeer
->
nodeId
=
pInfo
->
nodeId
;
tstrncpy
(
pPeer
->
fqdn
,
pInfo
->
nodeFqdn
,
sizeof
(
pPeer
->
fqdn
));
pPeer
->
ip
=
ip
;
//
pPeer->ip = ip;
pPeer
->
port
=
pInfo
->
nodePort
;
pPeer
->
fqdn
[
sizeof
(
pPeer
->
fqdn
)
-
1
]
=
0
;
snprintf
(
pPeer
->
id
,
sizeof
(
pPeer
->
id
),
"vgId:%d, nodeId:%d"
,
pNode
->
vgId
,
pPeer
->
nodeId
);
...
...
@@ -864,7 +876,7 @@ static void syncRestartPeer(SSyncPeer *pPeer) {
}
void
syncRestartConnection
(
SSyncPeer
*
pPeer
)
{
if
(
pPeer
->
ip
==
0
)
return
;
if
(
pPeer
->
fqdn
[
0
]
==
'\0'
)
return
;
if
(
syncAcquirePeer
(
pPeer
->
rid
)
==
NULL
)
return
;
...
...
@@ -878,7 +890,7 @@ static void syncProcessSyncRequest(char *msg, SSyncPeer *pPeer) {
SSyncNode
*
pNode
=
pPeer
->
pSyncNode
;
sInfo
(
"%s, sync-req is received"
,
pPeer
->
id
);
if
(
pPeer
->
ip
==
0
)
return
;
if
(
pPeer
->
fqdn
[
0
]
==
'\0'
)
return
;
if
(
nodeRole
!=
TAOS_SYNC_ROLE_MASTER
)
{
sError
(
"%s, I am not master anymore"
,
pPeer
->
id
);
...
...
@@ -1090,7 +1102,7 @@ static int32_t syncProcessPeerMsg(int64_t rid, void *buffer) {
}
static
int32_t
syncSendPeersStatusMsgToPeer
(
SSyncPeer
*
pPeer
,
char
ack
,
int8_t
type
,
uint16_t
tranId
)
{
if
(
pPeer
->
peerFd
<
0
||
pPeer
->
ip
==
0
)
{
if
(
pPeer
->
peerFd
<
0
||
pPeer
->
fqdn
[
0
]
==
'\0'
)
{
sDebug
(
"%s, failed to send status msg, restart fd:%d"
,
pPeer
->
id
,
pPeer
->
peerFd
);
syncRestartConnection
(
pPeer
);
return
-
1
;
...
...
@@ -1135,7 +1147,13 @@ static void syncSetupPeerConnection(SSyncPeer *pPeer) {
return
;
}
SOCKET
connFd
=
taosOpenTcpClientSocket
(
pPeer
->
ip
,
pPeer
->
port
,
0
);
uint32_t
ip
=
syncResolvePeerFqdn
(
pPeer
);
if
(
!
ip
)
{
taosTmrReset
(
syncCheckPeerConnection
,
SYNC_CHECK_INTERVAL
,
(
void
*
)
pPeer
->
rid
,
tsSyncTmrCtrl
,
&
pPeer
->
timer
);
return
;
}
SOCKET
connFd
=
taosOpenTcpClientSocket
(
ip
,
pPeer
->
port
,
0
);
if
(
connFd
<=
0
)
{
sDebug
(
"%s, failed to open tcp socket since %s"
,
pPeer
->
id
,
strerror
(
errno
));
taosTmrReset
(
syncCheckPeerConnection
,
SYNC_CHECK_INTERVAL
,
(
void
*
)
pPeer
->
rid
,
tsSyncTmrCtrl
,
&
pPeer
->
timer
);
...
...
src/sync/src/syncRetrieve.c
浏览文件 @
07c99df6
...
...
@@ -422,6 +422,12 @@ void *syncRetrieveData(void *param) {
return
NULL
;
}
uint32_t
ip
=
syncResolvePeerFqdn
(
pPeer
);
if
(
!
ip
)
{
syncReleasePeer
(
pPeer
);
return
NULL
;
}
SSyncNode
*
pNode
=
pPeer
->
pSyncNode
;
taosBlockSIGPIPE
();
...
...
@@ -430,7 +436,7 @@ void *syncRetrieveData(void *param) {
if
(
pNode
->
notifyFlowCtrlFp
)
(
*
pNode
->
notifyFlowCtrlFp
)(
pNode
->
vgId
,
pPeer
->
numOfRetrieves
);
pPeer
->
syncFd
=
taosOpenTcpClientSocket
(
pPeer
->
ip
,
pPeer
->
port
,
0
);
pPeer
->
syncFd
=
taosOpenTcpClientSocket
(
ip
,
pPeer
->
port
,
0
);
if
(
pPeer
->
syncFd
<
0
)
{
sError
(
"%s, failed to open socket to sync"
,
pPeer
->
id
);
}
else
{
...
...
tests/pytest/crash_gen/valgrind_taos.supp
浏览文件 @
07c99df6
...
...
@@ -17496,4 +17496,230 @@
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:__libc_alloc_buffer_allocate
fun:alloc_buffer_allocate
fun:__resolv_conf_allocate
fun:__resolv_conf_load
fun:__resolv_conf_get_current
fun:__res_vinit
fun:maybe_init
fun:context_get
fun:context_get
fun:__resolv_context_get
fun:gaih_inet.constprop.0
fun:getaddrinfo
fun:taosGetFqdn
fun:taosCheckGlobalCfg
fun:taos_init_imp
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.8
fun:PyTuple_Pack
fun:__pyx_pymod_exec_mtrand
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:PyCode_NewWithPosOnlyArgs
fun:PyCode_New
fun:__Pyx_InitCachedConstants
fun:__pyx_pymod_exec__generator
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.8
fun:PyTuple_Pack
fun:__pyx_pymod_exec_bit_generator
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.8
fun:PyTuple_Pack
fun:__pyx_pymod_exec__common
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.8
fun:PyTuple_Pack
fun:__pyx_pymod_exec__bounded_integers
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.8
fun:PyTuple_Pack
fun:__pyx_pymod_exec__mt19937
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.8
fun:PyTuple_Pack
fun:__pyx_pymod_exec__philox
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.8
fun:PyTuple_Pack
fun:__pyx_pymod_exec__pcg64
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.8
fun:PyTuple_Pack
fun:__pyx_pymod_exec__sfc64
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.8
fun:PyTuple_Pack
fun:__Pyx_InitCachedConstants
fun:__pyx_pymod_exec__generator
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:PyCode_NewWithPosOnlyArgs
fun:PyCode_New
fun:__pyx_pymod_exec_mtrand
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:PyCode_NewWithPosOnlyArgs
fun:PyCode_New
fun:__pyx_pymod_exec_bit_generator
fun:PyModule_ExecDef
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
}
\ No newline at end of file
tests/pytest/fulltest.sh
浏览文件 @
07c99df6
...
...
@@ -313,6 +313,7 @@ python3 ./test.py -f query/last_row_cache.py
python3 ./test.py
-f
account/account_create.py
python3 ./test.py
-f
alter/alter_table.py
python3 ./test.py
-f
query/queryGroupbySort.py
python3 ./test.py
-f
functions/queryTestCases.py
python3 ./test.py
-f
insert/unsignedInt.py
python3 ./test.py
-f
insert/unsignedBigint.py
...
...
tests/pytest/functions/queryTestCases.py
0 → 100644
浏览文件 @
07c99df6
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
subprocess
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to execute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
)
->
str
:
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/debug/build/bin"
)]
break
return
buildPath
def
getCfgDir
(
self
)
->
str
:
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
cfgDir
=
self
.
getBuildPath
()
+
"/community/sim/dnode1/cfg"
else
:
cfgDir
=
self
.
getBuildPath
()
+
"/sim/dnode1/cfg"
return
cfgDir
def
getCfgFile
(
self
)
->
str
:
return
self
.
getCfgDir
()
+
"/taos.cfg"
def
td3690
(
self
):
tdLog
.
printNoPrefix
(
"==========TD-3690=========="
)
tdSql
.
query
(
"show variables"
)
tdSql
.
checkData
(
51
,
1
,
864000
)
def
td4082
(
self
):
tdLog
.
printNoPrefix
(
"==========TD-4082=========="
)
cfgfile
=
self
.
getCfgFile
()
max_compressMsgSize
=
100000000
tdSql
.
query
(
"show variables"
)
tdSql
.
checkData
(
26
,
1
,
-
1
)
tdSql
.
query
(
"show dnodes"
)
index
=
tdSql
.
getData
(
0
,
0
)
tdDnodes
.
stop
(
index
)
cmd
=
f
"sed -i '$a compressMSgSize
{
max_compressMsgSize
}
'
{
cfgfile
}
"
try
:
_
=
subprocess
.
check_output
(
cmd
,
shell
=
True
).
decode
(
"utf-8"
)
except
Exception
as
e
:
raise
e
tdDnodes
.
start
(
index
)
tdSql
.
query
(
"show variables"
)
tdSql
.
checkData
(
26
,
1
,
100000000
)
tdDnodes
.
stop
(
index
)
cmd
=
f
"sed -i '$s/
{
max_compressMsgSize
}
/
{
max_compressMsgSize
+
10
}
/g'
{
cfgfile
}
"
try
:
_
=
subprocess
.
check_output
(
cmd
,
shell
=
True
).
decode
(
"utf-8"
)
except
Exception
as
e
:
raise
e
tdDnodes
.
start
(
index
)
tdSql
.
query
(
"show variables"
)
tdSql
.
checkData
(
26
,
1
,
-
1
)
tdDnodes
.
stop
(
index
)
cmd
=
f
"sed -i '$d'
{
cfgfile
}
"
try
:
_
=
subprocess
.
check_output
(
cmd
,
shell
=
True
).
decode
(
"utf-8"
)
except
Exception
as
e
:
raise
e
tdDnodes
.
start
(
index
)
def
td4097
(
self
):
tdLog
.
printNoPrefix
(
"==========TD-4097=========="
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db1"
)
tdSql
.
execute
(
"create database if not exists db keep 3650"
)
tdSql
.
execute
(
"create database if not exists db1 keep 3650"
)
tdSql
.
execute
(
"create stable db.stb1 (ts timestamp, c1 int) tags(t1 int)"
)
tdSql
.
execute
(
"create stable db.stb2 (ts timestamp, c1 int) tags(t1 int)"
)
tdSql
.
execute
(
"create stable db1.stb3 (ts timestamp, c1 int) tags(t1 int)"
)
tdSql
.
execute
(
"create table db.t10 using db.stb1 tags(1)"
)
tdSql
.
execute
(
"create table db.t11 using db.stb1 tags(2)"
)
tdSql
.
execute
(
"create table db.t20 using db.stb2 tags(3)"
)
tdSql
.
execute
(
"create table db1.t30 using db1.stb3 tags(4)"
)
tdLog
.
printNoPrefix
(
"==========TD-4097=========="
)
# 插入数据,然后进行show create 操作
# p1 不进入指定数据库
tdSql
.
query
(
"show create database db"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"show create database "
)
tdSql
.
error
(
"show create databases db "
)
tdSql
.
error
(
"show create database db.stb1"
)
tdSql
.
error
(
"show create database db0"
)
tdSql
.
error
(
"show create database db db1"
)
tdSql
.
error
(
"show create database db, db1"
)
tdSql
.
error
(
"show create database stb1"
)
tdSql
.
error
(
"show create database * "
)
tdSql
.
query
(
"show create stable db.stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"show create stable db.t10"
)
tdSql
.
error
(
"show create stable db.stb0"
)
tdSql
.
error
(
"show create stable stb1"
)
tdSql
.
error
(
"show create stable "
)
tdSql
.
error
(
"show create stable *"
)
tdSql
.
error
(
"show create stable db.stb1 db.stb2"
)
tdSql
.
error
(
"show create stable db.stb1, db.stb2"
)
tdSql
.
query
(
"show create table db.stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create table db.t10"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"show create table db.stb0"
)
tdSql
.
error
(
"show create table stb1"
)
tdSql
.
error
(
"show create table "
)
tdSql
.
error
(
"show create table *"
)
tdSql
.
error
(
"show create table db.stb1 db.stb2"
)
tdSql
.
error
(
"show create table db.stb1, db.stb2"
)
# p2 进入指定数据库
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show create database db"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create database db1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"show create database "
)
tdSql
.
error
(
"show create databases db "
)
tdSql
.
error
(
"show create database db.stb1"
)
tdSql
.
error
(
"show create database db0"
)
tdSql
.
error
(
"show create database db db1"
)
tdSql
.
error
(
"show create database db, db1"
)
tdSql
.
error
(
"show create database stb1"
)
tdSql
.
error
(
"show create database * "
)
tdSql
.
query
(
"show create stable db.stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create stable stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create stable db1.stb3"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"show create stable db.t10"
)
tdSql
.
error
(
"show create stable db"
)
tdSql
.
error
(
"show create stable t10"
)
tdSql
.
error
(
"show create stable db.stb0"
)
tdSql
.
error
(
"show create stables stb1"
)
tdSql
.
error
(
"show create stable "
)
tdSql
.
error
(
"show create stable *"
)
tdSql
.
error
(
"show create stable db.stb1 db.stb2"
)
tdSql
.
error
(
"show create stable stb1 stb2"
)
tdSql
.
error
(
"show create stable db.stb1, db.stb2"
)
tdSql
.
error
(
"show create stable stb1, stb2"
)
tdSql
.
query
(
"show create table db.stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create table stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create table db.t10"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create table t10"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create table db1.t30"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"show create table t30"
)
tdSql
.
error
(
"show create table db.stb0"
)
tdSql
.
error
(
"show create table db.t0"
)
tdSql
.
error
(
"show create table db"
)
tdSql
.
error
(
"show create tables stb1"
)
tdSql
.
error
(
"show create tables t10"
)
tdSql
.
error
(
"show create table "
)
tdSql
.
error
(
"show create table *"
)
tdSql
.
error
(
"show create table db.stb1 db.stb2"
)
tdSql
.
error
(
"show create table db.t11 db.t10"
)
tdSql
.
error
(
"show create table db.stb1, db.stb2"
)
tdSql
.
error
(
"show create table db.t11, db.t10"
)
tdSql
.
error
(
"show create table stb1 stb2"
)
tdSql
.
error
(
"show create table t11 t10"
)
tdSql
.
error
(
"show create table stb1, stb2"
)
tdSql
.
error
(
"show create table t11, t10"
)
# p3 删库删表后进行查询
tdSql
.
execute
(
"drop table if exists t11"
)
tdSql
.
error
(
"show create table t11"
)
tdSql
.
error
(
"show create table db.t11"
)
tdSql
.
query
(
"show create stable stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create table t10"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"drop stable if exists stb2"
)
tdSql
.
error
(
"show create table stb2"
)
tdSql
.
error
(
"show create table db.stb2"
)
tdSql
.
error
(
"show create stable stb2"
)
tdSql
.
error
(
"show create stable db.stb2"
)
tdSql
.
error
(
"show create stable db.t20"
)
tdSql
.
query
(
"show create database db"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create stable db.stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"drop database if exists db1"
)
tdSql
.
error
(
"show create database db1"
)
tdSql
.
error
(
"show create stable db1.t31"
)
tdSql
.
error
(
"show create stable db1.stb3"
)
tdSql
.
query
(
"show create database db"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show create stable db.stb1"
)
tdSql
.
checkRows
(
1
)
def
td4153
(
self
):
tdLog
.
printNoPrefix
(
"==========TD-4153=========="
)
pass
def
td4288
(
self
):
tdLog
.
printNoPrefix
(
"==========TD-4288=========="
)
# keep ~ [days,365000]
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database if not exists db"
)
tdSql
.
query
(
"show variables"
)
tdSql
.
checkData
(
36
,
1
,
3650
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkData
(
0
,
7
,
"3650,3650,3650"
)
days
=
tdSql
.
getData
(
0
,
6
)
tdSql
.
error
(
"alter database db keep 3650001"
)
tdSql
.
error
(
"alter database db keep 9"
)
tdSql
.
error
(
"alter database db keep 0b"
)
tdSql
.
error
(
"alter database db keep 3650,9,36500"
)
tdSql
.
error
(
"alter database db keep 3650,3650,365001"
)
tdSql
.
error
(
"alter database db keep 36500,a,36500"
)
tdSql
.
error
(
"alter database db keep (36500,3650,3650)"
)
tdSql
.
error
(
"alter database db keep [36500,3650,36500]"
)
tdSql
.
error
(
"alter database db keep 36500,0xff,3650"
)
tdSql
.
error
(
"alter database db keep 36500,0o365,3650"
)
tdSql
.
error
(
"alter database db keep 36500,0A3Ch,3650"
)
tdSql
.
error
(
"alter database db keep"
)
tdSql
.
error
(
"alter database db keep0 36500"
)
tdSql
.
execute
(
"alter database db keep 36500"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkData
(
0
,
7
,
"3650,3650,36500"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database if not exists db1"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkData
(
0
,
7
,
"3650,3650,3650"
)
tdSql
.
query
(
"show variables"
)
tdSql
.
checkData
(
36
,
1
,
3650
)
tdSql
.
execute
(
"alter database db1 keep 365"
)
tdSql
.
execute
(
"drop database if exists db1"
)
pass
def
td4724
(
self
):
tdLog
.
printNoPrefix
(
"==========TD-4724=========="
)
cfgfile
=
self
.
getCfgFile
()
minTablesPerVnode
=
5
maxTablesPerVnode
=
10
maxVgroupsPerDb
=
100
tdSql
.
query
(
"show dnodes"
)
index
=
tdSql
.
getData
(
0
,
0
)
tdDnodes
.
stop
(
index
)
vnode_cmd
=
f
"sed -i '$a maxVgroupsPerDb
{
maxVgroupsPerDb
}
'
{
cfgfile
}
"
min_cmd
=
f
"sed -i '$a minTablesPerVnode
{
minTablesPerVnode
}
'
{
cfgfile
}
"
max_cmd
=
f
"sed -i '$a maxTablesPerVnode
{
maxTablesPerVnode
}
'
{
cfgfile
}
"
try
:
_
=
subprocess
.
check_output
(
vnode_cmd
,
shell
=
True
).
decode
(
"utf-8"
)
_
=
subprocess
.
check_output
(
min_cmd
,
shell
=
True
).
decode
(
"utf-8"
)
_
=
subprocess
.
check_output
(
max_cmd
,
shell
=
True
).
decode
(
"utf-8"
)
except
Exception
as
e
:
raise
e
tdDnodes
.
start
(
index
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database if not exists db keep 3650"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"create stable db.stb1 (ts timestamp, c1 int) tags(t1 int)"
)
insert_sql
=
"insert into "
for
i
in
range
(
100
):
tdSql
.
execute
(
f
"create table db.t1
{
i
}
using db.stb1 tags(
{
i
}
)"
)
insert_sql
+=
f
" t1
{
i
}
values(
{
1604298064000
+
i
*
1000
}
,
{
i
}
)"
tdSql
.
query
(
"show dnodes"
)
vnode_count
=
tdSql
.
getData
(
0
,
2
)
if
vnode_count
<=
1
:
tdLog
.
exit
(
"vnode is less than 2"
)
tdSql
.
execute
(
insert_sql
)
tdDnodes
.
stop
(
index
)
cmd
=
f
"sed -i '$d'
{
cfgfile
}
"
try
:
_
=
subprocess
.
check_output
(
cmd
,
shell
=
True
).
decode
(
"utf-8"
)
_
=
subprocess
.
check_output
(
cmd
,
shell
=
True
).
decode
(
"utf-8"
)
_
=
subprocess
.
check_output
(
cmd
,
shell
=
True
).
decode
(
"utf-8"
)
except
Exception
as
e
:
raise
e
tdDnodes
.
start
(
index
)
pass
def
run
(
self
):
# master branch
# self.td3690()
# self.td4082()
# self.td4288()
self
.
td4724
()
# develop branch
# self.td4097()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/insert/binary.py
浏览文件 @
07c99df6
...
...
@@ -4,6 +4,8 @@ import sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
import
subprocess
import
os
class
TDTestCase
:
...
...
@@ -50,6 +52,10 @@ class TDTestCase:
tdLog
.
info
(
'==> $data00'
)
tdLog
.
info
(
"tdSql.checkData(0, 0, '34567')"
)
tdSql
.
checkData
(
0
,
0
,
'34567'
)
tdLog
.
info
(
"insert into tb values (now+4a,
\"
'';
\"
)"
)
config_dir
=
subprocess
.
check_output
(
str
(
"ps -ef |grep dnode1|grep -v grep |awk '{print $NF}'"
),
stderr
=
subprocess
.
STDOUT
,
shell
=
True
).
decode
(
'utf-8'
).
replace
(
'
\n
'
,
''
)
result
=
''
.
join
(
os
.
popen
(
r
"""taos -s "insert into db.tb values (now+4a, \"'';\")" -c %s"""
%
(
config_dir
)).
readlines
())
if
"Query OK"
not
in
result
:
tdLog
.
exit
(
"err:insert '';"
)
tdLog
.
info
(
'drop database db'
)
tdSql
.
execute
(
'drop database db'
)
tdLog
.
info
(
'show databases'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录