Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
0bfce14e
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看板
提交
0bfce14e
编写于
6月 15, 2021
作者:
B
bryanchang0603
浏览文件
操作
浏览文件
下载
差异文件
resolve conflict
上级
1a5aac6e
b79839b5
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
281 addition
and
68 deletion
+281
-68
documentation20/en/00.index/docs.md
documentation20/en/00.index/docs.md
+1
-1
src/balance/src/bnMain.c
src/balance/src/bnMain.c
+4
-8
src/balance/src/bnThread.c
src/balance/src/bnThread.c
+4
-5
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+1
-2
src/mnode/inc/mnodeDnode.h
src/mnode/inc/mnodeDnode.h
+1
-1
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+6
-6
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+11
-4
src/tsdb/src/tsdbCompact.c
src/tsdb/src/tsdbCompact.c
+0
-4
src/wal/src/walWrite.c
src/wal/src/walWrite.c
+1
-1
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+4
-0
tests/pytest/functions/function_derivative.py
tests/pytest/functions/function_derivative.py
+139
-0
tests/pytest/insert/restfulInsert.py
tests/pytest/insert/restfulInsert.py
+27
-13
tests/pytest/insert/special_character_show.py
tests/pytest/insert/special_character_show.py
+59
-0
tests/pytest/smoketest.sh
tests/pytest/smoketest.sh
+23
-23
未找到文件。
documentation20/en/00.index/docs.md
浏览文件 @
0bfce14e
...
...
@@ -29,7 +29,7 @@ TDengine is a highly efficient platform to store, query, and analyze time-series
## [Data Modeling](/model)
-
[
Create a
Library
](
/model#create-db
)
: create a library
for all data collection points with similar features
-
[
Create a
Database
](
/model#create-db
)
: create a database
for all data collection points with similar features
-
[
Create a Super Table(STable)
](
/model#create-stable
)
: create a STable for all data collection points with the same type
-
[
Create a Table
](
/model#create-table
)
: use STable as the template, to create a table for each data collecting point
...
...
src/balance/src/bnMain.c
浏览文件 @
0bfce14e
...
...
@@ -220,10 +220,6 @@ int32_t bnAllocVnodes(SVgObj *pVgroup) {
}
static
bool
bnCheckVgroupReady
(
SVgObj
*
pVgroup
,
SVnodeGid
*
pRmVnode
)
{
if
(
pVgroup
->
lbTime
+
5
*
tsStatusInterval
>
tsAccessSquence
)
{
return
false
;
}
int32_t
rmVnodeVer
=
0
;
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
SVnodeGid
*
pVnode
=
pVgroup
->
vnodeGid
+
i
;
...
...
@@ -405,7 +401,7 @@ void bnReset() {
if
(
pDnode
==
NULL
)
break
;
// while master change, should reset dnode to offline
mInfo
(
"dnode:%d set access:%
d
to 0"
,
pDnode
->
dnodeId
,
pDnode
->
lastAccess
);
mInfo
(
"dnode:%d set access:%
"
PRId64
"
to 0"
,
pDnode
->
dnodeId
,
pDnode
->
lastAccess
);
pDnode
->
lastAccess
=
0
;
if
(
pDnode
->
status
!=
TAOS_DN_STATUS_DROPPING
)
{
pDnode
->
status
=
TAOS_DN_STATUS_OFFLINE
;
...
...
@@ -499,7 +495,7 @@ static bool bnMontiorDropping() {
if
(
dnodeIsMasterEp
(
pDnode
->
dnodeEp
))
continue
;
if
(
mnodeGetDnodesNum
()
<=
1
)
continue
;
mLInfo
(
"dnode:%d, set to removing state for it offline:%
d
seconds"
,
pDnode
->
dnodeId
,
mLInfo
(
"dnode:%d, set to removing state for it offline:%
"
PRId64
"
seconds"
,
pDnode
->
dnodeId
,
tsAccessSquence
-
pDnode
->
lastAccess
);
pDnode
->
status
=
TAOS_DN_STATUS_DROPPING
;
...
...
@@ -574,8 +570,8 @@ void bnCheckStatus() {
if
(
pDnode
->
status
!=
TAOS_DN_STATUS_DROPPING
&&
pDnode
->
status
!=
TAOS_DN_STATUS_OFFLINE
)
{
pDnode
->
status
=
TAOS_DN_STATUS_OFFLINE
;
pDnode
->
offlineReason
=
TAOS_DN_OFF_STATUS_MSG_TIMEOUT
;
mInfo
(
"dnode:%d, set to offline state, access seq:%
d last seq:%d laststat:%d"
,
pDnode
->
dnodeId
,
tsAccessSquence
,
pDnode
->
lastAccess
,
pDnode
->
status
);
mInfo
(
"dnode:%d, set to offline state, access seq:%
"
PRId64
" last seq:%"
PRId64
" laststat:%d"
,
pDnode
->
dnodeId
,
tsAccessSquence
,
pDnode
->
lastAccess
,
pDnode
->
status
);
bnSetVgroupOffline
(
pDnode
);
bnStartTimer
(
3000
);
}
...
...
src/balance/src/bnThread.c
浏览文件 @
0bfce14e
...
...
@@ -102,12 +102,12 @@ static void bnProcessTimer(void *handle, void *tmrId) {
if
(
tsBnThread
.
stop
)
return
;
tsBnThread
.
timer
=
NULL
;
tsAccessSquence
++
;
bnStartTimer
(
-
1
);
bnCheckStatus
();
if
(
handle
==
NULL
)
{
++
tsAccessSquence
;
if
(
tsAccessSquence
%
tsBalanceInterval
==
0
)
{
mDebug
(
"balance function is scheduled by timer"
);
bnPostSignal
();
...
...
@@ -122,8 +122,7 @@ static void bnProcessTimer(void *handle, void *tmrId) {
void
bnStartTimer
(
int32_t
mseconds
)
{
if
(
tsBnThread
.
stop
)
return
;
bool
updateSoon
=
(
mseconds
!=
-
1
);
if
(
updateSoon
)
{
if
(
mseconds
!=
-
1
)
{
mTrace
(
"balance function will be called after %d ms"
,
mseconds
);
taosTmrReset
(
bnProcessTimer
,
mseconds
,
(
void
*
)(
int64_t
)
mseconds
,
tsMnodeTmr
,
&
tsBnThread
.
timer
);
}
else
{
...
...
@@ -132,5 +131,5 @@ void bnStartTimer(int32_t mseconds) {
}
void
bnNotify
()
{
bnStartTimer
(
500
);
bnStartTimer
(
500
);
}
src/mnode/inc/mnodeDef.h
浏览文件 @
0bfce14e
...
...
@@ -48,9 +48,8 @@ typedef struct SDnodeObj {
int32_t
dnodeId
;
int32_t
openVnodes
;
int64_t
createdTime
;
int
32_t
resever0
;
// from dnode status msg, config information
int
64_t
lastAccess
;
int32_t
customScore
;
// config by user
uint32_t
lastAccess
;
uint16_t
numOfCores
;
// from dnode status msg
uint16_t
dnodePort
;
char
dnodeFqdn
[
TSDB_FQDN_LEN
];
...
...
src/mnode/inc/mnodeDnode.h
浏览文件 @
0bfce14e
...
...
@@ -78,7 +78,7 @@ void mnodeUpdateDnode(SDnodeObj *pDnode);
int32_t
mnodeDropDnode
(
SDnodeObj
*
pDnode
,
void
*
pMsg
);
int32_t
mnodeCompactDnodes
();
extern
int
32
_t
tsAccessSquence
;
extern
int
64
_t
tsAccessSquence
;
#ifdef __cplusplus
}
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
0bfce14e
...
...
@@ -39,8 +39,8 @@
#include "mnodePeer.h"
#include "mnodeCluster.h"
int
32_t
tsAccessSquence
=
0
;
int64_t
tsDnodeRid
=
-
1
;
int
64_t
tsAccessSquence
=
0
;
int64_t
tsDnodeRid
=
-
1
;
static
void
*
tsDnodeSdb
=
NULL
;
static
int32_t
tsDnodeUpdateSize
=
0
;
extern
void
*
tsMnodeSdb
;
...
...
@@ -567,7 +567,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
mnodeGetClusterId
());
return
TSDB_CODE_MND_INVALID_CLUSTER_ID
;
}
else
{
mTrace
(
"dnode:%d, status received, access times %
d
openVnodes:%d:%d"
,
pDnode
->
dnodeId
,
pDnode
->
lastAccess
,
mTrace
(
"dnode:%d, status received, access times %
"
PRId64
"
openVnodes:%d:%d"
,
pDnode
->
dnodeId
,
pDnode
->
lastAccess
,
htons
(
pStatus
->
openVnodes
),
pDnode
->
openVnodes
);
}
}
...
...
@@ -629,9 +629,9 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
bnNotify
();
}
i
f
(
!
tsEnableBalance
)
{
int32_t
numOfMnodes
=
mnodeGetMnodesNum
();
if
(
numOfMnodes
<
tsNumOfMnodes
)
bnNotify
();
i
nt32_t
numOfMnodes
=
mnodeGetMnodesNum
();
if
(
numOfMnodes
<
tsNumOfMnodes
&&
numOfMnodes
<
mnodeGetOnlineDnodesNum
()
&&
!
pDnode
->
isMgmt
)
{
bnNotify
();
}
if
(
openVnodes
!=
pDnode
->
openVnodes
)
{
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
0bfce14e
...
...
@@ -670,10 +670,17 @@ static int32_t sdbProcessWrite(void *wparam, void *hparam, int32_t qtype, void *
pTable
->
name
,
actStr
[
action
],
sdbGetKeyStr
(
pTable
,
pHead
->
cont
),
qtype
,
pHead
->
version
,
tsSdbMgmt
.
version
);
return
TSDB_CODE_SUCCESS
;
}
else
if
(
pHead
->
version
!=
tsSdbMgmt
.
version
+
1
)
{
pthread_mutex_unlock
(
&
tsSdbMgmt
.
mutex
);
sdbError
(
"vgId:1, sdb:%s, failed to restore %s key:%s from source(%d), hver:%"
PRIu64
" too large, mver:%"
PRIu64
,
pTable
->
name
,
actStr
[
action
],
sdbGetKeyStr
(
pTable
,
pHead
->
cont
),
qtype
,
pHead
->
version
,
tsSdbMgmt
.
version
);
return
TSDB_CODE_SYN_INVALID_VERSION
;
if
(
qtype
!=
TAOS_QTYPE_WAL
)
{
pthread_mutex_unlock
(
&
tsSdbMgmt
.
mutex
);
sdbError
(
"vgId:1, sdb:%s, failed to restore %s key:%s from source(%d), hver:%"
PRIu64
" too large, mver:%"
PRIu64
,
pTable
->
name
,
actStr
[
action
],
sdbGetKeyStr
(
pTable
,
pHead
->
cont
),
qtype
,
pHead
->
version
,
tsSdbMgmt
.
version
);
return
TSDB_CODE_SYN_INVALID_VERSION
;
}
else
{
// If cksum is wrong when recovering wal, use this code
tsSdbMgmt
.
version
=
pHead
->
version
;
}
}
else
{
tsSdbMgmt
.
version
=
pHead
->
version
;
}
...
...
src/tsdb/src/tsdbCompact.c
浏览文件 @
0bfce14e
...
...
@@ -14,8 +14,6 @@
*/
#include "tsdbint.h"
#ifndef _TSDB_PLUGINS
typedef
struct
{
STable
*
pTable
;
SBlockIdx
*
pBlkIdx
;
...
...
@@ -523,5 +521,3 @@ static int tsdbWriteBlockToRightFile(SCompactH *pComph, STable *pTable, SDataCol
return
0
;
}
#endif
\ No newline at end of file
src/wal/src/walWrite.c
浏览文件 @
0bfce14e
...
...
@@ -346,7 +346,7 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch
}
#if defined(WAL_CHECKSUM_WHOLE)
if
(
pHead
->
sver
==
0
&&
!
walValidateChecksum
(
pHead
)
)
{
if
(
(
pHead
->
sver
==
0
&&
!
walValidateChecksum
(
pHead
))
||
pHead
->
sver
<
0
||
pHead
->
sver
>
1
)
{
wError
(
"vgId:%d, file:%s, wal head cksum is messed up, hver:%"
PRIu64
" len:%d offset:%"
PRId64
,
pWal
->
vgId
,
name
,
pHead
->
version
,
pHead
->
len
,
offset
);
code
=
walSkipCorruptedRecord
(
pWal
,
pHead
,
tfd
,
&
offset
);
...
...
tests/pytest/fulltest.sh
浏览文件 @
0bfce14e
...
...
@@ -21,6 +21,7 @@ python3 insert/retentionpolicy.py
python3 ./test.py
-f
insert/alterTableAndInsert.py
python3 ./test.py
-f
insert/insertIntoTwoTables.py
python3 ./test.py
-f
insert/before_1970.py
python3 ./test.py
-f
insert/special_character_show.py
python3 bug2265.py
python3 ./test.py
-f
insert/bug3654.py
python3 ./test.py
-f
insert/insertDynamicColBeforeVal.py
...
...
@@ -256,6 +257,8 @@ python3 ./test.py -f client/client.py
python3 ./test.py
-f
client/version.py
python3 ./test.py
-f
client/alterDatabase.py
python3 ./test.py
-f
client/noConnectionErrorTest.py
#python3 test.py -f client/change_time_1_1.py
#python3 test.py -f client/change_time_1_2.py
# Misc
python3 testCompress.py
...
...
@@ -316,6 +319,7 @@ 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/function_stateWindow.py
python3 ./test.py
-f
functions/function_derivative.py
python3 ./test.py
-f
insert/unsignedInt.py
python3 ./test.py
-f
insert/unsignedBigint.py
...
...
tests/pytest/functions/function_derivative.py
0 → 100644
浏览文件 @
0bfce14e
###################################################################
# 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
taos
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
import
numpy
as
np
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
rowNum
=
10
self
.
ts
=
1537146000000
def
insertAndCheckData
(
self
):
types
=
[
"tinyint"
,
"tinyint unsigned"
,
"smallint"
,
"smallint unsigned"
,
"int"
,
"int unsigned"
,
"bigint"
,
"bigint unsigned"
,
"float"
,
"double"
,
"bool"
,
"binary(20)"
,
"nchar(20)"
]
for
type
in
types
:
print
(
"============== create table using %s type ================"
%
type
)
tdSql
.
execute
(
"drop table if exists stb"
)
tdSql
.
execute
(
"create table stb(ts timestamp, col %s) tags (id int)"
%
type
)
tdSql
.
execute
(
"create table tb1 using stb tags(1)"
)
tdSql
.
execute
(
"create table tb2 using stb tags(2)"
)
if
type
==
"tinyint"
or
type
==
"smallint"
or
type
==
"int"
or
type
==
"bigint"
:
tdSql
.
execute
(
"insert into tb1 values(%d, 1)(%d, 11)(%d, 21)"
%
(
self
.
ts
,
self
.
ts
+
10000
,
self
.
ts
+
20000
))
tdSql
.
execute
(
"insert into tb1 values(%d, -1)(%d, -11)(%d, -21)"
%
(
self
.
ts
+
30000
,
self
.
ts
+
40000
,
self
.
ts
+
50000
))
tdSql
.
execute
(
"insert into tb2 values(%d, 10)(%d, 20)(%d, 30)"
%
(
self
.
ts
+
60000
,
self
.
ts
+
70000
,
self
.
ts
+
80000
))
tdSql
.
execute
(
"insert into tb2 values(%d, -10)(%d, -20)(%d, -30)"
%
(
self
.
ts
+
90000
,
self
.
ts
+
1000000
,
self
.
ts
+
1100000
))
tdSql
.
execute
(
"insert into tb3 using stb tags(3) values(%d, 10)"
%
(
self
.
ts
+
1200000
))
tdSql
.
query
(
"select derivative(col, 1s, 1) from stb group by tbname"
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
"select derivative(col, 10s, 1) from stb group by tbname"
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
"select derivative(col, 10s, 0) from stb group by tbname"
)
tdSql
.
checkRows
(
10
)
tdSql
.
error
(
"select derivative(col, 10s, 0) from tb1 group by tbname"
)
tdSql
.
query
(
"select derivative(col, 10s, 1) from tb1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select derivative(col, 10s, 0) from tb1"
)
tdSql
.
checkRows
(
5
)
tdSql
.
query
(
"select derivative(col, 10s, 1) from tb2"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select derivative(col, 10s, 0) from tb2"
)
tdSql
.
checkRows
(
5
)
tdSql
.
query
(
"select derivative(col, 10s, 0) from tb3"
)
tdSql
.
checkRows
(
0
)
elif
type
==
"tinyint unsigned"
or
type
==
"smallint unsigned"
or
type
==
"int unsigned"
or
type
==
"bigint unsigned"
:
tdSql
.
execute
(
"insert into tb1 values(%d, 1)(%d, 11)(%d, 21)"
%
(
self
.
ts
,
self
.
ts
+
10000
,
self
.
ts
+
20000
))
tdSql
.
execute
(
"insert into tb2 values(%d, 10)(%d, 20)(%d, 30)"
%
(
self
.
ts
+
60000
,
self
.
ts
+
70000
,
self
.
ts
+
80000
))
tdSql
.
error
(
"select derivative(col, 1s, 1) from tb1"
)
tdSql
.
error
(
"select derivative(col, 10s, 0) from tb1"
)
tdSql
.
error
(
"select derivative(col, 999ms, 0) from tb1"
)
tdSql
.
error
(
"select derivative(col, 1s, 1) from tb2"
)
tdSql
.
error
(
"select derivative(col, 10s, 0) from tb2"
)
tdSql
.
error
(
"select derivative(col, 999ms, 0) from tb2"
)
elif
type
==
"float"
or
type
==
"double"
:
tdSql
.
execute
(
"insert into tb1 values(%d, 1.0)(%d, 11.0)(%d, 21.0)"
%
(
self
.
ts
,
self
.
ts
+
10000
,
self
.
ts
+
20000
))
tdSql
.
execute
(
"insert into tb2 values(%d, 3.0)(%d, 4.0)(%d, 5.0)"
%
(
self
.
ts
+
60000
,
self
.
ts
+
70000
,
self
.
ts
+
80000
))
tdSql
.
query
(
"select derivative(col, 10s, 1) from tb1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select derivative(col, 10s, 0) from tb1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select derivative(col, 10s, 1) from tb2"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select derivative(col, 10s, 0) from tb2"
)
tdSql
.
checkRows
(
2
)
elif
type
==
"bool"
:
tdSql
.
execute
(
"insert into tb1 values(%d, true)(%d, false)(%d, true)"
%
(
self
.
ts
,
self
.
ts
+
10000
,
self
.
ts
+
20000
))
tdSql
.
execute
(
"insert into tb2 values(%d, false)(%d, true)(%d, true)"
%
(
self
.
ts
+
60000
,
self
.
ts
+
70000
,
self
.
ts
+
80000
))
tdSql
.
error
(
"select derivative(col, 1s, 1) from tb1"
)
tdSql
.
error
(
"select derivative(col, 10s, 0) from tb1"
)
tdSql
.
error
(
"select derivative(col, 999ms, 0) from tb1"
)
tdSql
.
error
(
"select derivative(col, 1s, 1) from tb2"
)
tdSql
.
error
(
"select derivative(col, 10s, 0) from tb2"
)
tdSql
.
error
(
"select derivative(col, 999ms, 0) from tb2"
)
else
:
tdSql
.
execute
(
"insert into tb1 values(%d, 'test01')(%d, 'test01')(%d, 'test01')"
%
(
self
.
ts
,
self
.
ts
+
10000
,
self
.
ts
+
20000
))
tdSql
.
execute
(
"insert into tb2 values(%d, 'test01')(%d, 'test01')(%d, 'test01')"
%
(
self
.
ts
+
60000
,
self
.
ts
+
70000
,
self
.
ts
+
80000
))
tdSql
.
error
(
"select derivative(col, 1s, 1) from tb1"
)
tdSql
.
error
(
"select derivative(col, 10s, 0) from tb1"
)
tdSql
.
error
(
"select derivative(col, 999ms, 0) from tb1"
)
tdSql
.
error
(
"select derivative(col, 1s, 1) from tb2"
)
tdSql
.
error
(
"select derivative(col, 10s, 0) from tb2"
)
tdSql
.
error
(
"select derivative(col, 999ms, 0) from tb2"
)
tdSql
.
error
(
"select derivative(col, 10s, 1) from stb"
)
tdSql
.
error
(
"select derivative(col, 10s, 1) from stb group by col"
)
tdSql
.
error
(
"select derivative(col, 10s, 1) from stb group by id"
)
tdSql
.
error
(
"select derivative(col, 999ms, 1) from stb group by id"
)
tdSql
.
error
(
"select derivative(col, 10s, 2) from stb group by id"
)
def
run
(
self
):
tdSql
.
prepare
()
self
.
insertAndCheckData
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/insert/restfulInsert.py
浏览文件 @
0bfce14e
...
...
@@ -40,12 +40,13 @@ class RestfulInsert:
if
tableID
+
i
>=
self
.
numOfTables
:
break
name
=
'beijing'
if
(
tableID
+
i
)
%
2
==
0
else
'shanghai'
data
=
"create table if not exists %s.%s%d using %s.meters tags(%d, '%s')"
%
(
self
.
dbname
,
self
.
tableNamePerfix
,
tableID
+
i
,
self
.
dbname
,
tableID
+
i
,
name
)
response
=
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
try
:
response
=
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
except
Exception
as
e
:
print
(
e
)
def
insertData
(
self
,
threadID
):
print
(
"thread %d started"
%
threadID
)
tablesPerThread
=
int
(
self
.
numOfTables
/
self
.
numOfThreads
)
...
...
@@ -90,10 +91,16 @@ class RestfulInsert:
if
len
(
data
)
>
1024
*
1024
:
print
(
'batch size is larger than 1M'
)
exit
(
-
1
)
response
=
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
try
:
startTime
=
time
.
time
()
response
=
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
endTime
=
time
.
time
()
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
else
:
print
(
"inserted %d records, %d seconds"
%
(
bloop
,
endTime
-
startTime
))
except
Exception
as
e
:
print
(
e
)
def
insertUnlimitedData
(
self
,
threadID
):
print
(
"thread %d started"
%
threadID
)
...
...
@@ -119,10 +126,17 @@ class RestfulInsert:
else
:
random
.
shuffle
(
values
)
for
k
in
range
(
len
(
values
)):
data
+=
values
[
k
]
response
=
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
data
+=
values
[
k
]
try
:
startTime
=
time
.
time
()
response
=
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
endTime
=
time
.
time
()
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
else
:
print
(
"inserted %d records, %d seconds"
%
(
self
.
batchSize
,
endTime
-
startTime
))
except
Exception
as
e
:
print
(
e
)
def
run
(
self
):
data
=
"create database if not exists %s"
%
self
.
dbname
...
...
tests/pytest/insert/special_character_show.py
0 → 100644
浏览文件 @
0bfce14e
###################################################################
# 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
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
# test case for https://jira.taosdata.com:18080/browse/TD-4584
#1
tdLog
.
info
(
'=============== step1,create stable'
)
tdLog
.
info
(
'create table stb1 (ts timestamp, value double) tags (bin binary(128))'
)
tdSql
.
execute
(
'create table stb1 (ts timestamp, value double) tags (bin binary(128))'
)
tdLog
.
info
(
'=============== step2,create table增加了转义字符'
)
tdLog
.
info
(
'create table tb1 using stb1 tags("abc
\\
"def")'
)
#增加了转义字符\
tdSql
.
execute
(
'create table tb1 using stb1 tags("abc
\\
"def")'
)
tdLog
.
info
(
'=============== step3,insert data'
)
tdLog
.
info
(
'insert into tb1 values(now,1.0)'
)
tdSql
.
execute
(
'insert into tb1 values(now,1.0)'
)
tdLog
.
info
(
'=============== step4,select table'
)
tdLog
.
info
(
'select * from stb1 '
)
tdSql
.
query
(
'select * from stb1 '
)
tdLog
.
info
(
'=============== step5,check data'
)
tdSql
.
checkData
(
0
,
2
,
'abc"def'
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/smoketest.sh
浏览文件 @
0bfce14e
...
...
@@ -2,38 +2,38 @@
ulimit
-c
unlimited
# insert
python3
.8
./test.py
$1
-f
insert/basic.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3
.8
./test.py
$1
-f
insert/bigint.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3
.8
./test.py
$1
-f
insert/nchar.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3
.8
./test.py
$1
-f
insert/multi.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
insert/basic.py
python3 ./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
insert/bigint.py
python3 ./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
insert/nchar.py
python3 ./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
insert/multi.py
python3 ./test.py
$1
-s
&&
sleep
1
# table
python3
.8
./test.py
$1
-f
table/column_name.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3
.8
./test.py
$1
-f
table/column_num.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3
.8
./test.py
$1
-f
table/db_table.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
table/column_name.py
python3 ./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
table/column_num.py
python3 ./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
table/db_table.py
python3 ./test.py
$1
-s
&&
sleep
1
# import
python3
.8
./test.py
$1
-f
import_merge/importDataLastSub.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
import_merge/importDataLastSub.py
python3 ./test.py
$1
-s
&&
sleep
1
#tag
python3
.8
./test.py
$1
-f
tag_lite/filter.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
tag_lite/filter.py
python3 ./test.py
$1
-s
&&
sleep
1
#query
python3
.8
./test.py
$1
-f
query/filter.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
query/filter.py
python3 ./test.py
$1
-s
&&
sleep
1
# client
python3
.8
./test.py
$1
-f
client/client.py
python3
.8
./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-f
client/client.py
python3 ./test.py
$1
-s
&&
sleep
1
# connector
python3
.8
./test.py
$1
-f
connector/lua.py
python3 ./test.py
$1
-f
connector/lua.py
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录